-[error] AWT-EventQueue-0: java.lang.NullPointerException\r
-[error] AWT-EventQueue-0: at org.gjt.sp.jedit.Buffer.markTokens(Buffer.java:2109)\r
-[error] AWT-EventQueue-0: at factor.jedit.WordPreview.getWordAtCaret(WordPreview.java:95)\r
-[error] AWT-EventQueue-0: at factor.jedit.WordPreview.showPreview(WordPreview.java:137)\r
-[error] AWT-EventQueue-0: at factor.jedit.WordPreview.actionPerformed(WordPreview.java:79)\r
-[error] AWT-EventQueue-0: at javax.swing.Timer.fireActionPerformed(Timer.java:271)\r
-\r
+ compiler:\r
\r
- optimize away dispatch\r
\r
+ listener/plugin:\r
\r
+- WordPreview calls markTokens() -> NPE\r
- stream server can hang because of exception handler limitations\r
- listener should be multithreaded\r
- compile all, infer all commands\r
\r
+ kernel:\r
\r
-- after bootstrapping, classes hash is messed up\r
- do partial objects cause problems?\r
- profiler is inaccurate: wrong word on cs\r
- better i/o scheduler\r
\r
+ misc:\r
\r
-- each-with map-with\r
-- step: print NEXT word to execute, not word that JUST executed\r
- perhaps /i should work with all numbers\r
- unit test weirdness: 2 lines appears at end\r
- jedit ==> jedit-word, jedit takes a file name\r
#! corresponding quotation, the value is popped off the
#! stack.
swap [
- over >r unswons rot assoc* dup [
+ unswons rot assoc* dup [
cdr call
] [
2drop
- ] ifte r>
- ] each drop ;
+ ] ifte
+ ] each-with ;
: 2cons ( car1 car2 cdr1 cdr2 -- cons1 cons2 )
rot swons >r cons r> ;
>r dup vector-length [
f swap pick set-vector-nth
] times* r>
- [ unswons pick set-hash ] each drop
+ [ unswons rot set-hash ] each-with
] cons cons
boot-quot [ append ] change ;
"syntax" set
] bind
+<namespace> classes set
+
2 [
[ "words" | "execute" ]
[ "kernel" | "call" ]
: dispatch-body ( end label/param -- )
#! Output each branch, with a jump to the end label.
[
- uncons label, (linearize) dup #jump-label swons ,
- ] each drop ;
+ uncons label, (linearize) #jump-label swons ,
+ ] each-with ;
: check-dispatch ( vtable -- )
length num-types = [
: (kill-nodes) ( literals dataflow -- )
#! Append live nodes to currently constructing list.
- [ dupd "kill-node" [ nip , ] apply-dataflow ] each drop ;
+ [ "kill-node" [ nip , ] apply-dataflow ] each-with ;
: kill-nodes ( literals dataflow -- dataflow )
#! Remove literals and construct a list.
: each ( list quot -- )
#! Push each element of a proper list in turn, and apply a
- #! quotation with effect ( X -- ) to each element.
+ #! quotation with effect ( elt -- ) to each element.
over [ (each) each ] [ 2drop ] ifte ; inline
+: with ( obj quot elt -- obj quot )
+ #! Utility word for each-with, map-with.
+ pick pick >r >r swap call r> r> ;
+
+: each-with ( obj list quot -- )
+ #! Push each element of a proper list in turn, and apply a
+ #! quotation with effect ( obj elt -- ) to each element.
+ swap [ with ] each 2drop ; inline
+
: subset ( list quot -- list )
#! Applies a quotation with effect ( X -- ? ) to each
#! element of a list; all elements for which the quotation
dup builtin-supertypes [ > ] sort
classes get set-hash ;
-global [ classes get [ <namespace> classes set ] unless ] bind
+classes get [ <namespace> classes set ] unless
: computed-value-vector ( n -- vector )
[ drop object <computed> ] vector-project ;
-: add-inputs ( count stack -- count stack )
+: add-inputs ( count stack -- stack )
#! Add this many inputs to the given stack.
- [ vector-length - dup ] keep
- >r computed-value-vector dup r> vector-append ;
+ dup >r vector-length - computed-value-vector dup r>
+ vector-append ;
: unify-lengths ( list -- list )
#! Pad all vectors to the same length. If one vector is
#! shorter, pad it with unknown results at the bottom.
- dup longest-vector swap [ dupd add-inputs nip ] map nip ;
+ dup longest-vector swap [ add-inputs ] map-with ;
: unify-results ( list -- value )
#! If all values in list are equal, return the value.
: vector-transpose ( list -- vector )
#! Turn a list of same-length vectors into a vector of lists.
dup car vector-length [
- over [ dupd vector-nth ] map nip
+ over [ vector-nth ] map-with
] vector-project nip ;
: unify-stacks ( list -- stack )
: file-link. ( dir name -- )
tuck "/" swap cat3 dup "file-link" swons swap
unparse file-actions <actions> "actions" swons
- t "underline" swons
- 3list write-attr ;
+ 2list write-attr ;
: file. ( dir name -- )
#! If "doc-root" set, create links relative to it.
#! If "doc-root" set, create links relative to it.
dup directory [
dup [ "." ".." ] contains? [
- drop
+ 2drop
] [
- dupd file.
+ file.
] ifte
- ] each drop ;
+ ] each-with ;
: pwd cwd print ;
: dir. cwd directory. ;
#! ( X -- Y ) to each element into a new list.
over [ (each) rot >r map r> swons ] [ drop ] ifte ; inline
+: map-with ( obj list quot -- )
+ #! Push each element of a proper list in turn, and collect
+ #! return values of applying a quotation with effect
+ #! ( obj elt -- obj ) to each element into a new list.
+ swap [ with rot ] map nip nip ; inline
+
: remove ( obj list -- list )
#! Remove all occurrences of the object from the list.
[ dupd = not ] subset nip ;
USE: image
USE: namespaces
USE: stdio
+USE: parser
+USE: kernel
+USE: generic
+USE: math
[ "ab\0\0" ] [ 4 "ab" align-string ] unit-test
[
[ image-magic write-big-endian-64 ] with-string
] unit-test
+
+[
+ boot-quot off
+ "/library/bootstrap/boot.factor" run-resource
+] with-image drop
+
+[ fixnum ] [ 4 class ] unit-test
[ t ] [ [ 1 ] [ ] some? >boolean ] unit-test
[ t ] [ [ 1 2 3 ] [ 2 > ] some? >boolean ] unit-test
[ f ] [ [ 1 2 3 ] [ 10 > ] some? ] unit-test
+
+[ [ 2 3 4 ] ] [ 1 [ 1 2 3 ] [ + ] map-with ] unit-test
: step
#! Step into current word.
- [ next dup report do-1 ] not-done ;
+ [ meta-cf get . next do-1 ] not-done ;
: into
#! Step into current word.
- [ next dup report do ] not-done ;
+ [ meta-cf get . next do ] not-done ;
: walk-banner ( -- )
"The following words control the single-stepper:" print
"name"
"stack-effect"
] [
- dupd word-property
- ] map nip
+ word-property
+ ] map-with
] when ;
: completions ( str anywhere vocabs -- list )
: usages. ( word -- )
#! List all usages of a word in all vocabularies.
- vocabs [ dupd usages-in-vocab. ] each drop ;
+ vocabs [ usages-in-vocab. ] each-with ;
: vocab-apropos ( substring vocab -- list )
#! Push a list of all words in a vocabulary whose names
: apropos. ( substring -- )
#! List all words that contain a string.
- vocabs [ dupd vocab-apropos. ] each drop ;
+ vocabs [ vocab-apropos. ] each-with ;
: in. ( -- )
#! Print the vocabulary where new words are added in