anything
2021-1-12 12:32:54

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.


soegaard2
2021-1-12 12:33:23

(string-ref "a" 0)


anything
2021-1-12 12:34:48

Shame on me! Thanks!


joshibharathiramana
2021-1-12 13:32:21

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]



laurent.orseau
2021-1-12 13:35:25

Or make your struct mutable, and set the p after construction


joshibharathiramana
2021-1-12 13:38:00

What’s reason behind letrec not handling this and having a separate shared form?


samth
2021-1-12 14:38:43

It would make letrec substantially more complex, and also it allows data structures that are not constructible otherwise


samth
2021-1-12 14:38:48

such as your recursive point


joshibharathiramana
2021-1-12 14:43:40

> 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.


samth
2021-1-12 14:44:25

shared is Racket-specific


samth
2021-1-12 14:45:07

also, letrec is built-in and (mostly) can’t be implemented yourself


samth
2021-1-12 14:45:21

for example, to create a recursive procedure


alec.mills
2021-1-12 16:19:13

@alec.mills has joined the channel