Loops/Foreach: Difference between revisions
Content added Content deleted
Line 593: | Line 593: | ||
=={{header|Ela}}== |
=={{header|Ela}}== |
||
===Standard Approach=== |
===Standard Approach=== |
||
<lang ela>open |
<lang ela>open monad io |
||
each |
each [] = do return () |
||
each (x::xs) = do |
|||
Function 'each' is defined in imperative module as: |
|||
putStrLn $ show x |
|||
<lang ela>each f (x::xs) = f x $ each f xs |
|||
each xs</lang> |
|||
This also can be accomplished using 'map': |
|||
<lang ela>open console list |
|||
_ = map writen [1..10]</lang> |
|||
===Alternate Approach=== |
===Alternate Approach=== |