Questions tagged [racket]
Racket is an extensible multi-paradigm programming language in the Lisp/Scheme family.
racket
5,880
questions
0
votes
0
answers
15
views
File explorer functionality for DrRacket?
For me, adding the ability to browse files/directories to DrRacket would be a giant help. I found a reference to the plugin, "files-viewer" but documentation links are broken. Can anyone ...
2
votes
1
answer
41
views
Why is there an error about redefining a constant in code that doesn't redefine a constant?
The following code:
#lang racket
(define foo1234
(call/cc
(lambda (j) (j (lambda (_) (j 5))))))
(foo1234 (lambda (_) 2))
Produces an error about redefining a constant:
define-values: ...
0
votes
1
answer
74
views
(Scheme) Having trouble with binary search tree in-order traversal
I'm trying to write a Scheme program that performs an in-order traversal of a binary search tree:
(define (inorder lst)
(cond
((null? lst)
'())
((not (pair? lst))
(list lst))
...
2
votes
1
answer
54
views
Racket "rotate" and "shift-to" macro from "The Racket Guide"
I'm skimming section 16.1 of "The Racket Guide" and I'm stuck on 16.1.4. I understand everything prior to 16.1.4 (of section 16.1 and not the whole guide). What does the following mean?
(...
0
votes
1
answer
73
views
Why is factorial code scaling strangely with larger integers?
I wrote a Racket program to calculate factorials and ran tests to see how the runtime scaled with different values of n for n!. I was surprised to see that sometimes when scaling n, it caused little ...
0
votes
1
answer
74
views
Racket custom 'infix' operator
I am still learning this. So my question title and this code both may be incorrect.
I am trying to define a new operator for appending. The inspiration for this is some OCaml code I am porting to ...
1
vote
1
answer
63
views
Understanding *abort continuations in scheme/racket
Days ago i started reading about continuations and delimited continuation control operators in Scheme (i'm working in racket but using scheme continuations). In that context i was trying the shift/...
0
votes
0
answers
51
views
How to Validate Phone Numbers in Plait without Using Regex?
I'm working on a project in Plait, a sublanguage of Racket, and I need to validate phone numbers. The phone numbers should be in the format "xxx-xxx-xxxx" where the area code is either "...
0
votes
1
answer
10
views
Why does my typed racket code signal any-wrap/c: contract violation expected: acyclic value?
In my Typed Racket program, I'm seeing this error:
any-wrap/c: contract violation
expected: acyclic value
given: #0=(foo #0#)
argument position: 1st
other arguments...:
What could cause this ...
0
votes
2
answers
75
views
Why in SICP one can see seemingly useless evaluation of local variable expressions? Different Scheme implementations behave differently
The deposit and withdraw procedures in the make-account code from SICP both have seemingly useless balance variable expression to evaluate,
What is the practical purpose for doing that? (To me it ...
0
votes
0
answers
35
views
in drracket version 8.12 how to trace a function?
my quesion is how can i trace a function in drracket version 8.12?
I have a guy who wrote the same code as me and his code works, so I think it's because our versions are different, so I want to know, ...
0
votes
0
answers
40
views
Why does Racket output 1 for (and 0 1)? [duplicate]
As the title asks, why does Racket output a 1 for a logical and between 0 1? The interesting this here is that the same operation but flipped positions of 0 and 1 give the proper output of 0. I'm no ...
0
votes
0
answers
32
views
How to fix "caddr: expects argument of type <caddrable value>" error in Scheme when parsing custom grammar?
I'm developing a Scheme program where I aim to parse a custom language using the sllgen library, focusing on handling try-catch-finally blocks. However, I'm encountering an error related to list ...
0
votes
1
answer
39
views
What is the difference between `some-struct?` and `#<some-struct>` in Racket?
I have a struct
(struct client-sock-addr (host port))
I have a toText function
(define (toText.v1 addr)
(string->chunked-string (format "<client-sock-addr ~a ~a>" (client-sock-...
0
votes
0
answers
77
views
Creating a Deterministic Pushdown Automata (pda) that decides L = {a^(m)b^(n)c^(p) | n does not equal p}. FSM, code in Racket Language
When aiming to create a deterministic PDA for the given language, L = {a^(m)b^(n)c^(p) | n should not equal p}, I had come up with the following pda, along with tests that should in theory work:
#lang ...