The compiler now does constant folding for certain words with literal
operands. The compiler's peephole optimizer has been improved.
-The alien interface now supports "float" and "double" types.
-
-Defining a predicate subclass of tuple is supported now. Note that
-unions and complements over tuples are still not supported. Also,
-predicate subclasses of concrete tuple classes are not supported either.
+The alien interface now supports "float" and "double" types, and arrays
+of C types.
The SO_OOBINLINE socket flag is now set. In 0.74, sending out-of-band
data could fill up the buffer and cause a denial-of-service attack.
G: foo [ dup ] [ type ] ;
-The seq-each and seq-map words have been renamed to each and map, and
-now work with lists. The each and map words in the lists vocabulary have
-been removed; use the new generic equivalents instead.
-
-Added two new types of 'virtual' sequences: a range sequence containing
-a range of integers, and a slice sequence containing a subsequence of
-another sequence.
-
-Some string words were made generic, and now work with all sequences:
-
-Old word: New word:
---------- ---------
-string-head head
-string-head? head?
-?string-head ?head
-string-tail tail
-vector-tail tail
-vector-tail* tail*
-string-tail? tail?
-?string-tail ?tail
-substring subseq
-cat2 append
-cat3 append3
-string/ cut
-string// cut*
-split1 split1
-split split
+Sequence API refactoring, as described in
+http://www.jroller.com/page/slava/20050518.
Factor 0.74:
------------
\ %unbox-double "unbox-op" set
] "double" define-primitive-type
-: alias-c-type ( old new -- )
+: (alias-c-type)
c-types get [ >r get r> set ] bind ;
+: alias-c-type ( old new -- )
+ over "*" append over "*" append
+ (alias-c-type) (alias-c-type) ;
+
! FIXME for 64-bit platforms
"int" "long" alias-c-type
"uint" "ulong" alias-c-type
t [
"/library/math/constants.factor"
"/library/math/pow.factor"
+ "/library/math/matrices.factor"
"/library/math/trig-hyp.factor"
"/library/math/arc-trig-hyp.factor"
"/library/math/random.factor"
! : v. ( v v -- x ) 0 swap [ * + ] 2each ;
: v. ( v v -- x ) v** 0 swap [ + ] each ;
-: norm ( v -- a ) dup v. sqrt ;
+: (cross) ( v1 v2 i1 i2 -- n )
+ rot nth >r swap nth r> * ;
+
+: cross ( { x1 y1 z1 } { x2 y2 z2 } -- { z1 z2 z3 } )
+ #! Cross product of two 3-dimensional vectors.
+ [
+ 2dup 2 1 (cross) >r 2dup 1 2 (cross) r> - ,
+ 2dup 0 2 (cross) >r 2dup 2 0 (cross) r> - ,
+ 2dup 1 0 (cross) >r 2dup 0 2 (cross) r> - ,
+ 2drop
+ ] make-vector ;
! Matrices
! The major dimension is the number of elements per row.
--- /dev/null
+! Copyright (C) 2005 Slava Pestov.
+! See http://factor.sf.net/license.txt for BSD license.
+IN: matrices
+USING: kernel math ;
+
+: norm ( v -- a )
+ dup v. sqrt ;
+
+: normalize ( v -- v )
+ [ norm recip ] keep n*v ;