Loops/Foreach: Difference between revisions
Content added Content deleted
BrianFennell (talk | contribs) mNo edit summary |
|||
Line 491: | Line 491: | ||
Function 'each' is defined in imperative module as: |
Function 'each' is defined in imperative module as: |
||
<lang ela>each f (x::xs) = f x $ each f xs |
<lang ela>each f (x::xs) = f x $ each f xs |
||
each _ [] = ()</lang> |
|||
This also can be accomplished using 'map': |
This also can be accomplished using 'map': |
||
<lang ela>open console list |
<lang ela>open console list |
||
map writen [1..10]</lang> |
_ = map writen [1..10]</lang> |
||
===Alternate Approach=== |
===Alternate Approach=== |