Task

Demonstrate a language's methods of:

   variable declaration
   initialization
   assignment
   datatypes
   scope 
   referencing,     and 
   other variable related facilities


 
1) working in a global scope
 
{def A 3}
-> A                                 // A   is in the global scope
{def B 4}
-> B                                 // B   is in the global scopel
{def MUL {lambda {:x :y} {* :x :y}}}
-> MUL                               // MUL is a global function
{MUL {A} {B}}                        // using global variables
-> 12
 
2) working in a local scope
 
{let                                 // open local scope
 {                                     // begin defining and assigning local variables
   {:a 3}                                // :a is local
   {:b 4}                                // :b is local 
   {:mul {lambda {:x :y} {* :x :y}}}     // :mul is a local function
 }                                     // end defining and assigning local variables 
   {:mul :a :b}                        // computing with local variables
}                                    // closing local scope
-> 12
 