HackerTrans
TopNewTrendsCommentsPastAskShowJobs

harryposner

no profile record

comments

harryposner
·bulan lalu·discuss
Clojure has two options:

The version with a threading macro, will create a lazy-sequence for each step in the pipeline. It will not instantiate the entire list, so it's O(1) memory overhead in terms of peak memory, but it churns O(N) extra garbage.

    (->> things
         (map model/find-thing)
         (filter some?))
And the version with transducers, which will not create any intermediate sequences:

    (sequence (comp (map model/find-thing)
                    (filter some?))
              things)
It looks like there's a Common Lisp transducers library, but I have no idea how widely it's used.

https://github.com/fosskers/transducers
harryposner
·2 tahun yang lalu·discuss
> This would imply that you can jump into the same stack frame multiple times, or do other weird things.

Yep— this is how you can implement the `amb` operator with call/cc: https://ds26gte.github.io/tyscheme/index-Z-H-16.html
harryposner
·2 tahun yang lalu·discuss
So the particular example here isn’t too different from exceptions. You’re unwinding the stack up to a predefined point— here, the callsite of foo, where with exceptions it would be up to the surrounding try/catch. Scala actually implements non-local returns (the only practical use I’ve had for call/cc) using exceptions: https://tpolecat.github.io/2014/05/09/return.html
harryposner
·3 tahun yang lalu·discuss
You joke, and yet [Lucas 1988] uses an amusement park as a toy model to demonstrate how monetary shocks can affect real economic activity. The key difference between this and Chuck E. Cheese, though, is that Chuck E. Cheese is the only merchant that accepts their tokens for any sort of payment.

[Lucas 1988] https://home.uchicago.edu/~vlima/courses/econ203/fall01/Luca...