Is there a way to “destructure” multiple values, such as from (quotient/remainder), so that you don’t have to explicitly assign them somewhere? Or how do people normally use (quotient/remainder)?
define-values
or let-values
will do it.
ah I see, thanks
I was thinking that let-values would perhaps do an extra assignment, but I guess that’s the way to do it
More generally, match-define
and match-let
from racket/match
can pattern-match on/destructure other sorts of things.
And there’s match-define-values
and match-let-values
that combine that behavior with multiple-value handling, though I generally think racket/match
subsumes multiple values and should usually be preferred instead of returning multiple values at all.
I’ll definitely check out match
How does one view previous historical commands for DrRacket on MacOS?
For Ubuntu I’d just use up-arrow
I think Ctrl+Up will do it.
ah I see, I need to remap interfering macos default hotkeys
Perhaps I’m misinterpreting the point-free style, but so far I’ve found it very easy to use and learn
i’m surprised people say that it’s a code smell
For me, point-free implies a chain of single-arity functions
That’s so much easier to think about than matching function arities
@slack1 there are much more complex ways of writing point free code than what is provided in the point-free
package
So far I’ve just been using it as an easy compose
Would stream-fold
be the right way to implement something like a “pairwise” stream operation, or, “for every 2”
there’s chunk
from data/collection
http://docs.racket-lang.org/collections/collections-api.html#%28def._%28%28lib._data%2Fcollection..rkt%29._chunk%29%29
ahh whoaa
in an entirely different library I see
with such useful stuff
courtesy of Alexis