From 23768dd482037e93cc4764d3bbbfc9eb31e496a7 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 1 Apr 2008 17:06:36 -0500 Subject: [PATCH] remove singleton? from sequences.lib fix bootstrap error --- extra/math/polynomials/polynomials.factor | 2 +- extra/math/text/english/english.factor | 2 +- extra/random/unix/unix.factor | 2 +- extra/sequences/lib/lib-tests.factor | 3 --- extra/sequences/lib/lib.factor | 3 --- 5 files changed, 3 insertions(+), 9 deletions(-) diff --git a/extra/math/polynomials/polynomials.factor b/extra/math/polynomials/polynomials.factor index d6ac71e629..0b0d3520ef 100644 --- a/extra/math/polynomials/polynomials.factor +++ b/extra/math/polynomials/polynomials.factor @@ -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+ ; diff --git a/extra/math/text/english/english.factor b/extra/math/text/english/english.factor index b77ac725ab..cba8c28310 100755 --- a/extra/math/text/english/english.factor +++ b/extra/math/text/english/english.factor @@ -79,7 +79,7 @@ SYMBOL: and-needed? ] if ; : recombine ( seq -- str ) - dup singleton? [ + dup length 1 = [ first 3digits>text ] [ dup set-conjunction "" swap diff --git a/extra/random/unix/unix.factor b/extra/random/unix/unix.factor index f3f55007f0..3be2697bdf 100644 --- a/extra/random/unix/unix.factor +++ b/extra/random/unix/unix.factor @@ -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 diff --git a/extra/sequences/lib/lib-tests.factor b/extra/sequences/lib/lib-tests.factor index 6e6a924382..99565e966c 100755 --- a/extra/sequences/lib/lib-tests.factor +++ b/extra/sequences/lib/lib-tests.factor @@ -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 diff --git a/extra/sequences/lib/lib.factor b/extra/sequences/lib/lib.factor index d246b16b8d..945ba1a3b7 100755 --- a/extra/sequences/lib/lib.factor +++ b/extra/sequences/lib/lib.factor @@ -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 ;