From 17a0a6e1a4a67ee7122965abb2fea86d14e6516c Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 28 Sep 2019 13:51:39 -0500 Subject: [PATCH 1/3] tools.deploy: Trying to get clean binaries. --- basis/tools/deploy/deploy-tests.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/tools/deploy/deploy-tests.factor b/basis/tools/deploy/deploy-tests.factor index 6ad4627851..4e6dac91bd 100644 --- a/basis/tools/deploy/deploy-tests.factor +++ b/basis/tools/deploy/deploy-tests.factor @@ -59,7 +59,7 @@ delete-staging-images ! { } [ "bunny" shake-and-bake 2559640 small-enough? ] long-unit-test { } [ "bunny" shake-and-bake 2700000 small-enough? ] long-unit-test -{ } [ "gpu.demos.bunny" shake-and-bake 3660000 small-enough? ] long-unit-test +{ } [ "gpu.demos.bunny" shake-and-bake 3750000 small-enough? ] long-unit-test os macosx? [ [ ] [ "webkit-demo" shake-and-bake 600000 small-enough? ] long-unit-test From 9a8b1f8d8e66e69873601f7e1eb400f53ea136a0 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sun, 29 Sep 2019 07:15:28 -0700 Subject: [PATCH 2/3] monads: fix ordering of writer monad logs. --- extra/monads/monads-tests.factor | 19 ++++++++++++++++++- extra/monads/monads.factor | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/extra/monads/monads-tests.factor b/extra/monads/monads-tests.factor index a7b925ca2f..ca02097401 100644 --- a/extra/monads/monads-tests.factor +++ b/extra/monads/monads-tests.factor @@ -1,4 +1,5 @@ -USING: tools.test math kernel sequences lists promises monads ; +USING: tools.test math math.functions kernel sequences lists +promises monads ; FROM: monads => do ; IN: monads.tests @@ -113,6 +114,22 @@ LAZY: nats-from ( n -- list ) run-writer ] unit-test +{ + T{ writer + { value 1.618033988749895 } + { log + "Started with five, took square root, added one, divided by two." + } + } +} [ + { + [ 5 "Started with five, " ] + [ sqrt "took square root, " ] + [ 1 + "added one, " ] + [ 2 / "divided by two." ] + } do +] unit-test + { T{ identity f 7 } } [ 4 identity-monad return diff --git a/extra/monads/monads.factor b/extra/monads/monads.factor index 485e543160..19ac7f8c07 100644 --- a/extra/monads/monads.factor +++ b/extra/monads/monads.factor @@ -188,7 +188,7 @@ M: writer-monad fail "Fail" throw ; : run-writer ( writer -- value log ) [ value>> ] [ log>> ] bi ; -M: writer >>= '[ [ _ run-writer ] dip '[ @ run-writer ] dip append ] ; +M: writer >>= '[ [ _ run-writer ] dip '[ @ run-writer ] dip prepend ] ; : pass ( writer -- writer' ) run-writer [ first2 ] dip swap call( x -- y ) ; : listen ( writer -- writer' ) run-writer [ 2array ] keep ; From 0dc71ab053a67e1d15697ef28ac5018d52fbf1e1 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sun, 29 Sep 2019 18:38:41 -0700 Subject: [PATCH 3/3] memoize: fix memoize-quot for zero input effects. --- basis/memoize/memoize.factor | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/basis/memoize/memoize.factor b/basis/memoize/memoize.factor index bc34c481f3..3634fe4d4d 100644 --- a/basis/memoize/memoize.factor +++ b/basis/memoize/memoize.factor @@ -85,7 +85,8 @@ M: memoized reset-word bi ; : memoize-quot ( quot effect -- memo-quot ) - [ H{ } clone ] 2dip make-memoizer ; + dup in>> length zero? [ f 1array ] [ H{ } clone ] if + -rot make-memoizer ; : reset-memoized ( word -- ) "memoize" word-prop dup sequence?