]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' into specialized-arrays
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 2 Dec 2008 08:46:26 +0000 (02:46 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 2 Dec 2008 08:46:26 +0000 (02:46 -0600)
14 files changed:
basis/environment/environment.factor
basis/fry/fry-docs.factor
basis/unix/statfs/netbsd/authors.txt [deleted file]
basis/unix/statfs/netbsd/netbsd.factor [deleted file]
basis/unix/statfs/netbsd/tags.txt [deleted file]
basis/unix/statfs/statfs.factor
basis/unix/statvfs/freebsd/tags.txt [new file with mode: 0644]
basis/xmode/utilities/utilities.factor
core/io/io.factor
core/kernel/kernel-docs.factor
core/kernel/kernel.factor
extra/combinators/lib/lib.factor
extra/inverse/inverse.factor
extra/sequences/lib/lib.factor

index ca78c3efa7cd6727fb87214db13fe9e403e0f960..d6ce34dbcf967bf906ac5fae568175df95e67a68 100644 (file)
@@ -27,6 +27,9 @@ HOOK: (set-os-envs) os ( seq -- )
 } cond
 
 [
-    "FACTOR_ROOTS" os-env os windows? ";" ":" ? split
-    [ add-vocab-root ] each
+    "FACTOR_ROOTS" os-env
+    [
+        os windows? ";" ":" ? split
+        [ add-vocab-root ] each
+    ] when*    
 ] "environment" add-init-hook
index a982ecdd7d4a03613761b154c4ce91b45d6cb854..1dff0942bd301327bbb077ef6cf1d90bf5e37401 100644 (file)
@@ -46,10 +46,10 @@ $nl
     "{ 10 20 30 } [ sq ] [ . ] compose each"\r
     "{ 10 20 30 } [ sq . ] each"\r
 }\r
-"The " { $link _ } " and " { $link @ } " specifiers may be freely mixed:"\r
+"The " { $link _ } " and " { $link @ } " specifiers may be freely mixed, and the result is considerably more concise and readable than the version using " { $link curry } " and " { $link compose } " directly:"\r
 { $code\r
     "{ 8 13 14 27 } [ even? ] 5 '[ @ dup _ ? ] map"\r
-    "{ 8 13 14 27 } [ even? ] 5 [ dup ] swap [ ? ] curry 3compose map"\r
+    "{ 8 13 14 27 } [ even? ] 5 [ dup ] swap [ ? ] curry compose compose map"\r
     "{ 8 13 14 27 } [ even? dup 5 ? ] map"\r
 }\r
 "The following is a no-op:"\r
diff --git a/basis/unix/statfs/netbsd/authors.txt b/basis/unix/statfs/netbsd/authors.txt
deleted file mode 100644 (file)
index b4bd0e7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Doug Coleman
\ No newline at end of file
diff --git a/basis/unix/statfs/netbsd/netbsd.factor b/basis/unix/statfs/netbsd/netbsd.factor
deleted file mode 100644 (file)
index 5617ca7..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax kernel unix.stat math unix
-combinators system io.backend accessors alien.c-types
-io.encodings.utf8 alien.strings unix.types unix.statfs io.files ;
-IN: unix.statfs.netbsd
diff --git a/basis/unix/statfs/netbsd/tags.txt b/basis/unix/statfs/netbsd/tags.txt
deleted file mode 100644 (file)
index 6bf6830..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unportable
index bc7b1997058e775d749e97ebf6f2c9ef834d1117..4e3ba0d9f96686290e89ac8a935fd311e631a751 100644 (file)
@@ -8,6 +8,6 @@ os {
     { linux   [ "unix.statfs.linux"   require ] }
     { macosx  [ "unix.statfs.macosx"  require ] }
     { freebsd [ "unix.statfs.freebsd" require ] }
-    { netbsd  [ "unix.statfs.netbsd"  require ] }
-    { openbsd [ "unix.statfs.openbsd" require ] }
+    { netbsd  [ "unix.statfs.netbsd"  require ] }
+    { openbsd [ "unix.statfs.openbsd" require ] }
 } case
