From 9148e6b629d00289bccd7d380121079798c7ab6c Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 22 Aug 2004 21:28:31 +0000 Subject: [PATCH] ditch map, rename inject to map --- TODO.FACTOR.txt | 21 +++++++++++---------- library/lists.factor | 4 ++-- library/math/simpson.factor | 4 ++-- library/platform/jvm/boot-mini.factor | 2 +- library/platform/jvm/combinators.factor | 10 ---------- library/platform/jvm/compiler.factor | 6 +++--- library/platform/jvm/init.factor | 2 -- library/platform/jvm/listener.factor | 2 +- library/platform/native/namespaces.factor | 4 ++-- library/test/jvm-compiler/compiler.factor | 6 +++--- 10 files changed, 25 insertions(+), 36 deletions(-) diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 4b4496573b..5be16deafd 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -1,3 +1,12 @@ +- plugin should not exit jEdit on fatal errors +- auto insert USE: +- add a socket timeout +- read# and eof +- don't allow multiple reads on the same port +- multiple tasks should be able to write to the same port +- prettyprinting an empty vector +- jvm factor -- still supporting httpd? + + docs: - unparse examples @@ -5,7 +14,7 @@ - recursion -vs- iteration in vectors chapter - objects chapter covering namespaces, hashtables, equality and object identity. - = + + tests: - java factor: equal numbers have non-equal hashcodes! @@ -20,8 +29,6 @@ - maple-like: press enter at old commands to evaluate there - make inferior.factor nicer to use - input style after clicking link -- plugin should not exit jEdit on fatal errors -- auto insert USE: - plugin not unloaded - listener backspace overzealous - completion in the listener @@ -30,17 +37,13 @@ + native: -- add a socket timeout - read1 - telnetd and httpd should use multitasking -- read# and eof - sbuf-hashcode - vector-hashcode - clarify suspend -vs- yield - toplevel - irc: stack underflow? - ignore SIGPIPE -- don't allow multiple reads on the same port -- multiple tasks should be able to write to the same port - accept multi-line input in listener - gc call in the middle of some ops might affect callstack - better i/o scheduler @@ -61,14 +64,12 @@ + misc: -- ifte* and keep combinators +- ifte* combinator - 'cascading' styles - jedit ==> jedit-word, jedit takes a file name - some way to run httpd from command line -- prettyprinting an empty vector - rethink strhead/strtail&co - namespace clone drops static var bindings -- ditch map - ditch expand - set-object-path - more readable traces diff --git a/library/lists.factor b/library/lists.factor index 07ca8d83d2..8b9722d66a 100644 --- a/library/lists.factor +++ b/library/lists.factor @@ -256,7 +256,7 @@ DEFER: tree-contains? 2drop ] ifte ; inline interpret-only -: inject ( list code -- list ) +: map ( list code -- list ) #! Applies the code to each item, returns a list that #! contains the result of each application. #! @@ -298,7 +298,7 @@ DEFER: tree-contains? inline interpret-only : substitute ( new old list -- list ) - [ 2dup = [ drop over ] when ] inject nip nip ; + [ 2dup = [ drop over ] when ] map nip nip ; : (head) ( accum list n -- last list ) dup 1 = [ drop ] [ pred >r copy-cons r> (head) ] ifte ; diff --git a/library/math/simpson.factor b/library/math/simpson.factor index ffe1af7bc2..25d2afa10c 100644 --- a/library/math/simpson.factor +++ b/library/math/simpson.factor @@ -51,10 +51,10 @@ USE: stack #! The value n must be odd. pred >r over - r> dup succ count [ >r 3dup r> swap / * + - ] inject >r 3drop r> ; + ] map >r 3drop r> ; : y-values ( lower upper n quot -- values ) - >r x-values r> inject ; + >r x-values r> map ; : (simpson) ( lower upper n quot -- value ) over multipliers >r y-values r> *|+ ; diff --git a/library/platform/jvm/boot-mini.factor b/library/platform/jvm/boot-mini.factor index a44af81062..c068d97cde 100644 --- a/library/platform/jvm/boot-mini.factor +++ b/library/platform/jvm/boot-mini.factor @@ -52,8 +52,8 @@ USE: parser "/library/platform/jvm/errors.factor" run-resource ! errors "/library/platform/jvm/namespaces.factor" run-resource ! namespaces "/library/namespaces.factor" run-resource ! namespaces -"/library/sbuf.factor" run-resource ! strings "/library/list-namespaces.factor" run-resource ! namespaces +"/library/sbuf.factor" run-resource ! strings "/library/math/namespace-math.factor" run-resource ! arithmetic "/library/continuations.factor" run-resource ! continuations "/library/errors.factor" run-resource ! errors diff --git a/library/platform/jvm/combinators.factor b/library/platform/jvm/combinators.factor index 8bdd24694e..b2a13fc635 100644 --- a/library/platform/jvm/combinators.factor +++ b/library/platform/jvm/combinators.factor @@ -41,13 +41,3 @@ USE: stack restack call unstack ; interpret-only - -IN: lists -DEFER: each - -: map ( [ items ] [ code ] -- [ mapping ] ) - #! Applies the code to each item, returns a list that - #! contains the result of each application. - #! - #! This combinator will not compile. - unit cons restack each unstack ; inline interpret-only diff --git a/library/platform/jvm/compiler.factor b/library/platform/jvm/compiler.factor index c13e68d460..3b95cb9304 100644 --- a/library/platform/jvm/compiler.factor +++ b/library/platform/jvm/compiler.factor @@ -85,14 +85,14 @@ USE: words : effect>list ( effect -- list ) [ "inD" "outD" "inR" "outR" ] [ dupd "factor.compiler.StackEffect" swap jvar-get ] - inject nip ; + map nip ; : effect>typelist ( effect -- list ) [ "inDtypes" "outDtypes" "inRtypes" "outRtypes" ] [ dupd "factor.compiler.StackEffect" swap jvar-get - array>list [ class-name ] inject - ] inject nip ; + array>list [ class-name ] map + ] map nip ; : balance ( code -- effect ) #! Push stack effect of a quotation. diff --git a/library/platform/jvm/init.factor b/library/platform/jvm/init.factor index bf090647b9..2125a0c219 100644 --- a/library/platform/jvm/init.factor +++ b/library/platform/jvm/init.factor @@ -29,7 +29,6 @@ IN: init USE: combinators USE: compiler USE: continuations -USE: httpd-responder USE: kernel USE: lists USE: interpreter @@ -73,7 +72,6 @@ USE: words init-scratchpad init-styles init-vocab-styles - default-responders "args" get parse-command-line run-user-init diff --git a/library/platform/jvm/listener.factor b/library/platform/jvm/listener.factor index 9c6ccb67e5..25d3c1789d 100644 --- a/library/platform/jvm/listener.factor +++ b/library/platform/jvm/listener.factor @@ -81,7 +81,7 @@ USE: unparser uncons >r " " swap cat3 r> cons ; : ( path -- alist ) - unparse actions [ dupd ] inject nip ; + unparse actions [ dupd ] map nip ; : underline-attribute ( attribute-set -- ) t "Underline" swing-attribute+ ; diff --git a/library/platform/native/namespaces.factor b/library/platform/native/namespaces.factor index 87c780d26c..3917add151 100644 --- a/library/platform/native/namespaces.factor +++ b/library/platform/native/namespaces.factor @@ -82,8 +82,8 @@ DEFER: >n [ swap car swap car str-lexi> ] sort ; : vars-values ( -- list ) namespace hash>alist alist-sort ; -: vars ( -- list ) vars-values [ car ] inject ; -: values ( -- list ) vars-values [ cdr ] inject ; +: vars ( -- list ) vars-values [ car ] map ; +: values ( -- list ) vars-values [ cdr ] map ; ! We don't have bound objects in native Factor. : namespace? hashtable? ; diff --git a/library/test/jvm-compiler/compiler.factor b/library/test/jvm-compiler/compiler.factor index 4aa4148f81..d95df6db7e 100644 --- a/library/test/jvm-compiler/compiler.factor +++ b/library/test/jvm-compiler/compiler.factor @@ -70,14 +70,14 @@ USE: words ! We had a problem with JVM stack overflow... -: null-inject [ ] inject ; word must-compile +: null-map [ ] map ; word must-compile ! And a problem with stack normalization after ifte if both ! datastack and callstack were in use... -: inject-test [ dup [ ] when ] inject ; word must-compile +: map-test [ dup [ ] when ] map ; word must-compile -[ [ 1 2 3 ] ] [ [ 1 2 3 ] ] [ inject-test ] test-word +[ [ 1 2 3 ] ] [ [ 1 2 3 ] ] [ map-test ] test-word : nested-test-iter f [ nested-test-iter ] when ; : nested-test f nested-test-iter drop ; word must-compile