hosoda
2020-8-11 09:25:36

@hosoda has joined the channel


wanpeebaw
2020-8-11 10:41:21

Typical newcomer experience, fun to read…LOL https://artyom.me/learning-racket-1


badkins
2020-8-11 12:54:29

Thus far it’s been rare, but I can try and change a struct and see if I can generate the error.


gknauth
2020-8-11 13:09:54

Thank you!


greg
2020-8-11 15:49:53

This is a great example. Or also, I’m a big fan of using match in these cases (instead of car and cdr). I like the way the “destructure” match patterns like list or cons mirror the “constructor” procedures of the same name.


greg
2020-8-11 15:51:11

The second, commented-out example uses #:when. I’m not sure it’s clearer. I’d probably use the first. :shrug:


badkins
2020-8-11 16:28:09

I do like the destructuring of match. It’s about 3% slower on a quick benchmark, but that’s a small penalty.


badkins
2020-8-11 16:30:58

It also looks like the match version creates more garbage - gc time is 175 vs. 46. Maybe due to the cons ?


badkins
2020-8-11 16:32:12

I began my post-college career as an IBM systems programmer coding in S/360 assembler, followed by a decade using C/C++, so it’s hard for me to not think about efficiency sometimes :)