5,881
questions
218
votes
6
answers
69k
views
How is Racket different from Scheme?
Racket is a descendant of Scheme. How is Racket different than R6RS? What did it add, or take away, or is just different?
I understand that Racket is more than a language, it's a platform for ...
149
votes
4
answers
44k
views
What are the differences between Clojure, Scheme/Racket and Common Lisp?
I know they are dialects of the same family of language called lisp, but what exactly are the differences? Could you give an overview, if possible, covering topics such as syntax, characteristics, ...
113
votes
4
answers
48k
views
What are the actual differences between Scheme and Common Lisp? (Or any other two dialects of Lisp)
Note: I am not asking which to learn, which is better, or anything like that.
I picked up the free version of SICP because I felt it would be nice to read (I've heard good stuff about it, and I'm ...
87
votes
15
answers
37k
views
What is the best Scheme or LISP implementation for OS X? [closed]
I am looking for a version of Scheme or even LISP that I can use to recover some lost Lisp development skills. Some web capabilities would be nice but not essential.
I've looked at Plt and MIT ...
66
votes
2
answers
20k
views
What is the difference between quote and list?
I know that you can use ' (aka quote) to create a list, and I use this all the time, like this:
> (car '(1 2 3))
1
But it doesn’t always work like I’d expect. For example, I tried to create a ...
61
votes
6
answers
24k
views
What exactly is a symbol in lisp/scheme?
For the love of the almighty I have yet to understand the purpose of the symbol 'iamasymbol. I understand numbers, booleans, strings... variables. But symbols are just too much for my little ...
60
votes
8
answers
3k
views
Collection of Great Applications and Programs using Macros
I am very very interested in Macros and just beginning to understand its true power. Please help me collect some great usage of macro systems.
So far I have these constructs:
Pattern Matching:
...
49
votes
4
answers
11k
views
Why is foldl defined in a strange way in Racket?
In Haskell, like in many other functional languages, the function foldl is defined such that, for example, foldl (-) 0 [1,2,3,4] = -10.
This is OK, because foldl (-) 0 [1, 2,3,4] is, by definition, ((...
43
votes
2
answers
3k
views
Help understanding Continuations in Scheme
I have been working alongside The Little Schemer to learn Scheme and using PLT-Scheme for my environment.
The Little Schemer has helped me tremendously with recursion (it is straightforward for me ...
38
votes
1
answer
9k
views
Why is one-armed "if" missing from Racket?
In standard Scheme it is possible to write
(if (> x 2)
(set! x (- x 1)))
but this is not possible in Racket -- Racket's if always requires two arms. Why?
37
votes
1
answer
5k
views
What exactly is a "continuation prompt?"
I'm trying to decipher the documentation
call-with-continuation-prompt
Applies proc to the given args with the current continuation extended by a prompt. The prompt is tagged by prompt-tag, ...
36
votes
5
answers
8k
views
Is there an equivalent to Lisp's "runtime" primitive in Scheme?
According to SICP section 1.2.6, exercise 1.22:
Most Lisp implementations include a primitive called runtime that returns an integer that specifies the amount of time the system has been running (...
32
votes
3
answers
11k
views
Dr Racket problems with SICP
I'm working through SICP. Currently, in the first chapter, I'm having problems getting Racket to let me redefine "primitives". For instance, I was under the impression that I should be able to ...
32
votes
4
answers
8k
views
Little Schemer and Racket
I'm starting to read the Little Schemer and now instead of PLT Scheme we have Racket. I would like to know if Racket is suitable for doing the exercises in the book or do I need to get another true ...
32
votes
1
answer
9k
views
What is the difference between [ ] and ( ) brackets in Racket (lisp programming language)?
It seems to me that technically both are interchangeable but have different conventional meanings.
31
votes
3
answers
19k
views
Programming Scheme(Racket) with VIM - How to get started
recently, I started programming Racket (formerly Scheme) in DrRacket.
I quite fast I began to miss all the features of VIM in DrRacket, so I would like
to use VIM for my scheme(racket) programming.
I ...
30
votes
3
answers
2k
views
When did the idea of macros (user-defined code transformation) appear?
I have read McCarthy's 1960 paper on LISP and found no reference to anything that's similar to user-defined macros or normal order evaluation. I was wondering when macros first appeared in programming ...
28
votes
2
answers
15k
views
How do you load a file into racket via command line?
I have been trying to launch a racket program from the commandline (via 'racket') but have not been having success. According to the documentation (here http://docs.racket-lang.org/reference/running-...
27
votes
3
answers
6k
views
How can I get the previous command in DrRacket?
Like Racket - how to get the “previous executed command” in bash script? but with DrRacket. How can I get the previously executed command in DrRacket (like up arrow function in bash)?
26
votes
2
answers
6k
views
Racket Interactive vs Compiled Performance
Whether or not I compile a Racket program seems to make no difference to the runtime performance.
Is it just the loading of the file initially that is improved by compilation? In other words, does ...
25
votes
1
answer
7k
views
Differences between #lang scheme and #lang racket
I'm guessing that #lang racket is a dialect of scheme with much more out of the box structures and common functions and perhaps would be more pedagogic. What are the perks a #lang racket against #lang ...
24
votes
3
answers
3k
views
Racket vs Scheme macros
Do racket macros have more advanced functionality than those found in Scheme or Common Lisp? I suspect so, especially regarding modules, namespaces and scoping, etc, but I'd appreciate a simple ...
23
votes
6
answers
9k
views
What is scheme's equivalent of tuple unpacking?
In Python, I can do something like this:
t = (1, 2)
a, b = t
...and a will be 1 and b will be 2. Suppose I have a list '(1 2) in Scheme. Is there any way to do something similar with let? If it ...
23
votes
2
answers
27k
views
Converting String to integer in Scheme
How can I convert a string of digits to an integer ?
I want "365" to be converted to 365.
What I have tried,
string->list then char->integer, but this returns ASCII value of that integer, how can I ...
23
votes
3
answers
20k
views
How to run scheme with Emacs?
I followed this tutorial and successfully installed Emacs, STk, Quack.
The question is how can I load my program like I do in Racket?
In Racket I can edit my code in the upper window, type some ...
22
votes
1
answer
12k
views
Setting default argument value in Racket
Is it possible to set a default value to some of arguments in Racket?
Like so in Python:
def f(arg=0)
...
22
votes
2
answers
7k
views
Is there an autocomplete for Dr. Racket?
I usually use Sublime text editor and gnome terminal to edit and run my programs. Due to educational purposes, I am using the IDE Dr. Racket.
I could not find an autocomplete feature to use while ...
22
votes
1
answer
887
views
Can `match` in Racket have patterns with variables from an outer scope?
Consider the following example:
#lang racket
(match '(cat . doge)
[`(,a . ,b)
(match b
[a #t]
[_ #f])]
[_ "Not a pair"])
This is what I might write if I wanted to match pairs where ...
21
votes
3
answers
18k
views
set-car!, set-cdr! unbound in racket?
I am just trying to do very simple code with set-car! and set-cdr! in racket, but I got the error: expand: unbound identifier in module in: set-car! and expand: unbound identifier in module in: set-...
21
votes
4
answers
10k
views
How do I do anything with multiple return values in racket?
It seems like in order to use multiple return values in Racket, I have to either use define-values or collect them into a list with (call-with-values (thunk (values-expr)) list). In the latter case, ...
21
votes
3
answers
5k
views
Setting language with #lang in the REPL
I would like to set the language in the REPL on the fly, with #lang, not using "-I" command-line argument. But this gives me the error "read: #lang not enabled in the current context".
Is there a ...
20
votes
3
answers
7k
views
Use of lambda for cons/car/cdr definition in SICP
I was just beginning to feel I had a vague understanding of the use of lambda in racket and scheme when I came across the following 'alternate' definitions for cons and car in SICP
(define (cons x y)
...
20
votes
1
answer
4k
views
Vi Keybindings in DrRacket
Has anyone got any idea if drracket editor has got vi keybindings or if there is a plugin for that can activate vi keybindings within drracket?
19
votes
3
answers
11k
views
Including an external file in racket
I would like to include all the functions defined in a given racket file so that I get the same effect as if they were copied. Is it possible to do that?
19
votes
4
answers
6k
views
In Racket, what is the advantage of lists over vectors?
In my experience with Racket so far, I've not given much thought to vectors, because I gathered that their main benefit — constant-time access to elements — was not significant until you're working ...
19
votes
2
answers
2k
views
Racket reader macros
Is there any way to make simple reader macros in Racket. I mean a generalization like this:
(define-reader-syntax "'" quote)
; finds expressions that start with "'" and wraps them in `(quote ...)`
'(...
19
votes
4
answers
3k
views
Why doesn't Scheme support first class environments?
I've been reading through SICP (Structure and Interpration of Computer Programs) and was really excited to discover this wonderful special form: "make-environment", which they demonstrate to ...
18
votes
9
answers
39k
views
removing last element of a list(scheme)
So I have to remove the last element of a list in scheme.
For example, let's say I have a list (1 2 3 4). I need to return:
(1 2 3)
My idea:
reverse(list)
car(list)
reverse(list)
Is there a ...
17
votes
2
answers
37k
views
How do I get an item from a list at a given index in racket language?
I'm trying to get an item from a list at a given index for a loop statement.
(define decision-tree-learning
(lambda (examples attribs default)
(cond
[(empty? examples) default]
[(...
17
votes
2
answers
5k
views
The advantage of Arc over Racket
Arc is built on top of Racket. Since both of them are in the Lisp family, I am curious about the the advantage of Arc over Racket, or what is the motivation of creating Arc given that Racket is ...
17
votes
3
answers
3k
views
Is there a shorthand way to update a specific struct field in racket?
Suppose I have a struct with many fields:
(struct my-struct (f1 f2 f3 f4))
If I am to return a new struct with f2 updated, I have to rephrase every other fields:
(define s (my-struct 1 2 3 4))
(my-...
17
votes
3
answers
7k
views
Racket: execute file and stay in interactive mode
Is there a way from a command line to run Racket file and stay in the interactive mode afterwards?
E.g. same in Python it would be:
python -i <file.py>
17
votes
2
answers
27k
views
Check if an argument is a list or an atom
How do I check if something is an atom? I'm looking for something like number? or list?.
17
votes
3
answers
8k
views
What are the benefits of letrec?
While reading "The Seasoned Schemer" I've begun to learn about letrec. I understand what it does (can be duplicated with a Y-Combinator) but the book is using it in lieu of recurring on the already ...
16
votes
5
answers
12k
views
About "If.." in Scheme (plt-scheme)
I had a pretty simple requirement in my Scheme program to execute more
than one statement, in the true condition of a 'if'. . So I write my
code, something like this:
(if (= 1 1)
((expression1) (...
16
votes
2
answers
8k
views
How can I clear the interpreter screen in Dr. Racket IDE?
Just starting into The Little Schemer, and have a very basic Dr. Racket IDE question:
How can I clear the interpreter screen?
How can I set the up arrow to display the previously-typed items (like in ...
16
votes
1
answer
643
views
What is "3D syntax"?
In the context of writing Racket macros, what does "3D syntax" mean?
I've heard the phrase a few times. Including once in reference to a macro I was writing. But that was awhile ago; I fixed it, and ...
16
votes
0
answers
422
views
Is a function that curries the first argument of a list of functions typeable in Typed Racket?
I can write a simple function in untyped Racket called curry-all that takes a list of functions, all of which accept the same kind of value for their first argument, and produces a list of functions ...
15
votes
3
answers
37k
views
Newline in Scheme (Racket)
It is possible to have a new line when you write with "display" like
(display "exa \n mple")
But the problem is that there is no any code to have a new line in strings? Like:
"exa \n mple"
...
15
votes
3
answers
4k
views
I need help installing PLT Racket, I moved the Racket folder into Applications but I don't know how to use the raco command in the terminal
To explain, I have OSX and I wanted to install PLT Racket. I don't know how to use the raco command to run .rkt files in the terminal instead of using the Dr. Racket interpreter. I don't really like ...