-USING: help.markup help.syntax ;\r
+USING: help.markup help.syntax kernel strings ;\r
IN: ascii\r
\r
HELP: blank?\r
-{ $values { "ch" "a character" } { "?" "a boolean" } }\r
+{ $values { "ch" "a character" } { "?" boolean } }\r
{ $description "Tests for an ASCII whitespace character." } ;\r
\r
HELP: letter?\r
-{ $values { "ch" "a character" } { "?" "a boolean" } }\r
+{ $values { "ch" "a character" } { "?" boolean } }\r
{ $description "Tests for a lowercase alphabet ASCII character." } ;\r
\r
HELP: LETTER?\r
-{ $values { "ch" "a character" } { "?" "a boolean" } }\r
+{ $values { "ch" "a character" } { "?" boolean } }\r
{ $description "Tests for a uppercase alphabet ASCII character." } ;\r
\r
HELP: digit?\r
-{ $values { "ch" "a character" } { "?" "a boolean" } }\r
+{ $values { "ch" "a character" } { "?" boolean } }\r
{ $description "Tests for an ASCII decimal digit character." } ;\r
\r
HELP: Letter?\r
-{ $values { "ch" "a character" } { "?" "a boolean" } }\r
+{ $values { "ch" "a character" } { "?" boolean } }\r
{ $description "Tests for an ASCII alphabet character, both upper and lower case." } ;\r
\r
HELP: alpha?\r
-{ $values { "ch" "a character" } { "?" "a boolean" } }\r
+{ $values { "ch" "a character" } { "?" boolean } }\r
{ $description "Tests for an alphanumeric ASCII character." } ;\r
\r
HELP: printable?\r
-{ $values { "ch" "a character" } { "?" "a boolean" } }\r
+{ $values { "ch" "a character" } { "?" boolean } }\r
{ $description "Tests for a printable ASCII character." } ;\r
\r
HELP: control?\r
-{ $values { "ch" "a character" } { "?" "a boolean" } }\r
+{ $values { "ch" "a character" } { "?" boolean } }\r
{ $description "Tests for an ASCII control character." } ;\r
\r
HELP: quotable?\r
-{ $values { "ch" "a character" } { "?" "a boolean" } }\r
+{ $values { "ch" "a character" } { "?" boolean } }\r
{ $description "Tests for characters which may appear in a Factor string literal without escaping." } ;\r
\r
HELP: ascii?\r
-{ $values { "ch" "a character" } { "?" "a boolean" } }\r
+{ $values { "ch" "a character" } { "?" boolean } }\r
{ $description "Tests for whether a number is an ASCII character." } ;\r
\r
HELP: ch>lower\r
{ $description "Converts an ASCII character to upper case." } ;\r
\r
HELP: >lower\r
-{ $values { "str" "a string" } { "lower" "a string" } }\r
+{ $values { "str" string } { "lower" string } }\r
{ $description "Converts an ASCII string to lower case." } ;\r
\r
HELP: >upper\r
-{ $values { "str" "a string" } { "upper" "a string" } }\r
+{ $values { "str" string } { "upper" string } }\r
{ $description "Converts an ASCII string to upper case." } ;\r
\r
HELP: >title\r
-{ $values { "str" "a string" } { "title" "a string" } }\r
+{ $values { "str" string } { "title" string } }\r
{ $description "Converts a string to title case." } ;\r
\r
HELP: >words\r
-{ $values { "str" "a string" } { "words" "an array of slices" } }\r
+{ $values { "str" string } { "words" "an array of slices" } }\r
{ $description "Divides the string up into words." } ;\r
\r
HELP: capitalize\r
-{ $values { "str" "a string" } { "str'" "a string" } }\r
+{ $values { "str" string } { "str'" string } }\r
{ $description "Capitalize all the words in a string." } ;\r
\r
ARTICLE: "ascii" "ASCII"\r
{ index index-from last-index last-index-from sorted-index } related-words
HELP: sorted-member?
-{ $values { "obj" object } { "seq" "a sorted sequence" } { "?" "a boolean" } }
+{ $values { "obj" object } { "seq" "a sorted sequence" } { "?" boolean } }
{ $description "Tests if the sorted sequence contains " { $snippet "elt" } ". Equality is tested with " { $link = } "." } ;
{ member? sorted-member? } related-words
HELP: sorted-member-eq?
-{ $values { "obj" object } { "seq" "a sorted sequence" } { "?" "a boolean" } }
+{ $values { "obj" object } { "seq" "a sorted sequence" } { "?" boolean } }
{ $description "Tests if the sorted sequence contains " { $snippet "elt" } ". Equality is tested with " { $link eq? } "." } ;
{ member-eq? sorted-member-eq? } related-words
-USING: arrays help.markup help.syntax kernel
-kernel.private math prettyprint strings vectors sbufs ;
+USING: help.markup help.syntax math sequences ;
IN: bit-arrays
ARTICLE: "bit-arrays" "Bit arrays"
{ $description "Creates a new bit array with the given length and all elements initially set to " { $link f } "." } ;
HELP: >bit-array
-{ $values { "seq" "a sequence" } { "bit-array" bit-array } }
+{ $values { "seq" sequence } { "bit-array" bit-array } }
{ $description "Outputs a freshly-allocated bit array whose elements have the same boolean values as a given sequence." } ;
HELP: clear-bits
-USING: arrays bit-arrays help.markup help.syntax kernel\r
-combinators ;\r
+USING: help.markup help.syntax sequences ;\r
IN: bit-vectors\r
\r
ARTICLE: "bit-vectors" "Bit vectors"\r
{ $description "Creates a new bit vector that can hold " { $snippet "n" } " bits before resizing." } ;\r
\r
HELP: >bit-vector\r
-{ $values { "seq" "a sequence" } { "vector" bit-vector } }\r
+{ $values { "seq" sequence } { "vector" bit-vector } }\r
{ $description "Outputs a freshly-allocated bit vector with the same elements as a given sequence." } ;\r
\r
HELP: ?V{\r
{ $errors "Throws an error if the box is empty." } ;\r
\r
HELP: ?box\r
-{ $values { "box" box } { "value/f" "the value of the box or " { $link f } } { "?" "a boolean" } }\r
+{ $values { "box" box } { "value/f" "the value of the box or " { $link f } } { "?" boolean } }\r
{ $description "If the box is full, removes the value from the box and pushes " { $link t } ". If the box is empty pushes " { $snippet "f f" } "." } ;\r
\r
ARTICLE: "boxes" "Boxes"\r
{ years months days hours minutes seconds milliseconds microseconds nanoseconds } related-words
HELP: leap-year?
-{ $values { "obj" object } { "?" "a boolean" } }
+{ $values { "obj" object } { "?" boolean } }
{ $description "Returns " { $link t } " if the object represents a leap year." }
{ $examples
{ $example "USING: calendar prettyprint ;"
{ $description "Returns a zero timestamp that consists of zeros for every slot. Used to see if timestamps are valid." } ;
HELP: valid-timestamp?
-{ $values { "timestamp" timestamp } { "?" "a boolean" } }
+{ $values { "timestamp" timestamp } { "?" boolean } }
{ $description "Tests if a timestamp is valid or not." } ;
HELP: unix-1970
! Copyright (C) 2007 Chris Double.
! See http://factorcode.org/license.txt for BSD license.
-USING: help.syntax help.markup ;
+USING: help.syntax help.markup kernel ;
IN: channels
HELP: <channel>
-{ $values { "channel" "a channel object" }
+{ $values { "channel" channel }
}
{ $description "Create a channel that can be used for communicating between "
"concurrent processes and threads. " { $link to } " and " { $link from }
{ $see-also from to } ;
HELP: to
-{ $values { "value" "an object" }
- { "channel" "a channel object" }
+{ $values { "value" object }
+ { "channel" channel }
}
{ $description "Sends an object to a channel. The send operation is synchronous."
" It will block the calling thread until there is a receiver waiting "
"for data on the channel. It will return when the receiver has received "
-"the data successfully."
+"the data successfully."
}
{ $see-also <channel> from } ;
HELP: from
-{ $values { "channel" "a channel object" }
- { "value" "an object" }
+{ $values { "channel" channel }
+ { "value" object }
}
{ $description "Receives an object from a channel. The operation is synchronous."
" It will block the calling thread until there is data in the channel."
! Copyright (C) 2007 Chris Double.
! See http://factorcode.org/license.txt for BSD license.
USING: channels concurrency.distributed help.markup help.syntax
-io.servers ;
+io.servers strings ;
IN: channels.remote
HELP: <remote-channel>
{ $see-also publish unpublish } ;
HELP: unpublish
-{ $values { "id" "a string" }
+{ $values { "id" string }
}
{ $description "Stop a previously published channel from being "
"accessible by remote nodes."
HELP: publish
{ $values { "channel" "a channel object" }
- { "id" "a string" }
+ { "id" string }
}
{ $description "Make a channel accessible via remote Factor nodes. "
"An id is returned that can be used by another node to use "
HELP: APPLESCRIPT:
{ $syntax "APPLESCRIPT: word ...applescript... ;APPLESCRIPT" }
-{ $values { "word" "a word" } { "...applescript..." "AppleScript source text" } }
+{ $values { "word" "a new word to define" } { "...applescript..." "AppleScript source text" } }
{ $description "Defines a word that when called will run the provided uncompiled AppleScript. The word has stack effect " { $snippet "( -- )" } " due to return values being currently unsupported." } ;
-USING: help.markup help.syntax strings ;
+USING: help.markup help.syntax sequences strings ;
IN: cocoa.nibs
HELP: load-nib
{ $see-also nib-objects } ;
HELP: nib-objects
-{ $values { "anNSNib" "an instance of NSNib" } { "objects/f" "a sequence" } }
+{ $values { "anNSNib" "an instance of NSNib" } { "objects/f" { $maybe sequence } } }
{ $description "Instantiates the top-level objects of the " { $snippet ".nib" } " file loaded by anNSNib. First create an NSNib instance using " { $link nib-named } "." }
-{ $see-also nib-named } ;
\ No newline at end of file
+{ $see-also nib-named } ;
-USING: help.markup help.syntax strings ;
+USING: help.markup help.syntax kernel strings ;
IN: cocoa.pasteboard
HELP: pasteboard-string?
-{ $values { "pasteboard" "an " { $snippet "NSPasteBoard" } } { "?" "a boolean" } }
+{ $values { "pasteboard" "an " { $snippet "NSPasteBoard" } } { "?" boolean } }
{ $description "Tests if the pasteboard holds a string." } ;
HELP: pasteboard-string
-USING: classes compiler.tree.propagation.info help.markup help.syntax math
-math.intervals ;
+USING: classes compiler.tree.propagation.info help.markup
+help.syntax kernel math math.intervals ;
IN: compiler.tree.propagation.known-words
HELP: binary-op-class
{ $description "Ensure that the class is a subclass of " { $link number } "." } ;
HELP: fits-in-fixnum?
-{ $values { "interval" interval } { "?" "a boolean" } }
+{ $values { "interval" interval } { "?" boolean } }
{ $description "Checks if the interval is a subset of the " { $link fixnum } " interval. Used to see if arithmetic may overflow." }
{ $examples
{ $example
{ $description "A mailbox is an object that can be used for safe thread communication. Items can be put in the mailbox and retrieved in a FIFO order. If the mailbox is empty when a get operation is performed then the thread will block until another thread places something in the mailbox. If multiple threads are waiting on the same mailbox, only one of the waiting threads will be unblocked to thread the get operation." } ;\r
\r
HELP: mailbox-empty?\r
-{ $values { "mailbox" mailbox } \r
- { "bool" "a boolean" }\r
+{ $values { "mailbox" mailbox }\r
+ { "bool" boolean }\r
}\r
{ $description "Return true if the mailbox is empty." } ;\r
\r
HELP: mailbox-put\r
-{ $values { "obj" object } \r
- { "mailbox" mailbox } \r
+{ $values { "obj" object }\r
+ { "mailbox" mailbox }\r
}\r
{ $description "Put the object into the mailbox. Any threads that have a blocking get on the mailbox are resumed. Only one of those threads will successfully get the object, the rest will immediately block waiting for the next item in the mailbox." } ;\r
\r
HELP: block-unless-pred\r
{ $values\r
{ "mailbox" mailbox }\r
- { "timeout" "a " { $link duration } " or " { $link f } }\r
- { "pred" { $quotation ( ... message -- ... ? ) } } \r
+ { "timeout" { $maybe duration } }\r
+ { "pred" { $quotation ( ... message -- ... ? ) } }\r
}\r
{ $description "Block the thread if there are no items in the mailbox that return true when the predicate is called with the item on the stack." } ;\r
\r
HELP: block-if-empty\r
-{ $values { "mailbox" mailbox } \r
- { "timeout" "a " { $link duration } " or " { $link f } }\r
+{ $values { "mailbox" mailbox }\r
+ { "timeout" { $maybe duration } }\r
}\r
{ $description "Block the thread if the mailbox is empty." } ;\r
\r
! Copyright (C) 2005, 2008 Chris Double, Slava Pestov.\r
! See http://factorcode.org/license.txt for BSD license.\r
-USING: concurrency.messaging kernel arrays\r
-continuations help.markup help.syntax quotations calendar ;\r
+USING: calendar help.markup help.syntax kernel ;\r
IN: concurrency.promises\r
\r
HELP: promise\r
{ $description "Creates a new promise which may be fulfilled by calling " { $link fulfill } "." } ;\r
\r
HELP: promise-fulfilled?\r
-{ $values { "promise" promise } { "?" "a boolean" } }\r
+{ $values { "promise" promise } { "?" boolean } }\r
{ $description "Tests if " { $link fulfill } " has previously been called on the promise, in which case " { $link ?promise } " will return immediately without blocking." } ;\r
\r
HELP: ?promise-timeout\r
-USING: assocs cpu.x86.assembler help.markup help.syntax literals math
-multiline system words ;
+USING: assocs cpu.x86.assembler help.markup help.syntax kernel
+literals math multiline system words ;
IN: cpu.architecture
<<
{ $description "Maps any representation to its signed counterpart, if it has one." } ;
HELP: immediate-arithmetic?
-{ $values { "n" number } { "?" "a boolean" } }
+{ $values { "n" number } { "?" boolean } }
{ $description
"Can this value be an immediate operand for " { $link %add-imm } ", "
{ $link %sub-imm } ", or " { $link %mul-imm } "?"
{ $description "Parameter space to reserve in anything making VM calls." } ;
HELP: complex-addressing?
-{ $values { "?" "a boolean" } }
+{ $values { "?" boolean } }
{ $description "Specifies if " { $link %slot } ", " { $link %set-slot } " and " { $link %write-barrier } " accept the 'scale' and 'tag' parameters, and if %load-memory and %store-memory work." } ;
HELP: param-regs
{ $examples { $unchecked-example $[ ex-%box-alien ] } } ;
HELP: fused-unboxing?
-{ $values { "?" "a boolean" } }
+{ $values { "?" boolean } }
{ $description "Whether this architecture support " { $link %load-float } ", " { $link %load-double } ", and " { $link %load-vector } "." } ;
HELP: return-regs
-USING: help.syntax help.markup kernel prettyprint sequences
-io.pathnames strings ;
+USING: help.markup help.syntax io.pathnames quotations strings ;
IN: csv
HELP: read-row
HELP: with-delimiter
{ $values { "ch" "field delimiter (e.g. CHAR: \\t)" }
- { "quot" "a quotation" } }
+ { "quot" quotation } }
{ $description "Sets the field delimiter for read-csv, read-row, write-csv, or write-row words." } ;
ARTICLE: "csv" "Comma-separated-values parsing and writing"
{ $description "Advanced the pointer to an underlying SQL result set stored in a " { $link result-set } " object." } ;
HELP: more-rows?
-{ $values { "result-set" result-set } { "?" "a boolean" } }
+{ $values { "result-set" result-set } { "?" boolean } }
{ $description "Returns true if the " { $link result-set } " has more rows to traverse." } ;
HELP: in-transaction?
{ $values
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Returns true if there is currently a transaction in progress in this scope." } ;
HELP: query-each
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: classes hashtables help.markup help.syntax io.streams.string
-kernel sequences strings math ;
+USING: help.markup help.syntax kernel strings ;
IN: db.types
HELP: +db-assigned-id+
HELP: user-assigned-id-spec?
{ $values
{ "specs" "a sequence of SQL specs" }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Tests if any of the SQL specs has the type " { $link +user-assigned-id+ } "." } ;
HELP: bind#
HELP: db-assigned-id-spec?
{ $values
{ "specs" "a sequence of SQL specs" }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Tests if any of the SQL specs has the type " { $link +db-assigned-id+ } "." } ;
HELP: find-primary-key
HELP: primary-key?
{ $values
{ "spec" "a SQL spec" }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Returns true if a SQL spec is a primary key." } ;
HELP: relation?
{ $values
{ "spec" "a SQL spec" }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Returns true if a SQL spec is a relation." } ;
HELP: unknown-modifier
-USING: alien arrays generic generic.math help.markup help.syntax
-kernel math memory strings sbufs vectors io io.files classes
-help generic.single continuations io.files.private listener
-alien.libraries ;
+USING: alien alien.libraries arrays continuations generic.math
+generic.single help help.markup help.syntax io kernel math
+quotations sbufs strings vectors ;
IN: debugger
ARTICLE: "debugger" "The debugger"
{ $description "Prints the call stack at the time of the most recent error. Used for interactive debugging." } ;
HELP: :get
-{ $values { "variable" "an object" } { "value" "the value, or f" } }
+{ $values { "variable" object } { "value" "the value, or f" } }
{ $description "Looks up the value of a variable at the time of the most recent error." } ;
HELP: :res
{ $description "Print a list of restarts for the most recently thrown error to " { $link output-stream } "." } ;
HELP: try
-{ $values { "quot" "a quotation" } }
+{ $values { "quot" quotation } }
{ $description "Attempts to call a quotation; if it throws an error, the error is printed to " { $link output-stream } ", stacks are restored, and execution continues after the call to " { $link try } "." }
{ $examples
"The following example prints an error and keeps going:"
IN: deques
HELP: deque-empty?
-{ $values { "deque" deque } { "?" "a boolean" } }
+{ $values { "deque" deque } { "?" boolean } }
{ $contract "Returns true if a deque is empty." }
{ $notes "This operation is O(1)." } ;
HELP: deque-member?
{ $values
{ "value" object } { "deque" deque }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Returns true if the " { $snippet "value" } " is found in the deque." } ;
HELP: push-front
{ $description "Outputs the number of elements in the equivalence class of " { $snippet "a" } "." } ;
HELP: equiv?
-{ $values { "a" object } { "b" object } { "disjoint-set" disjoint-set } { "?" "a boolean" } }
+{ $values { "a" object } { "b" object } { "disjoint-set" disjoint-set } { "?" boolean } }
{ $description "Tests if two elements belong to the same equivalence class." } ;
HELP: equate
{ $description "Creates a new " { $link search-deque } " backed by a " { $link dlist } ", with a " { $link hashtable } " for fast membership tests." } ;
HELP: dlist-find
-{ $values { "dlist" { $link dlist } } { "quot" quotation } { "obj/f" "an object or " { $link f } } { "?" "a boolean" } }
+{ $values { "dlist" { $link dlist } } { "quot" quotation } { "obj/f" "an object or " { $link f } } { "?" boolean } }
{ $description "Applies the quotation to each element of the " { $link dlist } " in turn, until it outputs a true value or the end of the " { $link dlist } " is reached. Outputs either the object it found or " { $link f } ", and a boolean which is true if an object is found." }
{ $notes "Returns a boolean to allow dlists to store " { $link f } "."
$nl
{ $side-effects { "dlist" } } ;
HELP: dlist-any?
-{ $values { "dlist" { $link dlist } } { "quot" quotation } { "?" "a boolean" } }
+{ $values { "dlist" { $link dlist } } { "quot" quotation } { "?" boolean } }
{ $description "Just like " { $link dlist-find } " except it doesn't return the object." }
{ $notes "This operation is O(n)." } ;
HELP: delete-node-if*
-{ $values { "dlist" { $link dlist } } { "quot" quotation } { "obj/f" "an object or " { $link f } } { "?" "a boolean" } }
+{ $values { "dlist" { $link dlist } } { "quot" quotation } { "obj/f" "an object or " { $link f } } { "?" boolean } }
{ $description "Calls " { $link dlist-find } " on the " { $link dlist } " and deletes the node returned, if any. Returns the value of the deleted node and a boolean to allow the deleted value to distinguished from " { $link f } ", for nothing deleted." }
{ $notes "This operation is O(n)." } ;
-USING: help.markup help.syntax math models strings sequences ;
+USING: help.markup help.syntax kernel math models sequences
+strings ;
IN: documents
HELP: +col
{ $description "Sets the line number of a line/column pair." } ;
HELP: lines-equal?
-{ $values { "loc1" "a pair of integers" } { "loc2" "a pair of integers" } { "?" "a boolean" } }
+{ $values { "loc1" "a pair of integers" } { "loc2" "a pair of integers" } { "?" boolean } }
{ $description "Tests if both line/column pairs have the same line number." } ;
HELP: document
HELP: have-capabilities?
{ $values
{ "capabilities" "a sequence of capabilities" }
- { "?" "a boolean" }
+ { "?" boolean }
}
{ $description "Tests if the currently logged-in user possesses the given capabilities." } ;
{ $description "Adds a " { $snippet "deactivate-user" } " action to an authentication realm." } ;
HELP: allow-deactivation?
-{ $values { "?" "a boolean" } }
+{ $values { "?" boolean } }
{ $description "Outputs true if the current authentication realm allows user profile deactivation." } ;
ARTICLE: "furnace.auth.features.deactivate-user" "User profile deactivation"
{ $description "Adds an " { $snippet "edit-profile" } " action to an authentication realm." } ;
HELP: allow-edit-profile?
-{ $values { "?" "a boolean" } }
+{ $values { "?" boolean } }
{ $description "Outputs true if the current authentication realm allows user profile editing." } ;
ARTICLE: "furnace.auth.features.edit-profile" "User profile editing"
{ $description "Adds a " { $snippet "recover-password" } " action to an authentication realm." } ;
HELP: allow-password-recovery?
-{ $values { "?" "a boolean" } }
+{ $values { "?" boolean } }
{ $description "Outputs true if the current authentication realm allows user password recovery." } ;
HELP: lost-password-from
{ $description "Adds a " { $snippet "registration" } " action to an authentication realm." } ;
HELP: allow-registration?
-{ $values { "?" "a boolean" } }
+{ $values { "?" boolean } }
{ $description "Outputs true if the current authentication realm allows user registration." } ;
ARTICLE: "furnace.auth.features.registration" "User registration"
{ $description "Resolves a responder-relative template path." } ;
HELP: same-host?
-{ $values { "url" url } { "?" "a boolean" } }
+{ $values { "url" url } { "?" boolean } }
{ $description "Tests if the given URL is located on the same host as the URL of the current request." } ;
HELP: user-agent
{ $description "Closes the game input interface, releasing any allocated resources. Once this word is called, any remaining " { $link controller } " objects are invalid." } ;
HELP: game-input-opened?
-{ $values { "?" "a boolean" } }
+{ $values { "?" boolean } }
{ $description "Returns true if the game input interface is open, false otherwise." } ;
HELP: with-game-input
-USING: help.markup help.syntax sequences strings ;
+USING: help.markup help.syntax kernel sequences strings ;
IN: grouping
ARTICLE: "grouping" "Groups and clumps"
"New groups are created by calling " { $link <groups> } "." } ;
HELP: group
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "array" "a sequence of sequences" } }
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "array" "a sequence of sequences" } }
{ $description "Splits the sequence into disjoint groups of " { $snippet "n" } " elements and collects the groups into a new array." }
{ $notes "If the sequence length is not a multiple of " { $snippet "n" } ", the final subsequence in the list will be shorter than " { $snippet "n" } " elements." }
{ $examples
} ;
HELP: <groups>
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "groups" groups } }
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "groups" groups } }
{ $description "Outputs a virtual sequence whose elements are slices of disjoint subsequences of " { $snippet "n" } " elements from the underlying sequence." }
{ $examples
{ $example
"New clumps are created by calling " { $link <circular-clumps> } "." } ;
HELP: clump
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "array" "a sequence of sequences" } }
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "array" "a sequence of sequences" } }
{ $description "Splits the sequence into overlapping clumps of " { $snippet "n" } " elements and collects the clumps into a new array." }
{ $notes "For an empty sequence, the result is an empty sequence. For a non empty sequence with a length smaller than " { $snippet "n" } ", the result will be an empty sequence." }
{ $examples
} ;
HELP: circular-clump
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "array" "a sequence of sequences" } }
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "array" "a sequence of sequences" } }
{ $description "Splits the sequence into overlapping clumps of " { $snippet "n" } " elements, wrapping around the end of the sequence, and collects the clumps into a new array." }
{ $notes "For an empty sequence, the result is an empty sequence." }
{ $examples
} ;
HELP: <clumps>
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "clumps" clumps } }
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "clumps" clumps } }
{ $description "Outputs a virtual sequence whose elements are overlapping subsequences of " { $snippet "n" } " elements from the underlying sequence." }
{ $examples
"Running averages:"
} ;
HELP: <circular-clumps>
-{ $values { "seq" "a sequence" } { "n" "a non-negative integer" } { "clumps" clumps } }
+{ $values { "seq" sequence } { "n" "a non-negative integer" } { "clumps" clumps } }
{ $description "Outputs a virtual sequence whose elements are overlapping slices of " { $snippet "n" } " elements from the underlying sequence, starting with each of its elements and wrapping around the end of the sequence." }
{ $examples
{ $example
{ <clumps> <circular-clumps> <groups> } related-words
HELP: monotonic?
-{ $values { "seq" sequence } { "quot" { $quotation ( elt1 elt2 -- ? ) } } { "?" "a boolean" } }
+{ $values { "seq" sequence } { "quot" { $quotation ( elt1 elt2 -- ? ) } } { "?" boolean } }
{ $description "Applies the relation to successive pairs of elements in the sequence, testing for a truth value. The relation should be a transitive relation, such as a total order or an equality relation." }
{ $examples
"Testing if a sequence is non-decreasing:"
} ;
HELP: all-equal?
-{ $values { "seq" sequence } { "?" "a boolean" } }
+{ $values { "seq" sequence } { "?" boolean } }
{ $description "Tests if all elements in the sequence are equal. Yields true with an empty sequence." } ;
HELP: all-eq?
-{ $values { "seq" sequence } { "?" "a boolean" } }
+{ $values { "seq" sequence } { "?" boolean } }
{ $description "Tests if all elements in the sequence are the same identical object. Yields true with an empty sequence." } ;
{ monotonic? all-eq? all-equal? } related-words
{ $description "Create a new " { $link max-heap } "." } ;
HELP: heap-push
-{ $values { "value" object } { "key" "a comparable object" } { "heap" "a heap" } }
+{ $values { "value" object } { "key" "a comparable object" } { "heap" heap } }
{ $description "Push a pair onto a heap. The key must be comparable with all other keys by the " { $link <=> } " generic word." }
{ $side-effects "heap" } ;
HELP: heap-push*
-{ $values { "value" object } { "key" "a comparable object" } { "heap" "a heap" } { "entry" entry } }
+{ $values { "value" object } { "key" "a comparable object" } { "heap" heap } { "entry" entry } }
{ $description "Push a pair onto a heap, and output an entry which may later be passed to " { $link heap-delete } "." }
{ $side-effects "heap" } ;
HELP: heap-push-all
-{ $values { "assoc" assoc } { "heap" "a heap" } }
+{ $values { "assoc" assoc } { "heap" heap } }
{ $description "Push every key/value pair of an assoc onto a heap." }
{ $side-effects "heap" } ;
HELP: heap-peek
-{ $values { "heap" "a heap" } { "value" object } { "key" object } }
+{ $values { "heap" heap } { "value" object } { "key" object } }
{ $description "Output the first element in the heap, leaving it in the heap." } ;
HELP: heap-pop*
-{ $values { "heap" "a heap" } }
+{ $values { "heap" heap } }
{ $description "Remove the first element from the heap." }
{ $side-effects "heap" } ;
HELP: heap-pop
-{ $values { "heap" "a heap" } { "value" object } { "key" object } }
+{ $values { "heap" heap } { "value" object } { "key" object } }
{ $description "Output and remove the first element in the heap." }
{ $side-effects "heap" } ;
HELP: heap-empty?
-{ $values { "heap" "a heap" } { "?" "a boolean" } }
+{ $values { "heap" heap } { "?" boolean } }
{ $description "Tests if a heap has no nodes." } ;
HELP: heap-size
-{ $values { "heap" "a heap" } { "n" integer } }
+{ $values { "heap" heap } { "n" integer } }
{ $description "Returns the number of key/value pairs in the heap." } ;
HELP: heap-delete
-{ $values { "entry" entry } { "heap" "a heap" } }
+{ $values { "entry" entry } { "heap" heap } }
{ $description "Remove the specified entry from the heap." }
{ $errors "Throws an error if the entry is from another heap or if it has already been deleted." }
{ $side-effects "heap" } ;
HELP: slurp-heap
{ $values
- { "heap" "a heap" } { "quot" quotation } }
+ { "heap" heap } { "quot" quotation } }
{ $description "Removes values from a heap and processes them with the quotation until the heap is empty." } ;
-USING: help.markup help.crossref help.stylesheet help.topics
-help.syntax definitions io prettyprint summary arrays math
-sequences vocabs strings see ;
+USING: arrays help.crossref help.markup help.stylesheet
+help.syntax help.topics io kernel math prettyprint quotations
+see sequences strings summary vocabs ;
IN: help
ARTICLE: "printing-elements" "Printing markup elements"
{ $class-description "Class of simple elements, which are just arrays of elements." } ;
HELP: ($span)
-{ $values { "quot" "a quotation" } }
+{ $values { "quot" quotation } }
{ $description "Prints an inline markup element." } ;
HELP: ($block)
-{ $values { "quot" "a quotation" } }
+{ $values { "quot" quotation } }
{ $description "Prints a block markup element with newlines before and after." } ;
HELP: $heading
} ;
HELP: textual-list
-{ $values { "seq" "a sequence" } { "quot" { $quotation ( elt -- ) } } }
+{ $values { "seq" sequence } { "quot" { $quotation ( elt -- ) } } }
{ $description "Applies the quotation to each element of the sequence, printing a comma between each pair of elements." }
{ $examples
{ $example "USING: help.markup io namespaces ;" "last-element off" "{ \"fish\" \"chips\" \"salt\" } [ write ] textual-list" "fish, chips, salt" }
HELP: ARTICLE:
{ $syntax "ARTICLE: topic title content... ;" }
-{ $values { "topic" "an object" } { "title" "a string" } { "content" "markup elements" } }
+{ $values { "topic" object } { "title" string } { "content" "markup elements" } }
{ $description "Defines a help article. String topic names are reserved for core documentation. Contributed modules should name articles by arrays, where the first element of an array identifies the module; for example, " { $snippet "{ \"httpd\" \"intro\" }" } "." }
{ $examples
{ $code
] ?if ;
: $predicate ( element -- )
- { { "object" object } { "?" "a boolean" } } $values
+ { { "object" object } { "?" boolean } } $values
[
"Tests if the object is an instance of the " ,
first "predicating" word-prop <$link> ,
-USING: help.markup help.syntax help.crossref help io io.styles
-hashtables strings ;
+USING: help help.crossref help.markup help.syntax io.styles
+sequences strings words ;
IN: help.topics
HELP: articles
{ $description "Outputs the content of a specific help article." } ;
HELP: all-articles
-{ $values { "seq" "a sequence" } }
+{ $values { "seq" sequence } }
{ $description "Outputs a sequence of all help article names, and all words with documentation." } ;
HELP: elements
-{ $values { "elt-type" "a word" } { "element" "a markup element" } { "seq" "a new sequence" } }
+{ $values { "elt-type" word } { "element" "a markup element" } { "seq" "a new sequence" } }
{ $description "Outputs a sequence of all elements of type " { $snippet "elt-type" } " found by traversing " { $snippet "element" } "." } ;
HELP: collect-elements
+USING: assocs help.markup help.syntax kernel quotations strings
+;
IN: html.forms
-USING: help.markup help.syntax strings quotations kernel assocs ;
HELP: <form>
{ $values { "form" form } }
{ $notes "This word is used to implement the " { $snippet "t:bind-each" } " tag of the " { $vocab-link "html.templates.chloe" } " templating system. It can also be called directly from " { $vocab-link "html.templates.fhtml" } " templates." } ;
HELP: validation-failed?
-{ $values { "?" "a boolean" } }
+{ $values { "?" boolean } }
{ $description "Tests if validation of the current form failed." } ;
HELP: validate-values
-USING: help.markup help.syntax io.streams.string quotations strings urls
-http vocabs.refresh math io.servers assocs ;
+USING: assocs help.markup help.syntax http io.servers kernel
+math strings urls vocabs.refresh ;
IN: http.server
HELP: trivial-responder
{ $var-description "The responder which will handle HTTP requests." } ;
HELP: post-request?
-{ $values { "?" "a boolean" } }
+{ $values { "?" boolean } }
{ $description "Outputs if the current request is a POST request.s" } ;
HELP: responder-nesting
! Copyright (C) 2008, 2009 Daniel Ehrenberg.\r
! See http://factorcode.org/license.txt for BSD license.\r
-USING: help.markup help.syntax assocs kernel sequences ;\r
+USING: assocs help.markup help.syntax kernel sequences ;\r
IN: interval-maps\r
\r
HELP: interval-at*\r
{ $description "Looks up a key in an interval map, returning the value of the corresponding interval, or f if the interval is not present in the map." } ;\r
\r
HELP: interval-key?\r
-{ $values { "key" object } { "map" interval-map } { "?" "a boolean" } }\r
+{ $values { "key" object } { "map" interval-map } { "?" boolean } }\r
{ $description "Tests whether an object is in an interval in the interval map, returning t if the object is present." } ;\r
\r
HELP: <interval-map>\r
-USING: help.syntax help.markup ;
+USING: help.markup help.syntax kernel quotations words ;
IN: inverse
HELP: [undo]
-{ $values { "quot" "a quotation" } { "undo" "the inverse of the quotation" } }
+{ $values { "quot" quotation } { "undo" "the inverse of the quotation" } }
{ $description "Creates the inverse of the given quotation" }
{ $see-also undo } ;
HELP: undo
-{ $values { "quot" "a quotation" } }
+{ $values { "quot" quotation } }
{ $description "Executes the inverse of the given quotation" }
{ $see-also [undo] } ;
HELP: define-inverse
-{ $values { "word" "a word" } { "quot" "the inverse" } }
+{ $values { "word" word } { "quot" "the inverse" } }
{ $description "Defines the inverse of a given word, taking no arguments from the quotation, only the stack." }
{ $see-also define-dual define-involution define-pop-inverse } ;
HELP: define-dual
-{ $values { "word1" "a word" } { "word2" "a word" } }
+{ $values { "word1" word } { "word2" word } }
{ $description "Defines the inverse of each word as being the other one." }
{ $see-also define-inverse define-involution } ;
HELP: define-involution
-{ $values { "word" "a word" } }
+{ $values { "word" word } }
{ $description "Defines a word as being its own inverse." }
{ $see-also define-dual define-inverse } ;
HELP: define-pop-inverse
-{ $values { "word" "a word" } { "n" "number of arguments to be taken from the inverted quotation" } { "quot" "a quotation" } }
+{ $values { "word" word } { "n" "number of arguments to be taken from the inverted quotation" } { "quot" quotation } }
{ $description "Defines the inverse of the given word, taking the given number of arguments from the inverted quotation. The quotation given should generate an inverse quotation." }
{ $see-also define-inverse } ;
HELP: matches?
-{ $values { "quot" "a quotation" } { "?" "a boolean" } }
+{ $values { "quot" quotation } { "?" boolean } }
{ $description "Tests if the stack can match the given quotation. The quotation is inverted, and if the inverse can run without a unification failure, then t is returned. Else f is returned. If a different error is encountered (such as stack underflow), this will be propagated." } ;
HELP: switch
-USING: help.markup help.syntax byte-arrays alien destructors ;
+USING: alien byte-arrays destructors help.markup help.syntax
+kernel ;
IN: io.buffers
ARTICLE: "buffers" "Locked I/O buffers"
} ;
HELP: buffer-empty?
-{ $values { "buffer" buffer } { "?" "a boolean" } }
+{ $values { "buffer" buffer } { "?" boolean } }
{ $description "Tests if the buffer contains no more data to be read or written." } ;
HELP: >buffer
{ file-info link-info } related-words
HELP: directory?
-{ $values { "file-info" file-info } { "?" "a boolean" } }
+{ $values { "file-info" file-info } { "?" boolean } }
{ $description "Tests if " { $snippet "file-info" } " is a directory." } ;
HELP: regular-file?
-{ $values { "file-info" file-info } { "?" "a boolean" } }
+{ $values { "file-info" file-info } { "?" boolean } }
{ $description "Tests if " { $snippet "file-info" } " is a normal file." } ;
HELP: symbolic-link?
-{ $values { "file-info" file-info } { "?" "a boolean" } }
+{ $values { "file-info" file-info } { "?" boolean } }
{ $description "Tests if " { $snippet "file-info" } " is a symbolic link." } ;
HELP: file-systems
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: classes help.markup help.syntax io.streams.string
-strings math calendar io.files.info io.files.info.unix ;
+USING: calendar help.markup help.syntax io.files.info kernel
+math strings ;
IN: io.files.info.unix
HELP: add-file-permissions
HELP: group-execute?
{ $values
{ "obj" "a pathname string or an integer" }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Tests whether the " { $snippet "group execute" } " bit is set on a file, " { $link file-info } ", or an integer." } ;
HELP: group-read?
{ $values
{ "obj" "a pathname string, file-info object, or an integer" }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Tests whether the " { $snippet "group read" } " bit is set on a file, " { $link file-info } ", or an integer." } ;
HELP: group-write?
{ $values
{ "obj" "a pathname string, file-info object, or an integer" }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Tests whether the " { $snippet "group write" } " bit is set on a file, " { $link file-info } ", or an integer." } ;
HELP: other-execute?
{ $values
{ "obj" "a pathname string, file-info object, or an integer" }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Tests whether the " { $snippet "other execute" } " bit is set on a file, " { $link file-info } ", or an integer." } ;
HELP: other-read?
{ $values
{ "obj" "a pathname string, file-info object, or an integer" }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Tests whether the " { $snippet "other read" } " bit is set on a file, " { $link file-info } ", or an integer." } ;
HELP: other-write?
{ $values
{ "obj" "a pathname string, file-info object, or an integer" }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Tests whether the " { $snippet "other write" } " bit is set on a file, " { $link file-info } ", or an integer." } ;
HELP: set-file-access-time
HELP: set-gid
{ $values
- { "path" "a pathname string" } { "?" "a boolean" } }
+ { "path" "a pathname string" } { "?" boolean } }
{ $description "Sets the " { $snippet "gid" } " bit of a file to true or false." } ;
HELP: gid?
{ $values
{ "obj" "a pathname string, file-info object, or an integer" }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Tests whether the " { $snippet "gid" } " bit is set on a file, " { $link file-info } ", or an integer." } ;
HELP: set-group-execute
{ $values
- { "path" "a pathname string" } { "?" "a boolean" } }
+ { "path" "a pathname string" } { "?" boolean } }
{ $description "Sets the " { $snippet "group execute" } " bit of a file to true or false." } ;
HELP: set-group-read
{ $values
- { "path" "a pathname string" } { "?" "a boolean" } }
+ { "path" "a pathname string" } { "?" boolean } }
{ $description "Sets the " { $snippet "group read" } " bit of a file to true or false." } ;
HELP: set-group-write
{ $values
- { "path" "a pathname string" } { "?" "a boolean" } }
+ { "path" "a pathname string" } { "?" boolean } }
{ $description "Sets the " { $snippet "group write" } " bit of a file to true or false." } ;
HELP: set-other-execute
{ $values
- { "path" "a pathname string" } { "?" "a boolean" } }
+ { "path" "a pathname string" } { "?" boolean } }
{ $description "Sets the " { $snippet "other execute" } " bit of a file to true or false." } ;
HELP: set-other-read
{ $values
- { "path" "a pathname string" } { "?" "a boolean" } }
+ { "path" "a pathname string" } { "?" boolean } }
{ $description "Sets the " { $snippet "other read" } " bit of a file to true or false." } ;
HELP: set-other-write
{ $values
- { "path" "a pathname string" } { "?" "a boolean" } }
+ { "path" "a pathname string" } { "?" boolean } }
{ $description "Sets the " { $snippet "other execute" } " bit of a file to true or false." } ;
HELP: set-sticky
{ $values
- { "path" "a pathname string" } { "?" "a boolean" } }
+ { "path" "a pathname string" } { "?" boolean } }
{ $description "Sets the " { $snippet "sticky" } " bit of a file to true or false." } ;
HELP: sticky?
{ $values
{ "obj" "a pathname string, file-info object, or an integer" }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Tests whether the " { $snippet "sticky" } " bit is set on a file, " { $link file-info } ", or an integer." } ;
HELP: set-uid
{ $values
- { "path" "a pathname string" } { "?" "a boolean" } }
+ { "path" "a pathname string" } { "?" boolean } }
{ $description "Sets the " { $snippet "uid" } " bit of a file to true or false." } ;
HELP: uid?
{ $values
{ "obj" "a pathname string, file-info object, or an integer" }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Tests whether the " { $snippet "uid" } " bit is set on a file, " { $link file-info } ", or an integer." } ;
HELP: set-user-execute
{ $values
- { "path" "a pathname string" } { "?" "a boolean" } }
+ { "path" "a pathname string" } { "?" boolean } }
{ $description "Sets the " { $snippet "user execute" } " bit of a file to true or false." } ;
HELP: set-user-read
{ $values
- { "path" "a pathname string" } { "?" "a boolean" } }
+ { "path" "a pathname string" } { "?" boolean } }
{ $description "Sets the " { $snippet "user read" } " bit of a file to true or false." } ;
HELP: set-user-write
{ $values
- { "path" "a pathname string" } { "?" "a boolean" } }
+ { "path" "a pathname string" } { "?" boolean } }
{ $description "Sets the " { $snippet "user write" } " bit of a file to true or false." } ;
HELP: user-execute?
{ $values
{ "obj" "a pathname string, file-info object, or an integer" }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Tests whether the " { $snippet "user execute" } " bit is set on a file, " { $link file-info } ", or an integer." } ;
HELP: user-read?
{ $values
{ "obj" "a pathname string, file-info object, or an integer" }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Tests whether the " { $snippet "user read" } " bit is set on a file, " { $link file-info } ", or an integer." } ;
HELP: user-write?
{ $values
{ "obj" "a pathname string, file-info object, or an integer" }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Tests whether the " { $snippet "user write" } " bit is set on a file, " { $link file-info } ", or an integer." } ;
ARTICLE: "unix-file-permissions" "Unix file permissions"
-USING: help.markup help.syntax io io.ports kernel math
-io.pathnames io.directories math.parser io.files strings
-quotations io.files.unique.private ;
+USING: help.markup help.syntax quotations strings ;
IN: io.files.unique
HELP: default-temporary-directory
{ unique-length unique-retries } related-words
HELP: make-unique-file
-{ $values { "prefix" "a string" } { "suffix" "a string" }
+{ $values { "prefix" string } { "suffix" string }
{ "path" "a pathname string" } }
{ $description "Creates a file that is guaranteed not to exist in the directory stored in " { $link current-temporary-directory } ". The file name is composed of a prefix, a number of random digits and letters, and the suffix. Returns the full pathname." }
{ $errors "Throws an error if a new unique file cannot be created after a number of tries. The most likely error is incorrect directory permissions on the temporary directory." } ;
{ unique-file make-unique-file cleanup-unique-file } related-words
HELP: cleanup-unique-file
-{ $values { "prefix" "a string" } { "suffix" "a string" }
-{ "quot" "a quotation" } }
+{ $values { "prefix" string } { "suffix" string }
+{ "quot" quotation } }
{ $description "Creates a file with " { $link make-unique-file } " and calls the quotation with the path name on the stack." }
{ $notes "The unique file will be deleted after calling this word." } ;
{ $errors "Throws an error if the directory cannot be created after a number of tries. The most likely error is incorrect directory permissions on the temporary directory." } ;
HELP: cleanup-unique-directory
-{ $values { "quot" "a quotation" } }
+{ $values { "quot" quotation } }
{ $description "Creates a directory with " { $link unique-directory } " and calls the quotation with the pathname on the stack using the " { $link with-temporary-directory } " combinator. The quotation can access the " { $link current-temporary-directory } " symbol for the name of the temporary directory. Subsequent unique files will be created in this unique directory until the combinator returns." }
{ $notes "The directory will be deleted after calling this word, even if an error is thrown in the quotation. This combinator is like " { $link with-unique-directory } " but does not delete the directory." } ;
IN: io.monitors\r
-USING: help.markup help.syntax continuations destructors\r
-concurrency.mailboxes quotations ;\r
+USING: concurrency.mailboxes destructors help.markup help.syntax\r
+kernel quotations ;\r
\r
HELP: with-monitors\r
{ $values { "quot" quotation } }\r
{ $errors "Throws an error if the platform does not support file system change monitors." } ;\r
\r
HELP: <monitor>\r
-{ $values { "path" "a pathname string" } { "recursive?" "a boolean" } { "monitor" "a new monitor" } }\r
+{ $values { "path" "a pathname string" } { "recursive?" boolean } { "monitor" "a new monitor" } }\r
{ $contract "Opens a file system change monitor which listens for changes on " { $snippet "path" } ". The boolean indicates whether changes in subdirectories should be reported." }\r
{ $errors "Throws an error if the pathname does not exist, if a monitor could not be created or if the platform does not support monitors." } ;\r
\r
HELP: (monitor)\r
-{ $values { "path" "a pathname string" } { "recursive?" "a boolean" } { "mailbox" mailbox } { "monitor" "a new monitor" } }\r
+{ $values { "path" "a pathname string" } { "recursive?" boolean } { "mailbox" mailbox } { "monitor" "a new monitor" } }\r
{ $contract "Opens a file system change monitor which listens for changes on " { $snippet "path" } " and posts notifications to " { $snippet "mailbox" } " as triples with shape " { $snippet "{ path changed monitor } " } ". The boolean indicates whether changes in subdirectories should be reported." }\r
{ $errors "Throws an error if the pathname does not exist, if a monitor could not be created or if the platform does not support monitors." } ;\r
\r
{ $errors "Throws an error if the monitor is closed from another thread." } ;\r
\r
HELP: with-monitor\r
-{ $values { "path" "a pathname string" } { "recursive?" "a boolean" } { "quot" { $quotation ( monitor -- ) } } }\r
+{ $values { "path" "a pathname string" } { "recursive?" boolean } { "quot" { $quotation ( monitor -- ) } } }\r
{ $description "Opens a file system change monitor and passes it to the quotation. Closes the monitor after the quotation returns or throws an error." }\r
{ $errors "Throws an error if the pathname does not exist, if a monitor could not be created or if the platform does not support monitors." } ;\r
\r
{ $contract "Suspends the current thread until the port's buffer has data available for reading." } ;
HELP: wait-to-read
-{ $values { "port" input-port } { "eof?" "a boolean" } }
+{ $values { "port" input-port } { "eof?" boolean } }
{ $description "If the port's buffer has unread data, returns immediately, otherwise suspends the current thread until some data is available for reading. If the buffer was empty and no more data could be read, outputs " { $link t } " to indicate end-of-file; otherwise outputs " { $link f } "." } ;
} ;
HELP: write-object
-{ $values { "str" string } { "obj" "an object" } }
+{ $values { "str" string } { "obj" object } }
{ $description "Writes a string to " { $link output-stream } ", associating it with the object. If formatted output is supported, the string will become a clickable presentation of the object, otherwise this word behaves like a call to " { $link write } "." }
$io-error ;
IN: json.writer
HELP: >json
-{ $values { "obj" "an object" } { "string" "the object converted to JSON format" } }
+{ $values { "obj" object } { "string" "the object converted to JSON format" } }
{ $description "Serializes the object into a JSON formatted string." }
{ $see-also json-print } ;
HELP: json-print
-{ $values { "obj" "an object" } }
+{ $values { "obj" object } }
{ $description "Serializes the object into a JSON formatted string and outputs it to the standard output stream.
By default, tuples and hashtables are serialized into Javascript-friendly JSON formatted output by converting keys containing dashes into underscores. This behaviour can be modified by setting the dynamic variable " { $strong "jsvar-encode?" } " to false." }
-USING: help.syntax help.markup ;\r
+USING: help.syntax help.markup sequences ;\r
IN: lcs\r
\r
HELP: levenshtein\r
-{ $values { "old" "a sequence" } { "new" "a sequence" } { "n" "the Levenshtein distance" } }\r
+{ $values { "old" sequence } { "new" sequence } { "n" "the Levenshtein distance" } }\r
{ $description "Calculates the Levenshtein distance between old and new, that is, the minimal number of changes from the old sequence to the new one, in terms of deleting, inserting and replacing characters." } ;\r
\r
HELP: lcs\r
-{ $values { "seq1" "a sequence" } { "seq2" "a sequence" } { "lcs" "a longest common subsequence" } }\r
+{ $values { "seq1" sequence } { "seq2" sequence } { "lcs" "a longest common subsequence" } }\r
{ $description "Given two sequences, calculates a longest common subsequence between them. Note two things: this is only one of the many possible LCSs, and the LCS may not be contiguous." } ;\r
\r
HELP: diff\r
-{ $values { "old" "a sequence" } { "new" "a sequence" } { "diff" "an edit script" } }\r
+{ $values { "old" sequence } { "new" sequence } { "diff" "an edit script" } }\r
{ $description "Given two sequences, find a minimal edit script from the old to the new. There may be more than one minimal edit script, and this chooses one arbitrarily. This script is in the form of an array of the tuples of the classes " { $link retain } ", " { $link delete } " and " { $link insert } " which have their information stored in the 'item' slot." } ;\r
\r
HELP: retain\r
! Copyright (C) 2006 Chris Double.
! See http://factorcode.org/license.txt for BSD license.
-USING: help.markup help.syntax sequences strings lists ;
-IN: lists.lazy
+USING: help.markup help.syntax kernel lists math sequences
+strings ;
+IN: lists.lazy
ABOUT: "lists.lazy"
{ $description "Perform a similar functionality to that of the " { $link append } " word, but in a lazy manner. No evaluation of the list elements occurs initially but a " { $link <lazy-append> } " object is returned which conforms to the list protocol. Calling " { $link car } ", " { $link cdr } " or " { $link nil? } " on this will evaluate elements as required. Successive calls to " { $link cdr } " will iterate through list1, followed by list2." } ;
HELP: lfrom-by
-{ $values { "n" "an integer" } { "quot" { $quotation ( n -- o ) } } { "lazy-from-by" "a lazy list of integers" } }
+{ $values { "n" integer } { "quot" { $quotation ( n -- o ) } } { "lazy-from-by" "a lazy list of integers" } }
{ $description "Return an infinite lazy list of values starting from n, with each successive value being the result of applying quot to the previous value." } ;
HELP: lfrom
-{ $values { "n" "an integer" } { "list" "a lazy list of integers" } }
+{ $values { "n" integer } { "list" "a lazy list of integers" } }
{ $description "Return an infinite lazy list of incrementing integers starting from n." } ;
HELP: sequence-tail>list
-{ $values { "index" "an integer 0 or greater" } { "seq" "a sequence" } { "list" "a list" } }
+{ $values { "index" "an integer 0 or greater" } { "seq" sequence } { "list" "a list" } }
{ $description "Convert the sequence into a list, starting from " { $snippet "index" } "." }
{ $see-also >list } ;
HELP: >list
-{ $values { "object" "an object" } { "list" "a list" } }
+{ $values { "object" object } { "list" "a list" } }
{ $description "Convert the object into a list. Existing lists are passed through intact, sequences are converted using " { $link sequence-tail>list } " and other objects cause an error to be thrown." }
{ $see-also sequence-tail>list } ;
-
+
{ leach foldl lazy-map ltake lfilter lappend lfrom lfrom-by lconcat lcartesian-product lcartesian-product* lcomp lcomp* lmerge lwhile luntil } related-words
HELP: lconcat
{ $description "Returns a symbol representing the empty list" } ;
HELP: nil?
-{ $values { "object" object } { "?" "a boolean" } }
+{ $values { "object" object } { "?" boolean } }
{ $description "Return true if the cons object is the nil cons." } ;
{ nil nil? } related-words
{ 1list 2list 3list } related-words
HELP: 1list
-{ $values { "obj" "an object" } { "cons" list } }
+{ $values { "obj" object } { "cons" list } }
{ $description "Create a list with 1 element." } ;
HELP: 2list
-{ $values { "a" "an object" } { "b" "an object" } { "cons" list } }
+{ $values { "a" object } { "b" object } { "cons" list } }
{ $description "Create a list with 2 elements." } ;
HELP: 3list
-{ $values { "a" "an object" } { "b" "an object" } { "c" "an object" } { "cons" list } }
+{ $values { "a" object } { "b" object } { "c" object } { "cons" list } }
{ $description "Create a list with 3 elements." } ;
HELP: lnth
{ $description "Call the quotation for each item in the list." } ;
HELP: foldl
-{ $values { "list" list } { "identity" "an object" } { "quot" { $quotation ( ... prev elt -- ... next ) } } { "result" "the final result" } }
+{ $values { "list" list } { "identity" object } { "quot" { $quotation ( ... prev elt -- ... next ) } } { "result" "the final result" } }
{ $description "Combines successive elements of the list (in a left-associative order) using a binary operation and outputs the final result." } ;
HELP: foldr
-{ $values { "list" list } { "identity" "an object" } { "quot" { $quotation ( ... prev elt -- ... next ) } } { "result" "the final result" } }
+{ $values { "list" list } { "identity" object } { "quot" { $quotation ( ... prev elt -- ... next ) } } { "result" "the final result" } }
{ $description "Combines successive elements of the list (in a right-associative order) using a binary operation, and outputs the final result." } ;
HELP: lmap
HELP: mask?
{ $values
{ "x" integer } { "n" integer }
- { "?" "a boolean" }
+ { "?" boolean }
}
{ $description "Returns true if all of the bits in the mask " { $snippet "n" } " are set in the integer input " { $snippet "x" } "." }
{ $examples
HELP: unmask?
{ $values
{ "x" integer } { "n" integer }
- { "?" "a boolean" }
+ { "?" boolean }
}
{ $description "Tests whether unmasking the bits in " { $snippet "x" } " would return an integer greater than zero." }
{ $examples
{ $description "Converts an absolute value and argument (polar form) to a complex number." } ;
HELP: [-1,1]?
-{ $values { "x" number } { "?" "a boolean" } }
+{ $values { "x" number } { "?" boolean } }
{ $description "Tests if " { $snippet "x" } " is a real number between -1 and 1, inclusive." } ;
HELP: abs
{ $notes "If " { $snippet "d" } " is 1, then " { $snippet "a" } " is the inverse of " { $snippet "y" } " modulo " { $snippet "x" } "." } ;
HELP: divisor?
-{ $values { "m" integer } { "n" integer } { "?" "a boolean" } }
+{ $values { "m" integer } { "n" integer } { "?" boolean } }
{ $description "Tests if " { $snippet "n" } " is a divisor of " { $snippet "m" } ". This is the same thing as asking if " { $snippet "m" } " is divisible by " { $snippet "n" } "." }
{ $notes "Returns t for both negative and positive divisors, as well as for trivial and non-trivial divisors." } ;
{ $description "Outputs the result of computing " { $snippet "x^y mod n" } "." } ;
HELP: ~
-{ $values { "x" real } { "y" real } { "epsilon" real } { "?" "a boolean" } }
+{ $values { "x" real } { "y" real } { "epsilon" real } { "?" boolean } }
{ $description "Tests if " { $snippet "x" } " and " { $snippet "y" } " are approximately equal to each other. There are three possible comparison tests, chosen based on the sign of " { $snippet "epsilon" } ":"
{ $list
{ { $snippet "epsilon" } " is zero: exact comparison." }
-USING: help.markup help.syntax math math.order ;
+USING: help.markup help.syntax kernel math math.order ;
IN: math.intervals
ARTICLE: "math-intervals-new" "Creating intervals"
{ $description "Integer-valued Base-2 logarithm of an interval." } ;
HELP: interval-intersect
-{ $values { "i1" interval } { "i2" interval } { "i3" "an " { $link interval } " or " { $link f } } }
+{ $values { "i1" interval } { "i2" interval } { "i3" { $maybe interval } } }
{ $description "Outputs the set-theoretic intersection of " { $snippet "i1" } " and " { $snippet "i2" } ". If " { $snippet "i1" } " and " { $snippet "i2" } " do not intersect, outputs " { $link f } "." } ;
HELP: interval-union
{ $description "Outputs the smallest interval containing the set-theoretic union of " { $snippet "i1" } " and " { $snippet "i2" } " (the union itself may not be an interval)." } ;
HELP: interval-subset?
-{ $values { "i1" interval } { "i2" interval } { "?" "a boolean" } }
+{ $values { "i1" interval } { "i2" interval } { "?" boolean } }
{ $description "Tests if every point of " { $snippet "i1" } " is contained in " { $snippet "i2" } "." } ;
HELP: interval-contains?
-{ $values { "x" real } { "int" interval } { "?" "a boolean" } }
+{ $values { "x" real } { "int" interval } { "?" boolean } }
{ $description "Tests if " { $snippet "x" } " is contained in " { $snippet "int" } "." } ;
HELP: interval-closure
{ $description "Outputs the interval consisting of points from " { $snippet "i1" } " which are less or equal to all points in " { $snippet "i2" } "." } ;
HELP: assume>
-{ $values { "i1" interval } { "i2" interval } { "i3" "an " { $link interval } " or " { $link f } } }
+{ $values { "i1" interval } { "i2" interval } { "i3" { $maybe interval } } }
{ $description "Outputs the interval consisting of points from " { $snippet "i1" } " which are greater than all points in " { $snippet "i2" } ". If the resulting interval is empty, outputs " { $link f } "." } ;
HELP: assume>=
-USING: help.markup help.syntax math sequences ;
+USING: help.markup help.syntax kernel math sequences ;
IN: math.polynomials
ARTICLE: "polynomials" "Polynomials"
{ $examples { $example "USING: math.polynomials prettyprint ;" "4 2 powers ." "{ 1 2 4 8 }" } } ;
HELP: p=
-{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "?" "a boolean" } }
+{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "?" boolean } }
{ $description "Tests if two polynomials are equal." }
{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 0 1 } { 0 1 0 } p= ." "t" } } ;
HELP: lucas-lehmer
{ $values
{ "p" "a prime number" }
- { "?" "a boolean" }
+ { "?" boolean }
}
{ $description "Runs the Lucas-Lehmer test on the prime " { $snippet "p" } " and returns " { $link t } " if " { $snippet "(2 ^ p) - 1" } " is prime." }
{ $examples
HELP: miller-rabin
{ $values
{ "n" integer }
- { "?" "a boolean" }
+ { "?" boolean }
}
{ $description "Returns true if the number is a prime. Calls " { $link miller-rabin* } " with a default of 10 Miller-Rabin tests." } ;
HELP: miller-rabin*
{ $values
{ "n" integer } { "numtrials" integer }
- { "?" "a boolean" }
+ { "?" boolean }
}
{ $description "Performs " { $snippet "numtrials" } " trials of the Miller-Rabin probabilistic primality test algorithm and returns true if prime." } ;
-USING: help.markup help.syntax math sequences ;
+USING: help.markup help.syntax kernel math sequences ;
IN: math.primes
{ next-prime prime? } related-words
{ $description "Return the next prime number greater than " { $snippet "n" } "." } ;
HELP: prime?
-{ $values { "n" "an integer" } { "?" "a boolean" } }
+{ $values { "n" integer } { "?" boolean } }
{ $description "Test if an integer is a prime number." } ;
{ nprimes primes-upto primes-between } related-words
HELP: nprimes
-{ $values { "n" "a non-negative integer" } { "seq" "a sequence" } }
+{ $values { "n" "a non-negative integer" } { "seq" sequence } }
{ $description "Return a sequence containing the " { $snippet "n" } " first primes numbers." } ;
HELP: primes-upto
-{ $values { "n" "an integer" } { "seq" "a sequence" } }
+{ $values { "n" integer } { "seq" sequence } }
{ $description "Return a sequence containing all the prime numbers smaller or equal to " { $snippet "n" } "." } ;
HELP: primes-between
-{ $values { "low" "an integer" } { "high" "an integer" } { "seq" "a sequence" } }
+{ $values { "low" integer } { "high" integer } { "seq" sequence } }
{ $description "Return a sequence containing all the prime numbers between " { $snippet "low" } " and " { $snippet "high" } "." } ;
HELP: find-relative-prime
! Copyright (C) 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: combinators.short-circuit help.markup help.syntax kernel
-math math.functions math.primes random ;
+USING: help.markup help.syntax kernel math ;
IN: math.primes.safe
HELP: next-safe-prime
HELP: safe-prime?
{ $values
{ "q" integer }
- { "?" "a boolean" }
+ { "?" boolean }
}
{ $description "Tests whether the number is a safe prime. A safe prime " { $snippet "p" } " must be prime, as must " { $snippet "(p - 1) / 2" } "." } ;
-USING: help.markup help.syntax ;
+USING: help.markup help.syntax kernel ;
IN: math.rectangles
HELP: rect
{ $description "Computes the intersection of two rectangles." } ;
HELP: contains-rect?
-{ $values { "rect1" rect } { "rect2" rect } { "?" "a boolean" } }
+{ $values { "rect1" rect } { "rect2" rect } { "?" boolean } }
{ $description "Tests if two rectangles have a non-empty intersection." } ;
HELP: contains-point?
-{ $values { "point" "a pair of integers" } { "rect" rect } { "?" "a boolean" } }
+{ $values { "point" "a pair of integers" } { "rect" rect } { "?" boolean } }
{ $description "Tests if a rectangle contains a point." } ;
HELP: <zero-rect>
-USING: help.markup help.syntax math math.functions sequences ;
+USING: help.markup help.syntax kernel math math.functions
+sequences ;
IN: math.vectors
ARTICLE: "math-vectors-arithmetic" "Vector arithmetic"
{ $description "Shifts the entire SIMD array to the right by " { $snippet "n" } " bytes, filling the vacated left-hand bits with zeroes. This word may only be used in a context where the compiler can statically infer that the input is a SIMD array." } ;
HELP: vmerge
-{ $values { "u" "a sequence" } { "v" "a sequence" } { "w" "a sequence" } }
+{ $values { "u" sequence } { "v" sequence } { "w" sequence } }
{ $description "Creates a new sequence of the same type as and twice the length of " { $snippet "u" } " and " { $snippet "v" } " by interleaving the elements of " { $snippet "u" } " and " { $snippet "v" } "." }
{ $examples
{ $example """USING: kernel math.vectors prettyprint ;
} } ;
HELP: (vmerge)
-{ $values { "u" "a sequence" } { "v" "a sequence" } { "h" "a sequence" } { "t" "a sequence" } }
+{ $values { "u" sequence } { "v" sequence } { "h" sequence } { "t" sequence } }
{ $description "Creates two new sequences of the same type and size as " { $snippet "u" } " and " { $snippet "v" } " by interleaving the elements of " { $snippet "u" } " and " { $snippet "v" } "." }
{ $notes "For hardware-supported SIMD vector types this word compiles to a single instruction per output value." }
{ $examples
} } ;
HELP: (vmerge-head)
-{ $values { "u" "a sequence" } { "v" "a sequence" } { "h" "a sequence" } }
+{ $values { "u" sequence } { "v" sequence } { "h" sequence } }
{ $description "Creates a new sequence of the same type and size as " { $snippet "u" } " and " { $snippet "v" } " by interleaving the elements from the first half of " { $snippet "u" } " and " { $snippet "v" } "." }
{ $notes "For hardware-supported SIMD vector types this word compiles to a single instruction." }
{ $examples
} } ;
HELP: (vmerge-tail)
-{ $values { "u" "a sequence" } { "v" "a sequence" } { "t" "a sequence" } }
+{ $values { "u" sequence } { "v" sequence } { "t" sequence } }
{ $description "Creates a new sequence of the same type and size as " { $snippet "u" } " and " { $snippet "v" } " by interleaving the elements from the tail half of " { $snippet "u" } " and " { $snippet "v" } "." }
{ $notes "For hardware-supported SIMD vector types this word compiles to a single instruction." }
{ $examples
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean inputs and results when using SIMD types." } ;
HELP: vif
-{ $values { "mask" "a sequence of booleans" } { "true-quot" { $quotation ( -- vector ) } } { "false-quot" { $quotation ( -- vector ) } } { "result" "a sequence" } }
+{ $values { "mask" "a sequence of booleans" } { "true-quot" { $quotation ( -- vector ) } } { "false-quot" { $quotation ( -- vector ) } } { "result" sequence } }
{ $description "If all of the elements of " { $snippet "mask" } " are true, " { $snippet "true-quot" } " is called and its output value returned. If all of the elements of " { $snippet "mask" } " are false, " { $snippet "false-quot" } " is called and its output value returned. Otherwise, both quotations are called and " { $snippet "mask" } " is used to select elements from each output as with " { $link v? } "." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean inputs and results when using SIMD types."
$nl
{ v? vif } related-words
HELP: vany?
-{ $values { "v" "a sequence of booleans" } { "?" "a boolean" } }
+{ $values { "v" "a sequence of booleans" } { "?" boolean } }
{ $description "Returns true if any element of " { $snippet "v" } " is true." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean inputs when using SIMD types." } ;
HELP: vall?
-{ $values { "v" "a sequence of booleans" } { "?" "a boolean" } }
+{ $values { "v" "a sequence of booleans" } { "?" boolean } }
{ $description "Returns true if every element of " { $snippet "v" } " is true." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean inputs when using SIMD types." } ;
HELP: vnone?
-{ $values { "v" "a sequence of booleans" } { "?" "a boolean" } }
+{ $values { "v" "a sequence of booleans" } { "?" boolean } }
{ $description "Returns true if every element of " { $snippet "v" } " is false." }
{ $notes "See " { $link "math-vectors-simd-logic" } " for notes on dealing with vector boolean inputs when using SIMD types." } ;
{ $description "Wrapper for " { $snippet "GL_VERSION glGetString" } " that returns only the vendor-specific information from the version string." } ;
HELP: has-gl-version?
-{ $values { "version" "A version string" } { "?" "A boolean value" } }
+{ $values { "version" "A version string" } { "?" boolean } }
{ $description "Compares the version string returned by " { $link gl-version } " to " { $snippet "version" } ". Returns true if the implementation version meets or exceeds " { $snippet "version" } "." } ;
HELP: require-gl-version
{ $description "Wrapper for " { $snippet "GL_SHADING_LANGUAGE_VERSION glGetString" } " that returns only the vendor-specific information from the version string." } ;
HELP: has-glsl-version?
-{ $values { "version" "A version string" } { "?" "A boolean value" } }
+{ $values { "version" "A version string" } { "?" boolean } }
{ $description "Compares the version string returned by " { $link glsl-version } " to " { $snippet "version" } ". Returns true if the implementation version meets or exceeds " { $snippet "version" } "." } ;
HELP: require-glsl-version
{ $description "Wrapper for " { $snippet "GL_EXTENSIONS glGetString" } " that returns a sequence of extension names supported by the OpenGL implementation." } ;
HELP: has-gl-extensions?
-{ $values { "extensions" "A sequence of extension name strings" } { "?" "A boolean value" } }
+{ $values { "extensions" "A sequence of extension name strings" } { "?" boolean } }
{ $description "Returns true if the set of " { $snippet "extensions" } " is a subset of the implementation-supported extensions returned by " { $link gl-extensions } ". Elements of " { $snippet "extensions" } " can be sequences, in which case true will be returned if any one of the extensions in the subsequence are available." }
{ $examples "Testing for framebuffer object and pixel buffer support:"
{ $code """{
} ;
HELP: has-gl-version-or-extensions?
-{ $values { "version" "A version string" } { "extensions" "A sequence of extension name strings" } { "?" "a boolean" } }
+{ $values { "version" "A version string" } { "extensions" "A sequence of extension name strings" } { "?" boolean } }
{ $description "Returns true if either " { $link has-gl-version? } " or " { $link has-gl-extensions? } " returns true for " { $snippet "version" } " or " { $snippet "extensions" } ", respectively. Intended for use when required OpenGL functionality can be verified either by a minimum version or a set of equivalent extensions." } ;
HELP: require-gl-extensions
-USING: help.markup help.syntax io kernel math quotations
-opengl.gl multiline assocs ;
+USING: help.markup help.syntax math opengl.gl quotations ;
IN: opengl.framebuffers
HELP: gen-framebuffer
{ $description "Checks the framebuffer currently bound by " { $link glBindFramebuffer } " or " { $link with-framebuffer } " with " { $link framebuffer-incomplete? } ", and throws a descriptive error if the framebuffer is incomplete." } ;
HELP: with-framebuffer
-{ $values { "id" "The id of a framebuffer object." } { "quot" "a quotation" } }
+{ $values { "id" "The id of a framebuffer object." } { "quot" quotation } }
{ $description "Binds framebuffer " { $snippet "id" } " for drawing in the dynamic extent of " { $snippet "quot" } ", restoring the window framebuffer when finished." } ;
ABOUT: "gl-utilities"
{ $description "Tries to compile the given GLSL source into a fragment shader object. Equivalent to " { $snippet "GL_FRAGMENT_SHADER <gl-shader>" } "." } ;
HELP: gl-shader-ok?
-{ $values { "shader" "A " { $link gl-shader } " object" } { "?" "a boolean" } }
+{ $values { "shader" "A " { $link gl-shader } " object" } { "?" boolean } }
{ $description "Returns a boolean value indicating whether the given shader object compiled successfully. Compilation errors and warnings are available in the shader's info log, which can be gotten using " { $link gl-shader-info-log } "." } ;
HELP: check-gl-shader
{ <gl-program> <simple-gl-program> } related-words
HELP: gl-program-ok?
-{ $values { "program" "A " { $link gl-program } " object" } { "?" "a boolean" } }
+{ $values { "program" "A " { $link gl-program } " object" } { "?" boolean } }
{ $description "Returns a boolean value indicating whether the given program object linked successfully. Link errors and warnings are available in the program's info log, which can be gotten using " { $link gl-program-info-log } "." } ;
HELP: check-gl-program
! Copyright (C) 2009 Chris Double.
! See http://factorcode.org/license.txt for BSD license.
-USING: help.syntax help.markup peg peg.search ;
+USING: help.syntax help.markup peg peg.search words ;
IN: peg.ebnf
HELP: <EBNF
HELP: EBNF:
{ $syntax "EBNF: word ...ebnf... ;EBNF" }
-{ $values { "word" "a word" } { "...ebnf..." "EBNF DSL text" } }
+{ $values { "word" word } { "...ebnf..." "EBNF DSL text" } }
{ $description
"Defines a word that when called will parse a string using the syntax "
"defined with the EBNF DSL. The word has stack effect "
! Copyright (C) 2008 Chris Double, Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: help.markup help.syntax peg peg.parsers.private
-unicode.categories ;
+USING: help.markup help.syntax kernel math sequences
+unicode.categories strings ;
IN: peg.parsers
HELP: 1token
HELP: (list-of)
{ $values
- { "items" "a sequence" }
+ { "items" sequence }
{ "separator" "a parser" }
- { "repeat1?" "a boolean" }
+ { "repeat1?" boolean }
{ "parser" "a parser" }
} { $description
"Returns a parser that returns a list of items separated by the separator parser. Does not hide the separators."
HELP: list-of
{ $values
- { "items" "a sequence" }
+ { "items" sequence }
{ "separator" "a parser" }
{ "parser" "a parser" }
} { $description
{ $example "USING: peg peg.parsers prettyprint ;" "\"a\" \"a\" token \",\" token list-of parse ." "V{ \"a\" }" }
{ $example "USING: peg peg.parsers prettyprint ;" "\"a,a,a,a\" \"a\" token \",\" token list-of parse ." "V{ \"a\" \"a\" \"a\" \"a\" }" }
} { $see-also list-of-many } ;
-
+
HELP: list-of-many
{ $values
- { "items" "a sequence" }
+ { "items" sequence }
{ "separator" "a parser" }
{ "parser" "a parser" }
} { $description
HELP: exactly-n
{ $values
{ "parser" "a parser" }
- { "n" "an integer" }
+ { "n" integer }
{ "parser'" "a parser" }
} { $description
"Returns a parser that matches an exact repetition of the input parser."
HELP: at-least-n
{ $values
{ "parser" "a parser" }
- { "n" "an integer" }
+ { "n" integer }
{ "parser'" "a parser" }
} { $description
"Returns a parser that matches n or more repetitions of the input parser."
HELP: at-most-n
{ $values
{ "parser" "a parser" }
- { "n" "an integer" }
+ { "n" integer }
{ "parser'" "a parser" }
} { $description
"Returns a parser that matches n or fewer repetitions of the input parser."
HELP: from-m-to-n
{ $values
{ "parser" "a parser" }
- { "m" "an integer" }
- { "n" "an integer" }
+ { "m" integer }
+ { "n" integer }
{ "parser'" "a parser" }
} { $description
"Returns a parser that matches between and including m to n repetitions of the input parser."
HELP: surrounded-by
{ $values
{ "parser" "a parser" }
- { "begin" "a string" }
- { "end" "a string" }
+ { "begin" string }
+ { "end" string }
{ "parser'" "a parser" }
} { $description
"Calls token on begin and end to make them into string parsers. Returns a parser that parses the begin, body, and end parsers in order. The begin and end parsers are hidden."
HELP: range-pattern
{ $values
- { "pattern" "a string" }
+ { "pattern" string }
{ "parser" "a parser" }
} { $description
"Returns a parser that matches a single character based on the set "
! Copyright (C) 2007 Chris Double.\r
! See http://factorcode.org/license.txt for BSD license.\r
-USING: help.markup help.syntax ;\r
+USING: help.markup help.syntax kernel quotations strings words ;\r
IN: peg\r
\r
HELP: parse\r
{ $values \r
- { "input" "a string" } \r
- { "parser" "a parser" } \r
- { "ast" "an object" } \r
+ { "input" string }\r
+ { "parser" parser }\r
+ { "ast" object }\r
}\r
{ $description \r
"Given the input string, parse it using the given parser. The result is the abstract "\r
\r
HELP: compile\r
{ $values \r
- { "parser" "a parser" } \r
- { "word" "a word" } \r
+ { "parser" parser }\r
+ { "word" word }\r
}\r
{ $description \r
"Compile the parser to a word. The word will have stack effect ( -- ast )."\r
\r
HELP: token\r
{ $values \r
- { "string" "a string" } \r
- { "parser" "a parser" } \r
+ { "string" string }\r
+ { "parser" parser }\r
}\r
{ $description \r
"Returns a parser that matches the given string." } ;\r
\r
HELP: satisfy\r
-{ $values \r
- { "quot" "a quotation" } \r
- { "parser" "a parser" } \r
+{ $values\r
+ { "quot" quotation }\r
+ { "parser" parser }\r
}\r
{ $description \r
"Returns a parser that calls the quotation on the first character of the input string, "\r
"succeeding if that quotation returns true. The AST is the character from the string." } ;\r
\r
HELP: range\r
-{ $values \r
- { "min" "a character" } \r
- { "max" "a character" } \r
- { "parser" "a parser" } \r
+{ $values\r
+ { "min" "a character" }\r
+ { "max" "a character" }\r
+ { "parser" parser }\r
}\r
-{ $description \r
+{ $description\r
"Returns a parser that matches a single character that lies within the range of characters given, inclusive." }\r
{ $examples { $code ": digit ( -- parser ) CHAR: 0 CHAR: 9 range ;" } } ;\r
\r
HELP: seq\r
-{ $values \r
- { "seq" "a sequence of parsers" } \r
- { "parser" "a parser" } \r
+{ $values\r
+ { "seq" "a sequence of parsers" }\r
+ { "parser" parser }\r
}\r
{ $description \r
"Returns a parser that calls all parsers in the given sequence, in order. The parser succeeds if "\r
HELP: choice\r
{ $values \r
{ "seq" "a sequence of parsers" } \r
- { "parser" "a parser" } \r
+ { "parser" parser } \r
}\r
{ $description \r
"Returns a parser that will try all the parsers in the sequence, in order, until one succeeds. "\r
\r
HELP: repeat0\r
{ $values \r
- { "parser" "a parser" } \r
+ { "parser" parser } \r
}\r
{ $description \r
"Returns a parser that parses 0 or more instances of the 'p1' parser. The AST produced is "\r
\r
HELP: repeat1\r
{ $values \r
- { "parser" "a parser" } \r
+ { "parser" parser } \r
}\r
{ $description \r
"Returns a parser that parses 1 or more instances of the 'p1' parser. The AST produced is "\r
\r
HELP: optional\r
{ $values \r
- { "parser" "a parser" } \r
+ { "parser" parser } \r
}\r
{ $description \r
"Returns a parser that parses 0 or 1 instances of the 'p1' parser. The AST produced is "\r
\r
HELP: semantic\r
{ $values \r
- { "parser" "a parser" } \r
+ { "parser" parser } \r
{ "quot" { $quotation ( object -- ? ) } } \r
}\r
{ $description \r
\r
HELP: ensure\r
{ $values \r
- { "parser" "a parser" } \r
+ { "parser" parser } \r
}\r
{ $description \r
"Returns a parser that succeeds if the 'p1' parser succeeds but does not add anything to the "\r
\r
HELP: ensure-not\r
{ $values \r
- { "parser" "a parser" } \r
+ { "parser" parser } \r
}\r
{ $description \r
"Returns a parser that succeeds if the 'p1' parser fails but does not add anything to the "\r
\r
HELP: action\r
{ $values \r
- { "parser" "a parser" } \r
+ { "parser" parser } \r
{ "quot" { $quotation ( ast -- ast ) } } \r
}\r
{ $description \r
\r
HELP: sp\r
{ $values \r
- { "parser" "a parser" } \r
+ { "parser" parser } \r
}\r
{ $description \r
"Returns a parser that calls the original parser 'p1' after stripping any whitespace "\r
\r
HELP: hide\r
{ $values \r
- { "parser" "a parser" } \r
+ { "parser" parser } \r
}\r
{ $description \r
"Returns a parser that succeeds if the original parser succeeds, but does not " \r
\r
HELP: delay\r
{ $values \r
- { "quot" "a quotation" } \r
- { "parser" "a parser" } \r
+ { "quot" quotation } \r
+ { "parser" parser } \r
}\r
{ $description \r
"Delays the construction of a parser until it is actually required to parse. This " \r
\r
HELP: box\r
{ $values \r
- { "quot" "a quotation" } \r
- { "parser" "a parser" } \r
+ { "quot" quotation } \r
+ { "parser" parser } \r
}\r
{ $description \r
"Delays the construction of a parser until the parser is compiled. The quotation "\r
! Copyright (C) 2006 Chris Double.
! See http://factorcode.org/license.txt for BSD license.
-USING: help.syntax help.markup peg ;
+USING: help.markup help.syntax kernel peg sequences strings ;
IN: peg.search
HELP: tree-write
{ $values
- { "object" "an object" } }
+ { "object" object } }
{ $description
"Write the object to the standard output stream, unless "
"it is an array, in which case recurse through the array "
HELP: search
{ $values
- { "string" "a string" }
+ { "string" string }
{ "parser" "a peg based parser" }
- { "seq" "a sequence" }
+ { "seq" sequence }
}
{ $description
"Returns a sequence containing the parse results of all substrings "
HELP: replace
{ $values
- { "string" "a string" }
+ { "string" string }
{ "parser" "a peg based parser" }
- { "result" "a string" }
+ { "result" string }
}
{ $description
"Returns a copy of the original string but with all substrings that "
{ $description "Creates a new persistent heap consisting of one object with the given priority." } ;
HELP: pheap-empty?
-{ $values { "heap" "a persistent heap" } { "?" "a boolean" } }
+{ $values { "heap" "a persistent heap" } { "?" boolean } }
{ $description "Returns true if this is an empty persistent heap." } ;
HELP: pheap-peek
USING: help.markup help.syntax ;
HELP: step1a
-{ $values { "str" "a string" } { "newstr" "a new string" } }
+{ $values { "str" string } { "newstr" "a new string" } }
{ $description "Gets rid of plurals." }
{ $examples
{ $table
} ;
HELP: step1b
-{ $values { "str" "a string" } { "newstr" "a new string" } }
+{ $values { "str" string } { "newstr" "a new string" } }
{ $description "Gets rid of \"-ed\" and \"-ing\" suffixes." }
{ $examples
{ $table
} ;
HELP: step1c
-{ $values { "str" "a string" } { "newstr" "a new string" } }
+{ $values { "str" string } { "newstr" "a new string" } }
{ $description "Turns a terminal y to i when there is another vowel in the stem." } ;
HELP: step2
-{ $values { "str" "a string" } { "newstr" "a new string" } }
+{ $values { "str" string } { "newstr" "a new string" } }
{ $description "Maps double suffices to single ones. so -ization maps to -ize etc. note that the string before the suffix must give positive " { $link consonant-seq } "." } ;
HELP: step3
-{ $values { "str" "a string" } { "newstr" "a new string" } }
+{ $values { "str" string } { "newstr" "a new string" } }
{ $description "Deals with -c-, -full, -ness, etc. Similar strategy to " { $link step2 } "." } ;
HELP: step5
-{ $values { "str" "a string" } { "newstr" "a new string" } }
+{ $values { "str" string } { "newstr" "a new string" } }
{ $description "Removes a final -e and changes a final -ll to -l if " { $link consonant-seq } " is greater than 1," } ;
HELP: stem
-{ $values { "str" "a string" } { "newstr" "a new string" } }
+{ $values { "str" string } { "newstr" "a new string" } }
{ $description "Applies the Porter stemming algorithm to the input string." } ;
ARTICLE: "porter-stemmer" "Porter stemming algorithm"
-USING: help.markup help.syntax io kernel
-prettyprint.config prettyprint.sections prettyprint.custom
-words strings ;
+USING: help.markup help.syntax kernel prettyprint.config
+prettyprint.custom sequences strings words ;
IN: prettyprint.backend
ABOUT: "prettyprint-extension"
HELP: pprint-word
-{ $values { "word" "a word" } }
+{ $values { "word" word } }
{ $description "Adds a text section for the word. Unlike the " { $link word } " method of " { $link pprint* } ", this does not add a " { $link POSTPONE: POSTPONE: } " prefix to parsing words." }
$prettyprinting-note ;
$prettyprinting-note ;
HELP: nesting-limit?
-{ $values { "?" "a boolean" } }
+{ $values { "?" boolean } }
{ $description "Tests if the " { $link nesting-limit } " has been reached." }
$prettyprinting-note ;
HELP: check-recursion
-{ $values { "obj" "an object" } { "quot" { $quotation ( obj -- ) } } }
+{ $values { "obj" object } { "quot" { $quotation ( obj -- ) } } }
{ $description "If the object is already being printed, that is, if the prettyprinter has encountered a cycle in the object graph, or if the maximum nesting depth has been reached, outputs a dummy string. Otherwise applies the quotation to the object." }
$prettyprinting-note ;
HELP: do-length-limit
-{ $values { "seq" "a sequence" } { "trimmed" "a trimmed sequence" } { "n/f" "an integer or " { $link f } } }
+{ $values { "seq" sequence } { "trimmed" "a trimmed sequence" } { "n/f" "an integer or " { $link f } } }
{ $description "If the " { $link length-limit } " is set and the sequence length exceeds this limit, trims the sequence and outputs a the number of elements which were chopped off the end. Otherwise outputs " { $link f } "." }
$prettyprinting-note ;
HELP: pprint-elements
-{ $values { "seq" "a sequence" } }
+{ $values { "seq" sequence } }
{ $description "Prettyprints the elements of a sequence, trimming the sequence to " { $link length-limit } " if necessary." }
$prettyprinting-note ;
-USING: prettyprint.backend prettyprint.config prettyprint.custom
-prettyprint.sections help.markup help.syntax
-io kernel words definitions quotations strings generic classes
-prettyprint.private ;
+USING: help.markup help.syntax io kernel math
+prettyprint.backend prettyprint.config prettyprint.custom
+prettyprint.private prettyprint.sections sequences ;
IN: prettyprint
ARTICLE: "prettyprint-numbers" "Prettyprinting numbers"
{ $description "Prettyprints an object to " { $link output-stream } " with a trailing line break. This word rebinds printer control variables to enforce “shorter” output." } ;
HELP: .b
-{ $values { "n" "an integer" } }
+{ $values { "n" integer } }
{ $description "Outputs an integer in binary." } ;
HELP: .o
-{ $values { "n" "an integer" } }
+{ $values { "n" integer } }
{ $description "Outputs an integer in octal." } ;
HELP: .h
{ $description "Outputs an integer or floating-point value in hexadecimal." } ;
HELP: stack.
-{ $values { "seq" "a sequence" } }
+{ $values { "seq" sequence } }
{ $description "Prints a the elements of the sequence, one per line." }
{ $notes "This word is used in the implementation of " { $link .s } " and " { $link .r } "." } ;
-USING: prettyprint io kernel help.markup help.syntax
-prettyprint.config words hashtables math
-strings definitions quotations ;
+USING: hashtables help.markup help.syntax io kernel math
+prettyprint.config quotations strings ;
IN: prettyprint.sections
HELP: position
{ $var-description "The current nesting of collections being output by the prettyprinter, used to detect circularity and prevent infinite recursion." } ;
HELP: line-limit?
-{ $values { "?" "a boolean" } }
+{ $values { "?" boolean } }
{ $description "Tests if the line number limit has been reached, and thus if prettyprinting should stop." } ;
HELP: do-indent
{ soft hard } related-words
HELP: section-fits?
-{ $values { "section" section } { "?" "a boolean" } }
+{ $values { "section" section } { "?" boolean } }
{ $contract "Tests if a section fits in the space that remains on the current line." } ;
HELP: short-section
{ $contract "Prints a section which spans multiple lines. This should use a layout strategy maximizing readability and minimizing line length." } ;
HELP: indent-section?
-{ $values { "section" section } { "?" "a boolean" } }
+{ $values { "section" section } { "?" boolean } }
{ $contract "Outputs a boolean indicating if the indent level should be increased when printing this section as a " { $link long-section } ". Default implementation outputs " { $link f } "." } ;
HELP: unindent-first-line?
-{ $values { "section" section } { "?" "a boolean" } }
+{ $values { "section" section } { "?" boolean } }
{ $contract "Outputs a boolean indicating if the indent level should only be increased for lines after the first line when printing this section as a " { $link long-section } ". Default implementation outputs " { $link f } "." }
{ $notes "This is used to format " { $link colon } " sections because of the colon definition formatting convention." } ;
HELP: newline-after?
-{ $values { "section" section } { "?" "a boolean" } }
+{ $values { "section" section } { "?" boolean } }
{ $contract "Outputs a boolean indicating if a newline should be output after printing this section as a " { $link long-section } ". Default implementation outputs " { $link f } "." } ;
HELP: short-section?
-{ $values { "section" section } { "?" "a boolean" } }
+{ $values { "section" section } { "?" boolean } }
{ $contract "Tests if a section should be output as a " { $link short-section } ". The default implementation calls " { $link section-fits? } " but this behavior can be customized." } ;
HELP: section
{ $description "Prints a break section as per the policy outlined in " { $link line-break } "." } ;
HELP: empty-block?
-{ $values { "block" block } { "?" "a boolean" } }
+{ $values { "block" block } { "?" boolean } }
{ $description "Tests if the block has no child sections." } ;
HELP: if-nonempty
{ $class-description "A " { $link block } " section which indents every line when printed as a " { $link long-section } "." } ;
HELP: <inset
-{ $values { "narrow?" "a boolean" } }
+{ $values { "narrow?" boolean } }
{ $description "Begins an " { $link inset } " section. When printed as a " { $link long-section } ", the output format is determined by the " { $snippet "narrow?" } " flag. If it is " { $link f } ", then longer lines are favored, wrapping at the " { $link margin } ". Otherwise, every child section is printed on its own line." }
{ $examples
"Compare the output of printing a long quotation versus a hashtable. Quotations are printed with " { $snippet "narrow?" } " set to " { $link f } ", and hashtables are printed with " { $snippet "narrow?" } " set to " { $link t } "."
! Copyright (C) 2009 Keith Lazuka.
! See http://factorcode.org/license.txt for BSD license.
-USING: help.markup help.syntax kernel words ;
+USING: help.markup help.syntax kernel strings words ;
IN: prettyprint.stylesheet
HELP: effect-style
HELP: string-style
{ $values
- { "str" "a string" }
+ { "str" string }
{ "style" "a style assoc" }
}
{ $description "The stylesheet for string literals" } ;
HELP: word-style
{ $values
- { "word" "a word" }
+ { "word" word }
{ "style" "a style assoc" }
}
{ $description "The stylesheet for word names" } ;
-USING: help.markup help.syntax math kernel sequences arrays ;
+USING: arrays help.markup help.syntax kernel math quotations
+sequences ;
IN: random
HELP: seed-random
{ $description "Generates a random 32-bit unsigned integer." } ;
HELP: random-bytes*
-{ $values { "n" "an integer" } { "obj" "a random number generator" } { "byte-array" "a sequence of random bytes" } }
+{ $values { "n" integer } { "obj" "a random number generator" } { "byte-array" "a sequence of random bytes" } }
{ $description "Generates a byte-array of random bytes." } ;
HELP: random
{ $description "Outputs 32 random bits. This word is more efficient than calling " { $link random } " because no scaling is done on the output." } ;
HELP: random-bytes
-{ $values { "n" "an integer" } { "byte-array" "a random integer" } }
+{ $values { "n" integer } { "byte-array" "a random integer" } }
{ $description "Outputs an integer with n bytes worth of bits." }
{ $examples
{ $unchecked-example "USING: prettyprint random ;"
{ $description "Returns an integer exactly " { $snippet "numbits" } " in length, with the topmost bit set to one." } ;
HELP: with-random
-{ $values { "obj" "a random number generator" } { "quot" "a quotation" } }
+{ $values { "obj" "a random number generator" } { "quot" quotation } }
{ $description "Calls the quotation with the random number generator in a dynamic variable. All random numbers will be generated using this random number generator." } ;
HELP: with-secure-random
-{ $values { "quot" "a quotation" } }
+{ $values { "quot" quotation } }
{ $description "Calls the quotation with the secure random number generator in a dynamic variable. All random numbers will be generated using this random number generator." } ;
HELP: with-system-random
-{ $values { "quot" "a quotation" } }
+{ $values { "quot" quotation } }
{ $description "Calls the quotation with the system's random number generator in a dynamic variable. All random numbers will be generated using this random number generator." } ;
{ with-random with-secure-random with-system-random } related-words
{ $class-description "The class of regular expressions. To construct these, see " { $link "regexp-construction" } "." } ;
HELP: matches?
-{ $values { "string" string } { "regexp" regexp } { "?" "a boolean" } }
+{ $values { "string" string } { "regexp" regexp } { "?" boolean } }
{ $description "Tests if the string as a whole matches the given regular expression." } ;
HELP: all-matching-slices
{ $description "Finds the first match of the regular expression in the string, and returns it as a slice. If there is no match, then " { $link f } " is returned." } ;
HELP: re-contains?
-{ $values { "string" string } { "regexp" regexp } { "?" "a boolean" } }
+{ $values { "string" string } { "regexp" regexp } { "?" boolean } }
{ $description "Determines whether the string has a substring which matches the regular expression given." } ;
-USING: help.markup help.syntax strings definitions generic words classes ;
+USING: classes definitions generic help.markup help.syntax
+sequences strings words ;
FROM: prettyprint.sections => with-pprint ;
IN: see
{ $notes "This word is used in the implementation of " { $link see } "." } ;
HELP: definition
-{ $values { "defspec" "a definition specifier" } { "seq" "a sequence" } }
+{ $values { "defspec" "a definition specifier" } { "seq" sequence } }
{ $contract "Outputs the body of a definition." }
{ $examples
{ $example "USING: definitions math prettyprint ;" "\\ sq definition ." "[ dup * ]" }
synopsis*
} ;
-ABOUT: "see"
\ No newline at end of file
+ABOUT: "see"
{ $see-also find } ;
HELP: deep-any?
-{ $values { "obj" object } { "quot" { $quotation ( ... elt -- ... ? ) } } { "?" "a boolean" } }
+{ $values { "obj" object } { "quot" { $quotation ( ... elt -- ... ? ) } } { "?" boolean } }
{ $description "Tests whether the given object or any subnode satisfies the given quotation." }
{ $see-also any? } ;
-USING: help.syntax help.markup kernel sequences words io
-effects classes math combinators
-stack-checker.backend
-stack-checker.branches
-stack-checker.errors
-stack-checker.transforms
-stack-checker.state
-continuations ;
+USING: classes continuations effects help.markup help.syntax io
+kernel quotations sequences stack-checker.errors ;
IN: stack-checker
ARTICLE: "inference-simple" "Straight-line stack effects"
} ;
HELP: infer
-{ $values { "quot" "a quotation" } { "effect" "an instance of " { $link effect } } }
+{ $values { "quot" quotation } { "effect" "an instance of " { $link effect } } }
{ $description "Attempts to infer the quotation's stack effect. For interactive testing, the " { $link infer. } " word should be called instead since it presents the output in a nicely formatted manner." }
{ $errors "Throws an " { $link inference-error } " if stack effect inference fails." } ;
HELP: infer.
-{ $values { "quot" "a quotation" } }
+{ $values { "quot" quotation } }
{ $description "Attempts to infer the quotation's stack effect, and prints this data to " { $link output-stream } "." }
{ $errors "Throws an " { $link inference-error } " if stack effect inference fails." } ;
ABOUT: "tools.annotations"
HELP: annotate
-{ $values { "word" "a word" } { "quot" { $quotation ( old-def -- new-def ) } } }
+{ $values { "word" word } { "quot" { $quotation ( old-def -- new-def ) } } }
{ $description "Changes a word definition to the result of applying a quotation to the old definition." }
{ $notes "This word is used to implement " { $link watch } "." } ;
-USING: help.markup help.syntax words definitions prettyprint
-tools.crossref.private math quotations assocs kernel sets ;
+USING: assocs help.markup help.syntax kernel math sets
+tools.crossref.private words ;
IN: tools.crossref
ARTICLE: "tools.crossref" "Definition cross referencing"
{ $notes "The sequence might include the definition itself, if it is a recursive word." } ;
HELP: usage.
-{ $values { "word" "a word" } }
+{ $values { "word" word } }
{ $description "Prints an list of all callers of a word. This may include the word itself, if it is recursive." }
{ $examples { $code "\\ reverse usage." } } ;
-USING: ui.gadgets ui.gestures help.markup help.syntax strings ;
+USING: help.markup help.syntax kernel strings ui.gadgets
+ui.gestures ;
IN: ui.clipboards
HELP: clipboard
{ $class-description "A mutable container for a single string implementing the " { $link "clipboard-protocol" } "." } ;
HELP: paste-clipboard
-{ $values { "gadget" gadget } { "clipboard" "an object" } }
+{ $values { "gadget" gadget } { "clipboard" object } }
{ $contract "Arranges for the contents of the clipboard to be inserted into the gadget at some point in the near future via a call to " { $link user-input } ". The gadget must be grafted." } ;
HELP: copy-clipboard
-{ $values { "string" string } { "gadget" gadget } { "clipboard" "an object" } }
+{ $values { "string" string } { "gadget" gadget } { "clipboard" object } }
{ $contract "Arranges for the string to be copied to the clipboard on behalf of the gadget. The gadget must be grafted." } ;
HELP: selection
} ;
HELP: user-input*
-{ $values { "str" string } { "gadget" gadget } { "?" "a boolean" } }
+{ $values { "str" string } { "gadget" gadget } { "?" boolean } }
{ $contract "Handle free-form textual input while the gadget has keyboard focus." } ;
HELP: children-on
{ $description "Applies the quotation to each child of the gadget." } ;
HELP: gadget-selection?
-{ $values { "gadget" gadget } { "?" "a boolean" } }
+{ $values { "gadget" gadget } { "?" boolean } }
{ $contract "Outputs if the gadget has an active text selection; if so, the selected text can be obtained with a call to " { $link gadget-selection } "." } ;
HELP: gadget-selection
{ $description "Outputs a sequence of all parents of the gadget, with the first element being the gadget itself." } ;
HELP: each-parent
-{ $values { "gadget" gadget } { "quot" { $quotation ( gadget -- ? ) } } { "?" "a boolean" } }
+{ $values { "gadget" gadget } { "quot" { $quotation ( gadget -- ? ) } } { "?" boolean } }
{ $description "Applies the quotation to every parent of the gadget, starting from the gadget itself, stopping if the quotation yields " { $link f } ". Outputs " { $link t } " if the iteration completed, and outputs " { $link f } " if it was stopped prematurely." } ;
HELP: find-parent
{ $description "Outputs the location of the gadget relative to the top-left corner of the world containing the gadget. This word does not output a useful value if the gadget is not grafted." } ;
HELP: child?
-{ $values { "parent" gadget } { "child" gadget } { "?" "a boolean" } }
+{ $values { "parent" gadget } { "child" gadget } { "?" boolean } }
{ $description "Tests if " { $snippet "child" } " is contained inside " { $snippet "parent" } "." } ;
HELP: focusable-child*
+USING: help.markup help.syntax kernel math.rectangles
+ui.gadgets ;
IN: ui.gadgets.glass
-USING: help.markup help.syntax ui.gadgets math.rectangles ;
HELP: show-glass
{ $values { "owner" gadget } { "child" gadget } { "visible-rect" rect } }
{ $description "Called when a gadget displayed in a glass layer is hidden. The gadget can perform cleanup tasks here." } ;
HELP: pass-to-popup
-{ $values { "gesture" "a gesture" } { "owner" "the popup's owner" } { "?" "a boolean" } }
+{ $values { "gesture" "a gesture" } { "owner" "the popup's owner" } { "?" boolean } }
{ $description "Resends the gesture to the popup displayed by " { $snippet "owner" } ". The owner must have a " { $slot "popup" } " slot. Outputs " { $link f } " if the gesture was handled, " { $link t } " otherwise." } ;
HELP: show-popup
pass-to-popup
} ;
-ABOUT: "ui.gadgets.glass"
\ No newline at end of file
+ABOUT: "ui.gadgets.glass"
-USING: help.markup help.syntax ui.gadgets models models.range
+USING: help.markup help.syntax math math.ranges ui.gadgets
ui.gadgets.sliders.private ;
IN: ui.gadgets.sliders
{ $class-description "A thumb is the gadget contained in a " { $link slider } "'s " { $link elevator } " which indicates the current scroll position and can be dragged up and down with the mouse." } ;
HELP: slide-by
-{ $values { "amount" "an integer" } { "slider" slider } }
+{ $values { "amount" integer } { "slider" slider } }
{ $description "Adds the amount (which may be positive or negative) to the slider's current position." } ;
HELP: slide-by-page
-{ $values { "amount" "an integer" } { "slider" slider } }
+{ $values { "amount" integer } { "slider" slider } }
{ $description "Adds the amount multiplied by " { $link slider-page } " to the slider's current position." } ;
HELP: slide-by-line
-{ $values { "amount" "an integer" } { "slider" slider } }
+{ $values { "amount" integer } { "slider" slider } }
{ $description "Adds the amount multiplied by the " { $snippet "line" } " slot to the slider's current position." } ;
HELP: <slider>
{ $description "Sets the gestures a gadget class responds to. The hashtable maps gestures to quotations with stack effect " { $snippet "( gadget -- )" } "." } ;
HELP: handle-gesture
-{ $values { "gesture" "a gesture" } { "gadget" "the receiver of the gesture" } { "?" "a boolean" } }
+{ $values { "gesture" "a gesture" } { "gadget" "the receiver of the gesture" } { "?" boolean } }
{ $contract "Handles a gesture sent to a gadget."
$nl
"Outputs " { $link f } " if the gesture was handled, and " { $link t } " if the gesture should be passed on to the gadget's parent."
{ $notes "Methods should be defined on this word if you desire to handle an arbitrary set of gestures. To define handlers for a fixed set, it is easier to use " { $link set-gestures } ". If you define a method on " { $snippet "handle-gesture" } ", you should also override " { $link handles-gesture? } "." } ;
HELP: handles-gesture?
-{ $values { "gesture" "a gesture" } { "gadget" "the receiver of the gesture" } { "?" "a boolean" } }
+{ $values { "gesture" "a gesture" } { "gadget" "the receiver of the gesture" } { "?" boolean } }
{ $contract "Returns a true value if " { $snippet "gadget" } " would handle " { $snippet "gesture" } " in its " { $link handle-gesture } " method."
$nl
"The default implementation looks at the " { $snippet "\"gestures\"" } " word property of each superclass of the gadget's class and returns true if a handler is present for " { $snippet "gesture" } "." }
{ $notes "This word is used in Factor's MacOS X UI to validate menu items." } ;
HELP: parents-handle-gesture?
-{ $values { "gesture" "a gesture" } { "gadget" "the receiver of the gesture" } { "?" "a boolean" } }
+{ $values { "gesture" "a gesture" } { "gadget" "the receiver of the gesture" } { "?" boolean } }
{ $contract "Returns a true value if " { $snippet "gadget" } " or any of its ancestors would handle " { $snippet "gesture" } " in its " { $link handle-gesture } " method." } ;
{ propagate-gesture handle-gesture handles-gesture? set-gestures } related-words
{ $description "Defines a command map named " { $snippet "group" } " on " { $snippet "class" } " consisting of operations applicable to " { $snippet "object" } ". The translator quotation is applied to the target gadget, and the result of the translator is passed to the operation." } ;
HELP: $operations
-{ $values { "element" "a sequence" } }
+{ $values { "element" sequence } }
{ $description "Converts the element to a quotation and calls it; the resulting quotation must have stack effect " { $snippet "( -- obj )" } ". Prints a list of operations applicable to the object, together with keyboard shortcuts." } ;
HELP: $operation
} ;
HELP: set-fullscreen
-{ $values { "gadget" gadget } { "?" "a boolean" } }
+{ $values { "gadget" gadget } { "?" boolean } }
{ $description "Sets and unsets fullscreen mode for the gadget's world." } ;
HELP: fullscreen?
-{ $values { "gadget" gadget } { "?" "a boolean" } }
+{ $values { "gadget" gadget } { "?" boolean } }
{ $description "Queries the gadget's world to see if it is running in fullscreen mode." } ;
{ fullscreen? set-fullscreen } related-words
-USING: help.syntax help.markup strings ;
+USING: help.syntax help.markup kernel strings ;
IN: unicode.case
ABOUT: "unicode.case"
{ $description "Converts a string to case-folded form." } ;
HELP: upper?
-{ $values { "string" string } { "?" "a boolean" } }
+{ $values { "string" string } { "?" boolean } }
{ $description "Tests if a string is in upper case." } ;
HELP: lower?
-{ $values { "string" string } { "?" "a boolean" } }
+{ $values { "string" string } { "?" boolean } }
{ $description "Tests if a string is in lower case." } ;
HELP: title?
-{ $values { "string" string } { "?" "a boolean" } }
+{ $values { "string" string } { "?" boolean } }
{ $description "Tests if a string is in title case." } ;
HELP: case-fold?
-{ $values { "string" string } { "?" "a boolean" } }
+{ $values { "string" string } { "?" boolean } }
{ $description "Tests if a string is in case-folded form." } ;
! Copyright (C) 2009 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
-USING: help.syntax help.markup strings ;
+USING: help.syntax help.markup kernel math strings ;
IN: unicode.data
ABOUT: "unicode.data"
{ $description "This returns the compatibility decomposition (NFKD) for a code point" } ;
HELP: combining-class
-{ $values { "char" "a code point" } { "n" "an integer" } }
+{ $values { "char" "a code point" } { "n" integer } }
{ $description "Finds the combining class of a code point." } ;
HELP: non-starter?
-{ $values { "char" "a code point" } { "?" "a boolean" } }
+{ $values { "char" "a code point" } { "?" boolean } }
{ $description "Returns true if the code point has a combining class." } ;
HELP: char>name
{ $description "Looks up the code point corresponding to a given name." } ;
HELP: property?
-{ $values { "char" "a code point" } { "property" string } { "?" "a boolean" } }
+{ $values { "char" "a code point" } { "property" string } { "?" boolean } }
{ $description "Tests whether the code point is listed under the given property in PropList.txt in the Unicode Character Database." } ;
HELP: category
-USING: strings help.markup help.syntax assocs urls ;
+USING: assocs help.markup help.syntax kernel strings ;
IN: urls.encoding
HELP: url-decode
{ $description "URL-encodes a string, including all reserved characters, such as \"/\"." } ;
HELP: url-quotable?
-{ $values { "ch" "a character" } { "?" "a boolean" } }
+{ $values { "ch" "a character" } { "?" boolean } }
{ $description "Tests if a character be used without URL-encoding in a URL." } ;
HELP: assoc>query
HELP: relative-url?
{ $values
{ "url" url }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Tests whether a URL is relative." } ;
HELP: secure-protocol?
-{ $values { "protocol" string } { "?" "a boolean" } }
+{ $values { "protocol" string } { "?" boolean } }
{ $description "Tests if protocol connections must be made with secure sockets (SSL/TLS)." }
{ $examples
{ $example
-USING: help.markup help.syntax io.streams.string quotations
-strings math regexp ;
+USING: help.markup help.syntax kernel math quotations regexp
+strings ;
IN: validators
HELP: v-checkbox
-{ $values { "str" string } { "?" "a boolean" } }
+{ $values { "str" string } { "?" boolean } }
{ $description "Converts the string value of a checkbox component (either \"on\" or \"off\") to a boolean value." } ;
HELP: v-captcha
-USING: help.markup help.syntax strings ;
+USING: help.markup help.syntax kernel strings ;
IN: vocabs.refresh
HELP: source-modified?
-{ $values { "path" "a pathname string" } { "?" "a boolean" } }
+{ $values { "path" "a pathname string" } { "?" boolean } }
{ $description "Tests if the source file has been modified since it was last loaded. This compares the file's CRC32 checksum of the file's contents against the previously-recorded value." } ;
HELP: refresh
-USING: help.syntax help.markup ;
+USING: help.syntax help.markup math sequences strings ;
IN: xml-rpc
HELP: send-rpc
{ $see-also send-rpc } ;
HELP: <base64>
-{ $values { "string" "a string" } { "base64" "a base64 tuple" } }
+{ $values { "string" string } { "base64" "a base64 tuple" } }
{ $description "creates a base64 tuple using the data in the string. This marks the data for encoding in the base64 format" }
{ $see-also base64 } ;
{ $see-also <base64> } ;
HELP: <rpc-method>
-{ $values { "name" "a string" } { "params" "a sequence" } { "rpc-method" rpc-method } }
+{ $values { "name" string } { "params" sequence } { "rpc-method" rpc-method } }
{ $description "creates a tuple representing a method call which can be translated using send-rpc into an XML-RPC document" }
{ $see-also rpc-method <rpc-response> <rpc-fault> } ;
{ $see-also <rpc-method> rpc-response rpc-fault } ;
HELP: <rpc-response>
-{ $values { "params" "a sequence" } { "rpc-response" rpc-response } }
+{ $values { "params" sequence } { "rpc-response" rpc-response } }
{ $description "creates a tuple representing a data response in XML-RPC" }
{ $see-also rpc-response <rpc-method> <rpc-fault> } ;
{ $see-also <rpc-response> rpc-method rpc-fault } ;
HELP: <rpc-fault>
-{ $values { "code" "an integer" } { "string" "a string" } { "rpc-fault" rpc-fault } }
+{ $values { "code" integer } { "string" string } { "rpc-fault" rpc-fault } }
{ $description "creates a tuple representing an exception in RPC, to be returned to the caller. The code is a number representing what type of error it is, and the string is a description" }
{ $see-also rpc-fault <rpc-method> <rpc-response> } ;
-USING: help.markup help.syntax sequences strings ;
+USING: help.markup help.syntax kernel sequences strings ;
IN: xml.data
ABOUT: "xml.data"
{ $see-also <name> tag } ;
HELP: <name>
-{ $values { "space" "a string" } { "main" "a string" } { "url" "a string" }
+{ $values { "space" string } { "main" string } { "url" string }
{ "name" "an XML tag name" } }
{ $description "Creates a name tuple with the namespace prefix space, the the given main part of the name, and the namespace URL given by url." }
{ $see-also name <tag> } ;
HELP: <prolog>
{ $values { "version" "a string, 1.0 or 1.1" }
-{ "encoding" "a string" } { "standalone" "a boolean" } { "prolog" "an XML prolog" } }
+{ "encoding" string } { "standalone" boolean } { "prolog" "an XML prolog" } }
{ $description "Creates an XML prolog tuple." }
{ $see-also prolog <xml> } ;
{ $see-also <instruction> } ;
HELP: <instruction>
-{ $values { "text" "a string" } { "instruction" "an XML instruction" } }
+{ $values { "text" string } { "instruction" "an XML instruction" } }
{ $description "Creates an XML parsing instruction, like " { $snippet "<?xsl stylesheet='foo.xml'?>" } "." }
{ $see-also instruction } ;
{ $see-also tag-named deep-tag-named tags-named } ;
HELP: children>string
-{ $values { "tag" "an XML tag or document" } { "string" "a string" } }
+{ $values { "tag" "an XML tag or document" } { "string" string } }
{ $description "Concatenates the children of the tag, throwing an exception when there is a non-string child." } ;
HELP: children-tags
{ $see-also deep-tag-named deep-tags-named tag-named } ;
HELP: get-id
-{ $values { "tag" "an XML tag or document" } { "id" "a string" } { "elem" "an XML element or f" } }
+{ $values { "tag" "an XML tag or document" } { "id" string } { "elem" "an XML element or f" } }
{ $description "Finds the XML tag with the specified id, ignoring the namespace." } ;
"All of these words operate on arbitrary pieces of XML: they can take, as in put, XML documents, comments, tags, strings (text nodes), XML chunks, etc." ;
HELP: xml>string
-{ $values { "xml" "an XML document" } { "string" "a string" } }
+{ $values { "xml" "an XML document" } { "string" string } }
{ $description "This converts an XML document " { $link xml } " into a string. It can also be used to convert any piece of XML to a string, eg an " { $link xml-chunk } " or " { $link comment } "." }
{ $notes "This does not preserve what type of quotes were used or what data was omitted from version declaration, as that information isn't present in the XML data representation. The whitespace in the text nodes of the original document is preserved." } ;
HELP: pprint-xml>string
-{ $values { "xml" "an XML document" } { "string" "a string" } }
+{ $values { "xml" "an XML document" } { "string" string } }
{ $description "Converts an XML document into a string in a prettyprinted form." }
{ $notes "This does not preserve what type of quotes were used or what data was omitted from version declaration, as that information isn't present in the XML data representation. The whitespace in the text nodes of the original document is preserved." } ;
USING: alien.accessors alien.c-types alien.libraries
-alien.syntax arrays byte-arrays compiler cpu.x86
-debugger definitions eval help.markup help.syntax io io.backend
-kernel libc math parser quotations sequences system ;
+alien.syntax byte-arrays cpu.x86 eval help.markup help.syntax io
+io.backend kernel math quotations sequences system ;
IN: alien
HELP: cdecl
{ $class-description "The class of native library handles. See " { $link "syntax-aliens" } " for syntax and " { $link "dll.private" } " for general information." } ;
HELP: dll-valid?
-{ $values { "dll" dll } { "?" "a boolean" } }
+{ $values { "dll" dll } { "?" boolean } }
{ $description "Returns true if the library exists and is loaded." } ;
HELP: expired?
-{ $values { "c-ptr" c-ptr } { "?" "a boolean" } }
+{ $values { "c-ptr" c-ptr } { "?" boolean } }
{ $description "Tests if the alien is a relic from an earlier session. A byte array is never considered to have expired, whereas passing " { $link f } " always yields true." } ;
HELP: <bad-alien>
{ $description "Constructs an invalid alien pointer that has expired." } ;
HELP: <displaced-alien>
-{ $values { "displacement" "an integer" } { "c-ptr" c-ptr } { "alien" "a new alien" } }
+{ $values { "displacement" integer } { "c-ptr" c-ptr } { "alien" "a new alien" } }
{ $description "Creates a new alien address object, wrapping a raw memory address. The alien points to a location in memory which is offset by " { $snippet "displacement" } " from the address of " { $snippet "c-ptr" } "." }
{ $notes "Passing a value of " { $link f } " for " { $snippet "c-ptr" } " creates an alien with an absolute address; this is how " { $link <alien> } " is implemented."
$nl
-USING: help.markup help.syntax kernel classes classes.private words\r
-checksums checksums.crc32 sequences math ;\r
+USING: classes classes.private help.markup help.syntax kernel\r
+math sequences ;\r
IN: classes.algebra\r
\r
ARTICLE: "class-operations" "Class operations"\r
{ $description "Outputs a set of builtin and tuple classes whose union is the smallest cover of " { $snippet "class" } "." } ;\r
\r
HELP: class<=\r
-{ $values { "first" "a class" } { "second" "a class" } { "?" "a boolean" } }\r
+{ $values { "first" "a class" } { "second" "a class" } { "?" boolean } }\r
{ $description "Tests if all instances of " { $snippet "class1" } " are also instances of " { $snippet "class2" } "." }\r
{ $notes "Classes are partially ordered. This means that if " { $snippet "class1 <= class2" } " and " { $snippet "class2 <= class1" } ", then " { $snippet "class1 <= class2" } ". Also, if " { $snippet "class1 <= class2" } " and " { $snippet "class2 <= class3" } ", then " { $snippet "class1 <= class3" } "." } ;\r
\r
{ $description "Outputs the largest anonymous class contained in both " { $snippet "class1" } " and " { $snippet "class2" } "." } ;\r
\r
HELP: classes-intersect?\r
-{ $values { "first" class } { "second" class } { "?" "a boolean" } }\r
+{ $values { "first" class } { "second" class } { "?" boolean } }\r
{ $description "Tests if two classes have a non-empty intersection. If the intersection is empty, no object can be an instance of both classes at once." } ;\r
\r
HELP: smallest-class\r
-USING: help.markup help.syntax kernel kernel.private
-namespaces sequences words arrays effects math
-classes.private classes.union classes.mixin
-classes.predicate quotations ;
+USING: classes.private help.markup help.syntax kernel quotations
+sequences words ;
IN: classes
ARTICLE: "class-predicates" "Class predicate words"
{ $var-description "Assoc mapping each class to a set of classes defined in terms of this class. The " { $link define-class } " word uses this information to update generic words when classes are redefined." } ;
HELP: predicate-word
-{ $values { "word" "a word" } { "predicate" "a predicate word" } }
+{ $values { "word" word } { "predicate" "a predicate word" } }
{ $description "Suffixes the word's name with \"?\" and creates a word with that name in the same vocabulary as the word itself." } ;
HELP: define-predicate
HELP: instance?
{ $values
{ "object" object } { "class" class }
- { "?" "a boolean" } }
+ { "?" boolean } }
{ $description "Tests whether the input object is a member of the class." } ;
HELP: reset-class
-USING: generic help.markup help.syntax kernel
-classes.tuple.private classes slots quotations words arrays
-generic.standard sequences definitions compiler.units
-growable vectors sbufs assocs math strings ;
+USING: arrays assocs classes classes.tuple.private
+compiler.units growable help.markup help.syntax kernel math
+sbufs sequences slots strings vectors words ;
IN: classes.tuple
ARTICLE: "slot-read-only-declaration" "Read-only slots"
{ $examples { $example "USING: classes.tuple prettyprint ;" "IN: scratchpad" "TUPLE: name title first last ;" "name tuple-class? ." "t" } } ;
HELP: tuple=
-{ $values { "tuple1" tuple } { "tuple2" tuple } { "?" "a boolean" } }
+{ $values { "tuple1" tuple } { "tuple2" tuple } { "?" boolean } }
{ $description "Checks if two tuples have equal slot values. This is the default behavior of " { $link = } " on tuples, unless the tuple class subclasses " { $link identity-tuple } " or implements a method on " { $link equal? } ". In cases where equality has been redefined, this word can be used to get the default semantics if needed." } ;
HELP: tuple
} ;
HELP: alist>quot
-{ $values { "default" "a quotation" } { "assoc" "a sequence of quotation pairs" } { "quot" "a new quotation" } }
+{ $values { "default" quotation } { "assoc" "a sequence of quotation pairs" } { "quot" "a new quotation" } }
{ $description "Constructs a quotation which calls the first quotation in each pair of " { $snippet "assoc" } " until one of them outputs a true value, and then calls the second quotation in the corresponding pair. Quotations are called in reverse order, and if no quotation outputs a true value then " { $snippet "default" } " is called." }
{ $notes "This word is used to implement compile-time behavior for " { $link cond } ", and it is also used by the generic word system. Note that unlike " { $link cond } ", the constructed quotation performs the tests starting from the end and not the beginning." } ;
-USING: help.markup help.syntax words math source-files
-parser quotations definitions stack-checker.errors ;
+USING: definitions help.markup help.syntax kernel parser
+quotations source-files stack-checker.errors words ;
IN: compiler.units
ARTICLE: "compilation-units-internals" "Compilation units internals"
{ $error-description "Thrown when an attempt is made to define a word outside of a " { $link with-compilation-unit } " combinator." } ;
HELP: modify-code-heap
-{ $values { "alist" "an association list with words as keys" } { "update-existing?" "a boolean" } { "reset-pics?" "a boolean" } }
+{ $values { "alist" "an association list with words as keys" } { "update-existing?" boolean } { "reset-pics?" boolean } }
{ $description "Lowest-level primitive for defining words. Associates words with code blocks in the code heap."
$nl
"The alist maps words to one of the following:"
-USING: help.markup help.syntax kernel kernel.private
-continuations.private vectors arrays namespaces
-assocs words quotations lexer sequences math ;
+USING: continuations.private help.markup help.syntax kernel
+kernel.private lexer namespaces quotations sequences vectors ;
IN: continuations
ARTICLE: "errors-restartable" "Restartable errors"
{ $description "Throws a resumable error. If the user elects to continue execution, this word returns normally." } ;
HELP: compute-restarts
-{ $values { "error" object } { "seq" "a sequence" } }
+{ $values { "error" object } { "seq" sequence } }
{ $description "Outputs a sequence of triples, where each triple consists of a human-readable string, an object, and a continuation. Resuming a continuation with the corresponding object restarts execution immediately after the corresponding call to " { $link condition } "."
$nl
"This word recursively travels up the delegation chain to collate restarts from nested and wrapped conditions." } ;
-USING: help.markup help.syntax libc kernel continuations io
-sequences classes ;
+USING: classes help.markup help.syntax io quotations sequences ;
IN: destructors
HELP: debug-leaks?
{ $description "Calls the quotation, disposing the object with " { $link dispose } " after the quotation returns or if it throws an error." } ;
HELP: with-destructors
-{ $values { "quot" "a quotation" } }
+{ $values { "quot" quotation } }
{ $description "Calls a quotation within a new dynamic scope. This quotation may register destructors using " { $link &dispose } " or " { $link |dispose } ". The former registers a destructor that will always run whether or not the quotation threw an error, and the latter registers a destructor that only runs if the quotation throws an error. Destructors are run in reverse order from the order in which they were registered." }
{ $notes
"Destructors generalize " { $link with-disposal } ". The following two lines are equivalent, except that the second line establishes a new dynamic scope:"
-USING: arrays classes help.markup help.syntax math strings words kernel combinators sequences ;
+USING: arrays classes help.markup help.syntax kernel math
+sequences strings words ;
IN: effects
ARTICLE: "effects" "Stack effect declarations"
{ $description "Outputs the number of objects added to the data stack by the stack effect. This will be negative if the stack effect only removes objects from the stack." } ;
HELP: effect<=
-{ $values { "effect1" effect } { "effect2" effect } { "?" "a boolean" } }
+{ $values { "effect1" effect } { "effect2" effect } { "?" boolean } }
{ $description "Tests if " { $snippet "effect1" } " is substitutable for " { $snippet "effect2" } ". What this means is that both stack effects change the stack height by the same amount, the first takes a smaller or equal number of inputs as the second, and either both or neither one terminate execution by throwing an error." } ;
HELP: effect=
-{ $values { "effect1" effect } { "effect2" effect } { "?" "a boolean" } }
+{ $values { "effect1" effect } { "effect2" effect } { "?" boolean } }
{ $description "Tests if " { $snippet "effect1" } " and " { $snippet "effect2" } " represent the same stack transformation, without looking parameter names." }
{ $examples
{ $example "USING: effects prettyprint ;" "( a -- b ) ( x -- y ) effect= ." "t" }
-USING: generic generic.single help.markup help.syntax sequences math
-math.parser effects ;
+USING: effects generic.single help.markup help.syntax words ;
IN: generic.standard
HELP: standard-combination
} ;
HELP: define-simple-generic
-{ $values { "word" "a word" } { "effect" effect } }
-{ $description "Defines a generic word with the " { $link standard-combination } " method combination and a dispatch position of 0." } ;
\ No newline at end of file
+{ $values { "word" word } { "effect" effect } }
+{ $description "Defines a generic word with the " { $link standard-combination } " method combination and a dispatch position of 0." } ;
-USING: hashtables.private help.markup help.syntax
-kernel prettyprint generic sequences sequences.private
-namespaces assocs ;
+USING: assocs hashtables.private help.markup help.syntax kernel
+sequences ;
IN: hashtables
ARTICLE: "hashtables.private" "Hashtable implementation details"
{ $description "Searches the hashtable for the key using a quadratic probing strategy. If the key is not present in the hashtable, outputs the index where it should be stored." } ;
HELP: set-nth-pair
-{ $values { "value" "the second element of the pair" } { "key" "the first element of the pair" } { "seq" "a sequence" } { "n" "an index in the sequence" } }
+{ $values { "value" "the second element of the pair" } { "key" "the first element of the pair" } { "seq" sequence } { "n" "an index in the sequence" } }
{ $description "Stores a pair of values into the elements with index " { $snippet "n" } " and " { $snippet "n+1" } ", respectively." }
{ $warning "This word is in the " { $vocab-link "hashtables.private" } " vocabulary because it does not perform bounds checks." }
{ $side-effects "seq" } ;
-USING: help.markup help.syntax io strings arrays io.backend
-io.files.private quotations sequences ;
+USING: help.markup help.syntax io kernel quotations sequences ;
IN: io.files
ARTICLE: "io.files.examples" "Examples of reading and writing files"
{ $errors "Throws an error if the file cannot be opened for writing." } ;
HELP: with-file-reader
-{ $values { "path" "a pathname string" } { "encoding" "an encoding descriptor" } { "quot" "a quotation" } }
+{ $values { "path" "a pathname string" } { "encoding" "an encoding descriptor" } { "quot" quotation } }
{ $description "Opens a file for reading and calls the quotation using " { $link with-input-stream } "." }
{ $errors "Throws an error if the file is unreadable." } ;
HELP: with-file-writer
-{ $values { "path" "a pathname string" } { "encoding" "an encoding descriptor" } { "quot" "a quotation" } }
+{ $values { "path" "a pathname string" } { "encoding" "an encoding descriptor" } { "quot" quotation } }
{ $description "Opens a file for writing using the given encoding and calls the quotation using " { $link with-output-stream } "." }
{ $errors "Throws an error if the file cannot be opened for writing." } ;
HELP: with-file-appender
-{ $values { "path" "a pathname string" } { "encoding" "an encoding descriptor" } { "quot" "a quotation" } }
+{ $values { "path" "a pathname string" } { "encoding" "an encoding descriptor" } { "quot" quotation } }
{ $description "Opens a file for appending using the given encoding and calls the quotation using " { $link with-output-stream } "." }
{ $errors "Throws an error if the file cannot be opened for writing." } ;
{ set-file-lines file-lines set-file-contents file-contents } related-words
HELP: exists?
-{ $values { "path" "a pathname string" } { "?" "a boolean" } }
+{ $values { "path" "a pathname string" } { "?" boolean } }
{ $description "Tests if the file named by " { $snippet "path" } " exists." } ;
-USING: help.markup help.syntax io.backend io.files
-io.directories strings system sequences io.pathnames.private ;
+USING: help.markup help.syntax io.backend io.directories
+io.files io.pathnames.private kernel sequences strings system ;
IN: io.pathnames
HELP: path-separator?
-{ $values { "ch" "a code point" } { "?" "a boolean" } }
+{ $values { "ch" "a code point" } { "?" boolean } }
{ $description "Tests if the code point is a platform-specific path separator." }
{ $examples
"On Unix:"
{ append-path prepend-path } related-words
HELP: absolute-path?
-{ $values { "path" "a pathname string" } { "?" "a boolean" } }
+{ $values { "path" "a pathname string" } { "?" boolean } }
{ $description "Tests if a pathname is absolute. Examples of absolute pathnames are " { $snippet "/foo/bar" } " on Unix and " { $snippet "c:\\foo\\bar" } " on Windows." } ;
HELP: windows-absolute-path?
-{ $values { "path" "a pathname string" } { "?" "a boolean" } }
+{ $values { "path" "a pathname string" } { "?" boolean } }
{ $description "Tests if a pathname is absolute on Windows. Examples of absolute pathnames on Windows are " { $snippet "c:\\foo\\bar" } " and " { $snippet "\\\\?\\c:\\foo\\bar" } " for absolute Unicode pathnames." } ;
HELP: root-directory?
-{ $values { "path" "a pathname string" } { "?" "a boolean" } }
+{ $values { "path" "a pathname string" } { "?" boolean } }
{ $description "Tests if a pathname is a root directory. Examples of root directory pathnames are " { $snippet "/" } " on Unix and " { $snippet "c:\\" } " on Windows." } ;
{ absolute-path? windows-absolute-path? root-directory? } related-words
-USING: generic help.markup help.syntax math memory
-namespaces sequences kernel.private layouts classes
-vectors combinators quotations strings words
-assocs arrays math.order ;
+USING: arrays classes combinators help.markup help.syntax
+kernel.private layouts math quotations words ;
IN: kernel
HELP: eq?
-{ $values { "obj1" object } { "obj2" object } { "?" "a boolean" } }
+{ $values { "obj1" object } { "obj2" object } { "?" boolean } }
{ $description "Tests if two references point at the same object." } ;
HELP: drop $shuffle ;
{ hashcode hashcode* identity-hashcode } related-words
HELP: =
-{ $values { "obj1" object } { "obj2" object } { "?" "a boolean" } }
+{ $values { "obj1" object } { "obj2" object } { "?" boolean } }
{ $description
"Tests if two objects are equal. If " { $snippet "obj1" } " and " { $snippet "obj2" } " point to the same object, outputs " { $link t } ". Otherwise, calls the " { $link equal? } " generic word."
}
} ;
HELP: equal?
-{ $values { "obj1" object } { "obj2" object } { "?" "a boolean" } }
+{ $values { "obj1" object } { "obj2" object } { "?" boolean } }
{ $contract
"Tests if two objects are equal."
$nl
{ $class-description "A union of the " { $link POSTPONE: t } " and " { $link POSTPONE: f } " classes." } ;
HELP: >boolean
-{ $values { "obj" "a generalized boolean" } { "?" "a boolean" } }
+{ $values { "obj" "a generalized boolean" } { "?" boolean } }
{ $description "Convert a generalized boolean into a boolean. That is, " { $link f } " retains its value, whereas anything else becomes " { $link t } "." } ;
HELP: not
-{ $values { "obj" "a generalized boolean" } { "?" "a boolean" } }
+{ $values { "obj" "a generalized boolean" } { "?" boolean } }
{ $description "For " { $link f } " outputs " { $link t } " and for anything else outputs " { $link f } "." }
{ $notes "This word implements boolean not, so applying it to integers will not yield useful results (all integers have a true value). Bitwise not is the " { $link bitnot } " word." } ;
{ $notes "This word implements boolean exclusive or, so applying it to integers will not yield useful results (all integers have a true value). Bitwise exclusive or is the " { $link bitxor } " word." } ;
HELP: both?
-{ $values { "x" object } { "y" object } { "quot" { $quotation ( ... obj -- ... ? ) } } { "?" "a boolean" } }
+{ $values { "x" object } { "y" object } { "quot" { $quotation ( ... obj -- ... ? ) } } { "?" boolean } }
{ $description "Tests if the quotation yields a true value when applied to both " { $snippet "x" } " and " { $snippet "y" } "." }
{ $examples
{ $example "USING: kernel math prettyprint ;" "3 5 [ odd? ] both? ." "t" }
} ;
HELP: either?
-{ $values { "x" object } { "y" object } { "quot" { $quotation ( ... obj -- ... ? ) } } { "?" "a boolean" } }
+{ $values { "x" object } { "y" object } { "quot" { $quotation ( ... obj -- ... ? ) } } { "?" boolean } }
{ $description "Tests if the quotation yields a true value when applied to either " { $snippet "x" } " or " { $snippet "y" } "." }
{ $examples
{ $example "USING: kernel math prettyprint ;" "3 6 [ odd? ] either? ." "t" }
} ;
HELP: same?
-{ $values { "x" object } { "y" object } { "quot" { $quotation ( ... obj -- ... obj' ) } } { "?" "a boolean" } }
+{ $values { "x" object } { "y" object } { "quot" { $quotation ( ... obj -- ... obj' ) } } { "?" boolean } }
{ $description "Applies the quotation to both " { $snippet "x" } " and " { $snippet "y" } ", and then checks if the results are equal." }
{ $examples
{ $example "USING: kernel math prettyprint ;" "4 5 [ 2/ ] same? ." "t" }
{ $description "Creates a new " { $link lexer-error } ", filling in the location information from the current " { $link lexer } "." } ;
HELP: skip
-{ $values { "i" "a starting index" } { "seq" sequence } { "?" "a boolean" } { "n" integer } }
+{ $values { "i" "a starting index" } { "seq" sequence } { "?" boolean } { "n" integer } }
{ $description "Skips to the first space character (if " { $snippet "boolean" } " is " { $link f } ") or the first non-space character (otherwise). Tabulations used as separators instead of spaces will be flagged as an error." } ;
HELP: change-lexer-column
{ $notes "Custom lexers can implement this generic word." } ;
HELP: still-parsing-line?
-{ $values { "lexer" lexer } { "?" "a boolean" } }
+{ $values { "lexer" lexer } { "?" boolean } }
{ $description "Outputs " { $link f } " if the end of the current line has been reached, " { $link t } " otherwise." } ;
HELP: parse-token
$parsing-note ;
HELP: still-parsing?
-{ $values { "lexer" lexer } { "?" "a boolean" } }
+{ $values { "lexer" lexer } { "?" boolean } }
{ $description "Outputs " { $link f } " if end of input has been reached, " { $link t } " otherwise." } ;
HELP: each-token
-USING: help.markup help.syntax math math.private ;
+USING: help.markup help.syntax kernel math math.private ;
IN: math.floats
HELP: float
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link /f } " instead." } ;
HELP: float<
-{ $values { "x" float } { "y" float } { "?" "a boolean" } }
+{ $values { "x" float } { "y" float } { "?" boolean } }
{ $description "Primitive version of " { $link < } "." }
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link < } " instead." } ;
HELP: float<=
-{ $values { "x" float } { "y" float } { "?" "a boolean" } }
+{ $values { "x" float } { "y" float } { "?" boolean } }
{ $description "Primitive version of " { $link <= } "." }
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link <= } " instead." } ;
HELP: float>
-{ $values { "x" float } { "y" float } { "?" "a boolean" } }
+{ $values { "x" float } { "y" float } { "?" boolean } }
{ $description "Primitive version of " { $link > } "." }
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link > } " instead." } ;
HELP: float>=
-{ $values { "x" float } { "y" float } { "?" "a boolean" } }
+{ $values { "x" float } { "y" float } { "?" boolean } }
{ $description "Primitive version of " { $link u>= } "." }
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link u>= } " instead." } ;
HELP: float-u<
-{ $values { "x" float } { "y" float } { "?" "a boolean" } }
+{ $values { "x" float } { "y" float } { "?" boolean } }
{ $description "Primitive version of " { $link u< } "." }
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link u< } " instead." } ;
HELP: float-u<=
-{ $values { "x" float } { "y" float } { "?" "a boolean" } }
+{ $values { "x" float } { "y" float } { "?" boolean } }
{ $description "Primitive version of " { $link u<= } "." }
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link u<= } " instead." } ;
HELP: float-u>
-{ $values { "x" float } { "y" float } { "?" "a boolean" } }
+{ $values { "x" float } { "y" float } { "?" boolean } }
{ $description "Primitive version of " { $link u> } "." }
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link u> } " instead." } ;
HELP: float-u>=
-{ $values { "x" float } { "y" float } { "?" "a boolean" } }
+{ $values { "x" float } { "y" float } { "?" boolean } }
{ $description "Primitive version of " { $link u>= } "." }
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link u>= } " instead." } ;
-USING: help.markup help.syntax math math.private ;
+USING: help.markup help.syntax kernel math math.private ;
IN: math.integers
ARTICLE: "integers" "Integers"
{ $class-description "The class of integers, which is a disjoint union of fixnums and bignums." } ;
HELP: even?
-{ $values { "n" integer } { "?" "a boolean" } }
+{ $values { "n" integer } { "?" boolean } }
{ $description "Tests if an integer is even." } ;
HELP: odd?
-{ $values { "n" integer } { "?" "a boolean" } }
+{ $values { "n" integer } { "?" boolean } }
{ $description "Tests if an integer is odd." } ;
! Unsafe primitives
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link /mod } " instead." } ;
HELP: fixnum<
-{ $values { "x" fixnum } { "y" fixnum } { "?" "a boolean" } }
+{ $values { "x" fixnum } { "y" fixnum } { "?" boolean } }
{ $description "Primitive version of " { $link < } "." }
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link < } " instead." } ;
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link <= } " instead." } ;
HELP: fixnum>
-{ $values { "x" fixnum } { "y" fixnum } { "?" "a boolean" } }
+{ $values { "x" fixnum } { "y" fixnum } { "?" boolean } }
{ $description "Primitive version of " { $link > } "." }
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link > } " instead." } ;
HELP: fixnum>=
-{ $values { "x" fixnum } { "y" fixnum } { "?" "a boolean" } }
+{ $values { "x" fixnum } { "y" fixnum } { "?" boolean } }
{ $description "Primitive version of " { $link >= } "." }
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link >= } " instead." } ;
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link /mod } " instead." } ;
HELP: bignum<
-{ $values { "x" bignum } { "y" bignum } { "?" "a boolean" } }
+{ $values { "x" bignum } { "y" bignum } { "?" boolean } }
{ $description "Primitive version of " { $link < } "." }
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link < } " instead." } ;
HELP: bignum<=
-{ $values { "x" bignum } { "y" bignum } { "?" "a boolean" } }
+{ $values { "x" bignum } { "y" bignum } { "?" boolean } }
{ $description "Primitive version of " { $link <= } "." }
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link <= } " instead." } ;
HELP: bignum>
-{ $values { "x" bignum } { "y" bignum } { "?" "a boolean" } }
+{ $values { "x" bignum } { "y" bignum } { "?" boolean } }
{ $description "Primitive version of " { $link > } "." }
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link > } " instead." } ;
HELP: bignum>=
-{ $values { "x" bignum } { "y" bignum } { "?" "a boolean" } }
+{ $values { "x" bignum } { "y" bignum } { "?" boolean } }
{ $description "Primitive version of " { $link >= } "." }
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link >= } " instead." } ;
HELP: bignum=
-{ $values { "x" bignum } { "y" bignum } { "?" "a boolean" } }
+{ $values { "x" bignum } { "y" bignum } { "?" boolean } }
{ $description "Primitive version of " { $link number= } "." }
{ $warning "This word does not perform type checking, and passing objects of the wrong type can crash the runtime. User code should call the generic word " { $link number= } " instead." } ;
-USING: help.markup help.syntax kernel sequences quotations
-math.private byte-arrays io.binary ;
+USING: help.markup help.syntax kernel quotations sequences ;
IN: math
HELP: number=
-{ $values { "x" number } { "y" number } { "?" "a boolean" } }
+{ $values { "x" number } { "y" number } { "?" boolean } }
{ $description "Tests if two numbers have the same numeric value." }
{ $notes "This word differs from " { $link = } " in that it disregards differences in type when comparing numbers."
$nl
"Due to the two's complement representation of signed integers, the following two lines are equivalent:" { $code "bitnot" "neg 1 -" } } ;
HELP: bit?
-{ $values { "x" integer } { "n" integer } { "?" "a boolean" } }
+{ $values { "x" integer } { "n" integer } { "?" boolean } }
{ $description "Tests if the " { $snippet "n" } "th bit of " { $snippet "x" } " is set." }
{ $examples { $example "USING: math prettyprint ;" "0b101 2 bit? ." "t" } } ;
{ $description "Computes two to the power of " { $snippet "n" } ". This word will only give correct results if " { $snippet "n" } " is greater than zero; for the general case, use " { $snippet "2 swap ^" } "." } ;
HELP: zero?
-{ $values { "x" number } { "?" "a boolean" } }
+{ $values { "x" number } { "?" boolean } }
{ $description "Tests if the number is equal to zero." } ;
HELP: if-zero
} ;
HELP: fp-special?
-{ $values { "x" real } { "?" "a boolean" } }
+{ $values { "x" real } { "?" boolean } }
{ $description "Tests if " { $snippet "x" } " is an IEEE special value (Not-a-Number or Infinity). While " { $snippet "x" } " can be any real number, this word will only ever yield true if " { $snippet "x" } " is a " { $link float } "." } ;
HELP: fp-nan?
-{ $values { "x" real } { "?" "a boolean" } }
+{ $values { "x" real } { "?" boolean } }
{ $description "Tests if " { $snippet "x" } " is an IEEE Not-a-Number value. While " { $snippet "x" } " can be any real number, this word will only ever yield true if " { $snippet "x" } " is a " { $link float } "." } ;
HELP: fp-qnan?
-{ $values { "x" real } { "?" "a boolean" } }
+{ $values { "x" real } { "?" boolean } }
{ $description "Tests if " { $snippet "x" } " is an IEEE Quiet Not-a-Number value. While " { $snippet "x" } " can be any real number, this word will only ever yield true if " { $snippet "x" } " is a " { $link float } "." } ;
HELP: fp-snan?
-{ $values { "x" real } { "?" "a boolean" } }
+{ $values { "x" real } { "?" boolean } }
{ $description "Tests if " { $snippet "x" } " is an IEEE Signaling Not-a-Number value. While " { $snippet "x" } " can be any real number, this word will only ever yield true if " { $snippet "x" } " is a " { $link float } "." } ;
HELP: fp-infinity?
-{ $values { "x" real } { "?" "a boolean" } }
+{ $values { "x" real } { "?" boolean } }
{ $description "Tests if " { $snippet "x" } " is an IEEE Infinity value. While " { $snippet "x" } " can be any real number, this word will only ever yield true if " { $snippet "x" } " is a " { $link float } "." }
{ $examples
{ $example "USING: math prettyprint ;" "1/0. fp-infinity? ." "t" }
} ;
HELP: fp-sign
-{ $values { "x" float } { "?" "a boolean" } }
+{ $values { "x" float } { "?" boolean } }
{ $description "Outputs the sign bit of " { $snippet "x" } ". For ordered non-zero values, this is equivalent to calling " { $snippet "0 <" } ". For zero values, this outputs the zero's sign bit." } ;
HELP: fp-nan-payload
{ $class-description "The class of numbers." } ;
HELP: next-power-of-2
-{ $values { "m" "a non-negative integer" } { "n" "an integer" } }
+{ $values { "m" "a non-negative integer" } { "n" integer } }
{ $description "Outputs the smallest power of 2 greater than or equal to " { $snippet "m" } ". The output value is always at least 2." } ;
HELP: power-of-2?
-{ $values { "n" integer } { "?" "a boolean" } }
+{ $values { "n" integer } { "?" boolean } }
{ $description "Tests if " { $snippet "n" } " is a power of 2." } ;
HELP: each-integer
{ $notes "This word is used to implement " { $link each } "." } ;
HELP: all-integers?
-{ $values { "n" integer } { "quot" { $quotation ( ... i -- ... ? ) } } { "?" "a boolean" } }
+{ $values { "n" integer } { "quot" { $quotation ( ... i -- ... ? ) } } { "?" boolean } }
{ $description "Applies the quotation to each integer from 0 up to " { $snippet "n" } ", excluding " { $snippet "n" } ". Iteration stops when the quotation outputs " { $link f } " or the end is reached. If the quotation yields a false value for some integer, this word outputs " { $link f } ". Otherwise, this word outputs " { $link t } "." }
{ $notes "This word is used to implement " { $link all? } "." } ;
-USING: help.markup help.syntax kernel math quotations
-math.private words words.symbol ;
+USING: help.markup help.syntax kernel math ;
IN: math.order
HELP: <=>
{ $description "Outputs " { $snippet "x" } " if contained in the interval " { $snippet "[min,max]" } " or else outputs one of the endpoints." } ;
HELP: between?
-{ $values { "x" object } { "y" object } { "z" object } { "?" "a boolean" } }
+{ $values { "x" object } { "y" object } { "z" object } { "?" boolean } }
{ $description "Tests if " { $snippet "x" } " is in the interval " { $snippet "[y,z]" } "." }
{ $notes "As per the closed interval notation, the end-points are included in the interval." } ;
HELP: before?
-{ $values { "obj1" object } { "obj2" object } { "?" "a boolean" } }
+{ $values { "obj1" object } { "obj2" object } { "?" boolean } }
{ $description "Tests if " { $snippet "obj1" } " comes before " { $snippet "obj2" } " using an intrinsic total order." }
{ $notes "Implemented using " { $link <=> } "." } ;
HELP: after?
-{ $values { "obj1" object } { "obj2" object } { "?" "a boolean" } }
+{ $values { "obj1" object } { "obj2" object } { "?" boolean } }
{ $description "Tests if " { $snippet "obj1" } " comes after " { $snippet "obj2" } " using an intrinsic total order." }
{ $notes "Implemented using " { $link <=> } "." } ;
HELP: before=?
-{ $values { "obj1" object } { "obj2" object } { "?" "a boolean" } }
+{ $values { "obj1" object } { "obj2" object } { "?" boolean } }
{ $description "Tests if " { $snippet "obj1" } " comes before or equals " { $snippet "obj2" } " using an intrinsic total order." }
{ $notes "Implemented using " { $link <=> } "." } ;
HELP: after=?
-{ $values { "obj1" object } { "obj2" object } { "?" "a boolean" } }
+{ $values { "obj1" object } { "obj2" object } { "?" boolean } }
{ $description "Tests if " { $snippet "obj1" } " comes after or equals " { $snippet "obj2" } " using an intrinsic total order." }
{ $notes "Implemented using " { $link <=> } "." } ;
-USING: help.markup help.syntax kernel sequences words
-math strings vectors quotations generic effects classes
-vocabs.loader definitions io vocabs source-files
-namespaces compiler.units assocs lexer
-words.symbol words.alias words.constant vocabs.parser ;
+USING: compiler.units definitions help.markup help.syntax kernel
+lexer math namespaces quotations sequences source-files strings
+vectors vocabs vocabs.parser words words.symbol ;
IN: parser
ARTICLE: "reading-ahead" "Reading ahead"
{ $notes "This word is used to implement " { $link ?scan-datum } " and " { $link scan-datum } "." } ;
HELP: scan-word
-{ $values { "word" "a word" } }
+{ $values { "word" word } }
{ $description "Reads the next token from parser input. If the token is a valid number literal, it is converted to a number, otherwise the vocabulary search path is searched for a word named by the token." }
{ $errors "Throws an error if the token does not name a word or end of file is reached." }
$parsing-note ;
-USING: arrays help.markup help.syntax math
-sequences.private vectors strings kernel math.order layouts
-quotations generic.single ;
+USING: arrays generic.single help.markup help.syntax kernel
+layouts math math.order quotations sequences.private vectors ;
IN: sequences
HELP: sequence
{ $notes "Unlike " { $link clone-like } ", the output sequence might share storage with the input sequence." } ;
HELP: empty?
-{ $values { "seq" sequence } { "?" "a boolean" } }
+{ $values { "seq" sequence } { "?" boolean } }
{ $description "Tests if the sequence has zero length." } ;
HELP: if-empty
{ $side-effects "seq" } ;
HELP: bounds-check?
-{ $values { "n" "an integer" } { "seq" sequence } { "?" "a boolean" } }
+{ $values { "n" integer } { "seq" sequence } { "?" boolean } }
{ $description "Tests if the index is within the bounds of the sequence." } ;
HELP: bounds-error
{ $description "Throws an error if " { $snippet "n" } " is negative or if it is greater than or equal to the length of " { $snippet "seq" } ". Otherwise the two inputs remain on the stack." } ;
HELP: ?nth
-{ $values { "n" "an integer" } { "seq" sequence } { "elt/f" "an object or " { $link f } } }
+{ $values { "n" integer } { "seq" sequence } { "elt/f" "an object or " { $link f } } }
{ $description "A forgiving version of " { $link nth } ". If the index is out of bounds, or if the sequence is " { $link f } ", simply outputs " { $link f } "." } ;
HELP: ?set-nth
-{ $values { "elt" object } { "n" "an integer" } { "seq" sequence } }
+{ $values { "elt" object } { "n" integer } { "seq" sequence } }
{ $description "A forgiving version of " { $link set-nth } ". If the index is out of bounds, does nothing." } ;
HELP: ?first
{ $description "A forgiving version of " { $link last } ". If the sequence is empty, or if the sequence is " { $link f } ", simply outputs " { $link f } "." } ;
HELP: nth-unsafe
-{ $values { "n" "an integer" } { "seq" sequence } { "elt" object } }
+{ $values { "n" integer } { "seq" sequence } { "elt" object } }
{ $contract "Unsafe variant of " { $link nth } " that does not perform bounds checks." } ;
HELP: set-nth-unsafe
-{ $values { "elt" object } { "n" "an integer" } { "seq" sequence } }
+{ $values { "elt" object } { "n" integer } { "seq" sequence } }
{ $contract "Unsafe variant of " { $link set-nth } " that does not perform bounds checks." } ;
HELP: exchange-unsafe
{ $description "Applies the quotation to each triple of elements in turn, yielding new elements which are collected into a new sequence having the same class as " { $snippet "exemplar" } "." } ;
HELP: 2all?
-{ $values { "seq1" sequence } { "seq2" sequence } { "quot" { $quotation ( ... elt1 elt2 -- ... ? ) } } { "?" "a boolean" } }
+{ $values { "seq1" sequence } { "seq2" sequence } { "quot" { $quotation ( ... elt1 elt2 -- ... ? ) } } { "?" boolean } }
{ $description "Tests the predicate pairwise against elements of " { $snippet "seq1" } " and " { $snippet "seq2" } "." } ;
HELP: find
{ $description "Applies the quotation to each element of the sequence, until the quotation outputs a true value. If the quotation ever yields a result which is not " { $link f } ", then the value is output, along with the element of the sequence which yielded this." } ;
HELP: any?
-{ $values { "seq" sequence } { "quot" { $quotation ( ... elt -- ... ? ) } } { "?" "a boolean" } }
+{ $values { "seq" sequence } { "quot" { $quotation ( ... elt -- ... ? ) } } { "?" boolean } }
{ $description "Tests if the sequence contains an element satisfying the predicate, by applying the predicate to each element in turn until a true value is found. If the sequence is empty or if the end of the sequence is reached, outputs " { $link f } "." } ;
HELP: all?
-{ $values { "seq" sequence } { "quot" { $quotation ( ... elt -- ... ? ) } } { "?" "a boolean" } }
+{ $values { "seq" sequence } { "quot" { $quotation ( ... elt -- ... ? ) } } { "?" boolean } }
{ $description "Tests if all elements in the sequence satisfy the predicate by checking each element in turn. Given an empty sequence, vacuously outputs " { $link t } "." } ;
HELP: push-if
{ $side-effects "seq" } ;
HELP: interleave
-{ $values { "seq" sequence } { "between" "a quotation" } { "quot" { $quotation ( ... elt -- ... ) } } }
+{ $values { "seq" sequence } { "between" quotation } { "quot" { $quotation ( ... elt -- ... ) } } }
{ $description "Applies " { $snippet "quot" } " to each element in turn, also invoking " { $snippet "between" } " in-between each pair of elements." }
{ $examples { $example "USING: io sequences ;" "{ \"a\" \"b\" \"c\" } [ \"X\" write ] [ write ] interleave" "aXbXc" } } ;
{ $description "Outputs the index of the last element in the sequence equal to " { $snippet "obj" } ", traversing the sequence backwards starting from the " { $snippet "i" } "th element and finishing at the first. If no element is found, outputs " { $link f } "." } ;
HELP: member?
-{ $values { "elt" object } { "seq" sequence } { "?" "a boolean" } }
+{ $values { "elt" object } { "seq" sequence } { "?" boolean } }
{ $description "Tests if the sequence contains an element equal to the object." }
{ $notes "This word uses equality comparison (" { $link = } ")." } ;
HELP: member-eq?
-{ $values { "elt" object } { "seq" sequence } { "?" "a boolean" } }
+{ $values { "elt" object } { "seq" sequence } { "?" boolean } }
{ $description "Tests if the sequence contains the object." }
{ $notes "This word uses identity comparison (" { $link eq? } ")." } ;
{ $examples { $example "USING: io sequences ;" "{ \"ab\" \"quux\" } [ 5 CHAR: - pad-tail print ] each" "ab---\nquux-" } } ;
HELP: sequence=
-{ $values { "seq1" sequence } { "seq2" sequence } { "?" "a boolean" } }
+{ $values { "seq1" sequence } { "seq2" sequence } { "?" boolean } }
{ $description "Tests if the two sequences have the same length and elements. This is weaker than " { $link = } ", since it does not ensure that the sequences are instances of the same class." } ;
HELP: reversed
{ $errors "Throws an error if the index is out of bounds." } ;
HELP: shorter?
-{ $values { "seq1" sequence } { "seq2" sequence } { "?" "a boolean" } }
+{ $values { "seq1" sequence } { "seq2" sequence } { "?" boolean } }
{ $description "Tests if the length of " { $snippet "seq1" } " is smaller than the length of " { $snippet "seq2" } "." } ;
HELP: head?
-{ $values { "seq" sequence } { "begin" sequence } { "?" "a boolean" } }
+{ $values { "seq" sequence } { "begin" sequence } { "?" boolean } }
{ $description "Tests if " { $snippet "seq" } " starts with " { $snippet "begin" } ". If " { $snippet "begin" } " is longer than " { $snippet "seq" } ", this word outputs " { $link f } "." }
{ $examples
{ $example
} ;
HELP: tail?
-{ $values { "seq" sequence } { "end" sequence } { "?" "a boolean" } }
+{ $values { "seq" sequence } { "end" sequence } { "?" boolean } }
{ $description "Tests if " { $snippet "seq" } " ends with " { $snippet "end" } ". If " { $snippet "end" } " is longer than " { $snippet "seq" } ", this word outputs " { $link f } "." } ;
{ remove remove-nth remove-eq remove-eq! remove! remove-nth! } related-words
{ $description "Outputs the start index of the first contiguous subsequence equal to " { $snippet "subseq" } ", or " { $link f } " if no matching subsequence is found." } ;
HELP: subseq?
-{ $values { "subseq" sequence } { "seq" sequence } { "?" "a boolean" } }
+{ $values { "subseq" sequence } { "seq" sequence } { "?" boolean } }
{ $description "Tests if " { $snippet "seq" } " contains the elements of " { $snippet "subseq" } " as a contiguous subsequence." } ;
HELP: drop-prefix
{ $side-effects "set" } ;
HELP: ?adjoin
-{ $values { "elt" object } { "set" set } { "?" "a boolean" } }
+{ $values { "elt" object } { "set" set } { "?" boolean } }
{ $description "A version of " { $link adjoin } " which returns whether the element was added to the set." }
{ $notes "This is slightly less efficient than " { $link adjoin } " due to the initial membership test." } ;
{ $description "Creates a sequence with a single copy of each member of the set." $nl "Each set type is expected to implement a method on this generic word." } ;
HELP: in?
-{ $values { "elt" object } { "set" set } { "?" "a boolean" } }
+{ $values { "elt" object } { "set" set } { "?" boolean } }
{ $description "Tests whether the element is a member of the set." $nl "Each set type is expected to implement a method on this generic word as part of the set protocol." } ;
HELP: adjoin-at
} ;
HELP: all-unique?
-{ $values { "set" set } { "?" "a boolean" } }
+{ $values { "set" set } { "?" boolean } }
{ $description "Tests whether a set contains any repeated elements." }
{ $example
"USING: sets prettyprint ;"
} ;
HELP: intersection
-{ $values { "sets" sequence } { "set/f" "a " { $link set } " or " { $link f } } }
+{ $values { "sets" sequence } { "set/f" { $maybe set } } }
{ $description "Outputs the intersection of all the sets of the sequence " { $snippet "sets" } ", or " { $link f } " if " { $snippet "sets" } " is empty." } ;
HELP: union
{ $side-effects "set1" } ;
HELP: intersects?
-{ $values { "set1" set } { "set2" set } { "?" "a boolean" } }
+{ $values { "set1" set } { "set2" set } { "?" boolean } }
{ $description "Tests if " { $snippet "set1" } " and " { $snippet "set2" } " have any elements in common." }
{ $notes "If one of the sets is empty, the result is always " { $link f } "." } ;
HELP: subset?
-{ $values { "set1" set } { "set2" set } { "?" "a boolean" } }
+{ $values { "set1" set } { "set2" set } { "?" boolean } }
{ $description "Tests if every element of " { $snippet "set1" } " is contained in " { $snippet "set2" } "." }
{ $notes "If " { $snippet "set1" } " is empty, the result is always " { $link t } "." } ;
HELP: set=
-{ $values { "set1" set } { "set2" set } { "?" "a boolean" } }
+{ $values { "set1" set } { "set2" set } { "?" boolean } }
{ $description "Tests if both sets contain the same elements, disregrading order and duplicates." } ;
HELP: gather
{ $description "Returns the subsequence of the given sequence consisting of things that are not members of the set. This may contain duplicates, if the sequence has duplicates." } ;
HELP: null?
-{ $values { "set" set } { "?" "a boolean" } }
+{ $values { "set" set } { "?" boolean } }
{ $description "Tests whether the given set is empty. This outputs " { $snippet "t" } " when given a null set of any type." } ;
HELP: cardinality
{ $description "Returns the number of elements in the set. All sets support this operation." } ;
HELP: combine
-{ $values { "sets" "a sequence of sets" } { "set/f" "a " { $link set } " or " { $link f } } }
+{ $values { "sets" "a sequence of sets" } { "set/f" { $maybe set } } }
{ $description "Outputs the union of a sequence of sets, or " { $link f } " if the sequence is empty." } ;
-USING: help.markup help.syntax sequences strings ;
+USING: help.markup help.syntax kernel sequences strings ;
IN: splitting
ARTICLE: "sequences-split" "Splitting sequences"
{ $examples { $example "USING: prettyprint splitting ;" "\"hello world-how are you?\" \" -\" split ." "{ \"hello\" \"world\" \"how\" \"are\" \"you?\" }" } } ;
HELP: ?head
-{ $values { "seq" sequence } { "begin" sequence } { "newseq" "a new sequence" } { "?" "a boolean" } }
+{ $values { "seq" sequence } { "begin" sequence } { "newseq" "a new sequence" } { "?" boolean } }
{ $description "Tests if " { $snippet "seq" } " starts with " { $snippet "begin" } ". If there is a match, outputs the subrange of " { $snippet "seq" } " excluding " { $snippet "begin" } ", and " { $link t } ". If there is no match, outputs " { $snippet "seq" } " and " { $link f } "." } ;
HELP: ?head-slice
-{ $values { "seq" sequence } { "begin" sequence } { "newseq" slice } { "?" "a boolean" } }
+{ $values { "seq" sequence } { "begin" sequence } { "newseq" slice } { "?" boolean } }
{ $description "Like " { $link ?head } ", except the resulting sequence is a " { $link slice } "." } ;
HELP: ?tail
-{ $values { "seq" sequence } { "end" sequence } { "newseq" "a new sequence" } { "?" "a boolean" } }
+{ $values { "seq" sequence } { "end" sequence } { "newseq" "a new sequence" } { "?" boolean } }
{ $description "Tests if " { $snippet "seq" } " ends with " { $snippet "end" } ". If there is a match, outputs the subrange of " { $snippet "seq" } " excluding " { $snippet "end" } ", and " { $link t } ". If there is no match, outputs " { $snippet "seq" } " and " { $link f } "." } ;
HELP: ?tail-slice
-{ $values { "seq" sequence } { "end" sequence } { "newseq" slice } { "?" "a boolean" } }
+{ $values { "seq" sequence } { "end" sequence } { "newseq" slice } { "?" boolean } }
{ $description "Like " { $link ?tail } ", except the resulting sequence is a " { $link slice } "." } ;
HELP: string-lines
-USING: generic help.syntax help.markup kernel math parser words
-effects classes classes.tuple generic.math generic.single arrays
-io.pathnames vocabs.loader io sequences assocs words.symbol
-words.alias words.constant combinators vocabs.parser command-line ;
+USING: arrays assocs classes.tuple combinators command-line
+effects generic generic.math generic.single help.markup
+help.syntax io.pathnames kernel math parser sequences
+vocabs.loader vocabs.parser words words.alias words.constant
+words.symbol ;
IN: syntax
ARTICLE: "parser-algorithm" "Parser algorithm"
HELP: POSTPONE:
{ $syntax "POSTPONE: word" }
-{ $values { "word" "a word" } }
+{ $values { "word" word } }
{ $description "Reads the next word from the input string and appends the word to the parse tree, even if it is a parsing word." }
{ $examples "For an ordinary word " { $snippet "foo" } ", " { $snippet "foo" } " and " { $snippet "POSTPONE: foo" } " are equivalent; however, if " { $snippet "foo" } " is a parsing word, the former will execute it at parse time, while the latter will execute it at runtime." }
{ $notes "This word is used inside parsing words to delegate further action to another parsing word, and to refer to parsing words literally from literal arrays and such." } ;
HELP: \
{ $syntax "\\ word" }
-{ $values { "word" "a word" } }
+{ $values { "word" 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\n0 <vector>" } "If " { $snippet "foo" } " is a symbol, the following two lines are equivalent:" { $code "foo" "\\ foo" } } ;
HELP: FORGET:
{ $syntax "FORGET: word" }
-{ $values { "word" "a word" } }
+{ $values { "word" word } }
{ $description "Removes the word from its vocabulary, or does nothing if no such word exists. Existing definitions that reference forgotten words will continue to work, but new occurrences of the word will not parse." } ;
HELP: USE:
-USING: generic help.markup help.syntax kernel math memory
-namespaces sequences kernel.private strings classes.singleton ;
+USING: classes.singleton help.markup help.syntax kernel math ;
IN: system
ABOUT: "system"
} ;
HELP: embedded?
-{ $values { "?" "a boolean" } }
+{ $values { "?" boolean } }
{ $description "Tests if this Factor instance is embedded in another application." } ;
HELP: exit
-USING: definitions help.markup help.syntax kernel parser
-kernel.private vocabs classes quotations sequences
-strings effects compiler.units ;
+USING: classes compiler.units definitions effects help.markup
+help.syntax kernel parser quotations sequences strings vocabs ;
IN: words
ARTICLE: "interned-words" "Looking up and creating words"
{ $description "Looks up a word with the same name and vocabulary as the given word, performing a transformation to handle parsing words in the target dictionary. Used during bootstrap to transfer host words to the target dictionary." } ;
HELP: parsing-word?
-{ $values { "object" object } { "?" "a boolean" } }
+{ $values { "object" object } { "?" boolean } }
{ $description "Tests if an object is a parsing word declared by " { $link POSTPONE: SYNTAX: } "." }
{ $notes "Outputs " { $link f } " if the object is not a word." } ;
} ;
HELP: delimiter?
-{ $values { "obj" object } { "?" "a boolean" } }
+{ $values { "obj" object } { "?" boolean } }
{ $description "Tests if an object is a delimiter word declared by " { $link POSTPONE: delimiter } "." }
{ $notes "Outputs " { $link f } " if the object is not a word." } ;
HELP: deprecated?
-{ $values { "obj" object } { "?" "a boolean" } }
+{ $values { "obj" object } { "?" boolean } }
{ $description "Tests if an object is " { $link POSTPONE: deprecated } "." }
{ $notes "Outputs " { $link f } " if the object is not a word." } ;