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
9
votes
4 answers

Increment and Decrement operators in scheme programming language

What are the increment and decrement operators in scheme programming language. I am using "Dr.Racket" and it is not accepting -1+ and 1+ as operators. And, I have also tried incf and decf, but no use.
unknownerror
  • 2,235
  • 2
  • 25
  • 26
9
votes
6 answers

zip function in Racket/Scheme

Given two lists, return a list whose elements are lists of size two, such that for the i-th list, the first element is the i-th element of the first original list, and the second element is the i-th element of the second original list. If one list…
user3294726
  • 201
  • 1
  • 3
  • 4
9
votes
2 answers

What Scheme Does Ghuloum Use?

I'm trying to work my way through Compilers: Backend to Frontend (and Back to Front Again) by Abdulaziz Ghuloum. It seems abbreviated from what one would expect in a full course/seminar, so I'm trying to fill in the pieces myself. For instance, I…
Don Wakefield
  • 8,693
  • 3
  • 36
  • 54
9
votes
2 answers

Confused about racket contracts

I defined a function true? for use with count in racket/list. (define (true? expr) (and (boolean? expr) expr #t)) I noticed I could provide it numeric arguments and my function would happily return #f. > (true? 6) #f So, I thought I would…
wdkrnls
  • 4,548
  • 7
  • 36
  • 64
9
votes
1 answer

What constitutes the core of the DrRacket Programming language

What constitutes the core of the Racket programming language? Is the core based off any RnRS specification with all the extras such as the numerous sequence methods based of that tiny core or is everything in the reference part of the language core?
cobie
  • 7,023
  • 11
  • 38
  • 60
9
votes
5 answers

tail-recursive function appending element to list

i've seen several examples of implementing append an element to a list, but all are not using tail recursion. how to implement such a function in a functional style? (define (append-list lst elem) expr)
9
votes
2 answers

converting a file to list or string in scheme

I'm having a bit of an issue taking a text file and converting it into a list or string. Say I have "blah.txt" which holds: 3 + 4 Now I want to call that file which I know can be done by (define in (open-input-file "blah.txt")) Where do I take it…
Ceelos
  • 1,116
  • 2
  • 14
  • 35
8
votes
4 answers

Loop in PLT Scheme

How can I implement loop in plt-scheme like in java- for(int i=0;i<10;){ for(int j=0;j<3;){ System.out.println(""+j); j++; } System.out.println(""+i); i++; }
fireball003
  • 1,909
  • 5
  • 20
  • 24
8
votes
2 answers

Game programming in racket

I want to use racket to make a game whose graphics would involve a grid where each cell could be filled with one or more sprites on top of each other. Racket has a graphics and gui toolkit in its standard library, which is very nice. But apart from…
adrusi
  • 835
  • 1
  • 7
  • 14
8
votes
7 answers

How to split list into evenly sized chunks in Racket (Scheme)?

Example: How to convert list: '(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) Into list of lists: '((0 1 2 3) (4 5 6 7) (8 9 10 11) (12 13 14 15)) Based on answers provided here so far, this is what I've come up with: First define function to…
PopMilo
  • 128
  • 1
  • 9
8
votes
8 answers

How to get rid of duplicates in a list, but keep the order

I am using Intermediate Student with Lambda in DrRacket, I was wondering how one would remove the duplicates in a list, while keeping the order. For example (remove-dup (list 2 5 4 5 1 2)) would produce (list 2 5 4 1). So far, I have this: (define…
J-Y
  • 365
  • 3
  • 9
  • 18
8
votes
1 answer

Racket: using events in a frame% window

I'm learning Racket (formerly PLT Scheme, a LISP dialect) and try to discover how to handle events different than paint-callback (maybe it's not even one). I hoped a lot from this part of the doc but on-char and on-event seem to do nothing that…
L01man
  • 1,521
  • 10
  • 27
8
votes
1 answer

Using Scheme libraries in a Racket program

I wrote a program in Racket (the source code is in a .rkt file with #lang racket at the top). I also wrote a library in (mostly) portable R7RS Scheme. Can I use the library in the program in a clean way? My goal is for the library to be widely…
Lassi
  • 3,522
  • 3
  • 22
  • 34
8
votes
2 answers

In Racket, how do I get or change my working directory?

What is Racket's equivalent for viewing and changing the working directory of a process like pwd and cd?
Sage Gerard
  • 1,311
  • 8
  • 29
8
votes
2 answers

why define-syntax of or in scheme need consider three conditions?

I'm reading the scheme programming language, in chapter 3, the book use define-syntax to define or and and procedure, and it says the following definition of or is incorrect: (define-syntax or ; incorrect! (syntax-rules () [(_) #f] [(_ e1…
myy1966
  • 83
  • 2