Hi Andy,
A quick test with my (older) Raku install and I was able to get one of the
examples (Daniel's) below to work. However I had to use "Int" instead of
"int":
user@mbook:~$ raku
Welcome to 퐑퐚퐤퐮퐝퐨™ v2020.10.
Implementing the 퐑퐚퐤퐮™ programming language v6.d.
Built on MoarVM version 2020.10.
Apologies, that should be spelled "intriguing".
--B.
On Mon, May 24, 2021 at 12:41 PM William Michels
wrote:
> WATs are everywhere, and (I'm not trying to pick on one language
> here), I find this SO question to be intruiging:
>
> https://stackoverflow.com/q/58340585/7270649
>
> Joseph (and
> Cannot sent this email in 'plain text' mode as ATOM SYMBOL disappears.
I was impressed I could copypasted that in the text/terminal sesion of raku's
REPL and have it work. As a matter of fact:
> sub foo($) { ++⚛$c }('a' | 'b,b' | 'c');
any(1, 2, 3)
> say $c;
3
but, trying it without the
On 2021-05-24 William Michels via perl6-users
wrote:
> Daniel: Thank you for your confirmation on EVAL. Also, I tried parsing
> the ATOM SYMBOL character to look at classification, and this is the
> best I could do (in the Raku REPL):
>
> > say "⚛".uniprop
> So
Not-terribly-human-friendly
WATs are everywhere, and (I'm not trying to pick on one language
here), I find this SO question to be intruiging:
https://stackoverflow.com/q/58340585/7270649
Joseph (and Ralph): thanks for starting off this conversation!
Fernando and Vadim: amazed at your code!
Andy: good questions always
> Oh, and WAT is [short for] "Weird/will Ass Thing"?
No, it's not an abbreviation for anything – it's the word "what", but
pronounced in a way that
indicates the speaker is surprised/confused. More specifically, it's a
reference to the WAT talk (a
really good one, even if it is about a
> As to "this completely lost me": there was a mistype and "taking" shoud've
> been "talking". Sorry for this.
No, that's wasn't what lost me, it was the code
('a' | 'b,b' | 'c')».&(-> $ { ++⚛$c });
>> Oh, and WAT is" Weird/will Ass Thing"?
> "Weird/will Ass Thing" made me totally lost as I've
> but what's that cabbage thing before $c?
It's the Atomic Symbol, U+269B. (Tangent: when looking up that unicode value, I
learned
that Unicode puts the atomic symbol in the Religious Symbols subcatigory.
Slightly troubling!)
Here, it's being used as part of the atomic prefix increment
As to " but what's that cabbage thing before $c?": we have this great
https://docs.raku.org site. And it has great search capability:
https://docs.raku.org/type/atomicint
https://docs.raku.org/language/unicode_ascii#index-entry-%E2%9A%9B
As to "this completely lost me": there was a mistype and
my atomicint $c = 0;
sub foo($) { ++⚛$c }('a' | 'b,b' | 'c');
say $c;
I was sort of hanging on by my fingertips (this completely lost me:
>Or, taking about tricks:
('a' | 'b,b' | 'c')».&(-> $ { ++⚛$c });
) but what's that cabbage thing before $c? Oh, and WAT is" Weird/will Ass
Thing"?
Still ugly but much more reliable trick would be to use a sub and a counter
variable:
my atomicint $c = 0;
sub foo($) { ++⚛$c }('a' | 'b,b' | 'c');
say $c;
Or, taking about tricks:
('a' | 'b,b' | 'c')».&(-> $ { ++⚛$c });
Apparently, this one is not ugly by semantics, but by its notation too.
> It can be done without the EVAL:
>
>> any('a', 'b', 'c').raku.substr(4, *-1).split(',').elems
>
> 3
Yeah, but only at the cost of some fragility:
> any('a', 'b,b', 'c').raku.substr(4, *-1).split(',').elems
4
I suppose you could do:
> any('a', 'b,b', 'c').elems.raku.substr(4,
It can be done without the EVAL:
> any('a', 'b', 'c').raku.substr(4, *-1).split(',').elems
3
On Mon, May 24, 2021 at 1:07 PM Daniel Sockwell
wrote:
> > But .EVAL is evil, right?
>
> Indeed! And
> any('a', 'b', 'c').raku.substr(3).EVAL.elems;
> arguably deserves _extra_ evil points for
> But .EVAL is evil, right?
Indeed! And
any('a', 'b', 'c').raku.substr(3).EVAL.elems;
arguably deserves _extra_ evil points for using the .EVAL method which, unlike
the
EVAL sub, doesn't even warn about how dangerous it is (even though it probably
should).
But .EVAL is evil, right? --B.
On Sun, May 23, 2021 at 9:38 PM Daniel Sockwell wrote:
>
> > For example, you can't get a count of the number of elements in a junction
>
> Well, if you're willing to stoop to ugly enough hacks, there's _always_ a
> way :D
>
> any('a',
15 matches
Mail list logo