From 887b385250b31b3af7b2f6a7e703759b1aaef3ee Mon Sep 17 00:00:00 2001 From: James Cash <james.nvc@gmail.com> Date: Thu, 5 Jun 2008 19:50:35 -0400 Subject: [PATCH 1/3] De-linting lists and lists.lazy --- extra/lists/lazy/lazy-docs.factor | 2 +- extra/lists/lists.factor | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extra/lists/lazy/lazy-docs.factor b/extra/lists/lazy/lazy-docs.factor index 95e925b089..6a9359027d 100644 --- a/extra/lists/lazy/lazy-docs.factor +++ b/extra/lists/lazy/lazy-docs.factor @@ -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 diff --git a/extra/lists/lists.factor b/extra/lists/lists.factor index 30a234214b..3799d48fff 100644 --- a/extra/lists/lists.factor +++ b/extra/lists/lists.factor @@ -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 From 9a0484b3a5862634325f1401fc2eabab1864d7ce Mon Sep 17 00:00:00 2001 From: James Cash <james.nvc@gmail.com> Date: Thu, 5 Jun 2008 20:38:12 -0400 Subject: [PATCH 2/3] Minor edits --- extra/lisp/lisp.factor | 5 ++--- extra/lists/lists.factor | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/extra/lisp/lisp.factor b/extra/lisp/lisp.factor index b64957b2c5..6c9aa3eb73 100644 --- a/extra/lisp/lisp.factor +++ b/extra/lisp/lisp.factor @@ -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 @@ -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 ( -- ) diff --git a/extra/lists/lists.factor b/extra/lists/lists.factor index 3799d48fff..13d77f757a 100644 --- a/extra/lists/lists.factor +++ b/extra/lists/lists.factor @@ -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 ; From b64a115226b4b13f17c3f18a0f91bc5049577b9e Mon Sep 17 00:00:00 2001 From: James Cash <james.nvc@gmail.com> Date: Fri, 6 Jun 2008 00:29:22 -0400 Subject: [PATCH 3/3] More refactorings to lisp --- extra/lisp/lisp.factor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/lisp/lisp.factor b/extra/lisp/lisp.factor index 6c9aa3eb73..e865a2e3ed 100644 --- a/extra/lisp/lisp.factor +++ b/extra/lisp/lisp.factor @@ -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 ;