dSMMatrix := DSMMatrix withNodes: #(#1 #2 #3) edges: #(#(#1 #2) #(#2 #1) #(#3 #1)).
Just as a side remark, but I already stumbled several times over code like the above in Mondrian and Glamour:
#1 " is not valid Smalltalk "
It does not parse with any parser other then the default one in Pharo/Squeak. Up until a few minutes ago it broke the refactoring engine badly. Pharo strangely compiles the above expression to the number 1. So why not just put the number, which also saves you one character?
1 " is a valid number "
To get a symbol with 1 you need to put the number in quotes:
#'1' " is a valid symbol "
Lukas
On 21 avr. 2010, at 16:25, Lukas Renggli wrote:
dSMMatrix := DSMMatrix withNodes: #(#1 #2 #3) edges: #(#(#1 #2) #(#2 #1) #(#3 #1)).
Just as a side remark, but I already stumbled several times over code like the above in Mondrian and Glamour:
#1 " is not valid Smalltalk "
Good remark. I always wonder why people (feel obliged to?) put only symbols inside of literal arrays, when the following works and is more readable:
dSMMatrix := DSMMatrix withNodes: #(1 2 3) edges: #((1 2) (2 1) (3 1)).
It does not parse with any parser other then the default one in Pharo/Squeak. Up until a few minutes ago it broke the refactoring engine badly. Pharo strangely compiles the above expression to the number 1. So why not just put the number, which also saves you one character?
1 " is a valid number "
To get a symbol with 1 you need to put the number in quotes:
#'1' " is a valid symbol "
Lukas
-- Lukas Renggli www.lukas-renggli.ch _______________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- Simon
dSMMatrix := DSMMatrix withNodes: #(#1 #2 #3) edges: #(#(#1 #2) #(#2 #1) #(#3 #1)).
Just as a side remark, but I already stumbled several times over code like the above in Mondrian and Glamour:
I tried to find some #0, #1, ... in Mondrian, but I haven't found some.
Cheers, Alexandre
dSMMatrix := DSMMatrix withNodes: #(#1 #2 #3) edges: #(#(#1 #2) #(#2 #1) #(#3 #1)).
Just as a side remark, but I already stumbled several times over code like the above in Mondrian and Glamour:
I tried to find some #0, #1, ... in Mondrian, but I haven't found some.
Indeed, there are no occurrences in the latest Moose distribution.
There is only one in Glamour, but I think this is already fixed in the latest version.
Lukas