Skip to content

Commit

Permalink
rename some words to x>sequence and sequence>x.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Jul 24, 2012
1 parent 9ab4053 commit 5c76cbb
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion basis/bitstreams/bitstreams.factor
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions basis/bootstrap/image/image.factor
Expand Up @@ -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 ]
Expand Down
8 changes: 4 additions & 4 deletions basis/checksums/sha/sha.factor
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions basis/regexp/classes/classes.factor
Expand Up @@ -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 ] }
Expand All @@ -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>> ]
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions basis/xml/data/data.factor
Expand Up @@ -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>

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion extra/game/models/collada/collada-docs.factor
Expand Up @@ -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." } ;

Expand Down
4 changes: 2 additions & 2 deletions extra/game/models/collada/collada.factor
Expand Up @@ -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
Expand All @@ -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 ;
Expand Down
4 changes: 2 additions & 2 deletions extra/id3/id3-tests.factor
Expand Up @@ -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"
Expand All @@ -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
8 changes: 4 additions & 4 deletions extra/id3/id3.factor
Expand Up @@ -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 ;

Expand All @@ -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 ;
Expand All @@ -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 )
Expand Down
4 changes: 2 additions & 2 deletions extra/images/bitmap/bitmap.factor
Expand Up @@ -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 ;

Expand Down

0 comments on commit 5c76cbb

Please sign in to comment.