2005-05-03 04:40:13 -04:00
|
|
|
! Copyright (C) 2005 Slava Pestov.
|
|
|
|
! See http://factor.sf.net/license.txt for BSD license.
|
|
|
|
|
|
|
|
IN: !syntax
|
|
|
|
USING: kernel lists math matrices parser sequences syntax
|
|
|
|
vectors ;
|
|
|
|
|
|
|
|
! Complex numbers
|
|
|
|
: #{ f ; parsing
|
|
|
|
: }# 2unlist swap rect> swons ; parsing
|
|
|
|
|
|
|
|
! Reading integers in other bases
|
|
|
|
: (BASE) ( base -- )
|
|
|
|
#! Reads an integer in a specific base.
|
|
|
|
scan swap base> swons ;
|
|
|
|
|
|
|
|
: HEX: 16 (BASE) ; parsing
|
|
|
|
: DEC: 10 (BASE) ; parsing
|
|
|
|
: OCT: 8 (BASE) ; parsing
|
|
|
|
: BIN: 2 (BASE) ; parsing
|
|
|
|
|
|
|
|
! Matrices
|
2005-07-25 17:13:35 -04:00
|
|
|
: M{ f ; parsing
|
2005-05-03 04:40:13 -04:00
|
|
|
|
2005-07-25 17:13:35 -04:00
|
|
|
: }M
|
2005-05-03 04:40:13 -04:00
|
|
|
reverse
|
|
|
|
[ dup length swap car length ] keep
|
|
|
|
concat >vector <matrix> swons ; parsing
|