Merge branch 'master' of git://factorcode.org/git/jamesnvc
commit
6d2aabea39
|
@ -9,8 +9,8 @@ IN: lisp
|
|||
DEFER: convert-form
|
||||
DEFER: funcall
|
||||
DEFER: lookup-var
|
||||
DEFER: lisp-macro?
|
||||
DEFER: lookup-macro
|
||||
DEFER: lisp-macro?
|
||||
DEFER: macro-expand
|
||||
DEFER: define-lisp-macro
|
||||
|
||||
|
@ -96,10 +96,10 @@ PRIVATE>
|
|||
convert-form lambda-rewrite call ; inline
|
||||
|
||||
: macro-call ( lambda -- cons )
|
||||
call ;
|
||||
call ; inline
|
||||
|
||||
: macro-expand ( cons -- quot )
|
||||
uncons lookup-macro macro-call compile-form ;
|
||||
uncons [ list>seq [ ] like ] [ lookup-macro macro-call compile-form ] bi* call ;
|
||||
|
||||
: lisp-string>factor ( str -- quot )
|
||||
lisp-expr parse-result-ast compile-form ;
|
||||
|
@ -110,10 +110,9 @@ PRIVATE>
|
|||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
SYMBOL: lisp-env
|
||||
ERROR: no-such-var variable-name ;
|
||||
|
||||
SYMBOL: macro-env
|
||||
|
||||
ERROR: no-such-var variable-name ;
|
||||
M: no-such-var summary drop "No such variable" ;
|
||||
|
||||
: init-env ( -- )
|
||||
|
|
|
@ -115,7 +115,7 @@ HELP: lmerge
|
|||
{ $values { "list1" "a list" } { "list2" "a list" } { "result" "lazy list merging list1 and list2" } }
|
||||
{ $description "Return the result of merging the two lists in a lazy manner." }
|
||||
{ $examples
|
||||
{ $example "USING: lazy-lists prettyprint ;" "{ 1 2 3 } >list { 4 5 6 } >list lmerge list>array ." "{ 1 4 2 5 3 6 }" }
|
||||
{ $example "USING: lists.lazy prettyprint ;" "{ 1 2 3 } >list { 4 5 6 } >list lmerge list>array ." "{ 1 4 2 5 3 6 }" }
|
||||
} ;
|
||||
|
||||
HELP: lcontents
|
||||
|
|
|
@ -8,7 +8,7 @@ IN: lists
|
|||
MIXIN: list
|
||||
GENERIC: car ( cons -- car )
|
||||
GENERIC: cdr ( cons -- cdr )
|
||||
GENERIC: nil? ( cons -- ? )
|
||||
GENERIC: nil? ( object -- ? )
|
||||
|
||||
TUPLE: cons car cdr ;
|
||||
|
||||
|
@ -26,7 +26,7 @@ M: object nil? drop f ;
|
|||
|
||||
: atom? ( obj -- ? ) [ list? ] [ nil? ] bi or not ;
|
||||
|
||||
: nil ( -- +nil+ ) +nil+ ;
|
||||
: nil ( -- symbol ) +nil+ ;
|
||||
|
||||
: uncons ( cons -- cdr car )
|
||||
[ cdr ] [ car ] bi ;
|
||||
|
@ -61,9 +61,9 @@ M: object nil? drop f ;
|
|||
: lmap ( list quot -- result )
|
||||
over nil? [ drop ] [ (leach) lmap cons ] if ; inline
|
||||
|
||||
: foldl ( list ident quot -- result ) swapd leach ; inline
|
||||
: foldl ( list identity quot -- result ) swapd leach ; inline
|
||||
|
||||
: foldr ( list ident quot -- result )
|
||||
: foldr ( list identity quot -- result )
|
||||
pick nil? [ [ drop ] [ ] [ drop ] tri* ] [
|
||||
[ [ cdr ] 2dip foldr ] [ nip [ car ] dip ] 3bi
|
||||
call
|
||||
|
|
Loading…
Reference in New Issue