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
2
votes
2 answers

Assigning random values to the elements of a list

From this question we can construct an interleaved list out of two lists with a different length (according to Sylwester answer making use of circular-list). My question is how can we do the same but taking the elements of the second list…
gibarian
  • 133
  • 6
2
votes
2 answers

Compare two lists and return false if they are not equal scheme

i would like to ask you for help to complete code below with condition which is testing if lists ws and vs are not equal. If they are not equal so return text false(#f) else process code below. I stared with fulfilling variables len1 and len2 which…
Fanhanes
  • 45
  • 6
2
votes
1 answer

Enabling CORS on a Racket servlet

I'm have a Racket web server using web-server, is there a way to enable Cross origin resource sharing (CORS)?
2
votes
1 answer

Two racket modules colliding

I am requiring two modules to my file: (require sicp) ; contains set-car! and set-cdr! (require (planet dyoo/sicp-concurrency:1:2/sicp-concurrency)) ; contains procedures parallel-execute and test-and-set! Problem: both libraries use different…
lightning_missile
  • 2,821
  • 5
  • 30
  • 58
2
votes
1 answer

Use or not, of lambda to define a function in Racket

I'm learning racket, and I used to use lambda to define my functions. But I have found that it is not needed to use it (as far as I know). I have tried these two functions in DrRacket and both returns the same result: #lang racket (define factorial …
VansFannel
  • 45,055
  • 107
  • 359
  • 626
2
votes
1 answer

What are the ways to identify unlifted Racket constructs while using the full Rosette language?

One of the most common bugs I make while implementing a program synthesizer with Rosette is using unlifted Racket constructs in an unsafe way that makes synthesizer to output (unsat). In fact, as a beginner Rosette programmer, it is difficult to…
Mike Chung
  • 140
  • 7
2
votes
1 answer

Racket Binary Addition

I have a question concerning Racket. Given 2 string binary numbers, I would like to obtain their sum in a string binary number. The function should take into account carry bits and a possible overflow. So the function should look like this: (define…
DrDominio
  • 113
  • 1
  • 10
2
votes
2 answers

Text editor / IDE for Ruby similar to DrScheme

For those who haven't used DrScheme, window is split in two parts: one part is a file you're editing, and the other is interactive shell. When I run a file, it is loaded into interactive environment, so I can invoke functions I've defined etc.…
Slartibartfast
  • 8,735
  • 6
  • 41
  • 45
2
votes
1 answer

redefining one of the existing racket forms

I'm designing a new language and would like to re-define the procedural form of define but export the standard expression form as well. Is there a way I can do that? So far I have this code: (define-syntax-rule (my-define (name args) body ...)…
JRR
  • 6,014
  • 6
  • 39
  • 59
2
votes
1 answer

How to redefine a standard function within a scope in Racket?

I would like to redefine a standard Racket function, namely display, within a lexical scope, as in this example: (with-custom-display (display "hello")) This should work even when the code within the scope of with-custom-display is from a different…
Renato
  • 12,940
  • 3
  • 54
  • 85
2
votes
0 answers

In Racket's mini-kanren libraries, where is condi?

The mini-kanren language features four conditional operators: conda, conde, condi and condu (described here). There are two mini-kanren libraries available for Racket that I am aware of (both described here). Neither of them implements condi. My…
Jeffrey Benjamin Brown
  • 3,427
  • 2
  • 28
  • 40
2
votes
1 answer

The amb -< operator is not defined

I see this in the lecture slide > (+ 10 (-< 1 2 3)) 11 > (next) 12 > (next) 13 > (next) 'done But when I tried it my own in DrRacket, it came up with an error > (+ 10 (-< 1 2 3)) . . -<: undefined; cannot reference an identifier before its…
user8314628
  • 1,952
  • 2
  • 22
  • 46
2
votes
2 answers

Confused with behavior of this procedure

(CONTEXT) I've defined a procedure that applies another one-argument procedure object to it's parameter twice. Take for example the procedure inc that adds 1 to it's argument, (double inc) will add two. hence ((double inc) 5) returns 7. (THE…
TomatoFarmer
  • 463
  • 3
  • 13
2
votes
2 answers

List passed to procedure converts into list of list inside the procedure

I'm debugging this code on DrRacket: #lang racket (define last-element-on-list (lambda l (cond ((null? l) '()) ((null? (cdr l)) (car l)) (else (last-element-on-list (cdr l))) ) ) ) (define lst '( (n 25 f…
VansFannel
  • 45,055
  • 107
  • 359
  • 626
2
votes
1 answer

Racket: render a video to a canvas

I am trying to display a video within a panel using racket/gui. It looks like the library to use is video. The video-player% class extends frame% which will not be contained inside a panel so I assume I have to use a video-player-server%. Is that…
BBS
  • 1,351
  • 2
  • 12
  • 27