How should I convert a single-character string to a char? What have been doing is string->list followed by car. I can’t find a function that does this directly.
(string-ref "a" 0)
Shame on me! Thanks!
Does racket not support recursive structs? As in, the following does not seem to work > (struct recursive-point2d (x y p))
> (letrec ([p (recursive-point2d 0 0 p)]) p)
; p: undefined;
; cannot use before initialization
; [,bt for context]
Or make your struct mutable, and set the p
after construction
What’s reason behind letrec
not handling this and having a separate shared
form?
It would make letrec
substantially more complex, and also it allows data structures that are not constructible otherwise
such as your recursive point
> It would make letrec
substantially more complex Is there something that letrec
can do that shared
cannot? Also, is shared
a racket-specific form or a scheme form? I looked up http://schemers.org\|schemers.org, couldn’t find anything.
shared
is Racket-specific
also, letrec
is built-in and (mostly) can’t be implemented yourself
for example, to create a recursive procedure
@alec.mills has joined the channel