remove singleton? from sequences.lib

fix bootstrap error
db4
Doug Coleman 2008-04-01 17:06:36 -05:00
parent b4adebb691
commit 23768dd482
5 changed files with 3 additions and 9 deletions

View File

@ -22,7 +22,7 @@ PRIVATE>
: p= ( p p -- ? ) pextend = ;
: ptrim ( p -- p )
dup singleton? [ [ zero? ] right-trim ] unless ;
dup length 1 = [ [ zero? ] right-trim ] unless ;
: 2ptrim ( p p -- p p ) [ ptrim ] bi@ ;
: p+ ( p p -- p ) pextend v+ ;

View File

@ -79,7 +79,7 @@ SYMBOL: and-needed?
] if ;
: recombine ( seq -- str )
dup singleton? [
dup length 1 = [
first 3digits>text
] [
dup set-conjunction "" swap

View File

@ -1,5 +1,5 @@
USING: alien.c-types io io.files io.nonblocking kernel
namespaces random io.encodings.binary singleton init
namespaces random io.encodings.binary init
accessors system ;
IN: random.unix

View File

@ -46,9 +46,6 @@ IN: sequences.lib.tests
[ { 1 -1 5 2 4 } [ < ] monotonic-split [ >array ] map ] unit-test
[ { { 1 1 1 1 } { 2 2 } { 3 } { 4 } { 5 } { 6 6 6 } } ]
[ { 1 1 1 1 2 2 3 4 5 6 6 6 } [ = ] monotonic-split [ >array ] map ] unit-test
[ f ] [ { } singleton? ] unit-test
[ t ] [ { "asdf" } singleton? ] unit-test
[ f ] [ { "asdf" "bsdf" } singleton? ] unit-test
[ 2 ] [ V{ 10 20 30 } [ delete-random drop ] keep length ] unit-test
[ V{ } [ delete-random drop ] keep length ] must-fail

View File

@ -98,9 +98,6 @@ MACRO: firstn ( n -- )
v, [ pick ,, call [ v, ] unless ] curry 2each ,v
] { } make ;
: singleton? ( seq -- ? )
length 1 = ;
: delete-random ( seq -- value )
[ length random ] keep [ nth ] 2keep delete-nth ;