-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Anastasios Valtinos
committed
Oct 22, 2022
1 parent
2f401f3
commit cc1ad34
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
Haskell Excercises & Code/Chapter27 - Nonstrictness/evaluEx.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module EvEx where | ||
|
||
-- Evaluation reasoning examples | ||
1. const 1 undefined | ||
2. const undefined 1 | ||
3. flip const undefined 1 | ||
4. flip const 1 undefined | ||
5. const undefined undefined | ||
|
||
6. foldr const 'z' ['a'..'e'] | ||
-- That reasoning i did was closer to foldl not foldr (read again and understood) | ||
-- (foldr const 'z' ['a','b','c','d']) const 'e' | ||
-- (((fodlr const 'z' ['a','b','c'] ) const 'd') const 'e') | ||
-- ((((foldr const 'z' ['a','b']) const 'c' ) const 'd') const 'e') | ||
-- (((((foldr const 'z' ['a']) const 'b') const 'c') const 'd') const 'e' | ||
-- ((((((foldr const 'z' [] ) const 'a' ) const 'b') const 'c') const 'd') const 'e') | ||
-- Wrong reasoning | ||
7. foldr (flip const) 'z' ['a'..'e'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters