Spis poleceń › Containers — poleceń: 66


:container

containers

Wejście: none
Wyjście: none

A colon : indicates a container, with the name of the word following the colon. turtleSpaces 'resolves' a :container 'tag' into the value of that container when an instruction is executed, such that if the value of :container is 5, then forward :container becomes 'resolved' to forward 5, before the instruction is executed.

show :container

:=

containers

Wejście: expression | expression
Wyjście: none

Assigns the value of the second expression to the container name resolved by the first expression. See make for more details

So, for example, "frog := 5 puts the value 5 in the container named frog. However, :frog := 5 puts the value of 5 in the container named whatever is inside the container named frog.

"frog := "duck
:frog = 5
show :duck
5

buryname

containers

Wejście: name or [list]
Wyjście: none

Buries the provided container names.

buryname "container

cleardatabase

containers

Wejście: database (word)
Wyjście: none

Clears the given database. Unlike erasedatabase, the database is still defined. See newdatabase

cleardatabase "mydb

cleardictionary

containers

Wejście: dictionary (word)
Wyjście: none

Clears the given dictionary. Unlike erasedictionary, the dictionary is still defined. See enter, lookup, newdictionary, erasedictionary, dictionary, dictionaryp, copydictionary, savedictionary, loaddictionary

cleardictionary "mydict

copydatabase

containers

Wejście: source | destination
Wyjście: none

Copies a database with the name source to another database with the name destination. See database, newdatabase

copydatabase "from "to

copydictionary

containers

Wejście: source | destination
Wyjście: none

Copies a dictionary with the name source to another dictionary with the name destination. See dictionary, newdictionary

copydictionary "from "to

database

containers

Wejście: databasename (word)
Wyjście: contents

Outputs a list containing the contents of the specified database in the format [key1 [container1 [values] container2 [values]…] key2…] See newdatabase

show database "mydb

dequeue

containers

Wejście: container
Wyjście: item

Similar to pop, except removes the item from the end of the list. See pop

show dequeue "container

dictionary

containers

Wejście: dictionary (word)
Wyjście: list

Returns a list containing the contents of the given dictionary. See enter, lookup, erasedictionary, cleardictionary, newdictionary, dictionaryp, copydictionary, savedictionary, loaddictionary

show dictionary "mydict

edn

containers

Wejście: containername (word)
Wyjście: none

Inserts a make statement into the prompt containing the specified container name and its contents for editing.

edn "container

edns

containers

Wejście: containername(s) (list)
Wyjście: none

Opens the editor with a list of the provided containers and their contents, which are updated when the editor is exited.

edns [container1 container2]

enter

containers

Wejście: dictionary (name) | key (name) | value (word or list)
Wyjście: none

Associates the given value with the given key in the given dictionary. See newdictionary, lookup, erasedictionary, cleardictionary, dictionary, dictionaryp, copydictionary, savedictionary, loaddictionary

enter "mydict "stooges [moe larry curly]
enter "mydict "ducks 5

erasedatabase

containers

Wejście: database (word)
Wyjście: none

Erases the given database. Unlike cleardatabase, the database is no longer defined. See newdatabase

erasedatabase "mydb

erasedictionary

containers

Wejście: dictionary (word)
Wyjście: none

Erases the given dictionary. Unlike cleardictionary, the dictionary is no longer defined. See enter, lookup, newdictionary, cleardictionary, dictionary, dictionaryp, copydictionary, savedictionary, loaddictionary

erasedictionary "mydict

eraselocal

containers

Wejście: container (word)
Wyjście: none

Erases the named local container. See local

erase "localcontainer

erasename

Także: ern

containers

Wejście: container (word)
Wyjście: none

Erases the name off of a specified container (unallocating it), and empties its contents.

erasename "mycontainer

erasenames

Także: erns

containers

Wejście: none
Wyjście: none

Erases the names off of all the containers held by the turtle that calls it, and empties their contents

erasenames

eraseprivate

containers

Wejście: container (word)
Wyjście: none

Erases the named private container. See private

eraseprivate "privatecontainer

eraseshare

containers

Wejście: container (word)
Wyjście: none

Erases the specified shared container.

eraseshare "sharedcontainer

eraseshares

containers

Wejście: none
Wyjście: none

Erases all shared containers and their contents.


erprops

containers

Wejście: none
Wyjście: none

Erases all property lists.

erprops

get

containers

Wejście: surname | container
Wyjście: value

Returns the value of the specified container under the given surname. See setsurname, set

show get "jones "car
camry

global

containers

Wejście: containername (word)
Wyjście: none

Marks a specified container as a global container, one that is accessible by all procedures inside of a turtle. global converts any local or private container at the same level. To make a container accessible by multiple turtles, see share. To make a container accessible only inside a particular procedure see local and private.

global "mycontainer

gprop

containers

Wejście: name | property
Wyjście: value

Returns the value of the property in the named property list. See plist

show gprop "john "phone

in

containers

