diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 134e4a7fa7..9e592052ae 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -2,8 +2,9 @@ - inline float allocation needs a gc check - docs: don't pass volatile aliens to callbacks -- docs: mention that 'like' may destroy the underlying sequence - don't save big free chunk at the end of the code heap +- some instability remains +- overhaul alien docs + ui: diff --git a/library/collections/sequences.facts b/library/collections/sequences.facts index a85e3efbce..9e8c0521b3 100644 --- a/library/collections/sequences.facts +++ b/library/collections/sequences.facts @@ -1,5 +1,5 @@ USING: arrays help sequences sequences-internals vectors -strings ; +strings kernel ; HELP: { $values { "n" "a positive integer specifying initial capacity" } { "vector" "a new vector" } } @@ -36,7 +36,25 @@ HELP: thaw HELP: like { $values { "seq" "a sequence" } { "prototype" "a sequence" } { "newseq" "a sequence" } } -{ $contract "Outputs a sequence with the same elements as the input sequence, but " { $emphasis "like" } " the template sequence, in the sense that it either has the same class as the template sequence, or if the template sequence is a virtual sequence, the same class as the template sequence's underlying sequence. The default implementation does nothing." } ; +{ $contract "Outputs a sequence with the same elements as the input sequence, but " { $emphasis "like" } " the template sequence, in the sense that it either has the same class as the template sequence, or if the template sequence is a virtual sequence, the same class as the template sequence's underlying sequence." +$terpri +"The default implementation does nothing." } +{ $notes "The output sequence might share storage with the input sequence, for example:" +{ $example + "{ 1 2 3 } \"array\" set" + "\"array\" get V{ } like \"vector\" set" + "t 0 \"array\" get set-nth" + "\"vector\" get ." + "V{ t 2 3 }" +} +"If this behavior is undesirable, you can use one of the following words instead, which always output a fresh sequence:" +{ $list + { $link >array } + { $link >quotation } + { $link >string } + { $link >sbuf } + { $link >vector } +} } ; HELP: empty? { $values { "seq" "a sequence" } { "?" "a boolean" } } diff --git a/library/compiler/pentium4/intrinsics.factor b/library/compiler/pentium4/intrinsics.factor index ffa30b1938..c7f9baf2ca 100644 --- a/library/compiler/pentium4/intrinsics.factor +++ b/library/compiler/pentium4/intrinsics.factor @@ -11,8 +11,8 @@ M: float-regs (%peek) : load-zone-ptr ( reg -- ) #! Load pointer to start of zone array - 0 MOV - dup "generations" f rel-absolute-cell rel-dlsym + dup 0 MOV + "generations" f rel-absolute-cell rel-dlsym dup [] MOV ; : load-allot-ptr ( vreg -- )