fix weirdness
parent
05d800ed28
commit
5784027842
|
@ -24,6 +24,8 @@
|
|||
initial size.</li>
|
||||
<li>The <code>fill</code> word to create a new string with an initial character
|
||||
repeated a certain number of times has been renamed to <code><string></code>.</li>
|
||||
<li>The <code>sum</code> and <code>product</code> words have been moved to
|
||||
<code>contrib/math/</code>.</li>
|
||||
</li>
|
||||
|
||||
<li><code>stream-format ( string style stream -- )</code> now takes a hashtable
|
||||
|
@ -102,6 +104,7 @@ USE: image
|
|||
<li>Contributed libraries:
|
||||
|
||||
<ul>
|
||||
<li>Updated <code>contrib/x11/</code> with many more examples (Eduardo Cavazos)</li>
|
||||
<li>Added splay tree library in <code>contrib/splay-trees.factor</code> (Mackenzie Straight)</li>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ ARTICLE: "integers" "Integers"
|
|||
{ $example "128 class ." "fixnum" }
|
||||
{ $example "134217728 128 * ." "17179869184" }
|
||||
{ $example "134217728 128 * class ." "bignum" }
|
||||
"Integers can be entered using a different base; see " { $link "integer-literals" } "."
|
||||
"Integers can be entered using a different base; see " { $link "syntax-numbers" } "."
|
||||
$terpri
|
||||
"Integers can be tested for, and real numbers can be converted to integers:"
|
||||
{ $subsection fixnum? }
|
||||
|
@ -116,7 +116,7 @@ $terpri
|
|||
|
||||
ARTICLE: "complex-numbers" "Complex numbers"
|
||||
{ $subsection complex }
|
||||
"Complex numbers arise as solutions to quadratic equations whose graph does not intersect the " { $emphasis "x" } " axis. Their literal syntax is covered in " { $link "complex-literals" } "."
|
||||
"Complex numbers arise as solutions to quadratic equations whose graph does not intersect the " { $emphasis "x" } " axis. Their literal syntax is covered in " { $link "syntax-complex-numbers" } "."
|
||||
$terpri
|
||||
"Unlike math, where all real numbers are also complex numbers, Factor only considers a number to be a complex number if its imaginary part is non-zero. However, complex number operations are fully supported for real numbers; they are treated as having an imaginary part of zero."
|
||||
$terpri
|
||||
|
|
|
@ -188,7 +188,7 @@ GLOSSARY: "array"
|
|||
"an instance of the" { $link array } "class, implementing a fixed-length mutable sequence of objects" ;
|
||||
|
||||
ARTICLE: "arrays" "Arrays"
|
||||
"An array is a fixed-size mutable sequence whose elements are stored in a contiguous range of memory. The literal syntax is covered in " { $link "array-literals" } ". Sometimes you need a growable array -- this is called a vector, and vectors are documented in " { $link "vectors" } "."
|
||||
"An array is a fixed-size mutable sequence whose elements are stored in a contiguous range of memory. The literal syntax is covered in " { $link "syntax-arrays" } ". Sometimes you need a growable array -- this is called a vector, and vectors are documented in " { $link "vectors" } "."
|
||||
$terpri
|
||||
"Array words are in the " { $snippet "arrays" } " vocabulary. Unsafe implementation words are in the " { $snippet "kernel-internals" } " vocabulary."
|
||||
$terpri
|
||||
|
|
|
@ -119,7 +119,7 @@ $terpri
|
|||
|
||||
GLOSSARY: "number" "an instance of the " { $link number } " class" ;
|
||||
|
||||
ARTICLE: "syntax-numbers" "Numbers"
|
||||
ARTICLE: "syntax-numbers" "Number syntax"
|
||||
"If a vocabulary lookup of a token fails, the parser attempts to parse it as a number."
|
||||
{ $subsection "syntax-integers" }
|
||||
{ $subsection "syntax-ratios" }
|
||||
|
@ -132,7 +132,7 @@ GLOSSARY: "fixnum" "an instance of the " { $link fixnum } " class, representing
|
|||
|
||||
GLOSSARY: "bignum" "an instance of the " { $link bignum } " class, representing an arbitrary-precision integer whose value is bounded by available object memory" ;
|
||||
|
||||
ARTICLE: "syntax-integers" "Integers"
|
||||
ARTICLE: "syntax-integers" "Integer syntax"
|
||||
"The printed representation of an integer consists of a sequence of digits, optionally prefixed by a sign."
|
||||
{ $code
|
||||
"123456"
|
||||
|
@ -147,18 +147,18 @@ ARTICLE: "syntax-integers" "Integers"
|
|||
|
||||
GLOSSARY: "ratio" "an instance of the " { $link ratio } " class, representing an exact ratio of two integers" ;
|
||||
|
||||
ARTICLE: "syntax-ratios" "Ratios"
|
||||
ARTICLE: "syntax-ratios" "Ratio syntax"
|
||||
"The printed representation of a ratio is a pair of integers separated by a slash (/). No intermediate whitespace is permitted. Either integer may be signed, however the ratio will be normalized into a form where the denominator is positive and the greatest common divisor of the two terms is 1."
|
||||
{ $code
|
||||
"75/33"
|
||||
"1/10"
|
||||
"-5/-6"
|
||||
}
|
||||
"More information on ratios can be found in " { $link "ratios" } ;
|
||||
"More information on ratios can be found in " { $link "rationals" } ;
|
||||
|
||||
GLOSSARY: "float" "an instance of the " { $link float } " class, representing an IEEE 754 double-precision floating point number" ;
|
||||
|
||||
ARTICLE: "syntax-floats" "Floats"
|
||||
ARTICLE: "syntax-floats" "Float syntax"
|
||||
"Floating point numbers contain an optional decimal part, an optional exponent, with an optional sign prefix on either the mantissa or exponent."
|
||||
{ $code
|
||||
"10.5"
|
||||
|
@ -170,7 +170,7 @@ ARTICLE: "syntax-floats" "Floats"
|
|||
|
||||
GLOSSARY: "complex" "an instance of the " { $link complex } " class, representing a complex number with real and imaginary components, where both components are real numbers" ;
|
||||
|
||||
ARTICLE: "syntax-complex-numbers" "Complex numbers"
|
||||
ARTICLE: "syntax-complex-numbers" "Complex number syntax"
|
||||
"A complex number is given by two components, a ``real'' part and ''imaginary'' part. The components must either be integers, ratios or floats."
|
||||
{ $code
|
||||
"C{ 1/2 1/3 } ! the complex number 1/2+1/3i"
|
||||
|
@ -180,7 +180,7 @@ ARTICLE: "syntax-complex-numbers" "Complex numbers"
|
|||
|
||||
GLOSSARY: "wrapper" "an instance of the " { $link wrapper } " class, holding a reference to a single object. When the evaluator encounters a wrapper, it pushes the wrapped object on the data stack. Wrappers are used to push words literally on the data stack" ;
|
||||
|
||||
ARTICLE: "syntax-words" "Words"
|
||||
ARTICLE: "syntax-words" "Word syntax"
|
||||
"A word occurring inside a quotation is executed when the quotation is called. Sometimes a word needs to be pushed on the data stack instead. The canonical use-case for this is passing the word to the " { $link execute } " combinator, or alternatively, reflectively accessing word properties (" { $link "word-props" } ")."
|
||||
{ $subsection POSTPONE: \ }
|
||||
{ $subsection POSTPONE: POSTPONE: }
|
||||
|
@ -201,7 +201,7 @@ ARTICLE: "syntax-booleans" "Booleans"
|
|||
|
||||
GLOSSARY: "escape" "a sequence allowing a non-literal character to be inserted in a string. For a list of escapes, see " { $link "escape" } ;
|
||||
|
||||
ARTICLE: "syntax-strings" "Characters and strings"
|
||||
ARTICLE: "syntax-strings" "Character and string syntax"
|
||||
"Factor has no distinct character type, however Unicode character value integers can be read by specifying a literal character, or an escaped representation thereof."
|
||||
{ $subsection POSTPONE: CHAR: }
|
||||
{ $subsection POSTPONE: " }
|
||||
|
@ -227,31 +227,31 @@ ARTICLE: "escape" "Character escape codes"
|
|||
}
|
||||
"While not useful for single characters, this syntax is also permitted inside strings." ;
|
||||
|
||||
ARTICLE: "syntax-sbufs" "String buffers"
|
||||
ARTICLE: "syntax-sbufs" "String buffer syntax"
|
||||
{ $subsection POSTPONE: SBUF" }
|
||||
"String buffers are documented in " { $link "string-buffers" } "." ;
|
||||
"String buffers are documented in " { $link "sbufs" } "." ;
|
||||
|
||||
ARTICLE: "syntax-arrays" "Arrays"
|
||||
ARTICLE: "syntax-arrays" "Array syntax"
|
||||
{ $subsection POSTPONE: { }
|
||||
{ $subsection POSTPONE: } }
|
||||
"Arrays are documented in " { $link "arrays" } "." ;
|
||||
|
||||
ARTICLE: "syntax-vectors" "Vectors"
|
||||
ARTICLE: "syntax-vectors" "Vector syntax"
|
||||
{ $subsection POSTPONE: V{ }
|
||||
{ $subsection POSTPONE: } }
|
||||
"Vectors are documented in " { $link "vectors" } "." ;
|
||||
|
||||
ARTICLE: "syntax-hashtables" "Hashtables"
|
||||
ARTICLE: "syntax-hashtables" "Hashtable syntax"
|
||||
{ $subsection POSTPONE: H{ }
|
||||
{ $subsection POSTPONE: } }
|
||||
"Hashtables are documented in " { $link "vectors" } "." ;
|
||||
"Hashtables are documented in " { $link "hashtables" } "." ;
|
||||
|
||||
ARTICLE: "syntax-tuples" "Tuples"
|
||||
ARTICLE: "syntax-tuples" "Tuple syntax"
|
||||
{ $subsection POSTPONE: T{ }
|
||||
{ $subsection POSTPONE: } }
|
||||
"Tuples are documented in " { $link "tuples" } "." ;
|
||||
|
||||
ARTICLE: "syntax-lists" "Lists"
|
||||
ARTICLE: "syntax-lists" "Quotation syntax"
|
||||
{ $subsection POSTPONE: [ }
|
||||
{ $subsection POSTPONE: ] }
|
||||
"Lists are documented in " { $link "lists" } "." ;
|
||||
"Quotations are documented in " { $link "quotations" } "." ;
|
||||
|
|
|
@ -74,13 +74,13 @@ C: alien-node make-node ;
|
|||
dup class get swap fastcall-regs >= ;
|
||||
|
||||
: spill-param ( reg-class -- n reg-class )
|
||||
reg-class-size stack-params [ tuck + ] change
|
||||
reg-size stack-params [ tuck + ] change
|
||||
T{ stack-params } ;
|
||||
|
||||
: inc-reg-class ( reg-class -- )
|
||||
#! On Mac OS X, float parameters 'shadow' integer registers.
|
||||
dup class inc dup float-regs? dual-fp/int-regs? and [
|
||||
int-regs [ over reg-class-size 4 / + ] change
|
||||
int-regs [ over reg-size 4 / + ] change
|
||||
] when drop ;
|
||||
|
||||
: fastcall-param ( reg-class -- n reg-class )
|
||||
|
|
|
@ -28,7 +28,7 @@ HELP: ensure "( n seq -- )"
|
|||
{ $values { "n" "a positive integer" } { "seq" "a growable sequence" } }
|
||||
{ $description "If " { $snippet "n" } " is less than the length of the sequence, does nothing. Otherwise, if " { $snippet "n" } " also exceeds the capacity of the underlying storage, the underlying storage is grown, and the fill pointer is reset. Finally, if " { $snippet "n" } " is greater than or equal to the length but less than the capacity of the underlying storage, the fill pointer is moved and nothing else is done."
|
||||
$terpri
|
||||
"This word is used in the implementation of the " { $link set-nth } " generic for sequences supporting the growable sequence protocol (see " { $link "sequences-internals" } ")."
|
||||
"This word is used in the implementation of the " { $link set-nth } " generic for sequences supporting the growable sequence protocol (see " { $link "sequences-growable" } ")."
|
||||
} ;
|
||||
|
||||
HELP: bounds-error "( n seq -- )"
|
||||
|
@ -41,8 +41,8 @@ HELP: bounds-check "( n seq -- n seq )"
|
|||
|
||||
HELP: grow-length "( n seq -- )"
|
||||
{ $values { "n" "a positive integer" } { "seq" "a sequence" } }
|
||||
{ $description "An implementation of the " { $link set-length } " generic for sequences supporting the growable sequence protocol (see " { $link "sequences-internals" } ")." } ;
|
||||
{ $description "An implementation of the " { $link set-length } " generic for sequences supporting the growable sequence protocol (see " { $link "sequences-growable" } ")." } ;
|
||||
|
||||
HELP: clone-growable "( seq -- seq )"
|
||||
{ $values { "seq" "a sequence" } { "seq" "a fresh sequence" } }
|
||||
{ $description "An implementation of the " { $link clone } " generic for sequences supporting the growable sequence protocol (see " { $link "sequences-internals" } ")." } ;
|
||||
{ $description "An implementation of the " { $link clone } " generic for sequences supporting the growable sequence protocol (see " { $link "sequences-growable" } ")." } ;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
IN: help
|
||||
USING: gadgets-listener gadgets-presentations words ;
|
||||
|
||||
"Show word" [ word? ] [ help ] \ in-browser define-default-command
|
||||
"Show word documentation" [ word? ] [ help ] \ in-browser define-default-command
|
||||
"Show term definition" [ term? ] [ help ] \ in-browser define-default-command
|
||||
"Show article" [ link? ] [ help ] \ in-browser define-default-command
|
||||
|
|
|
@ -55,7 +55,7 @@ M: word print-element
|
|||
|
||||
: $url url-style ($span) ;
|
||||
|
||||
: $terpri terpri drop ;
|
||||
: $terpri terpri terpri drop ;
|
||||
|
||||
! Some blocks
|
||||
M: simple-element print-element [ print-element ] each ;
|
||||
|
@ -138,7 +138,13 @@ DEFER: help
|
|||
] with-style ;
|
||||
|
||||
: $link ( article -- )
|
||||
first dup article-name swap <link> simple-object ;
|
||||
first dup word? [
|
||||
pprint
|
||||
] [
|
||||
link-style [
|
||||
dup article-name swap <link> simple-object
|
||||
] with-style
|
||||
] if ;
|
||||
|
||||
: $glossary ( element -- )
|
||||
first dup <term> simple-object ;
|
||||
|
|
|
@ -8,6 +8,9 @@ USING: styles ;
|
|||
{ wrap-margin 500 }
|
||||
} ;
|
||||
|
||||
: link-style
|
||||
H{ { foreground { 0.3 0 0 1 } } { font-style bold } } ;
|
||||
|
||||
: emphasis-style
|
||||
H{ { font-style italic } } ;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
! Combine an input and output stream into one, and flush the
|
||||
! stream more often.
|
||||
USING: io kernel ;
|
||||
IN: io
|
||||
USING: kernel ;
|
||||
|
||||
TUPLE: duplex-stream in out ;
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ HELP: + "( x y -- z )"
|
|||
HELP: - "( x y -- z )"
|
||||
{ $values { "x" "a number" } { "y" "a number" } { "z" "a number" } }
|
||||
{ $description
|
||||
"Subtracts " { $link "y" } " from " { $snippet "x" } "."
|
||||
"Subtracts " { $snippet "y" } " from " { $snippet "x" } "."
|
||||
{ $list
|
||||
"Subtraction of fixnums may overflow and convert the result to a bignum."
|
||||
"Subtraction of bignums always yields a bignum."
|
||||
|
|
|
@ -77,7 +77,7 @@ HELP: V{ "elements... }"
|
|||
HELP: H{ "{ key value }... }"
|
||||
{ $values { "key" "an object" } { "value" "an object" } }
|
||||
{ $description "Marks the beginning of a literal hashtable, given as a list of two-element arrays holding key/value pairs." }
|
||||
{ $examples { $code "H{ { \"tuna\" \"fish\" } { \"jalapeno\" \"vegatable\" } }" } } ;
|
||||
{ $examples { $code "H{ { \"tuna\" \"fish\" } { \"jalapeno\" \"vegetable\" } }" } } ;
|
||||
|
||||
HELP: C{ "real imaginary }"
|
||||
{ $values { "real" "a real number" } { "imaginary" "a real number" } }
|
||||
|
@ -115,7 +115,7 @@ HELP: SYMBOL: "word"
|
|||
HELP: \ "word"
|
||||
{ $values { "word" "a word" } }
|
||||
{ $description "Reads the next word from the input and appends a wrapper holding the word to the parse tree. When the evaluator encounters a wrapper, it pushes the wrapped word literally on the data stack." }
|
||||
{ $examples "The following two lines are equivalent:" { $code "0 \\ <vector> execute\n<vector>" } } ;
|
||||
{ $examples "The following two lines are equivalent:" { $code "0 \\ <vector> execute\n0 <vector>" } } ;
|
||||
|
||||
HELP: DEFER: "word"
|
||||
{ $values { "word" "a new word to define" } }
|
||||
|
@ -194,7 +194,7 @@ HELP: GENERIC: "word"
|
|||
{ $values { "word" "a new word to define" } }
|
||||
{ $description "Defines a new generic word in the current vocabulary. Initially, it contains no methods, and thus will throw an error when called." }
|
||||
{ $notes
|
||||
"A " { $link "method-combinations" "method combination" } " facility exists for customizing method dispatch behavior."
|
||||
"A " { $link "method-combination" } " facility exists for customizing method dispatch behavior."
|
||||
$terpri
|
||||
"This parsing word is equivalent to the following usage of the more general " { $link POSTPONE: G: } " word:"
|
||||
{ $code "G: word simple-combination ;" }
|
||||
|
|
|
@ -94,7 +94,7 @@ $parsing-note ;
|
|||
|
||||
HELP: create-constructor "( word -- constructor )"
|
||||
{ $values { "class" "a word" } { "constructor" "a new word" } }
|
||||
{ $description "Creates a new word in the current vocabulary, named by surrounding " { $link "word" } " with angle brackets." } ;
|
||||
{ $description "Creates a new word in the current vocabulary, named by surrounding " { $snippet "word" } " with angle brackets." } ;
|
||||
|
||||
HELP: CREATE "( -- word )"
|
||||
{ $values { "word" "a word" } }
|
||||
|
|
|
@ -145,6 +145,6 @@ HELP: definer "( word -- definer )"
|
|||
{ $values { "word" "a word" } { "definer" "a word" } }
|
||||
{ $description "Outputs the parsing word that defines the given word." }
|
||||
{ $examples
|
||||
{ $example ": foo ; \ foo definer ." "POSTPONE: :" }
|
||||
{ $example "SYMBOL: foo \ foo definer ." "POSTPONE: SYMBOL:" }
|
||||
{ $example ": foo ; \\ foo definer ." "POSTPONE: :" }
|
||||
{ $example "SYMBOL: foo \\ foo definer ." "POSTPONE: SYMBOL:" }
|
||||
} ;
|
||||
|
|
Loading…
Reference in New Issue