diff --git a/basis/unix/statvfs/freebsd/tags.txt b/basis/unix/statvfs/freebsd/tags.txt
new file mode 100644 (file)
index 0000000..6bf6830
--- /dev/null
@@ -0,0 +1 @@
+unportable
index 8f1a6184e84c7658d72bf9e9ea629ae9c82bc004..23e4195158b05dc0d9e90fc647001de05e727ee5 100644 (file)
@@ -1,30 +1,30 @@
 USING: accessors sequences assocs kernel quotations namespaces
-xml.data xml.utilities combinators macros parser lexer words ;
+xml.data xml.utilities combinators macros parser lexer words fry ;
 IN: xmode.utilities
 
-: implies >r not r> or ; inline
+: implies [ not ] dip or ; inline
 
 : child-tags ( tag -- seq ) children>> [ tag? ] filter ;
 
 : map-find ( seq quot -- result elt )
     f -rot
-    [ nip ] swap [ dup ] 3compose find
-    >r [ drop f ] unless r> ; inline
+    '[ nip @ dup ] find
+    [ [ drop f ] unless ] dip ; inline
 
 : tag-init-form ( spec -- quot )
     {
         { [ dup quotation? ] [ [ object get tag get ] prepose ] }
         { [ dup length 2 = ] [
-            first2 [
-                >r >r tag get children>string
-                r> [ execute ] when* object get r> execute
-            ] 2curry
+            first2 '[
+                tag get children>string
+                _ [ execute ] when* object get _ execute
+            ]
         ] }
         { [ dup length 3 = ] [
-            first3 [
-                >r >r tag get at
-                r> [ execute ] when* object get r> execute
-            ] 3curry
+            first3 '[
+                _ tag get at
+                _ [ execute ] when* object get _ execute
+            ]
         ] }
     } cond ;
 
@@ -36,7 +36,7 @@ MACRO: (init-from-tag) ( specs -- )
     [ with-tag-initializer ] curry ;
 
 : init-from-tag ( tag tuple specs -- tuple )
-    over >r (init-from-tag) r> ; inline
+    over [ (init-from-tag) ] dip ; inline
 
 SYMBOL: tag-handlers
 SYMBOL: tag-handler-word
index c1fd69a16af006791a1e95eb07473ae0987589c2..fc553cc163e5b2e7dddc95144f110bc320d2563c 100644 (file)
@@ -65,7 +65,7 @@ SYMBOL: error-stream
 
 : with-streams ( input output quot -- )
     [ [ with-streams* ] 3curry ]
-    [ [ drop dispose dispose ] 3curry ] 3bi
+    [ drop [ [ dispose ] bi@ ] 2curry ] 3bi
     [ ] cleanup ; inline
 
 : tabular-output ( style quot -- )
index 3fc3d175a0a513af9648d07c082d90cfb674a5fc..91b18d834b94582b64c05c9b8b7a10bc7e7e4d8b 100644 (file)
@@ -578,18 +578,6 @@ HELP: prepose
 
 { compose prepose } related-words
 
-HELP: 3compose
-{ $values { "quot1" callable } { "quot2" callable } { "quot3" callable } { "compose" compose } }
-{ $description "Quotation composition. Outputs a " { $link callable } " which calls " { $snippet "quot1" } ", " { $snippet "quot2" } " and then " { $snippet "quot3" } "." }
-{ $notes
-    "The following two lines are equivalent:"
-    { $code
-        "3compose call"
-        "3append call"
-    }
-    "However, " { $link 3compose } " runs in constant time, and the compiler is able to compile code which calls composed quotations."
-} ;
-
 HELP: dip
 { $values { "x" object } { "quot" quotation } }
 { $description "Calls " { $snippet "quot" } " with " { $snippet "obj" } " hidden on the retain stack." }
