Leftmost-Innermost and Outermost (Haskell)
haskell
Solution
You (probably) forgot
4. head (isort [2,4,7,8])
4.1 head (2 : isort [4,7,8])
4.2 head (2 : 4 : isort [7,8])
4.3 head (2 : 4 : 7 : isort [8])
4.4 head (2 : 4 : 7 : 8 : isort [])
4.4 head (2 : 4 : 7 : 8 : [])
(only now is head's argument a value)
5. 2
Through outermost evaluation
4. head (isort [2,4,7,8])
4.1 head (2 : isort [4,7,8])
5 2
Problem
I have to show how much steps Haskell needs to calculate (Two ways - leftmost innermost and leftmost outermost). It's for the function ``` minimum [7,4,2,8] ``` Minimum is defined as ``` minimum xs = head (isort xs) ``` So the innermost (?) steps are: ``` 1. minimum [7,4,2,8] 2. head (isort [7,4,2,8]) 3. head (isort [4,7,2,8]) 4. head (isort [2,4,7,8]) 5. head [2:4:7:8] 6. (The output) => 2 ``` Am I right? I can't see an other way to solve it.. but there should be one..? (sorry for bad english).. Thanks for help.