| I'm a of ruby's in place array expansion by prefixing the array with an asterisk >> a = [1, 2, 3]
=> [1, 2, 3]
>> p a
[1, 2, 3]
=> nil
>> p *a # expands to: p 1, 2, 3
1
2
3
=> nil
It's often really helpful with a rest parameter def foo(*args)
bar(*args)
end
In arc it would be natural to just make "@" work in unquoted context as well as quoted ones. Lists (or expressions that resolve to lists?) prefixed by @ get expanded to their elements.Something like this: arc> (= l '(1 2 3))
(1 2 3)
arc> (pr l)
(1 2 3)(1 2 3)
arc> (apply pr l)
1231
arc> (pr @l) ; would expand to (pr 1 2 3)
1231
This would eliminate most if not all calls to apply and would be handy in a lot of other contexts as well. |