soegaard2
2020-8-29 12:44:51

If you need tail-recursion (and I believe you don’t) accumulate the results in reverse order, and when you are done reverse the accumulated results.


samdphillips
2020-8-29 16:33:29

A more Racket-y way I’ve done this is to use in-producer or in-port to make a sequence, and if you really need a list call sequence->list on it.


samdphillips
2020-8-29 16:35:52

Oh or use for/list with one of the sequence makers


cris2000.espinoza677
2020-8-29 18:08:52

oh ok, ty everyone


cris2000.espinoza677
2020-8-29 18:38:57

im in trouble. im trying to make a module language. in the expander i use (provide (all-from-out racket/base)) and then i provide my bindings as well. when i run a test i made, a file with #lang reader "expander.rkt" in the same directory as my expander it says binding-that-im-sure-is-provided: unbound identifier; followed by also #%app isn't provided . which cannot be true because im providing all from out racket/base (i tried doing it explicitly, it also didnt work). the repl in drracket works fine. so i know it’s receiving #%top-interaction


cris2000.espinoza677
2020-8-29 19:00:47

a minimum example, from what i understand i have to do? ;; reader.rkt #lang racket/base (require (rename-in racket/base [read-syntax base-read-syntax])) (provide read-syntax) (define (read-syntax path port) #`(module mod-name racket/base #,(base-read-syntax path port))) ;; test.rkt #lang reader "reader.rkt" (println 3) same error?


sorawee
2020-8-29 20:02:07

I think you need strip-context in your read-syntax



sorawee
2020-8-29 20:03:42

Note that strip-bindings in beautifulracket = strip-context in Racket


cris2000.espinoza677
2020-8-29 20:03:58

oh… i need to reread this entire book…


cris2000.espinoza677
2020-8-29 20:04:35

i started my racket journey with it, but even if i typed every line of code by myself, a lot went over my head…


sorawee
2020-8-29 20:04:43

If your language will be S-expression based, why don’t you use #lang s-exp though?


cris2000.espinoza677
2020-8-29 20:05:09

oh isnt s-expression based that was just an example


cris2000.espinoza677
2020-8-29 20:10:04

nice it almost works! … but my binding is still missing :upside_down_face: ill keep reading that chapter and see what happens


cris2000.espinoza677
2020-8-29 20:13:09

ok now it does work


cris2000.espinoza677
2020-8-29 20:15:49

THANK YOUUUUUUUUUUU