@hosoda has joined the channel
Typical newcomer experience, fun to read…LOL https://artyom.me/learning-racket-1
Thus far it’s been rare, but I can try and change a struct and see if I can generate the error.
Thank you!
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.
The second, commented-out example uses #:when
. I’m not sure it’s clearer. I’d probably use the first. :shrug:
I do like the destructuring of match
. It’s about 3% slower on a quick benchmark, but that’s a small penalty.
It also looks like the match
version creates more garbage - gc time is 175 vs. 46. Maybe due to the cons
?
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 :)