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

How do I write higher-order functions that take polymorphic functions as arguments in Typed Racket?

For example, how can I write a version of map that will work with polymorphic functions in Typed Racket? I use a simple id function defined as: (: id : (All (A) A -> A)) (define (id x) x) When I try to map it over a list i get an error: > (map id…
8
votes
1 answer

How to handle GUI exit in Racket?

My Racket GUI application needs to do a lot of cleanup work when exiting, i.e. when the user presses the X button. These include killing child processes (which isn't automatic on Windows) etc. Wrapping the .rkt in a shell script which waits and then…
ithisa
  • 752
  • 1
  • 8
  • 25
8
votes
3 answers

How does eq? in Racket work?

At my university we had to work with Racket and since I kind of liked it, I bought the recently published book "Realm Of Racket" from No Starch. It's great so far, however, I cannot figure out what they mean in Chapter 4 when they try to explain how…
typeduke
  • 6,494
  • 6
  • 25
  • 34
8
votes
1 answer

Is the racket "universe" teachpack an example of FRP?

Is the 2htdp/universe teachpack a good (or bad, or not a) example of Functional Reactive Programming ? It seems to fit the concept (a new state of the world build on each tick / input), but I never saw the FRP label associated with it.
Rhangaun
  • 1,430
  • 2
  • 15
  • 34
8
votes
2 answers

Racket: How to retrieve the path of the running file?

I need a way to get the path of the running script (the directory that contains the source file), but (current-directory) never points there (in this case an external drive), but rather to some predefined location. I created a file to try all the…
SquareCrow
  • 291
  • 2
  • 14
8
votes
3 answers

Scheme's "expected a procedure that can be applied to arguments"

I use DrRacket. I have problem with this code: (define (qweqwe n) ( (cond [(< n 10) #t] [(>= (lastnum n) (pochtilastnum n)) (qweqwe (quotient n 10))] …
michaeluskov
  • 1,729
  • 7
  • 27
  • 53
8
votes
1 answer

Web scraping with Scheme

Is there a good library/package to do web scraping using Scheme (preferably Racket)? e.g. a Scheme equivalent of mechanize?
abeln
  • 3,749
  • 2
  • 22
  • 31
8
votes
2 answers

How to map a function over a list in parallel in racket?

The question title says it all, really: What is the best way map a function over a list in parallel in racket? Thanks.
Chris
  • 941
  • 9
  • 18
8
votes
2 answers

List to string conversion in Racket

How do I convert a list into a string in DrRacket? For example, how do I convert '(red yellow blue green) into "red yellow blue green"? I tried using list->string but that seems to work only for characters.
spatra
  • 151
  • 1
  • 3
  • 10
8
votes
5 answers

How to map over values of a hash table (racket)

I want to map a function over the values in a hash table, like so: (hash-map add1 (hash "apple" 1 "pear" 2)) => #hash(("apple" . 2) ("pear" . 3)) Is there a library function to do this? It'd be good to have one that worked on immutable hashetables…
Theo Belaire
  • 2,980
  • 2
  • 22
  • 33
8
votes
1 answer

How do I read a web page in Racket?

All of the information I can find online is about writing web servers, but there seems to be very little about functions useful for web clients. Ideally, I would like the function to look something like this: (website "http://www.google.com") And…
Alex V
  • 3,416
  • 2
  • 33
  • 52
8
votes
4 answers

Scheme getting last element in list

Im trying to write a simple scheme function that returns the last element of a list. My function looks like it should work, but I managed to fail on something: (define (last_element l)( (cond (null? (cdr l)) (car l)) (last_element (cdr…
calccrypto
  • 8,583
  • 21
  • 68
  • 99
8
votes
4 answers

streams in racket

Can anyone help me better understand how to write a stream? I understand that a stream is an infinite sequence of values and the way I have learned programming them is a representing them as a thunk that when called produces a pair of (1) the first…
kfem
  • 189
  • 3
  • 11
8
votes
2 answers

Scheme add element to the end of list

How can you add an element to the end of a list (before the empty) when only cons, first, rest, empty? and cond recursions can be used
user1718737
  • 113
  • 1
  • 1
  • 2
8
votes
2 answers

What are "reduction semantics"? Please explain the use of PLT Redex in layman's term

Somebody please explain the usage of reduction semantics and the PLT Redex in simpler language. Thanks.
unj2
  • 52,135
  • 87
  • 247
  • 375