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

What is the appropriate Racket/Scheme idiom for this code?

I'm new to racket/scheme, so i decided to learn by implemeting an emulator for the DCPU-16, a simple 16 bit processor. My question is thus: What is a better way to implement my solution? This is the solution I hacked together to control the cpu's…
Kevin Coffey
  • 386
  • 1
  • 6
7
votes
1 answer

How to get html response from a url string? (Scheme/Racket)

How can I get an html response from a url string? Using this: #lang racket (require net/url) (require net/websocket/client) (define google (string->url "http://google.com")) (ws-connect(struct-copy url google [scheme "ws"])) Gives me ws-connect:…
kim taeyun
  • 1,837
  • 2
  • 24
  • 49
7
votes
2 answers

random function in DrRacket

I am currently using DrRacket on Mac OS X and choose the language "R5RS", but when I enter (random 100) I get the error message: reference to undefined identifier: random What's the problem here? Is it caused by a missing package?
JasonLi
  • 182
  • 2
  • 8
7
votes
3 answers

2 questions at the end of a functional programming course

Here seems to be the two biggest things I can take from the How to Design Programs (simplified Racket) course I just finished, straight from the lecture notes of the course: 1) Tail call optimization, and the lack thereof in non-functional…
7
votes
2 answers

Best way to learn Racket Macro system for imperative style programmers

What is the best route for an experienced imperative style programmer only familiar with C macros to learn the Racket macro system. Not just the mechanics of it (the how?) but also the where and why to use it and examples that illustrate…
Harry Spier
  • 1,395
  • 16
  • 30
7
votes
1 answer

Behavour of nested quotes in Scheme and Racket

While writing a function in Racket I accidently put two single quotes in front of a symbol instead of one. i.e. I accidently wrote ''a and discovered some behaviour of nested quotes that seems strange. I'm using DrRacket and tested this with both…
Harry Spier
  • 1,395
  • 16
  • 30
7
votes
1 answer

What are the uses for parameters in Racket?

I'm trying to understand parameters in Racket for single-threaded programs and I read about it here. That said, I'm still confused about why it is useful for single-threaded programs. Why is it useful? Should I think of it as a way to implement…
JRR
  • 6,014
  • 6
  • 39
  • 59
7
votes
0 answers

Domain-Specific Languages in Racket compared to Model-Driven frameworks such as Xtext

Racket and Xtext are both considered as language workbenches, but they are based on different concepts and workflows. As an experienced Xtext user, I find it difficult to adapt my thought process to Racket. In Xtext, the grammar of a language is…
7
votes
1 answer

What is the real answer to SICP 3.57

SICP Exercise 3.57: How many additions are performed when we compute the nth Fibonacci number using the definition of fibs based on the add-streams procedure? Show that the number of additions would be exponentially greater if we had implemented…
nate
  • 71
  • 4
7
votes
3 answers

How does Racket Scheme's "design by contract" features different from Eiffel?

I know that both Eiffel (the progenitor) and Racket both to implement "Design by Contract" features. Sadly, I am not sure how one would different from the other. Eiffel's DBC is reliant on the OOP paradigm and inheritance, but how would Racket, a…
Eli Schneider
  • 4,903
  • 3
  • 28
  • 50
7
votes
1 answer

Racket streams slower than custom streams?

I implemented a simple and not very efficent sieve of eratosthenes. Once for the built in racket-streams, and once for self defined streams. The only known difference to me is that the built in streams are evaluating the first item on call and not…
Alex
  • 71
  • 4
7
votes
1 answer

Some Macro terms in Racket

I am confused by the terms for a long time, thinking it is good to ask out what exactly do they mean: A. syntax. B. syntax value. C. syntax object. D.s-expression E.datum (in syntax->datum) What's the difference between s-expression and…
user618815
7
votes
1 answer

When should I use Rosette's shallow vs. deep embedding for program synthesis?

Some tutorials for Rosette introduce program synthesis using shallow embedding and others using deep embedding. After reading Torlak et Bodik's "Growing Solver-Aided Languages with ROSETTE", it seems the shallow embedding is good for fast…
Mike Chung
  • 140
  • 7
7
votes
2 answers

how can I compare syntax objects in racket?

I'd like to compare the code contents of two syntax objects and ignore things like contexts. Is converting them to datum the only way to do so? Like: (equal? (syntax->datum #'(x+1)) (syntax->datum #'(x+1)))
JRR
  • 6,014
  • 6
  • 39
  • 59
7
votes
1 answer

How to define exceptions in scheme using a dynamic variable and abortive control?

I am having trouble implementing exceptions (handle and raise) using a dynamically scoped variable and abort. This question came from reading the paper A syntactic theory of dynamic binding, section 6 figure 7. What I have attempted seems to work…
river
  • 1,028
  • 6
  • 16