kokou.afidegnon
2020-11-18 13:02:17

hi, (define my-snip-class (new (class snip-class% (super-new) (send this set-classname "my-snip")))) can you please elaborate in this context the use of set-classname?


kokou.afidegnon
2020-11-18 13:02:52

hi, (define my-snip-class (new (class snip-class% (super-new) (send this set-classname "my-snip")))) can you please explain why set-classname?


samth
2020-11-18 16:50:18

@sorawee yeah, that’s what i meant (although it might be clearer as a let loop)


phanthero
2020-11-18 23:50:52

Thank you to @samth, @sorawee, @kellysmith12.21 for teaching me a bit more about functional programming!


phanthero
2020-11-18 23:51:44

Now I just have to look up what values are actually doing in the docs! Also didn’t know there were things like for/fold and match-define (or at least I only knew these vaguely and never found much use for them, or forgot to use them)


phanthero
2020-11-19 00:21:11

Also @sorawee what is PL?


sorawee
2020-11-19 00:21:45

programming languages (implementation / design / whatever)


phanthero
2020-11-19 00:22:02

“In PL, you can write a functional interpreter that supports mutable state by using what’s known as “store passing style”. This is similar, but instead of passing the store around, you pass the stream around.”


phanthero
2020-11-19 00:22:21

Right, it seemed like you were referring to some specific language here


phanthero
2020-11-19 00:22:42

Where PL is the language


sorawee
2020-11-19 00:23:19

Not specific language. I referred to how you can create a functional interpreter to interpret any language with mutation.


phanthero
2020-11-19 00:25:34

I see, thank you for clarifying. I suppose I am still a beginner at PL then :slightly_smiling_face:


plragde
2020-11-19 01:38:17

I have used the awkwardness of a store-passing interpreter to motivate monads and do-notation.


phanthero
2020-11-19 02:01:03

Cool Wikipedia example though! This problem of preorder traversal seemed very hard, and took me hours to figure out that global file ports will help circumvent this problem, which made it seem sort of like a “hack”. Is store the same thing as stream then?


phanthero
2020-11-19 02:01:07

In Racket, I mean. the word “stream” seems to have a few different meanings in different languages, sort of


phanthero
2020-11-19 02:08:35

Never used do-notation in Racket, but I do know that it exists. Felt sort of weird to me at first because it seemed that imperative programming was seeping into functional programming. Would that help with this problem? Maybe a do-notation with some cons, car and cdr would help create the sort of “stack” we might need for this kind of problem

Gonna read into monads as well. Thanks @plragde. Not sure if this exists in #lang racket however


wanpeebaw
2020-11-19 04:31:31

Is there a way to write multi-line string literals in source code?


sorawee
2020-11-19 04:32:18

#<<EOF hello world EOF


sorawee
2020-11-19 04:32:20

IIRC


sorawee
2020-11-19 04:32:32

you can change EOF to anything, as long as they match


sorawee
2020-11-19 04:33:44

Also IIRC, you can use @-expression, if you are OK with changing the reader @~a{ abc def }


sorawee
2020-11-19 04:35:41

Oh, actually:

"abc def" works already too. The benefit of the above two solutions is that you don’t need to escape quotes.


kellysmith12.21
2020-11-19 07:11:17

What would an immutable box be useful for?