Coffeescript in Z
Jump to navigation
Jump to search
Coffeescript in Z
In ZCubes, Coffeescript code can be run without any other connections. Simply indicate the language is Coffeescript.
greet = -> console.log "Hello how are you" greet()
In z^3 environment, assume we have already defined a=1..10;
Then, this can be executed in Coffeescript language. [= and =] encompass the z^3 code SUM(a) to be prepiled into the code before execution in Coffeescript.
CL([=SUM(a)=])
in the following, assigning to window.numbers transfers the value from Coffescript Execution to the main z^3 computational space. Other variables in Coffeescript code stay private. <pre> numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9] start = numbers[0..2] middle = numbers[3...-2] end = numbers[-2..] copy = numbers[..] numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] numbers[3..6] = [-3, -4, -5, -6] numbers window.numbers=SIN(numbers)
Another example of Coffeescript interacting with z^3 computational space.
// transfers values from and to the rest of the system. numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9] start = numbers[0..[=a=]] middle = numbers[3...-2] end = numbers[-2..] copy = numbers[..] numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] numbers[3..6] = [-3, -4, -5, -6] numbers numbers=(numbers) window.start=TAN(start)