De-linting lists and lists.lazy
parent
50b76dbe26
commit
887b385250
|
@ -115,7 +115,7 @@ HELP: lmerge
|
||||||
{ $values { "list1" "a list" } { "list2" "a list" } { "result" "lazy list merging list1 and list2" } }
|
{ $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." }
|
{ $description "Return the result of merging the two lists in a lazy manner." }
|
||||||
{ $examples
|
{ $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
|
HELP: lcontents
|
||||||
|
|
|
@ -26,7 +26,7 @@ M: object nil? drop f ;
|
||||||
|
|
||||||
: atom? ( obj -- ? ) [ list? ] [ nil? ] bi or not ;
|
: atom? ( obj -- ? ) [ list? ] [ nil? ] bi or not ;
|
||||||
|
|
||||||
: nil ( -- +nil+ ) +nil+ ;
|
: nil ( -- symbol ) +nil+ ;
|
||||||
|
|
||||||
: uncons ( cons -- cdr car )
|
: uncons ( cons -- cdr car )
|
||||||
[ cdr ] [ car ] bi ;
|
[ cdr ] [ car ] bi ;
|
||||||
|
@ -61,9 +61,9 @@ M: object nil? drop f ;
|
||||||
: lmap ( list quot -- result )
|
: lmap ( list quot -- result )
|
||||||
over nil? [ drop ] [ (leach) lmap cons ] if ; inline
|
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* ] [
|
pick nil? [ [ drop ] [ ] [ drop ] tri* ] [
|
||||||
[ [ cdr ] 2dip foldr ] [ nip [ car ] dip ] 3bi
|
[ [ cdr ] 2dip foldr ] [ nip [ car ] dip ] 3bi
|
||||||
call
|
call
|
||||||
|
|
Loading…
Reference in New Issue