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

(Chez) Scheme benchmarks?

Now that Chez Scheme is open-source, I wonder how it compares to Racket and other Schemes or languages in terms of performance, so that one could make informed choices about using them in one's projects. Unfortunately, I couldn't find any relevant…
MWB
  • 11,740
  • 6
  • 46
  • 91
13
votes
4 answers

Why are `not-equal?` and similar negated comparisons not built into Racket?

In Racket (and other Schemes, from what I can tell), the only way I know of to check whether two things are not equal is to explicitly apply not to the test: (not (= num1 num2)) (not (equal? string1 string2)) It's obviously (not…
ohspite
  • 1,269
  • 1
  • 10
  • 18
13
votes
1 answer

Expected a module declaration, found something else?

I'm working on a Racket script (on a Linux machine) that requires the math/number-theory library. My entire script at the moment is thus: #!/usr/bin/racket (require math/number-theory) Yes, it's literally just requiring the library. When I try to…
QuillAndSaber
  • 167
  • 1
  • 8
13
votes
2 answers

How to convert real to exact integer in Racket?

How do I convert a value of the form 20.2 into something that (random ...) accepts? I've tried these: ;; x defined by some earlier maths and of form 20.2 (random (round x)) (random (floor x)) But both return: random: contract violation expected:…
Eric Clack
  • 1,886
  • 1
  • 15
  • 28
13
votes
5 answers

What do I need to do to get paid to Scheme?

I'm a big fan of functional programming in general, Schemes in particular, and PLT-Racket ideally. I am wondering what concrete steps are likely to get me into a position where coding Scheme (or some functional language) is the bulk of the work.…
Ben
  • 4,980
  • 3
  • 43
  • 84
13
votes
1 answer

Detecting if script executed from command line in Racket?

I'm new to Racket (and Lisp's in general) and I'm wondering if there's a canonical way to detect if a script was run from the command line? For example, in Python the standard way to do this would be with if __name__ == __main__: as so: def foo(): …
Paul M.
  • 608
  • 3
  • 11
13
votes
10 answers

What are some things that you've used Scheme macros for?

Many examples of macros seem to be about hiding lambdas, e.g. with-open-file in CL. I'm looking for some more exotic uses of macros, particularly in PLT Scheme. I'd like to get a feel for when to consider using a macro vs. using functions.
Steven Huwig
  • 20,015
  • 9
  • 55
  • 79
13
votes
4 answers

How to use check-expect in Racket

I am trying to use the check-expect function in scheme but I keep being told its an unbound identifier for check-expect. Isn't check-expect a function I can use already? Below is my code: #lang racket (define contains (lambda (item list*) …
user3259073
  • 145
  • 1
  • 1
  • 6
13
votes
2 answers

Guidelines on structuring large racket project

Is there any general guidelines (equivalent to How to Write Go Code ) on how to structure large racket project ?
Salah Eddine Taouririt
  • 24,925
  • 20
  • 60
  • 96
13
votes
2 answers

Issue an HTTP GET from REPL in Racket

I feel like I'm missing something, but after perusing the docs for net/url and poking around in general, I was unable to figure out a way to issue a GET request from the interactive prompt. Basically, I want to imitate my python workflow for poking…
Ben
  • 4,980
  • 3
  • 43
  • 84
13
votes
4 answers

Can Racket produce visually stunning apps on par with commercial software?

Although Racket permits one to create GUI apps (even games) I am wondering whether it is suitable for releasing commercial applications visually on par with Things or OmniOutliner. Would such an app feel native or would it look like an awkward…
Mario
  • 6,572
  • 3
  • 42
  • 74
13
votes
4 answers

Error with define in Racket

I just discovered Racket a few days ago, and I'm trying to get more comfortable with it by writing a little script that generates images to represent source code using #lang slideshow. I know that when programming in a functional paradigm it's good…
exists-forall
  • 4,148
  • 4
  • 22
  • 29
13
votes
1 answer

PLT Redex: parameterizing a language definition

This is a problem that's been nagging at me for some time, and I wonder if anyone here can help. I have a PLT Redex model of a language called lambdaLVar that is more or less a garden-variety untyped lambda calculus, but extended with a store…
Lindsey Kuper
  • 984
  • 8
  • 21
13
votes
5 answers

Compiling SICP Picture Exercises in DrRacket?

I am going through SICP as a self-study and am on the picture language section in Chapter 2. I have been using DrRacket for the earlier exercises, but I get compilation errors when trying to do an exercise based on the 'draw-line' picture function…
Kevin Finch
  • 183
  • 1
  • 7
12
votes
3 answers

Setting Racket Geiser Emacs Path

I'm trying to get Geiser's REPL to work in Emacs, but it doesn't seem to be able to find Racket. racket is on my path, but anytime I type run-geiser followed by racket it complains: Unable to start REPL: Searching for program: no such file or…
Scott Klarenbach
  • 37,171
  • 15
  • 62
  • 91