diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/lux/control/function/memo.lux | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/stdlib/source/test/lux/control/function/memo.lux b/stdlib/source/test/lux/control/function/memo.lux index 29c39dbdb..edc74a9c0 100644 --- a/stdlib/source/test/lux/control/function/memo.lux +++ b/stdlib/source/test/lux/control/function/memo.lux @@ -28,12 +28,12 @@ (def: (fibonacci recur input) (/.Memo Nat Nat) (case input - 0 (state\wrap 0) - 1 (state\wrap 1) + 0 (state\in 0) + 1 (state\in 1) _ (do state.monad [output_1 (recur (n.- 1 input)) output_2 (recur (n.- 2 input))] - (wrap (n.+ output_1 output_2))))) + (in (n.+ output_1 output_2))))) (def: (time function input) (All [i o] (-> (-> i o) i (IO [Duration o]))) @@ -41,8 +41,8 @@ [before instant.now #let [output (function input)] after instant.now] - (wrap [(instant.span before after) - output]))) + (in [(instant.span before after) + output]))) (def: milli_seconds (-> Duration Nat) @@ -75,8 +75,8 @@ memo_is_faster! (n.< (n.+ ..wiggle_room (milli_seconds slow_time)) (milli_seconds fast_time))]] - (wrap (and same_output! - memo_is_faster!))))) + (in (and same_output! + memo_is_faster!))))) (_.cover [/.open] (io.run (do io.monad @@ -97,19 +97,19 @@ incrementalism_is_faster! (n.< (n.+ ..wiggle_room (milli_seconds open_time)) (milli_seconds open_time/+1))]] - (wrap (and same_output! - memo_is_faster! - incrementalism_is_faster!))))) + (in (and same_output! + memo_is_faster! + incrementalism_is_faster!))))) (_.cover [/.memoization] (let [memo (<| //.mixin (//.inherit /.memoization) (: (//.Mixin Nat (State (Dictionary Nat Nat) Nat)) (function (factorial delegate recur input) (case input - (^or 0 1) (\ state.monad wrap 1) + (^or 0 1) (\ state.monad in 1) _ (do state.monad [output' (recur (dec input))] - (wrap (n.* input output'))))))) + (in (n.* input output'))))))) expected (|> (list.indices input) (list\map inc) (list\fold n.* 1)) |