On Wed, Mar 21, 2012 at 7:52 PM, Daniel Carrera <dcarr...@gmail.com> wrote: >> * >= $b --- this determines where the sequence ends: when the current value >> is greater or equal to $b. > > So... after the "..." you have an anonymous function that has to > return 'True' for the sequence to end? Seems strange, but it works: > > # A "function" that always returns True => List of one item. >> 2,5...True > 2
It actually smartmatches whatever is on the right hand side against the sequence, and stops when the smartmatch returns True. It just "happens" that you smartmatch an anonymous function, it executes the function and returns its result. In particular, note that True there is not an anonymous function, it's just the value True. You'd need to say { True } to get an anonymous function which returns True. Examples: 2, 5 ... 11 # smartmatch is true when you hit 11 2, 5 ... True # stop right away 2, 5 ... False # never stop 2, 5 ... * # shorter way of saying never stop 2, 1, 1/2 ... Num # stop when the number switches from a Rat to a Num 'a' ... /f/ # stop when the regular expression matches -- Solomon Foster: colo...@gmail.com HarmonyWare, Inc: http://www.harmonyware.com