[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2.1 Constructors | ||
2.2 Data Selectors | ||
2.3 Data Mutators | ||
2.4 Predicates | ||
2.5 Queries |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
word | ||
list | ||
sentence | ||
fput | ||
lput | ||
array | ||
mdarray | ||
listtoarray | ||
arraytolist | ||
combine | ||
reverse | ||
gensym |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
WORD word1 word2 (WORD word1 word2 word3 ...)
outputs a word formed by concatenating its inputs.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
LIST thing1 thing2 (LIST thing1 thing2 thing3 ...)
outputs a list whose members are its inputs, which can be any Logo datum (word, list, or array).
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SENTENCE thing1 thing2 SE thing1 thing2 (SENTENCE thing1 thing2 thing3 ...) (SE thing1 thing2 thing3 ...)
outputs a list whose members are its inputs, if those inputs are not lists, or the members of its inputs, if those inputs are lists.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
FPUT thing list
outputs a list equal to its second input with one extra member, the first input, at the beginning. If the second input is a word, then the first input must be a one-letter word, and FPUT is equivalent to WORD.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
LPUT thing list
outputs a list equal to its second input with one extra member, the first input, at the end. If the second input is a word, then the first input must be a one-letter word, and LPUT is equivalent to WORD with its inputs in the other order.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ARRAY size (ARRAY size origin)
outputs an array of size members (must be a positive integer), each of
which initially is an empty list. Array members can be selected with
ITEM
and changed with SETITEM
. The first member of the array is member
number 1 unless an origin input (must be an integer) is given, in
which case the first member of the array has that number as its index.
(Typically 0 is used as the origin if anything.) Arrays are printed by
PRINT
and friends, and can be typed in, inside curly braces; indicate an
origin with {a b c}@0.
See section item , setitem , print .
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MDARRAY sizelist (library procedure) (MDARRAY sizelist origin)
outputs a multi-dimensional array. The first input must be a list of one or more positive integers. The second input, if present, must be a single integer that applies to every dimension of the array.
Ex: (MDARRAY [3 5] 0) outputs a two-dimensional array whose members range from [0 0] to [2 4].
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
LISTTOARRAY list (LISTTOARRAY list origin)
outputs an array of the same size as the input list, whose members are the members of the input list.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ARRAYTOLIST array
outputs a list whose members are the members of the input array. The first member of the output is the first member of the array, regardless of the array’s origin.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
COMBINE thing1 thing2 (library procedure)
if thing2 is a word, outputs WORD thing1 thing2. If thing2 is a list, outputs FPUT thing1 thing2.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
REVERSE list (library procedure)
outputs a list whose members are the members of the input list, in reverse order.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
GENSYM (library procedure)
outputs a unique word each time it’s invoked. The words are of the form
G1
, G2
, etc.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
first | ||
firsts | ||
last | ||
butfirst | ||
butfirsts | ||
butlast | ||
item | ||
mditem | ||
pick | ||
remove | ||
remdup | ||
quoted |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
FIRST thing
if the input is a word, outputs the first character of the word. If the input is a list, outputs the first member of the list. If the input is an array, outputs the origin of the array (that is, the index of the first member of the array).
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
FIRSTS list
outputs a list containing the FIRST
of each member of the input list.
It is an error if any member of the input list is empty. (The input
itself may be empty, in which case the output is also empty.) This
could be written as
to firsts :list output map "first :list end
but is provided as a primitive in order to speed up the iteration tools
MAP
, MAP.SE
, and FOREACH
.
to transpose :matrix if emptyp first :matrix [op []] op fput firsts :matrix transpose bfs :matrix end
See section map , map.se , foreach
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
LAST wordorlist
if the input is a word, outputs the last character of the word. If the input is a list, outputs the last member of the list.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
BUTFIRST wordorlist BF wordorlist
if the input is a word, outputs a word containing all but the first character of the input. If the input is a list, outputs a list containing all but the first member of the input.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
BUTFIRSTS list BFS list
outputs a list containing the BUTFIRST
of each member of the input list.
It is an error if any member of the input list is empty or an array.
(The input itself may be empty, in which case the output is also empty.)
This could be written as
to butfirsts :list output map "butfirst :list end
but is provided as a primitive in order to speed up the iteration tools
MAP
, MAP.SE
, and FOREACH
.
See section map , map.se , foreach
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
BUTLAST wordorlist BL wordorlist
if the input is a word, outputs a word containing all but the last character of the input. If the input is a list, outputs a list containing all but the last member of the input.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ITEM index thing
if the thing is a word, outputs the indexth character of the word. If the thing is a list, outputs the indexth member of the list. If the thing is an array, outputs the indexth member of the array. Index starts at 1 for words and lists; the starting index of an array is specified when the array is created.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MDITEM indexlist array (library procedure)
outputs the member of the multidimensional array selected by the list of numbers indexlist.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
PICK list (library procedure)
outputs a randomly chosen member of the input list.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
REMOVE thing list (library procedure)
outputs a copy of list with every member equal to thing removed.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
REMDUP list (library procedure)
outputs a copy of list with duplicate members removed. If two or more members of the input are equal, the rightmost of those members is the one that remains in the output.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
QUOTED thing (library procedure)
outputs its input, if a list; outputs its input with a quotation mark prepended, if a word.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
setitem | ||
mdsetitem | ||
.setfirst | SETFIRST | |
.setbf | SETBF | |
.setitem | SETITEM | |
push | ||
pop | ||
queue | ||
dequeue |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SETITEM index array value
command. Replaces the indexth member of array with the new value. Ensures that the resulting array is not circular, i.e., value may not be a list or array that contains array.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MDSETITEM indexlist array value (library procedure)
command. Replaces the member of array chosen by indexlist with the new value.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
.SETFIRST list value
command. Changes the first member of list to be value.
WARNING: Primitives whose names start with a period are dangerous.
Their use by non-experts is not recommended. The use of .SETFIRST
can
lead to circular list structures, which will get some Logo primitives
into infinite loops, and to unexpected changes to other data structures that
share storage with the list being modified.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
.SETBF list value
command. Changes the butfirst of list to be value.
WARNING: Primitives whose names start with a period are dangerous.
Their use by non-experts is not recommended. The use of .SETBF
can lead
to circular list structures, which will get some Logo primitives into
infinite loops; unexpected changes to other data structures that share
storage with the list being modified; or to Logo crashes and coredumps if the
butfirst of a list is not itself a list.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
.SETITEM index array value
command. Changes the indexth member of array to be value,
like SETITEM
, but without checking for circularity.
WARNING: Primitives whose names start with a period are dangerous.
Their use by non-experts is not recommended. The use of .SETITEM
can
lead to circular arrays, which will get some Logo primitives into
infinite loops.
See section setitem.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
PUSH stackname thing (library procedure)
command. Adds the thing to the stack that is the value of the variable whose name is stackname. This variable must have a list as its value; the initial value should be the empty list. New members are added at the front of the list.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
POP stackname (library procedure)
outputs the most recently PUSH
ed member of the stack that is the value
of the variable whose name is stackname and removes that member from
the stack.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
QUEUE queuename thing (library procedure)
command. Adds the thing to the queue that is the value of the variable whose name is queuename. This variable must have a list as its value; the initial value should be the empty list. New members are added at the back of the list.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
DEQUEUE queuename (library procedure)
outputs the least recently QUEUE
d member of the queue that is the value
of the variable whose name is queuename and removes that member from
the queue.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
wordp | ||
listp | ||
arrayp | ||
emptyp | ||
equalp | ||
notequalp | ||
beforep | ||
.eq | EQ | |
memberp | ||
substringp | ||
numberp | ||
vbarredp |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
WORDP thing WORD? thing
outputs TRUE
if the input is a word, FALSE
otherwise.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
LISTP thing LIST? thing
outputs TRUE
if the input is a list, FALSE
otherwise.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ARRAYP thing ARRAY? thing
outputs TRUE
if the input is an array, FALSE
otherwise.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
EMPTYP thing EMPTY? thing
outputs TRUE
if the input is the empty word or the empty list, FALSE
otherwise.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
EQUALP thing1 thing2 EQUAL? thing1 thing2 thing1 = thing2
outputs TRUE
if the inputs are equal, FALSE
otherwise. Two numbers are
equal if they have the same numeric value. Two non-numeric words are
equal if they contain the same characters in the same order. If there
is a variable named CASEIGNOREDP
whose value is TRUE
, then an upper case
letter is considered the same as the corresponding lower case letter.
(This is the case by default.) Two lists are equal if their members are
equal. An array is only equal to itself; two separately created arrays
are never equal even if their members are equal. (It is important to be
able to know if two expressions have the same array as their value
because arrays are mutable; if, for example, two variables have the same
array as their values then performing SETITEM
on one of them will also
change the other.)
See section caseignoredp , setitem
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
NOTEQUALP thing1 thing2 NOTEQUAL? thing1 thing2 thing1 <> thing2
outputs FALSE
if the inputs are equal, TRUE
otherwise. See EQUALP
for the meaning of equality for different data types.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
BEFOREP word1 word2 BEFORE? word1 word2
outputs TRUE
if word1 comes before word2 in ASCII collating sequence
(for words of letters, in alphabetical order). Case-sensitivity is
determined by the value of CASEIGNOREDP
. Note that if the inputs are
numbers, the result may not be the same as with LESSP
; for example,
BEFOREP 3 12 is false because 3 collates after 1.
See section caseignoredp , lessp
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
.EQ thing1 thing2
outputs TRUE
if its two inputs are the same datum, so that applying a
mutator to one will change the other as well. Outputs FALSE
otherwise,
even if the inputs are equal in value.
WARNING: Primitives whose names start with a period are dangerous. Their use by non-experts is not recommended. The use of mutators can lead to circular data structures, infinite loops, or Logo crashes.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MEMBERP thing1 thing2 MEMBER? thing1 thing2
if thing2 is a list or an array, outputs TRUE
if thing1 is
EQUALP
to a member of thing2, FALSE
otherwise. If
thing2 is a word, outputs TRUE
if thing1 is a one-character
word EQUALP
to a character of thing2, FALSE
otherwise.
See section equalp .
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
SUBSTRINGP thing1 thing2 SUBSTRING? thing1 thing2
if thing1 or thing2 is a list or an array, outputs FALSE
. If
thing2 is a word, outputs TRUE
if thing1 is EQUALP
to a substring of
thing2, FALSE
otherwise.
See section equalp .
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
NUMBERP thing NUMBER? thing
outputs TRUE
if the input is a number, FALSE
otherwise.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
VBARREDP char VBARRED? char BACKSLASHEDP char (library procedure) BACKSLASHED? char (library procedure)
outputs TRUE
if the input character was originally entered into Logo
within vertical bars (|) to prevent its usual special syntactic meaning,
FALSE
otherwise. (Outputs TRUE
only if the character is a
backslashed space, tab, newline, or one of ()[]+-*/=<>":;\~?|
)
The names BACKSLASHEDP
and BACKSLASHED?
are included in the
Logo library for backward compatibility with the former names of this
primitive, although it does not output TRUE
for characters
originally entered with backslashes.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
count | ||
ascii | ||
rawascii | ||
char | ||
member | ||
lowercase | ||
uppercase | ||
standout | ||
parse | ||
runparse |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
COUNT thing
outputs the number of characters in the input, if the input is a word; outputs the number of members in the input, if it is a list or an array. (For an array, this may or may not be the index of the last member, depending on the array’s origin.)
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ASCII char
outputs the integer (between 0 and 255) that represents the input
character in the ASCII code. Interprets control characters as
representing vbarred punctuation, and returns the character code for
the corresponding punctuation character without vertical bars. (Compare
RAWASCII
.)
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
RAWASCII char
outputs the integer (between 0 and 255) that represents the input character in the ASCII code. Interprets control characters as representing themselves. To find out the ASCII code of an arbitrary keystroke, use RAWASCII RC.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
CHAR int
outputs the character represented in the ASCII code by the input, which must be an integer between 0 and 255.
See section ascii .
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
MEMBER thing1 thing2
if thing2 is a word or list and if MEMBERP
with these inputs would
output TRUE
, outputs the portion of thing2 from the first instance of
thing1 to the end. If MEMBERP
would output FALSE
, outputs the empty
word or list according to the type of thing2. It is an error for
thing2 to be an array.
See section memberp .
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
LOWERCASE word
outputs a copy of the input word, but with all uppercase letters changed to the corresponding lowercase letter.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
UPPERCASE word
outputs a copy of the input word, but with all lowercase letters changed to the corresponding uppercase letter.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
STANDOUT thing
outputs a word that, when printed, will appear like the input but
displayed in standout mode (boldface, reverse video, or whatever your
version does for standout). The word contains machine-specific magic
characters at the beginning and end; in between is the printed form (as
if displayed using TYPE
) of the input. The output is always a word,
even if the input is of some other type, but it may include spaces and
other formatting characters. Note: a word output by STANDOUT
while Logo
is running on one machine will probably not have the desired effect if
printed on another type of machine.
In the Macintosh classic version, the way that standout works is incompatible with the use of characters whose ASCII code is greater than 127. Therefore, you have a choice to make: The instruction
CANINVERSE 0
disables standout, but enables the display of ASCII codes above 127, and the instruction
CANINVERSE 1
restores the default situation in which standout is enabled and the extra graphic characters cannot be printed.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
PARSE word
outputs the list that would result if the input word were entered in
response to a READLIST
operation. That is, PARSE READWORD has the same
value as READLIST
for the same characters read.
See section readlist , readword
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
RUNPARSE wordorlist
outputs the list that would result if the input word or list were entered as an instruction line; characters such as infix operators and parentheses are separate members of the output. Note that sublists of a runparsed list are not themselves runparsed.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on December 27, 2019 using texi2html 5.0.