rename some words to x>sequence and sequence>x.

db4
John Benediktsson 2012-07-23 21:28:38 -07:00
parent 9ab4053e46
commit 5c76cbb421
10 changed files with 25 additions and 25 deletions

View File

@ -170,7 +170,7 @@ M: msb0-bit-reader peek ( n bs -- bits ) \ be> \ subseq>bits-be (peek) ;
] unless
writer bytes>> ;
:: byte-array-n>seq ( byte-array n -- seq )
:: byte-array-n>sequence ( byte-array n -- seq )
byte-array length 8 * n / iota
byte-array <msb0-bit-reader> '[
drop n _ read

View File

@ -277,14 +277,14 @@ GENERIC: ' ( obj -- ptr )
: bignum-radix ( -- n ) bignum-bits 2^ 1 - ;
: bignum>seq ( n -- seq )
: bignum>sequence ( n -- seq )
#! n is positive or zero.
[ dup 0 > ]
[ [ bignum-bits neg shift ] [ bignum-radix bitand ] bi ]
produce nip ;
: emit-bignum ( n -- )
dup dup 0 < [ neg ] when bignum>seq
dup dup 0 < [ neg ] when bignum>sequence
[ nip length 1 + emit-fixnum ]
[ drop 0 < 1 0 ? emit ]
[ nip emit-seq ]

View File

@ -308,17 +308,17 @@ M: sha2-short checksum-block
[ prepare-message-schedule ]
[ [ block-size>> ] [ H>> clone ] [ ] tri process-chunk ] bi ;
: seq>byte-array ( seq n -- string )
: sequence>byte-array ( seq n -- string )
'[ _ >be ] map B{ } concat-as ;
: sha1>checksum ( sha2 -- bytes )
H>> 4 seq>byte-array ;
H>> 4 sequence>byte-array ;
: sha-224>checksum ( sha2 -- bytes )
H>> 7 head 4 seq>byte-array ;
H>> 7 head 4 sequence>byte-array ;
: sha-256>checksum ( sha2 -- bytes )
H>> 4 seq>byte-array ;
H>> 4 sequence>byte-array ;
: pad-last-short-block ( state -- )
[ bytes>> t ] [ bytes-read>> pad-last-block ] [ ] tri

View File

