ditch map, rename inject to map

cvs
Slava Pestov 2004-08-22 21:28:31 +00:00
parent 502dc2472f
commit 9148e6b629
10 changed files with 25 additions and 36 deletions

View File

@ -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

View File

@ -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 ;

View File

@ -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> *|+ ;

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -81,7 +81,7 @@ USE: unparser
uncons >r " " swap cat3 r> cons ;
: <actions-menu> ( path -- alist )
unparse actions [ dupd <action-menu-item> ] inject nip ;
unparse actions [ dupd <action-menu-item> ] map nip ;
: underline-attribute ( attribute-set -- )
t "Underline" swing-attribute+ ;

View File

@ -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? ;

View File

@ -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