Wejście: anything
Wyjście: anything

in simply passes whatever is passed to it. It is useful in two main contexts: first, to improve the readability of the make alternative put, as in put 5 in "container; second, to retrieve the value of another turtle's container using query, as in query "myrtle [in :container].

pr query speedy [in :suspensions]

increment

Także: inc

containers

Wejście: name (word)
Wyjście: none

Increments the contents of the named container by one. Has no effect if the value of the container is not a number.

show "container
4
inc "container
show "container
5

inherit

containers

Wejście: container (name)
Wyjście: none

Travels back down the stack of procedures to find an instance of a container of the given name, and then creates a pointer to it at the local container level in the current procedure. This means that changes to this container will also change at the parent level.

inherit "mycontainer

listnames

containers

Wejście: none
Wyjście: none

Lists the calling turtle's global variables

listnamess

listshares

containers

Wejście: none
Wyjście: none

Prints the names of the currently shared containers, one per line. See share, shares, unshare

listshares

local

containers

Wejście: word or list
Wyjście: none

Changes the scope of the container(s) specified by the supplied word or list to local - that is, they are only accessible by the current procedure, and only while it is executing. To preserve the state of the container when the procedure is not executing, use private. See make

local "container
local [container1 container2]

lookup

containers

Wejście: dictionary (name) | key (name)
Wyjście: value(s)

Returns the values associated with the specified key within the specified dictionary. See enter, newdictionary, erasedictionary, cleardictionary, dictionary, dictionaryp, copydictionary, savedictionary, loaddictionary

show lookup "mydict "ducks

make

containers

Wejście: name (word) | word, list, evaluated-list, expression or number, names (list) | list of words, numbers or lists
Wyjście: none

make tworzy pojemnik o nazwie podanej w pierwszym parametrze i umieszcza w nim element lub elementy wskazane albo wygenerowane przez drugi parametr. Działa też z listami jednych i drugich (zobacz przykłady), ale aby przypisać wartości zwracane przez doradców, trzeba użyć listy miękkiej {}. Zobacz name i put

make "container 5
print container
5
make "container [dog pig cow]
show "container
[dog pig cow]
make [ducks frogs pigs] [4 3 1]
show :ducks
4
show :frogs
3
make [x y z] {xpos ypos zpos}

make!

containers

Wejście: name (word) | expression
Wyjście: none

Contains a runtime-evaluated expression, or 'mutated' container. This allow expressions to be stored inside containers, and rather than being evaluated when stored, they are evaluated when recalled. A container that contains a REX may only contain a single REX and nothing else. See also name! and put!

make! "moo iterate (array 1 + random 10) ["moo]
pr :moo
make! "clock (se hours minutes seconds)
pr :clock

name

containers

Wejście: number, word, phrase, list, expression or container | name (word)
Wyjście: none

An alternative to make. Traditionally used for constants, eg name 3.14 "pi. See make, put

name 3.14 "pi

name!

containers

Wejście: expression | name (word)
Wyjście: none

Creates a mutated container, one whose expression is re-evaluated whenever it is accessed. See make!

name! (se hours minutes seconds) "clock

names

containers

Wejście: none
Wyjście: list

Returns a list of the defined containers (their names).

show names

newdatabase

Także: newdb

containers

Wejście: name (word)
Wyjście: none

Creates a new database. Databases store keys and containers. For more information, see store, retrieve. See also savedatabase, loaddatabase

newdatabase "animals

newdictionary

containers

Wejście: name (word)
Wyjście: none

Creates a special type of container called a dictionary. Dictionaries contain a list of 'name value pairs' – a series of containers. See enter, lookup, erasedictionary, cleardictionary, dictionary, dictionaryp, copydictionary, savedictionary, loaddictionary

newdictionary "mydict

nopersist

containers

Wejście: "name
Wyjście: none

Stops persisting the container or table "name and removes it from storage. The container itself is left in place; use erase to get rid of it. See persist

nopersist "score

persist

containers

Wejście: "name
Wyjście: none

Indicates that the container or table "name should be stored and updated with the project and with the browser session, and reloaded with both. Persisted containers survive reset and resetall, but not loading or creating another project. See nopersist, share

persist "score

plist

containers

Wejście: propertylistname (word)
Wyjście: propertylist (list)

Outputs the property list associated with the supplied name. Any word can have a property list associated with it – a list of 'properties' and their values. plist returns a list of these pairs sequentially: [property1 value1 property2 value2 etc.] See pprop

show plist "propertylist

pon

containers

Wejście: container(s) (word or list)
Wyjście: none

Prints out the name and value of the named container(s)

pon "container

pons

containers

Wejście: none
Wyjście: none

Prints out the names and values of every container in the workspace.

pons

pop

containers

Wejście: container
Wyjście: item

'Pops' the item at the front of the container and returns it, removing it from the contained word or list. Equivalent to: make "pop first :list make "list butfirst :list

See push
make "result pop "pushlist

