From APL
Simen Kjaeraas
simen.kjaras at gmail.com
Fri Sep 21 02:00:38 PDT 2012
On Thu, 20 Sep 2012 13:55:48 +0200, bearophile <bearophileHUGS at lycos.com>
wrote:
> Section 2.3 is about Scan operations, that are like reduce or fold, but
> keep all the intermediate results too:
>
> +\ of 3 1 2 4
>
> is 3 4 6 10
>
> Some lazy scans are present in the Haskell Prelude too (and in
> Mathematica) (the Prelude contains functions and constants that are
> loaded on default):
> http://zvon.org/other/haskell/Outputprelude/scanl_f.html
>
> I think scans are not present in Phobos. Maybe one or two are worth
> adding.
See attached. Mayhaps I should post this as a pull request?
> ------------------
>
> Section 2.5 suggests to generalize the dot product:
>
>> If the + and * of the Fortran 77 DO loops for inner product are
>> replaced by other functions, a whole family of interesting inner
>> products appear,<
>
> Some examples of usage (in J language):
>
> Associative search *./..=y
> Inverted associative x+./..~:y
> Minima of residues for primes x<./..|y
> Transitive closure step on Booleans y+./..*.y
> Minima of maxima x<./..>.y
>
> Maybe a higher order function named "dot" (that takes two callables) is
> worth adding to Phobos. But I am not sure.
So that's basically mapReduce, right? We've got that, just not as succinct.
--
Simen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scan.d
Type: application/octet-stream
Size: 2159 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120921/c5799715/attachment.obj>
More information about the Digitalmars-d
mailing list