Add array example, ArrayObj implementation
* VM creates arrays using the BeginArray and EndArray instructions * ArrayObj is implemented with a __str__ function (annoying) * Simple example of array creation is added Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
15
examples/array.sy
Normal file
15
examples/array.sy
Normal file
@@ -0,0 +1,15 @@
|
||||
# Create an array with just some numbers
|
||||
{ 1 2 3 }
|
||||
println!
|
||||
|
||||
[ :x x x ] :dup
|
||||
# Call some functions
|
||||
{ 1 dup! dup! }
|
||||
println!
|
||||
|
||||
# Call your own functions, why not?
|
||||
{
|
||||
[ 2 *! ] :double
|
||||
1 dup! double! dup! double!
|
||||
}
|
||||
println!
|
||||
Reference in New Issue
Block a user