Re: [better solution] pairs of separators from a string

2021-09-20 Thread William Michels via perl6-users
mpiling -e >>> Whitespace required before <= operator >>> at -e:1 >>> --> say 1, 1, * + * ...^ *<= 100;⏏ >>> expecting any of: >>> postfix >>> >>> and >>> $ raku -e 'say 1, 1, * + * ...^ * <= 100;' >&g

Re: [better solution] pairs of separators from a string

2021-09-20 Thread yary
1, 1, * + * ...^ * >= 100;' >> (1 1 2 3 5 8 13 21 34 55 89) >> >> So, then it dawned on me that the '>=' is "binding" (right word?) to the >> "*" marking the end of the sequence as "until I am ge 100". Though that >> doesn't quite wor

Re: [better solution] pairs of separators from a string

2021-08-25 Thread William Michels via perl6-users
. Though that > doesn't quite work, > $ raku -e 'say 1, 1, * + * ...^ * <= 100;' > () > > Ah, I see, it does work. The end of the sequence is the first number less > than 100, so 1 succeeds. I guess the sequence never gets started. > -- > *

Re: [better solution] pairs of separators from a string

2021-08-25 Thread Andy Bach
_ From: yary Sent: Tuesday, August 24, 2021 8:39 PM To: William Michels Cc: Marc Chantreux ; raku-users Subject: Re: [better solution] pairs of separators from a string CAUTION - EXTERNAL: Hi Bill, When building a range that's an arithmetic or geometric progressio

Re: [better solution] pairs of separators from a string

2021-08-24 Thread yary
Hi Bill, When building a range that's an arithmetic or geometric progression, the sequence operator is a little quicker to type. And thus also more likely to be understood more quickly too. > ('a' .. 'h')[(0..*-1).grep: * %% 2 ] (a c e g) > ('a' .. 'h')[ 0, 2 ... * ] (a c e g) > ('a' ..

Re: [better solution] pairs of separators from a string

2021-08-24 Thread William Michels via perl6-users
Hi Marc, My understanding is that ranges are pretty cheap to construct, and in any case, the range @x[0..*-1] is just the index of all elements in @x. The .grep() approach may be most useful if you have a function (e.g. %, %%, and .is-prime shown below): > (0...9) (0 1 2 3 4 5 6 7 8 9) >