hash* ( key hash -- [[ key value ]] ) is now hash* ( key hash -- value ? )hash-clear is now clear-hashhash-each, hash-each-with, hash-all?, hash-all-with?, hash-subset, hash-subset-with now pass the key and value separately on the stack to the given quotation, instead of passing a cons cellH{ [[ key value ]] ... } is now H{ { key value } }assoc*, set-assoc, acons and remove-assoc are gone.stream-format ( string style stream -- ) now takes a hashtable
rather than an association list for specifying style information.alien>string and string>alien.
ifte combinator has been renamed to if.
{ 1 2 3 } ! arrays
V{ 1 2 3 } ! vectors
H{ [[ key value ]] ... } ! hashtables
C{ 1.02 -7.44 } ! complex numbers
T{ class slots ... } ! tuple
.s, usage., uses., vocabs., and various other words.TAB.C+LEFT and C+RIGHT to move a word at a time, and C+BACKSPACE and C+DELETE to delete the previous and next word, respectively.map, 2each and 2map.nth-unsafe and set-nth-unsafe. These should only be used in special circumstances, such as inner loops (each, map and so on use them).replace-slice ( new from to seq -- seq ) word replaces a slice of a sequence with another sequence.mismatch ( seq seq -- i ) word returns first index where two sequences
differ, or -1 if they have equal elements.drop-prefix ( seq seq -- seq seq ) word returns a pair of
sequences which have the same elements as the two input sequences, with the common
prefix removed.cleanup ( try cleanup -- ) word encapsulates the following idiom:
[ A ] [ B rethrow ] catch [ A ] [ B ] cleanupThe
recover ( try recover -- ) word encapsulates the following idiom:
[ A ] [ [ B ] when* ] catch [ A ] [ B ] recoverThe
catch ( try -- error/f ) word no longer takes a quotation that receives the error caught; rather, it just pushes the error that was caught on the stack. That is, the old way:
[ A ] [ B ] catchBecomes:
[ A ] catch BHowever, most uses of
catch can be replaced by cleanup and recover.t type is gone. Now, the t object is just a symbol.with-server ( port ident quot -- ) combinator takes care of listening on a network socket, logging client connections, spawning client handler threads, and error handling. The quotation is called for each client, in a new scope with the client socket as the default stream.1+, 1- words are a bit faster than 1 + and 1 - since there is one less generic dispatch involved.library/httpd/ to library/contrib/.contrib/space-invaders (Chris Double)contrib/aim (Doug Coleman)contrib/cairo. (Sampo Vuori)contrib/math/. (Doug Coleman)contrib/units/. (Doug Coleman)contrib/x11/ (Eduardo Cavazos)fixnum-shift, fixnum/i overflow.foldable, eg:
: cube dup dup * * ; foldable
1 * are optimized out.
sort ( seq quot -- | quot: elt elt -- -1/0/1 ) combinator now works with any sequence, not just a list. The comparator also has to return a signed integer, not just a boolean. It is much faster than the old sorting algorithm.binsearch ( elt seq quot -- i | quot: elt elt -- -1/0/1 ) and binsearch ( elt seq quot -- elt | quot: elt elt -- -1/0/1 ) combinators perform a binary search on a sorted sequence.2each ( seq seq quot -- quot: elt -- elt ) combinatorjoin ( seq glue -- seq ) word. Takes a sequence of sequences, and constructs a new sequence with the glue in between each sequence. For example:
[ "usr" "bin" "grep" ] "/" join "usr/bin/grep"
count ( n -- [ 0 ... n-1 ] ) word is gone; just use >vector instead. Also, project has been made redundant by map.seq-transpose ( seq -- seq ) word is now named flip.
math vocabulary.make-hash ( quot -- namespace ) combinator executes quotation in a new namespace, which is then pushed on the stack.<namespace> word is gone. It would create a hashtable with a default capacity. Now, just write {{ }} clone.
make-list ==> [ ] make
make-vector ==> { } make
make-string ==> "" make
make-rstring ==> "" make reverse
make-sbuf ==> SBUF" " make
every? word has been replaced with monotonic? ( seq quot -- ? ). Its behavior is a superset of every? -- it now accepts any transitive relation, and checks if the sequence is monotonic under this relation. For example,
[ = ] monotonic? checks if all elements in a sequence are equal, and [ < ] monotonic? checks for a strictly increasing sequence of integers.unparse ( object -- string ) word has been moved to the prettyprint vocabulary, and can now produce a parsable string for any class supported by the prettyprinter.unparse-short ( object -- string ) returns a string no longer than a single line.profile ( word -- ) word. Causes the word's accumulative runtime to be stored in a global variable named by the word. This is done with the annotation facility, the word's definition is modified; use reload ( word -- ) to get the old definition back from the source file.sleep ( ms -- ) word pauses current thread for a number of milliseconds.with-datastack ( stack word -- stack ) combinator.cond ( conditions -- ) combinator. It behaves like a set of nested iftes, and compiles if each branch has the same stack effect. See its documentation comment for details.G: syntax) in handbook.contrib/concurrency (Chris Double).contrib/algebra/. Now, vector operations are possible
and the syntax doesn't use so many spaces. New way to write the quadratic formula:
MATH: quadratic[a;b;c] =
plusmin[(-b)/2*a;(sqrt(b^2)-4*a*c)/2*a] ;
(Daniel Ehrenberg)all? ( seq quot -- ? | quot: elt -- ? ) all-with? ( obj seq quot -- ? | quot: elt -- ? ) subset ( seq quot -- seq | quot: elt -- ? ) subset-with ( obj seq quot -- seq | quot: obj elt -- ? ) fiber? ( seq quot -- ? | quot: elt elt -- ? ) prune ( seq -- seq )
contains? word for testing membership in a sequence has been
renamed to member? ( elt seq -- ? ).
some? and some-with? combinators are gone. Their replacements are generic:
contains? ( seq quot -- ? | quot: elt -- ? ) contains-with? ( obj seq quot -- ? | quot: obj elt -- ? ) find ( seq quot -- i elt | quot: elt -- ? ) find* ( i seq quot -- i elt | quot: elt -- ? ) find-with ( obj seq quot -- i elt | quot: elt -- ? ) find-with* ( obj i seq quot -- i elt | quot: elt -- ? )See the developer's handbook for details.
nreverse ( seq -- ) word has been removed.
reverse-slice ( seq -- seq ) outputs a new sequence that shares
structure with the given sequence, but presents elements in reverse
order.
string-compare primitive has been replaced with the lexi word
which now operates on any pair of sequences of numbers. The
string> word has been replaced with lexi>.
, word no longer accepts a string as input inside a make-string. In 0.75, the following
two lines were equivalent:
[ "Hello" , " world" , ] make-string [ "Hello" % " world" % ] make-string
, with characters, and % with
strings inside make-string.
stream-auto-flush ==> stream-finish ( stream -- ) stream-write-attr ==> stream-format ( string style stream -- ) write-attr ==> format ( string style -- )
stream-format ( string style stream -- ) format ( string style -- ) stream-write ( string stream -- ) write ( string -- ) stream-print ( string -- ) print ( string -- )
stream-write1 ( char stream -- ) write1 ( char -- )Note that
stream-write1 is generic and your stream must implement it.
with-string word renamed to string-out ( quot -- string )
string-in ( string quot -- ) word, calls quot with stdio bound to
a stream that reads from the given string.
inspect ( obj -- ).
contrib/crypto/ (Doug Coleman).