Flattening lists
Sometimes we need to group things based on context
Example:
my @a = 5,6; my @b = 1, 2, (3, (4, @a)), 7; mysub 1, 2, (3, (4, @a)), 7;
Q: How many arguments are passed to mysub()?
- a. 4
- b. 6
- c. 7
- d. other
Answer: 4
Perl 6 | Perl 6 Lists and Arrays vivified | #44 |
Sometimes we need to group things based on context
Example:
my @a = 5,6; my @b = 1, 2, (3, (4, @a)), 7; mysub 1, 2, (3, (4, @a)), 7;
Q: How many arguments are passed to mysub()?
Answer: 4
Copyright © 2012 http://www.pmichaud.com/2012/pres/ |