Not really. FWIW neither match-lambda nor sub1 are standard, but pattern matching isn’t uncommon in the Scheme code I’ve worked on. (Well, the Guile code I’ve worked on.)
Yet, there is a standard pattern matcher, in syntax-rules. Not suitable, of course for matching general data structures out of the box, but the premise for inclusion, I think, is there.
Only if the compiler has a strategy to precompute arithmetic operations at compile-time. Even then, there are much better optimisations you can do without sacrificing run-time flexibility (check out the link to math/number-theory at the bottom).
And no, R7RS Small only mandates syntax-rules. Implementations independently advocate for syntax-case, explicit/implicit renaming and syntactic closures. But yes, it’s pretty much trivial to unroll loops with a macro system that allows you to break hygiene.
I don’t know how the author formatted them, but vim has rainbow parentheses, and emacs has rainbow delimiters. (The vim version also works on arbitrary delimiters.)
'personally attacked'.
Is this bad style in Scheme? I know a little Haskell and this definitively looks like what I’d write, looks much more clear than the other ones.
Not really. FWIW neither
match-lambda
norsub1
are standard, but pattern matching isn’t uncommon in the Scheme code I’ve worked on. (Well, the Guile code I’ve worked on.)Yet, there is a standard pattern matcher, in syntax-rules. Not suitable, of course for matching general data structures out of the box, but the premise for inclusion, I think, is there.
;; Feels enlightened after learning about CPS but doesn't know what to do with this information
I remember going through this stage. (I still don’t really know what to do with this information…)
I feel personally insulted.
I had never heard of or thought of using colours to highlight which parens close which and now it seems so obvious in hindsight I want this yesterday.
It’s been a thing (at least in Emacs) for a while: https://www.emacswiki.org/emacs/RainbowDelimiters
I enjoyed this a little too much…
Hey…
Is it actually improve performance in scheme? I would guess loop unrolling easy to implement. Does
quasisyntax
survive r7rs?Only if the compiler has a strategy to precompute arithmetic operations at compile-time. Even then, there are much better optimisations you can do without sacrificing run-time flexibility (check out the link to
math/number-theory
at the bottom).And no, R7RS Small only mandates
syntax-rules
. Implementations independently advocate forsyntax-case
, explicit/implicit renaming and syntactic closures. But yes, it’s pretty much trivial to unroll loops with a macro system that allows you to break hygiene.I chuckled at some of these, very recognisable :)
Reminds me of this old chestnut:
https://people.cs.uchicago.edu/~wiseman/humor/large-programs.html
(“A Short Ballad Dedicated to the Growth of Programs” By Ashwin Ram)
I like these scope-coloured braces. How are they achieved here?
I don’t know how the author formatted them, but vim has rainbow parentheses, and emacs has rainbow delimiters. (The vim version also works on arbitrary delimiters.)
It’s a quick and dirty script I put together here.