Skip to content

Commit

Permalink
Fixed y*
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinborner committed Sep 8, 2024
1 parent 8896fb6 commit 86bf5ed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion std/List/Church.bruijn
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,12 @@ enumerate zip (iterate ++‣ (+0)) ⧗ (List a) → (List (Pair Number a))
:test (enumerate "abc") (((+0) : 'a') : (((+1) : 'b') : {}((+2) : 'c')))

# calculates all fixed points of given functions as a list
y* y [[&(1 0) <$> 0]]
y* [[[0 1] <$> 0] xs] ⧗ (List a) → (List b)
xs [[1 <! ([[1 2 0]] <$> 0)]] <$> 0

:test (&(+5) <$> (y* ([[[=?0 true (1 --0)]]] : {}[[[=?0 false (2 --0)]]]))) (false : {}true)

# similar to y* but passes arguments as a list
list-y* y [[&(1 0) <$> 0]]

:test (&(+5) <$> (list-y* ([[=?0 true (_1 --0)]] : {}[[=?0 false (^1 --0)]]))) (false : {}true)

0 comments on commit 86bf5ed

Please sign in to comment.