I need to construct ( word, list, se, set, fput, lput )
Help Contents
Logo and Languages
I need to construct ( word, list, se, set, fput, lput )
I need to construct ( word, list, se, set, fput, lput )
The core of language processing is the creation of new words, lists or sets.
For each of these types Logo has one or more functions that create values. All these functions can accept many arguments.
The function word is used to concatenate several words in one word.
List is used to create a list which elements are the values of the arguments.
A similar function is se. Its name comes from sentence. Like list, se creates a list, but all arguments that are lists are 'unpacked' and their elements become elements of the resulting list.
The function for creating sets is called ... yes, you are right, it's called ... set.
By default it does not expects arguments and creates an empty set, so whenever you create non-empty set you must frame the action in parentheses.
print word "mint 5 ; mint5
print list [a b] [c [d]] ; [[a b] [c [d]]
print (list [a] "a [c]) ; [[a] b [c]]
print se [a b] [c [d]] ; [a b c [d]]
make "myset (set :x :y) ; a two-element set
There wre two other functions - fput and lput.
They are use to construct a new list or set where the new element is appended at the beginning or at the end of a given list or set.
print fput "x [a b] ; [x a b]
print fput [x] [a b] ; [[x] a b]
print lput "x [a b] ; [a b x]
print lput [x] [a b] ; [a b [x]]