C++ vs Lisp

Neal Alexander WQEQWEUQY at HOTMAIL.COM
Sat May 17 15:21:53 PDT 2008


Nick Sabalausky wrote:
> "Neal Alexander" <WQEQWEUQY at HOTMAIL.COM> wrote in message 
> news:g0nha0$1s9l$1 at digitalmars.com...
>> - Function composition: (process . reverse . sort) list
>> vs
>> process(reverse(sort(list)))
>>
> 
> Did you mean:
> 
> (sort . reverse . process) list
> vs
> process(reverse(sort(list)))
> 
> Or does Haskell put them in order of (last . first)?  FWIW, I really like 
> the style I've seen in some languages that's basically:
> 
> list.sort().reverse().process()
> vs
> process(reverse(sort(list)))
> 
> Which, I'm assuming is what you're talking about, but not certain. 
> 
> 
Nah its read right to left.

"(f . g) x" is the same as "f (g x)"

http://en.wikipedia.org/wiki/Function_composition_(computer_science)

Anyway, its similar to list.sort().reverse().process() in that you can 
create pipelines like that. But its different in that it joins two 
functions to create a new one - without having to apply any arguments to 
it right away.

list.sort().reverse().process() can be looked at as a Monad too i guess.

"process =<< reverse =<< sort =<< return list"

(right to left again - with sort, reverse, and process allowing side 
effects)



More information about the Digitalmars-d mailing list