darioszr
2019-8-17 09:47:05

thx!


darioszr
2019-8-17 09:48:12

@spdegabrielle thx sofar. I like it. I was wondering also when Creating a new github repository, I cannot select the language racket


darioszr
2019-8-17 09:49:12

I was wondering how we could contact somehow GitHub and say to add racket to a template. normally selecting racket lang template, it should add a usefull gitignore things etc.


spdegabrielle
2019-8-17 09:52:35

@darioszr github guesses the language from the source files. You can set the topic to ‘racket’ https://help.github.com/en/articles/classifying-your-repository-with-topics


darioszr
2019-8-17 09:56:22

@spdegabrielle right thx! what I was stating is that currenlty we don’t have a gitignore in Racket


darioszr
2019-8-17 09:56:29

I don’t know if it is usefull


darioszr
2019-8-17 09:57:21

(I’m still a nob for that :grin:) like when I create a new repo, i can select clojure, go, python bu tthere isn’t a racket gitignore.. that is what I was meaning. But for moment I don’t know if it is useful or not


spdegabrielle
2019-8-17 10:41:00

@darioszr raco pkg new creates a racket-specific .gitignore


darioszr
2019-8-17 11:12:54

ok thx!


darioszr
2019-8-17 15:26:41

does the #f symbol have a meaning in racket?


soegaard2
2019-8-17 15:26:58

It’s short for false.


soegaard2
2019-8-17 15:27:22

I think #false works too (not completely sure)


darioszr
2019-8-17 15:27:25

ok so #t is true then i assume


soegaard2
2019-8-17 15:27:29

Yep.


darioszr
2019-8-17 15:27:41

thx!


darioszr
2019-8-17 15:28:00

I was thinking another obscure thing :grin:


soegaard2
2019-8-17 15:28:11

Variable names can’t start with a #, so that’s why names of special values begin with #.


darioszr
2019-8-17 16:58:14

I’m reading this guide : https://docs.racket-lang.org/guide/ :clap: it is really good written


darioszr
2019-8-17 17:08:30

btw the foldl function seems to me really similar to the clojure transduce one https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/transduce


soegaard2
2019-8-17 17:11:33

soegaard2
2019-8-17 17:15:41

And you are right, it is the same idea.


darioszr
2019-8-17 17:25:21

thx @soegaard2 ! I really enjoy racketlang sofar :four_leaf_clover:


darioszr
2019-8-17 17:25:41

I can’t wait to get more hands dirty :grin:


notjack
2019-8-17 17:27:01

I mean they could have also just provided true and false variables from racket/base


soegaard2
2019-8-17 17:29:55

They do in racket/bool, but I can’t remember whether it is in both racket/base and racket or only the latter.


soegaard2
2019-8-17 17:30:51

But #t and #f can’t be shadowed.


darioszr
2019-8-17 18:56:22

nob question, are racketlang Places the equivalent to Tony Hoare’s “communicating sequential processes” ?


darioszr
2019-8-17 18:56:40

so simplifying, are they similar to core.async and golang channels?


darioszr
2019-8-17 18:57:33

I have just saw them quickly through the doc, and they looks pretty the implementation to me, unless I’m overlooking things :grin:


soegaard2
2019-8-17 18:58:56

Racket threads and channels might compare.


soegaard2
2019-8-17 19:00:35

Threads are used all over, since they are easy to use.


soegaard2
2019-8-17 19:01:44

They are concurrent, but all threads run on the same cpu - so they are not running in parallel.


soegaard2
2019-8-17 19:04:21

might compare -> do compare


darioszr
2019-8-17 19:16:16

thx!


philip.mcgrath
2019-8-17 20:29:19

In Racket terminology, “places” are for OS-level parallelism—a place is a CPU thread—and “threads” are green threads for concurrency without parallelism. Both share the same model of concurrency, which is most closely related to Concurrent ML: it is definitely inspired by “communicating sequential processes”. Andy Wingo, who implemented a similar system for Guile Scheme, has some blog posts comparing them to Go and core.async, e.g. https://wingolog.org/archives/2016/10/12/an-incomplete-history-of-language-facilities-for-concurrency


darioszr
2019-8-17 20:46:37

Thx Philip for this accurate answer:heart: :heart: :racket:


sydney.lambda
2019-8-18 03:12:28

Could I get some advice on a function I’m trying to write please? The goal is to convert Racket numerical expressions to Forth expressions/statements: '(+ a (* b (- c d) e) f) => '(a b c d - e * * f + +) The first challenge being that Racket is prefix, and Forth is postfix. The second challenge being that Racket numerical operators can take a variable number of arguments whereas Forth numerical operators (binary ones, that is) take a fixed number of two, with the stack holding intermediate results.

Another concern is that there doesn’t seem to be strict a 1-to–1 mapping between the conversions. That is, you can rearrange the expression in several ways and still get the same answer.

Could anyone please suggest how I could go about doing this, which individual functions I should try and write before combining them together, which conversion-format/order is simpler and such? Thanks :) I’ve tried various combinations of reversing but I feel like I’m just throwing things too see which stick, as I can’t seem to come up with a well-defined plan of action on how to tackle the problem. My brain really seems to have a thing about nested lists that makes it fall to pieces :/


notjack
2019-8-18 03:44:58

@sydney.lambda I actually did exactly this the other week. You want the Shunting-Yard Algorithm https://en.m.wikipedia.org/wiki/Shunting-yard_algorithm


notjack
2019-8-18 03:48:47

Oh wait nevermind, that’s for going from infix to forth. So to use that algorithm you’d need a first pass in front that goes from prefix to infix.


sydney.lambda
2019-8-18 03:51:41

thanks for the link @notjack :) I’m sure I can learn something from looking at that algorithm even if it’s not a direct conversion.


sydney.lambda
2019-8-18 04:05:22

thanks to Beautiful Racket, I think I have the varargs->binary part covered! :) (define (forthify ls) (match ls [`(+ ,x) (list x)] [`(+ ,x ,xs ...) (append `(+ ,x) (forthify `(+ ,@xs)))])) (forthify '(+ 1 2 3 4 5)) => '(+ 1 + 2 + 3 + 4 5) => '(5 4 + 3 + 2 + 1 +) ;reversed However, I’d like to eventually be able to convert any Racket expression into this form, which would have to respect the order of bindings and thus require a transformation like: (forthify '(+ 1 2 3 4 5)) => '(1 2 + 3 4 + 5 + +) any advice on how to I can achieve this? Thanks :)


sydney.lambda
2019-8-18 04:51:29

May I be nosy and ask what the project was? If it was part of a project, of course.


notjack
2019-8-18 06:14:34

I was working on a transducers library for Rebellion*, to complement reducers**. And a friend told me about this algorithm and I thought it was super cool that it’s single-pass and uses only a small amount of memory for a stack. So I made a transducer that implements the algorithm, giving me a streaming and memory-efficient implementation capable of parsing sequences that are too long to keep in memory all at once. It was a fun proof-of-concept problem for transducers.


notjack
2019-8-18 06:16:44

I tweeted about the implementation a little too: https://twitter.com/doitwithalambda/status/1157942169547575296