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

How can I construct procedures for usage in racket lisp engines?

I would like to use racket lisp engines which allow execution of a procedure that can be interrupted by a timer timeout. I'm not sure how to construct a procedure that engine will accept because I can't find examples online. At the engine…
durandaltheta
  • 217
  • 2
  • 8
2
votes
2 answers

Check if an argument is a dotted pair and not a list

I've just started learning Racket and I have to check if an argument is a dotted pair. I have tried this: (pair? '(a . 1)) And returns #t. (pair? '('(a b c) . 1)) And returns #t. (pair? '(a b c)) And returns #t. But I want to get #f in this…
VansFannel
  • 45,055
  • 107
  • 359
  • 626
2
votes
2 answers

Merge two list randomly returns a strange merged list

I've just started to learn Racket and I need to create a procedure that merge two list randomly. This is my code: #lang racket (define merge-randomly (lambda (lst1 lst2) (cond ((and (null? lst1) (null? lst2)) null) ((null? lst1)…
VansFannel
  • 45,055
  • 107
  • 359
  • 626
2
votes
2 answers

Scheme: mapping let and set! onto lists

I am trying to map let and set! onto lists something like this: (map (lambda (x) (let ((x #f)))) ) and (map set! ) But, of course, neither is working. Is there a way to do this? Any advice is appreciated. Thanks. The real…
Schemer
  • 1,635
  • 4
  • 19
  • 39
2
votes
1 answer

How to fix bash: raco: command not found?

raco pkg install iracket -bash: raco: command not found I add path to .bash_profile # Setting PATH for Racket 7.0 export PATH="/Applications/Racket v7.0/bin/raco:$PATH" But it still doesn't work. How can I fix it? Should I add path to…
user8314628
  • 1,952
  • 2
  • 22
  • 46
2
votes
3 answers

How to get the lowest integer out of a vector in Racket

I'm trying to get the lowest integer out of a vector only containing numbers. I know how to do it with lists. You compare the first two values of the list and depending on which is larger you either save your value to output it later or call the…
2
votes
2 answers

(Scheme) Check a list of item are all satisfied an logical relation

I'm currently studying Scheme and encounter a question which description such like: Define and implement a function that takes something like a logical operator check and a list xs, then check whether that (check a b) evaluate to true for all two…
user548976
  • 49
  • 1
  • 4
2
votes
1 answer

Adding and deleting directory to vim interpreters’ import path

What is the mzscheme equivalent of the following codes? python: python import sys, vim python sys.path.append(vim.eval("var")) <...> python sys.path.remove(vim.eval("var")) perl: perl push @INC, [VIM::Eval("var")]->[1]; <...> perl @INC=(grep {$_…
ZyX
  • 52,536
  • 7
  • 114
  • 135
2
votes
1 answer

Debugging scheme on vim

We are working on a project with scheme on UNIX terminal using vim. We are using mzscheme (though startup prompt says Welcome to Racket v6.1. Is there any way we can use vim to debug the program? I tried using Dr.Racket with the following…
selfPointer
  • 339
  • 1
  • 2
  • 12
2
votes
2 answers

How do you get canvas% objects to respond to mouseovers?

Right at the moment, I've got a window that looks like this: Each of those green disks represents a number. How can I make it so that when you move the mouse over the disk, a tooltip or something appears and shows you the number? That's only one…
Ben Kovitz
  • 4,920
  • 1
  • 22
  • 50
2
votes
1 answer

How to reference a recursive variable within a macro in racket

In Drracket I am being tasked with creating a recursive macro that can take in (edges n1 -> n2 <-> n3) for example, with n1, n2, and n3 being (define-struct node (name edges)). The -> indicates putting the second node into the edges of the first…
2
votes
1 answer

The Little Typer

In "The Little Typer" book, I am just starting to use DrRacket. From a David Christiansen video, I inputted: (claim two-plus-two-is-four (= Nat (+ 2 2) 4)) which returned an error: claim : this function is not defined. Why?
2
votes
1 answer

How can I access a class field by its name in racket?

I can access a class field by defining a method so (send joe get-name) will return me Joe. But can I get the same behavior without adding a method and just by calling a field, like this: (send joe name)? #lang racket (define person% (class…
Aliaksandr Sushkevich
  • 11,550
  • 7
  • 37
  • 44
2
votes
1 answer

Does for/list do an unnecessary reverse?

I was poking around in the Macro Stepper for the first time and noticed that a for/list expanded into code involving something called alt-reverse. Does for/list cons each item onto the front of an empty list and then reverse it? That seems very…
Ben Kovitz
  • 4,920
  • 1
  • 22
  • 50
2
votes
1 answer

Strange output after putting a "prime" on an identifier in Racket REPL

Today, I made a typing mistake in the REPL and discovered a strange behaviour. Here's a sample of the interaction: Welcome to Racket v6.11. > (define x 3) > x 3 > x' 3 > x 'x > So the first x I typed resulted in 3, which is expected. The x' I…
Flux
  • 9,805
  • 5
  • 46
  • 92
1 2 3
99
100