pprop

containers

Wejście: name | property | value
Wyjście: none

Property lists are a special type of container that hold multiple property / value pairs. You can have a property list and a non-property list container with the same name.

pprop "addresses [Marty McFly] [9303 Lyon Drive, Lyon Estates, Hill Valley CA 95420]

pps

containers

Wejście: none
Wyjście: none

Prints the property list containers belonging to the calling turtle.

pps

private

containers

Wejście: word
Wyjście: none

Initialises a private container with the name provided. A private container is a container which only exists and whose value persists inside of a procedure. This allows you to construct a procedure that modifies and stores internal parameters without losing them when that procedure exits, and needing to store them in the turtle. See the examples.

TO test
  if not namep "frog [private "frog make "frog 1 stop]
  inc "frog
  show :frog
END
TO test :switch
  private "var
  if :switch = "a [make "var 1]
  if :switch = "b [inc "var show :var]
END

put

containers

Wejście: input (number, word, phrase, list, primitive or container) | in | name (word)
Wyjście: none

Another syntax for make used by some Logos. 'in' is a simple prmitive that forwards whatever is passed to it. See in

put 5 in "counter

put!

containers

Wejście: expression | in | name (word)
Wyjście: none

See make!

put! (se hours minutes seconds) in "clock

push

containers

Wejście: item | container
Wyjście: none

"Pushes" the item on to the front of the specified container, making it the first item, and pushing the rest of the items to the right. If the container contains a word, push pushes the item on to the start of the word. If the container contains a list, push pushes the item on to the front of the list. To pull the item out of the container, use pop. Also see queue and dequeue (which do similar but to the end of the container).

push "frog "animals

queue

containers

Wejście: item | container
Wyjście: none

Similar to push, except adds the provided item to the end of the container, appending it to the word or list inside it. See push

queue "item "container

remprop

containers

Wejście: name | property
Wyjście: none

Removes the given property from the named property list.

remprop "proplist "property

rename

containers

Wejście: oldname | newname
Wyjście: none

Renames a container.

rename "oldname "newname

retrieve

containers

Wejście: database (word) | key (word)
Wyjście: none

Restores the values of the containers stored in the given database under the given key using the store primitive. For example, if you stored the containers :ducks and :pigs under the key "animals, then retrieving "animals would restore the values of :ducks and :pigs to the values they had when they are stored. See newdatabase, store

retrieve "farm "livestock
(show :pigs :ducks :cows)

set

containers

Wejście: surname | container | value
Wyjście: none

Sets the contents of the named container in the named surname to the provided value. See setsurname, surname, get

set "jones "car "camry

setsurname

containers

Wejście: "surname
Wyjście: none

Used to select the 'surname', otherwise more commonly known as the 'container space', to use. All the containers (or variables) in turtleSpace have a surname, or family they belong to. Changing the surname allows you to use code containing single-dimension containers in different contexts (for example, different players) without having to modify it. You just set a different surname and run the code again. The default surname is "default

setsurname "player1
make "score 5
setsurname "player2
make "score 10
setsurname "player1
print :score
5

setvar

containers

Wejście: turtle (word) | container (word) | value (word, number, list or boolean)
Wyjście: none

Changes the contents of the container held by the specified turtle to the specified value. Technically bad form, but sometimes necessary.

setvar "myrtle "container 50

share

containers

Wejście: "name
Wyjście: none

Indicates that the container "name should be shared amongst all turtles. Sharing does not store the container: use persist to have it saved with the project or browser session. See persist

share "lives

shares

containers

Wejście: none
Wyjście: list

Returns a list of all the currently shared containers.

show shares

store

containers

Wejście: database (name) | key (name) | container (name) OR [container1 container2…] (list)
Wyjście: none

Inserts or updates a record in a database with the key name. Store stores container names and their contents, which can be restored later using the retrieve primitive. See newdatabase, retrieve

newdatabase "farm
make "pigs 5 make "cows 2 make "ducks 12
store "farm "livestock [pigs cows ducks]

surname

containers

Wejście: none
Wyjście: namespace (word)

Returns the surname of the current container (name) space. The default surname is 'default'. See setsurname.

print surname
default

swap

containers

Wejście: container1 (word) | container2 (word)
Wyjście: none

Exchanges the contents of two containers. Note that the name of the container is specified as a word, eg "container. See make

swap "container1 "container2

thing

containers

Wejście: containername (word]
Wyjście: output

Returns the contents of (the 'thing' in) the calling turtle's container of the provided container name. A longhand way of invoking the shortcut :container

show thing in "mycontainer
make "mycontainer thing in "mycontainer + 5

unburyname

containers

Wejście: word or list
Wyjście: none

Unburies the container(s) named in its input. See bury

unburyname "container

unshare

containers

Wejście: name (word) or names (list)
Wyjście: none

Unlike eraseshare which erases the share and its container, unshare changes the share back into a 'global' (turtle-internal) container.

unshare "container