samth changed the topic of #racket to: Racket v7.6 has been released: https://blog.racket-lang.org/2020/02/racket-v7-6.html -- Racket -- https://racket-lang.org -- https://pkgs.racket-lang.org -- Paste at http://pasterack.org
efm has quit [Ping timeout: 240 seconds]
rmnull has quit [Ping timeout: 240 seconds]
rmnull has joined #racket
badkins has joined #racket
jellie has quit [Ping timeout: 240 seconds]
jellie has joined #racket
jellie has quit [Ping timeout: 250 seconds]
libertyprime has joined #racket
jellie has joined #racket
jellie has quit [Ping timeout: 250 seconds]
iyzsong has joined #racket
rmnull has quit [Ping timeout: 256 seconds]
rmnull has joined #racket
badkins has quit [Remote host closed the connection]
badkins has joined #racket
badkins has quit [Ping timeout: 264 seconds]
rmnull has quit [Quit: WeeChat 2.7.1]
efm has joined #racket
wingsorc has joined #racket
aidalgol has quit [Read error: Connection reset by peer]
libertyprime has quit [Ping timeout: 256 seconds]
libertyprime has joined #racket
aidalgol has joined #racket
pilne has quit [Quit: Download IceChat at www.icechat.net]
libertyprime has quit [Read error: Connection reset by peer]
libertyprime has joined #racket
orivej has quit [Ping timeout: 240 seconds]
endformationage has quit [Quit: WeeChat 2.6]
dddddd has quit [Remote host closed the connection]
Sauvin has joined #racket
KDr24 has joined #racket
KDr23 has quit [Ping timeout: 240 seconds]
narimiran has joined #racket
badkins has joined #racket
badkins has quit [Ping timeout: 240 seconds]
YuGiOhJCJ has joined #racket
johncob_ has quit [Remote host closed the connection]
johncob has joined #racket
ephemera_ has quit [Ping timeout: 264 seconds]
jellie has joined #racket
ephemera_ has joined #racket
Naptra has joined #racket
_whitelogger has joined #racket
badkins has joined #racket
badkins has quit [Ping timeout: 256 seconds]
jmiven has joined #racket
msiism has joined #racket
<msiism> I'm using DrRacket (working through the HTDP book) and today, something strange happened when starting it up: The start-up screen that would usually show the red-blue lambda symbol now gives me a stylized version of a turtle with a red and a blue body part.
<msiism> Can anyone tell me why that might be?
lavaflow has quit [Ping timeout: 240 seconds]
<x6c697370> ~
libertyprime has quit [Ping timeout: 264 seconds]
libertyprime has joined #racket
<notnotdan> hi
<notnotdan> msiism: i think it might be one of the DrRacket easter eggs?
<notnotdan> msiism: apparently it is to celebrate Prince Kūhiō Day
lavaflow has joined #racket
rbarraud has joined #racket
<rbarraud> o/
<msiism> notnotdan: Thanks you!
<msiism> I guess I have the same relationship to easter eggs that I have to April Fools' Day jokes.
<msiism> That is: Don't like, can definitely do without. DrRacket is great, though.
jellie has quit [Ping timeout: 240 seconds]
jellie has joined #racket
true-grue has joined #racket
iyzsong has quit [Remote host closed the connection]
iyzsong has joined #racket
YuGiOhJCJ has quit [Remote host closed the connection]
cartwright has quit [Read error: Connection reset by peer]
<msiism> I'm trying to solve exercise 51 in HTDP (https://htdp.org/2019-02-24/part_one.html#(part._sec~3aenums)). I've tried a few things but can't seem to arrive at any reasonable solution.
<msiism> My problem boils down to this: If there is only one variable representing world state, you cannot (and shouldn't try to) represent two distinct aspects of the actual world state in that variable, in this case: the color or a traffic light and overall elapsed time.
<msiism> s/or/of
orivej has joined #racket
<msiism> I have no trouble putting together a program that will just go on coloring a red circle green, a green one yellow and a yellow one red on every clock tick. But that's a sane emulation of a traffic light because it switches insanely fast, and it will go on forever.
<msiism> s/a sane/not a sane
<msiism> I'd need a representation of time in that program to be able to slow things down and define an end of time for it to stop at some point.
* msiism seems to have an idea
johncob has quit [Quit: Leaving]
cartwright has joined #racket
johncob has joined #racket
libertyprime has quit [Remote host closed the connection]
jellie has quit [Ping timeout: 265 seconds]
jboy has quit [Quit: bye]
* msiism has semi-solved the problem now: https://paste.debian.net/plainh/5b6ea5e2
jellie has joined #racket
rmnull has joined #racket
<msiism> The remaining problem is that the program will keep rolling until you pull the plug. But then, traffic lights do that as well, so…
<msiism> Also, defining which color follows which indirectly, via time, doesn't feel right.
jellie has quit [Ping timeout: 265 seconds]
jellie has joined #racket
dddddd has joined #racket
badkins has joined #racket
jellie has quit [Ping timeout: 240 seconds]
badkins has quit [Ping timeout: 264 seconds]
jellie has joined #racket
jellie has quit [Ping timeout: 240 seconds]
libertyprime has joined #racket
jellie has joined #racket
badkins has joined #racket
jellie has quit [Ping timeout: 265 seconds]
jellie has joined #racket
jellie has quit [Ping timeout: 250 seconds]
johncob_ has joined #racket
johncob has quit [Ping timeout: 256 seconds]
jellie has joined #racket
iyzsong has quit [Ping timeout: 272 seconds]
jellie has quit [Ping timeout: 256 seconds]
efm has quit [Read error: Connection reset by peer]
efm has joined #racket
jellie has joined #racket
jellie has quit [Ping timeout: 258 seconds]
libertyprime has quit [Quit: Lost terminal]
jellie has joined #racket
jellie has quit [Ping timeout: 264 seconds]
jellie has joined #racket
<msiism> FWIW, I've placed a write-up of my problem at https://www.msiism.org/fd/fdPFEn/ex51-writeup.html
msiism has left #racket [#racket]
jellie has quit [Ping timeout: 256 seconds]
badkins has quit [Remote host closed the connection]
badkins has joined #racket
jellie has joined #racket
badkins has quit [Ping timeout: 250 seconds]
jellie has quit [Ping timeout: 250 seconds]
jellie has joined #racket
jellie has quit [Ping timeout: 250 seconds]
jellie has joined #racket
orivej_ has joined #racket
orivej has quit [Read error: Connection reset by peer]
efm has quit [Ping timeout: 264 seconds]
jellie has quit [Ping timeout: 258 seconds]
jellie has joined #racket
efm has joined #racket
efm has quit [Ping timeout: 256 seconds]
jellie has quit [Ping timeout: 250 seconds]
jellie has joined #racket
badkins has joined #racket
libertyprime has joined #racket
<technomancy> in the compile-datum function here I have to do some weird stuff to strip out the useless '#%top-interaction bits; is there a better way to do that? my approach seems very tacky: https://p.hagelb.org/micro.rkt.html
epony has quit [Quit: reconfig]
jellie has quit [Ping timeout: 264 seconds]
jellie has joined #racket
libertyprime has quit [Read error: Connection reset by peer]
badkins has quit [Remote host closed the connection]
jellie has quit [Ping timeout: 256 seconds]
badkins has joined #racket
libertyprime has joined #racket
badkins has quit [Ping timeout: 265 seconds]
badkins has joined #racket
jellie has joined #racket
jellie has quit [Ping timeout: 264 seconds]
<samth> technomancy: are you working on fully expanded syntax?
<technomancy> samth: not yet; I'm working with whatever `load' gives me at this point. I want to expand macros first but I haven't gotten around to it.
<technomancy> would the expansion step get rid of #%top-interaction too?
<samth> what do you mean, what load gives you? are you implementing it as a load handler?
<samth> oh, i see
<technomancy> (disclaimer: I have no idea what I'm doing) I'm parameterizing current-eval and calling load
<technomancy> I have read the "syntax model" page of the manual a couple times; maybe the third time thru it will click =)
<samth> this is an odd way to do things, but on the route you are likely to see `(#%top-interaction . form)` wrappers and you probably want to either drop them or implement them as something that just evaluates `form`
dddddd has quit [Remote host closed the connection]
<technomancy> yeah... I noticed that I couldn't put syntax objects directly in pattern matches, which made that more difficult
jellie has joined #racket
<samth> in your setting you can just call syntax->datum
<samth> but i guess i would encourage a different strategy
<technomancy> I'm all ears =)
<samth> which is: define a bunch of macros which implement the syntax of microscheme by expansion to racket, then create a namespace, require that module, and run load in that namespace
<samth> rather than writing your own evaluator
<technomancy> that's ... really a lot more sensible =)
<technomancy> thanks!
efm has joined #racket
<technomancy> what's the best way to rename the built-ins so my own definitions don't mess them up?
<samth> I usually define my own things with different names (such as `-define`) and then do `(provide (rename-out [-define define]))`
<technomancy> cool; makes sense
jellie has quit [Ping timeout: 240 seconds]
<technomancy> hm; so that helps just fine with the microscheme forms, but how would you handle literals in that case?
<samth> technomancy: what do you mean by literals?
<samth> it might be that the answer is to provide a binding for `quote` and a binding for `#%datum`
<technomancy> samth: in the code I linked to, you can see that nulls, booleans, integers, strings, etc all need to emit certain strings of AVR assembly
<samth> ah, i see
<samth> i think providing #%datum is the right idea
<technomancy> https://docs.racket-lang.org/reference/quote.html?q=%23%25datum#%28form._%28%28quote._~23~25kernel%29._~23~25datum%29%29 <- is there somewhere I could find an example of how to provide that?
<technomancy> the examples on that page aren't that helpful
<samth> technomancy: (define-syntax (#%datum stx) ...) (provide #%datum)
<samth> #%datum is added by the expander around any literal that isn't quoted
<technomancy> ah right; ok, thanks
<samth> i would start by just supporting quoted literals, then you just have to define quote
jellie has joined #racket
cartwright has quit [Remote host closed the connection]
cartwright has joined #racket
libertyprime has quit [Read error: Connection reset by peer]
<technomancy> samth: it's telling me I can't require unless it's at the top level or module level; is there another require-like form I could use here? (define (main path) (parameterize ([current-namespace (make-empty-namespace)]) (require micro-racket) (load path)))
<samth> try evaling the require
epony has joined #racket
<technomancy> cool; thanks
<technomancy> huh... it looks like the macros now can't access the helper functions I had used previously: unbound identifier in module (in the transformer environment, which does not include the run-time definition)
<technomancy> do I need to turn those into macros too?
rmnull has quit [Ping timeout: 256 seconds]
even4void has joined #racket
<samth> technomancy: no, you can either put them in `begin-for-syntax` or put them in a different module and `(require (for-syntax`
rmnull has joined #racket
<technomancy> samth: perfect; thanks
even4void has quit [Quit: Textual IRC Client: www.textualapp.com]
even4void has joined #racket
<technomancy> is `define-macro-cases' a recent addition? I just noticed `match' doesn't seem to work in macros
<samth> you would need to `(require (for-syntax racket/match))`
even4void has quit [Client Quit]
<x6c697370> technomancy: define-macro-cases is from Matthew Butterick's #lang br.
<x6c697370> @s
<technomancy> x6c697370: aha; I see. I saw it had a very official-looking URL in the docs but upon closer inspection I see it's not =)
<technomancy> looks like I'm very close now! https://p.hagelb.org/micro.rkt.html I just need to figure out how to eval the module when I've replaced the namespace with an empty namespace.
<technomancy> (the main function at the very bottom in particular)
even4void has joined #racket
even4void has quit [Client Quit]
<technomancy> hm; eval takes a namespace as an arg; that could simplify things
wingsorc has quit [Quit: Leaving]
<technomancy> OK, I've cheated a bit by using make-base-namespace instead of make-empty-namespace, but somehow the require inside that namespace isn't able to find the module+ that I've defined above https://p.hagelb.org/micro.rkt.html
Sauvin has quit [Read error: Connection reset by peer]
jellie has quit [Ping timeout: 256 seconds]
jellie has joined #racket
<samth> technomancy: yes, that won't work in general
<samth> best to put the file somewhere that it would be findable outside
<samth> and just require as you would from a separate REPL
<technomancy> ok, that's easy enough. what about the empty namespace issue?
sagax has quit [Read error: Connection reset by peer]
<samth> using `make-base-namespace` should be fine
<samth> if you want to avoid that, you can use `namespace-require`
<technomancy> base namespace still gives me this: #%app: illegal use of syntax in: (#%app load "test/blink.scm")
<samth> you need to provide `#%app` too
<technomancy> welllll
<technomancy> I'm providing that, but that's micro-racket's #%app
<technomancy> and for the call to `load' I need regular #%app, right?
<samth> yes
<samth> you could use `(eval-syntax #'(#%app load "test/bink.scm"))`
<samth> i think that will work
<technomancy> "attempted to use a module that is not available" on that unfortunately
badkins has quit [Remote host closed the connection]
badkins has joined #racket
<samth> oh yes that won't work
rmnull has quit [Quit: WeeChat 2.7.1]
badkins has quit [Ping timeout: 250 seconds]
<samth> technomancy: i think you should just call load insted of evaling the call
<technomancy> but load doesn't take a namespace arg
<samth> load respects the current namespace
<technomancy> ah so the parameterization is enough
<technomancy> cool; now it seems the expansion is happening
badkins has joined #racket
Codaraxis has joined #racket
<technomancy> so my macros here must return syntax no matter what, even though my intended output is a string of AVR asm
<samth> yes
<technomancy> so I need it all as strings wrapped in syntax objects?
<samth> or a program that prints strings
<technomancy> seems cleaner to keep it as data, yeah
<technomancy> but something in between the macros and the `load' call returning would need to turn it from syntax objects into actual strings, right? do I get that for free?
<technomancy> I think I have enough to go on, anyway; thanks for all the help.
<samth> evaluation of string literals evaluates to a string
<samth> it's the same as : (define-syntax (m stx) #"hello world") (m)
<technomancy> I just need to make sure it's spliced into a flat list of strings, I guess
<technomancy> it's a lot to take in, but it's starting to click
<samth> it's not going to be turned into a list
chl has joined #racket
even4void has joined #racket
even4void has quit [Client Quit]
chl has quit [Client Quit]
efm has quit [Ping timeout: 260 seconds]
true-grue has quit [Read error: Connection reset by peer]
jboy has joined #racket
dddddd has joined #racket
narimiran has quit [Ping timeout: 250 seconds]
<technomancy> even though the file contains a list of forms?
<technomancy> or rather, more than one form
<samth> technomancy: each form in the file will be evaluated, and then the result discarded
<samth> just like if you call load on a file containing `1 2 3`
jboy has quit [Quit: bye]
jboy has joined #racket
sagax has joined #racket
pilne has joined #racket
<technomancy> yeah, I guess that's going to be a bit of a problem since I actually need the output for every top-level form
<samth> technomancy: i think you should define `#%top-interaction` to print things
<technomancy> yeah. printing every time I generate ASM seems bad, but if it's just printing in that one place, that's easier to work with. good call.
_whitelogger has joined #racket
_whitelogger has joined #racket
_whitelogger has joined #racket
<technomancy> hm; so #%top-interaction gets its arguments un-evaluated; it can't print them out until they've been expanded. but calling `eval' in that macro doesn't have the right context; it doesn't know about the micro-racket macros at all.
badkins has quit [Remote host closed the connection]
badkins has joined #racket
<technomancy> oh... top-interaction can return a form which then proceeds to print its argument; that works
<technomancy> no, that doesn't work, because I'm overriding #%app to produce strings instead of actually call things
badkins has quit [Ping timeout: 256 seconds]
<technomancy> anyway, ignoring printing I still get this error which doesn't really tell me anything useful: /home/phil/src/micro.rkt/test/blink.scm:1:0: set-digital-state: illegal use of syntax in: (set-digital-state 39 128 #t)
Naptra has quit [Remote host closed the connection]
<technomancy> it doesn't even attempt to expand the set-digital-state macro, but it does call top-interaction
<technomancy> overall this looks cleaner than when I was manually walking the tree, but when it doesn't work, it's impossible to debug; I'm not sure if what I'm gaining is actually worth the headache
jellie has quit [Ping timeout: 240 seconds]
jellie has joined #racket
efm has joined #racket
jellie has quit [Ping timeout: 256 seconds]
jellie has joined #racket
KDr24 has quit [Remote host closed the connection]
KDr24 has joined #racket
jellie has quit [Ping timeout: 264 seconds]
jellie has joined #racket
badkins has joined #racket
evdubs has quit [Quit: Leaving]
evdubs has joined #racket
badkins has quit [Remote host closed the connection]
badkins has joined #racket
badkins has quit [Ping timeout: 260 seconds]
badkins has joined #racket