Tacit programming: Difference between revisions

Content deleted Content added
Unix pipeline: named pipes are *named*, hence not point-free
Functional programming: more matter less art
Line 33:
 
===Functional programming===
A simple example (in [[Haskell (programming language)|Haskell]]) is a program which takescomputes (read "produces") athe sum of a list of numbers. AWe programmer mightcan define athe sum function recursively using a ''pointed'' style (cf. [[value-level programming|''value''-level programming]]) method as:
<syntaxhighlight lang="haskell">
sum (x:xs) = x + sum xs
Line 39:
</syntaxhighlight>
 
However, by noting this asusing a [[fold (higher-order function)|fold]] the programmerwe couldcan replace this with:
<syntaxhighlight lang="haskell">
sum xs = foldr (+) 0 xs
</syntaxhighlight>
 
And then the argument is not needed, so this cansimplifies be replaced withto
<syntaxhighlight lang="haskell">
sum = foldr (+) 0