I'm running into something I really don't understand why it isn't working.
I'm trying to create an array with
{
(1 to: 128) collect: [ :i | ((i mod: !N) eq: 0) true: 1 false: 0 ]
}
Which is supposed to generate a 1 every N place in the array the rest should be 0... But when running it only works when !N is 2, 4, 8, 16 and so on. With any other number it just becomes a big array of 1. I tried this as well
{
(1 to: 128) collect: [ :i | ((i mod: !N) eq: 0) ]
}
When I realised that true or false is just 1 and 0 anyway.
If i write
{
(1 to: 128) collect: [ :i | ((i mod: 3) eq: 0) true: 1 false: 0 ]
}
Everything is fine, so i expect to be something with turning it in to a eventvalue that causes the trouble, but i have no idea why. Am i doing something wrong with the logic, or breaking some rule about array creation?
Thanks!