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
1 answer

Installing racket packages as native executables on linux

Is there a way to install a racket package either: as a statically linked native executable? have raco install it to specific path where it can be packaged and distributed as native linux distribution package?
b2Wc0EKKOvLPn
  • 2,054
  • 13
  • 15
2
votes
1 answer

How to implement "function" monads in racket using functional's data/monad module?

Since the data/monad module's do notation operates on structures, how can I define monad types that are functions, e.g. like parsers? I'm used to OCaml, where my monad would have had roughly the following signature: module type Parser = sig type…
Antoine
  • 1,782
  • 1
  • 14
  • 32
2
votes
1 answer

How do you match hash-table against the value of a local variable?

> (define h #hash((a . 11) (b . 0))) > (define (f h key) (match h [(hash-table (key value)) value] [_ 'do-something-else])) > (f h 'a) 'do-something-else ;; expect 11 How should I modify the match pattern so the function above…
Ben Kovitz
  • 4,920
  • 1
  • 22
  • 50
2
votes
1 answer

What language should DrRacket be set to when doing SICP exercises?

What language should I select in DrRacket in order to do SICP exercises?
2
votes
3 answers

let vs define usage in continuations

I was trying to understand the call/cc execution in this example: (let ((x (call/cc (lambda (k) k)))) (x (lambda (ignore) "hi"))) which gives the value "hi". The execution is described in the doc as: Take the value, bind it to x, and apply the…
Nishant
  • 20,354
  • 18
  • 69
  • 101
2
votes
1 answer

GC logging when running racket as emacs REPL

I don't get any GC logging messages when running Racket code in raket-mode in emacs. Running the following code in DrRacket gives back a log entry while running it in Emacs REPL does not. (define my-logger (make-log-receiver (current-logger) 'debug…
PLux
  • 21
  • 1
2
votes
1 answer

racket/draw: get list of font face names?

Is it possible to get a list of available font face names in Racket? I want all values of x such that (text "Kimkoh" x) returns a pict with a unique font face.
Ben Greenman
  • 1,945
  • 12
  • 22
2
votes
2 answers

Random numbers in Racket

I'm trying to generate random numbers from 0 to 1, including the borders 0 and 1 in Racket. Until now I didn't find a solution. Is there a nice way ?
2
votes
1 answer

read-syntax: `#...=` forms not enabled

I am attempting to use the #‹digit10›{1,8}= and #‹digit10›{1,8}# syntax as described in The Reader, but receive the read-syntax: `#...=` forms not enabled when I do so: This code has been run a DrRacket REPL with only #lang racket in the edit area,…
Michael MacLeod
  • 130
  • 1
  • 6
2
votes
1 answer

Deadlock in Racket co-routine implementation

As a project to help me understand continuations in Racket, I decided to try and write a co-routine implementation without using mutable or global variables. Here is what I have so far, but it seems to end up in a deadlock of some kind. Am I missing…
2
votes
1 answer

how can I capture the expanded forms?

I'm trying to capture the expanded forms by defining my own module-begin: (define-syntax-rule (my-module-begin e ...) (#%module-begin e ... (foo e ...))) Am I correct that foo here gets the original forms? If so is there a way…
JRR
  • 6,014
  • 6
  • 39
  • 59
2
votes
3 answers

How to remove accents from a string in Racket?

I have a string like café and I need to translate it to cafe. I tried (string-normalize-nfd "café") but it returns cafe a quotation mark with an accent, and `(string-normalize-nfd alguém) returns alguem with accent on m. How can I translate the…
Vitor F.M.
  • 119
  • 7
2
votes
1 answer

arguments.callee in Racket (Scheme)?

I need the feature arguments.callee of JavaScript in Racket (Scheme). Do you know how? Here, an example in JavaScript function makeFactorialFunc() { return function(x) { if (x <= 1) return 1; return x * arguments.callee(x - 1); }; }
Naive Developer
  • 700
  • 1
  • 9
  • 17
2
votes
1 answer

How to interleave two language support files in a tmLanguge file?

I'm trying to make a VS Code extension to highlight Pollen Markup files. Those are plain text files with embedded variables and Racket code. Variables have syntax like this (and get later spliced into the text by a preprocessor): Some text…
Eugleo
  • 418
  • 4
  • 11
2
votes
1 answer

Scheme: Mysterious void in pattern match

I am writing a function called annotate that uses match-lambda -- often with recursive calls to annotate. Here is one of the pattern matches: (`(lambda (, . ,) ,) `(CLOSURE ENV (, . ,) (lambda (ENV) ,(map…
Schemer
  • 1,635
  • 4
  • 19
  • 39
1 2 3
99
100