@@ -814,7 +802,6 @@ ARTICLE: "compositional-combinators" "Compositional combinators"
 { $subsection 3curry }
 { $subsection with }
 { $subsection compose }
-{ $subsection 3compose }
 { $subsection prepose }
 "Quotations also implement the sequence protocol, and can be manipulated with sequence words; see " { $link "quotations" } "." ;
 
index 1677a2faaac1e1d9cdc84320dd9cc30c209f5a03..bbe2d348d86086c5a0709000effc705f336cbdcc 100644 (file)
@@ -179,9 +179,6 @@ GENERIC: boa ( ... class -- tuple )
 : prepose ( quot1 quot2 -- compose )
     swap compose ; inline
 
-: 3compose ( quot1 quot2 quot3 -- compose )
-    compose compose ; inline
-
 ! Booleans
 : not ( obj -- ? ) [ f ] [ t ] if ; inline
 
index 9a668b8e6e59879a57b84c6263a754ca25c5b9c1..0ae86c48c45903e16de08b676649d9e942be1626 100755 (executable)
@@ -142,7 +142,7 @@ MACRO: multikeep ( word out-indexes -- ... )
     [ tuck 2slip ] dip while ; inline
 
 : generate ( generator predicate -- obj )
-    [ dup ] swap [ dup [ nip ] unless not ] 3compose
+    '[ dup @ dup [ nip ] unless not ]
     swap [ ] do-while ;
 
 MACRO: predicates ( seq -- quot/f )
index dfef23b56a4f86490f105595f5fae33ba031f41b..8a2ce57e700c22292aa0ed73ff35b2c2179f8ed5 100755 (executable)
@@ -5,7 +5,7 @@ sequences assocs math arrays stack-checker effects generalizations
 continuations debugger classes.tuple namespaces make vectors
 bit-arrays byte-arrays strings sbufs math.functions macros
 sequences.private combinators mirrors
-combinators.short-circuit ;
+combinators.short-circuit fry ;
 IN: inverse
 
 TUPLE: fail ;
@@ -46,7 +46,7 @@ M: no-inverse summary
     dup word? [ "Badly formed math inverse" throw ] when 1quotation ;
 
 : swap-inverse ( math-inverse revquot -- revquot* quot )
-    next assure-constant rot second [ swap ] swap 3compose ;
+    next assure-constant rot second '[ @ swap @ ] ;
 
 : pull-inverse ( math-inverse revquot const -- revquot* quot )
     assure-constant rot first compose ;
@@ -236,8 +236,7 @@ DEFER: _
     ] recover ; inline
 
 : true-out ( quot effect -- quot' )
-    out>> [ ndrop ] curry
-    [ t ] 3compose ;
+    out>> '[ @ _ ndrop t ] ;
 
 : false-recover ( effect -- quot )
     in>> [ ndrop f ] curry [ recover-fail ] curry ;
index 9dc01c04faea05e4b1be0121400133d938ff71bd..0674b8d9d276f66718a74867dfaa17e24aab9d85 100755 (executable)
@@ -5,7 +5,7 @@ USING: combinators.lib kernel sequences math namespaces make
 assocs random sequences.private shuffle math.functions arrays
 math.parser math.private sorting strings ascii macros assocs.lib
 quotations hashtables math.order locals generalizations
-math.ranges random  ;
+math.ranges random fry ;
 IN: sequences.lib
 
 : each-withn ( seq quot n -- ) nwith each ; inline
@@ -90,12 +90,8 @@ ERROR: element-not-found ;
     dupd find over [ element-not-found ] unless
     >r cut rest r> swap ; inline
 
-: (map-until) ( quot pred -- quot )
-    [ dup ] swap 3compose
-    [ [ drop t ] [ , f ] if ] compose [ find 2drop ] curry ;
-
 : map-until ( seq quot pred -- newseq )
-    (map-until) { } make ;
+    '[ [ @ dup @ [ drop t ] [ , f ] if ] find 2drop ] { } make ;
 
 : take-while ( seq quot -- newseq )
     [ not ] compose