]> gitweb.factorcode.org Git - factor.git/commitdiff
listener: extract a loaded-vocab? word.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 4 Jun 2014 16:52:51 +0000 (09:52 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 4 Jun 2014 16:52:51 +0000 (09:52 -0700)
basis/listener/listener.factor

index fdc025f9fd193543e12e17e06fbd4ae459ad86fc..1e5f38e09383df8d798213cfc608c3ece9a654d4 100644 (file)
@@ -1,10 +1,10 @@
 ! Copyright (C) 2003, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors colors colors.constants compiler.units
-continuations debugger fry io io.styles kernel lexer locals
-math math.parser namespaces parser parser.notes prettyprint
-sequences sets source-files.errors vocabs vocabs.loader
-vocabs.parser ;
+USING: accessors colors colors.constants
+combinators.short-circuit compiler.units continuations debugger
+fry io io.styles kernel lexer locals math math.parser namespaces
+parser parser.notes prettyprint sequences sets
+source-files.errors vocabs vocabs.loader vocabs.parser ;
 IN: listener
 
 GENERIC: stream-read-quot ( stream -- quot/f )
@@ -188,14 +188,18 @@ SYMBOL: interactive-vocabs
     "words"
 } interactive-vocabs set-global
 
+: loaded-vocab? ( vocab-spec -- ? )
+    {
+        [ find-vocab-root not ]
+        [ source-loaded?>> +done+ eq? ]
+    } 1|| ;
+
 : use-loaded-vocabs ( vocabs -- )
-    [ lookup-vocab ] filter
     [
-        lookup-vocab
-        [ find-vocab-root not ]
-        [ source-loaded?>> +done+ eq? ] bi or
-    ] filter
-    [ use-vocab ] each ;
+        lookup-vocab [
+            dup loaded-vocab? [ use-vocab ] [ drop ] if
+        ] when*
+    ] each ;
 
 : with-interactive-vocabs ( quot -- )
     [