Hello list,
I'm starting for a couple of days with smalltalk/squeak - maybe it's not my
last post :)
I like to construct a flat array, but get a nested array:
#(1 2 (1 + 3)) "unexpected result: #(1 2 #(1 #+ 3)) "
Why squeak means, that "(1 + 3)" is an array and not 4?
The syntax for an array literal is defined via"#(" - isn't it?
salute
Thomas
But this is specific to Squeak. You will not find it in VW for example.
Rather prefer the Array class>>#with:with:with:
Try this: {1. 2. 1 + 3.}
Hope that helps,
Ron Teitelbaum
{3.14 2.} "{3.14 Period or right brace expected ->2.}"
PS: Is there anywhere in the net a *COMPLETE AND COMPACT* list
of all "cryptical" syntax characteristics for smalltalk/squeak?
salute
Thomas
{3.14. 2}
Math
salute
Thomas
would with arrays). Expressions do not require a period.
and just as well { (Stream on: ( String new:1204)). 'or whatever you can get away with...' .} (notice the periods
inside the literal string)
Olivier
I know that there are a number of tutorials,
http://wiki.squeak.org/squeak/792 if you find something good feel free to
let us know.
Ron Teitelbaum
Page Information
|
Wiki Information |
Recent PBwiki Blog Posts |