[This is preliminary documentation and subject to change]

Calling called

One of the most interesting feature of Logo is that most of the language elements are dynamic. And first let's see the variable scope.

In Logo, variables can be defined at global scope or at local scope. At global scope of course, any procedure can get and set value of a global variable. At local scope, the procedure where the variable is defined can handle the variable but, instead of most other programming language, any called procedure can handle variable in the same way. Liogo implement fully Logo variable scope. Here is a sample:

to called :other
    print :param

to calling :param
    print :glob
    called [Other parameter]
    ;print :other    ; Error, "other" no longer exist here

make "glob [Global value]
calling [Parameter]
;print :param    ; Error, "param" no longer exist here

Memory mapped procedure

When you do a map in Logo, you launch a multiple call of the template mapped. So with just a single line of code you can call repeatedly a procedure. Let's see a first sample with a list:

to getfirsts :l
    output map "first :l

print getfirsts [Gnu Not Unix]

Here "map" means: call "first" on each item of the list and build a new list with the result, so the result of the "getfirsts" call is:

Map can also process words instead of list. Let's see how in a famous game: Hangman (this sample is taken from the Logo bible: Computer Science Logo Style, volume 1):

to hangletter :letter
ifelse memberp :letter :guessed [output :letter] [output "_]

to hangword :secret :guessed
output map "hangletter :secret

print hangword "potsticker [e t a o i n]

print hangword "gelato [e t a o i n]

"hangword" procedure use a map to find letters and replace guessed letters in the word. Here, "map" means: call "hangletter" on each item of the secret param and build a new word with the result.

Note that Liogo support all form of template "named-procedure", "procedure-text", "named-slot" and "explicit-slot".

Dynamic Run

A dynamic statement is a statement created and run at runtime. Most of the Logo control structure (test, loop, ...) accept dynamic statements. Let's see some examples:

ifelse true :a :b

repeat 4 :c

run :d

Here "a", "b", "c" and "d" are variables containing Logo source. So, if "a" equal "[print 12]", result of the first line will be a print of the number 12

Liogo support all sort of dynamic statements, when Liogo encounter a dynamic statement at runtime it call again the compiler and run the resulting assembly.