@ -148,7 +148,7 @@ DEFER: substitute
: flatten ( seq class -- newseq )
'[ dup _ instance? [ seq>> ] [ 1array ] if ] map concat ; inline
:: seq>instance ( seq empty class -- instance )
:: sequence>instance ( seq empty class -- instance )
seq length {
{ 0 [ empty ] }
{ 1 [ seq first ] }
@ -167,7 +167,7 @@ TUPLE: class-partition integers not-integers simples not-simples and or other ;
[ or-class? ] partition
class-partition boa ;
: class-partition>seq ( class-partition -- seq )
: class-partition>sequence ( class-partition -- seq )
[
{
[ integers>> ]
@ -182,7 +182,7 @@ TUPLE: class-partition integers not-integers simples not-simples and or other ;
: repartition ( partition -- partition' )
! This could be made more efficient; only and and or are effected
class-partition>seq partition-classes ;
class-partition>sequence partition-classes ;
: filter-not-integers ( partition -- partition' )
dup
@ -205,7 +205,7 @@ TUPLE: class-partition integers not-integers simples not-simples and or other ;
[ t swap remove ] change-other
dup contradiction?
[ drop f ]
[ filter-not-integers class-partition>seq members t and-class seq>instance ] if ;
[ filter-not-integers class-partition>sequence members t and-class sequence>instance ] if ;
: <and-class> ( seq -- class )
dup and-class flatten partition-classes
@ -236,7 +236,7 @@ TUPLE: class-partition integers not-integers simples not-simples and or other ;
[ f swap remove ] change-other
dup tautology?
[ drop t ]
[ filter-integers class-partition>seq members f or-class seq>instance ] if ;
[ filter-integers class-partition>sequence members f or-class sequence>instance ] if ;
: <or-class> ( seq -- class )
dup or-class flatten partition-classes

View File

@ -194,7 +194,7 @@ CONSULT: name xml body>> ;
[ [ prolog>> ] [ before>> ] [ after>> ] tri ] dip
swap <xml> ;
: seq>xml ( xml seq -- newxml )
: sequence>xml ( xml seq -- newxml )
over body>> like tag>xml ;
PRIVATE>
@ -203,7 +203,7 @@ M: xml clone
M: xml like
swap dup xml? [ nip ] [
dup tag? [ tag>xml ] [ seq>xml ] if
dup tag? [ tag>xml ] [ sequence>xml ] if
] if ;
! tag with children=f is contained

View File

@ -32,7 +32,7 @@ HELP: >y-up-axis!
{ $values { "seq" sequence } { "from-axis" rh-up } }
{ $description "Destructively swizzles the first three elements of the input sequence to a right-handed 3D coordinate system where Y is up and returns the modified sequence." } ;
HELP: source>seq
HELP: source>sequence
{ $values { "source-tag" tag } { "up-axis" rh-up } { "scale" number } { "sequence" sequence } }
{ $description "Convert the " { $emphasis "float_array" } " in a " { $emphasis "source tag" } " to a sequence of number sequences according to the element stride. The values are scaled according to " { $emphasis "scale" } " and swizzled from " { $emphasis "up-axis" } " so that the Y coordinate points up." } ;

View File

@ -67,7 +67,7 @@ M: z-up >y-up-axis!
[ 0 swap set-nth ] tri
] bi ;
: source>seq ( source-tag up-axis scale -- sequence )
: source>sequence ( source-tag up-axis scale -- sequence )
rot
[ "float_array" x/ xt string>numbers [ * ] with map ]
[ nip "technique_common" x/ "accessor" x/ "stride" x@ string>number ] 2bi
@ -76,7 +76,7 @@ M: z-up >y-up-axis!
: source>pair ( source-tag -- pair )
[ "id" x@ ]
[ up-axis get unit-ratio get source>seq ] bi 2array ;
[ up-axis get unit-ratio get source>sequence ] bi 2array ;
: mesh>sources ( mesh-tag -- hashtable )
"source" [ source>pair ] x* >hashtable ;

View File

@ -32,7 +32,7 @@ IN: id3.tests
"Classical"
] [ "vocab:id3/tests/blah2.mp3" mp3>id3 id3-params ] unit-test
[
[
"Stormy Weather"
"Frank Sinatra"
"Night and Day Frank Sinatra"
@ -43,4 +43,4 @@ IN: id3.tests
[ t ]
[ 10000 iota [ synchsafe>seq seq>synchsafe ] map [ < ] monotonic? ] unit-test
[ 10000 iota [ synchsafe>sequence sequence>synchsafe ] map [ < ] monotonic? ] unit-test

View File

@ -101,10 +101,10 @@ CONSTANT: id3v1+-length 227
} cleave
] output>array sift ;
: seq>synchsafe ( seq -- n )
: sequence>synchsafe ( seq -- n )
0 [ [ 7 shift ] dip bitor ] reduce ;
: synchsafe>seq ( n -- seq )
: synchsafe>sequence ( n -- seq )
dup 1 + log2 1 + 7 / ceiling
[ [ -7 shift ] keep 0x7f bitand ] replicate nip reverse ;
@ -126,7 +126,7 @@ CONSTANT: id3v1+-length 227
[ <frame> ] dip
{
[ 4 head-slice decode-text >>tag ]
[ [ 4 8 ] dip subseq seq>synchsafe >>size ]
[ [ 4 8 ] dip subseq sequence>synchsafe >>size ]
[ [ 8 10 ] dip subseq >byte-array >>flags ]
[ read-frame-data decode-text >>data ]
} cleave ;
@ -149,7 +149,7 @@ CONSTANT: id3v1+-length 227
{
[ [ 3 5 ] dip <slice> >array >>version ]
[ [ 5 ] dip nth >>flags ]
[ [ 6 10 ] dip <slice> seq>synchsafe >>size ]
[ [ 6 10 ] dip <slice> sequence>synchsafe >>size ]
} cleave ;
: merge-frames ( id3 assoc -- id3 )

View File

@ -290,8 +290,8 @@ ERROR: bmp-not-supported n ;
color-index>>
] }
{ 8 [ color-lookup ] }
{ 4 [ [ 4 b:byte-array-n>seq ] change-color-index color-lookup ] }
{ 1 [ [ 1 b:byte-array-n>seq ] change-color-index color-lookup ] }
{ 4 [ [ 4 b:byte-array-n>sequence ] change-color-index color-lookup ] }
{ 1 [ [ 1 b:byte-array-n>sequence ] change-color-index color-lookup ] }
[ bmp-not-supported ]
} case >byte-array ;