Questions tagged [racket]

Racket is an extensible multi-paradigm programming language in the Lisp/Scheme family.

Racket is a general purpose, multi-paradigm programming language in the Lisp/Scheme family. One of its design goals is to serve as a platform for language creation, design, and implementation. The language is used in a variety of contexts such as scripting, general-purpose programming, computer science education, and research.

Racket Programming Books

Racket documentation is well written and directly accessible from within the DrRacket IDE. It has two great tutorials: one on web applications and one about systems programming.

A great tutorial on macros.

History: Racket was initially called PLT Scheme.

Questions about BSL, HTDP, and other student languages should go into the racket-student-languages tag instead.

5811 questions
7
votes
6 answers

Cartesian product in Scheme

I've been trying to do a function that returns the Cartesian Product of n sets,in Dr Scheme,the sets are given as a list of lists,I've been stuck at this all day,I would like a few guidelines as where to start. ----LATER EDIT ----- Here is the…
John Retallack
  • 1,498
  • 2
  • 19
  • 31
7
votes
1 answer

DrRacket: atom? and symbol? undefined - What's wrong?

I'm learning programming in Lisp using DrRacket. I don't like it too much but I would like to pass my exam ;) I have a weird problem - I can't use the atom? and symbol? functions. But number? and string? both work fine. > (atom? '()) . . atom?:…
wiwo
  • 721
  • 1
  • 13
  • 18
7
votes
1 answer

Advantages of define over let

During a conversation with Matt Flatt, one of the primary authors of Racket, I was told (in passing) that the let form is not recommended by the community and is largely being replaced by define. What are the advantages of define over let that would…
BlackVegetable
  • 12,594
  • 8
  • 50
  • 82
7
votes
5 answers

How to do a powerset in DrRacket?

I'm using the beginning language with list abbreviations for DrRacket and want to make a powerset recursively but cannot figure out how to do it. I currently have this much (define (powerset aL) (cond [(empty? aL) (list)] any help would be…
user3109171
  • 79
  • 1
  • 1
  • 2
7
votes
3 answers

Capturing Macros in Scheme

What's the simplest way to define a capturing macro using define-syntax or define-syntax-rule in Racket? As a concrete example, here's the trivial aif in a CL-style macro system. (defmacro aif (test if-true &optional if-false) `(let ((it…
Inaimathi
  • 13,853
  • 9
  • 49
  • 93
7
votes
1 answer

for/list annotations in typed/racket

I'm trying to add types to some numerical racket code in the hopes of making it faster, but I am stuck dealing with for/list macro expansion in the code below. (: index-member ((Listof Any) (Listof Any) -> (Listof Index))) (define (index-member xs…
wdkrnls
  • 4,548
  • 7
  • 36
  • 64
7
votes
1 answer

Selecting student language in Racket source code

I am trying to write a source file for DrRacket that specifies one of the languages from How to Design Programs Teaching Languages (see the Racket documentation). I know I can select such a language in the DrRacket menu, but I would like to specify…
Giorgio
  • 5,023
  • 6
  • 41
  • 71
7
votes
1 answer

Lower case an entire string in Racket

Is there a way to turn all of the characters in a string into lower case in Racket? The only way I can think of is turning char-downcase but it won't work with strings I am using the beginner language so I can't use some functions
user2113651
  • 153
  • 2
  • 10
7
votes
1 answer

What exactly is the purpose of syntax objects in scheme?

I am trying to write a small scheme-like language in python, in order to try to better understand scheme. The problem is that I am stuck on syntax objects. I cannot implement them because I do not really understand what they are for and how they…
Matt
  • 21,026
  • 18
  • 63
  • 115
7
votes
1 answer

Local Database with Scheme

I want to construct a local database for my program which has to be filled with user preffered settings, searched websites and so on. But what i could find on internet(google and this website) is just about a database from a server or local database…
Asqan
  • 4,319
  • 11
  • 61
  • 100
7
votes
10 answers

reverse list - scheme

I'm trying to reverse a list, here's my code: (define (reverse list) (if (null? list) list (list (reverse (cdr list)) (car list)))) so if i enter (reverse '(1 2 3 4)), I want it to come out as (4 3 2 1), but right now it's not giving…
tlauer
  • 558
  • 2
  • 8
  • 22
7
votes
3 answers

Fibonacci in Scheme

I am trying to understand recursion in Scheme and I have a hard time doing the dry run for it, for example a simple Fibonacci number problem. Could someone break down the steps in which the additions take place, for me? (define (fib n) (if (<= n…
Pradit
  • 709
  • 5
  • 12
  • 27
7
votes
2 answers

What does the "PLT" in PLT-Scheme (now called Racket) stand for?

I'm curious: what does the "PLT" in PLT-Scheme (now called racket) stand for? The closest I could come to an answer was that "“PLT” refers to the group that is the core of the Racket development team" on this page.
kristianp
  • 5,496
  • 37
  • 56
7
votes
1 answer

Migrating from Python to Racket (regular expression libraries and the "Racket Way")

I'm attempting to learn Racket, and in the process am attempting to rewrite a Python filter. I have the following pair of functions in my code: def dlv(text): """ Returns True if the given text corresponds to the output of DLV and False…
ggelfond
  • 321
  • 1
  • 2
  • 5
7
votes
3 answers

Rotate a list to the left in Scheme/Racket

Trying to rotate a list left in scheme/racket. For example: (rotate-left '(abc)) outputs (bca) Here's ze code! (define (rotate-left LIST) (if(null? LIST)'() (cons(car LIST)(cons(cdr LIST)'()))))) Unfortunately this just outputs the same…
Don Johnson
  • 93
  • 1
  • 6