[00:23] *** jgaz left
[02:26] nqp
[02:32] can a parameter be both positional and named
[03:06] Could you give an example?
[03:10] sub f($x) { $x } f(1) # 1 f(:x(1)) # 1
[03:11] @Nemokosch
[03:14] jack9: multi sub
[03:14] m: multi sub f(:$x) { say $x }; multi sub f($x) { say $x }; f(4); f(:x);
[03:14] rakudo-moar dfcb5f47a: OUTPUT: «4abc»
[03:15] m: multi sub f(:$x) { say $x }; multi sub f($x) { f(:$x) }; f(4); f(:x);
[03:15] rakudo-moar dfcb5f47a: OUTPUT: «4abc»
[03:15] looks cumbersome but ok
[03:16] m: multi sub f(:$x) { say $x }; multi sub f($x) { say $x }; f(4); f(:x);
[03:16] rakudo-moar dfcb5f47a: OUTPUT: «4abc»
[03:16] m: multi sub f(:$x) { say $x }; multi sub f($x) { say $x }; f(4); f(:yabc>);
[03:16] rakudo-moar dfcb5f47a: OUTPUT: «===SORRY!=== Error while compiling Missing required term after infixat :1------> lti sub f($x) { say $x }; f(4); f(:yabc>⏏); expecting any of: prefix term»
[03:16] You may be able to use slurpies
[03:16] m: multi sub f(:$x) { say $x }; multi sub f($x) { say $x }; f(4); f(y:);
[03:16] rakudo-moar dfcb5f47a: OUTPUT: «===SORRY!=== Error while compiling Unsupported use of y///. In Raku please use: tr///.at :1------> }; multi sub f($x) { say $x }; f(4); f(y⏏:);»
[03:16] argh
[03:17] m: multi sub f(:$x) { say $x }; multi sub f($x) { say $x }; f(4); f(:y);
[03:17] rakudo-moar dfcb5f47a: OUTPUT: «4Cannot resolve caller f(:y(Str)); none of these signatures matches: (:$x) ($x) in block at line 1»
[03:17] so even though you passed in one arg (a pair) it was NOT matched against the multi with 1 arg
[03:17] Yes
[03:18] I am trying to understand how it does this, but I think it will be awhile.
[03:18] Moar code is plentiful
[03:18] we need to be able to create sigs that say 'and no named args' somehow
[03:19] m: multi sub f(:$x) { say $x }; multi sub f($x) { f(:$x) }; f(4); f((x => 123));
[03:19] rakudo-moar dfcb5f47a: OUTPUT: «4x => 123»
[03:19] If you wrap in parens it counts as a pair.
[03:20] yeah - but when writing utils you dont really want to hamstring the caller
[03:20] m: multi sub f(:$x) { say $x }; multi sub f($x) { f(:$x) }; f(4); f: x => 123;
[03:20] rakudo-moar dfcb5f47a: OUTPUT: «===SORRY!=== Error while compiling Bogus statementat :1------> sub f($x) { f(:$x) }; f(4); f: x => 123;⏏ expecting any of: prefix term»
[03:20] m: multi sub f(:$x) { say $x }; multi sub f($x) { f(:$x) }; f(4); f: (x => 123);
[03:20] rakudo-moar dfcb5f47a: OUTPUT: «WARNINGS for :4Useless use of constant value x => 123 in sink context (line 1)Useless use of "x => 123" in sink context (line 1)»
[03:21] m: multi sub f(:$x) { say $x }; multi sub f($x) { f(:$x) }; f(4); f: :x
[03:21] rakudo-moar dfcb5f47a: OUTPUT: «WARNINGS for :4Useless use of constant value :x in sink context (line 1)Useless use of ":x" in sink context (line 1)»
[03:22] m: multi sub f(:$x) { say $x }; multi sub f($x) { f(:$x) }; f(4); f: :x;
[03:22] rakudo-moar dfcb5f47a: OUTPUT: «WARNINGS for :4Useless use of ":x" in sink context (line 1)Useless use of constant value :x in sink context (line 1)»
[03:22] I'm gonna quit while im ahead hahaha
[03:22] even `multi sub (Pair:D $p )` doesnt seem to work
[03:22] You have to wrap, same reason 1, 2, 3, 4 can be interpreted as args rather than a list iirc
[03:58] *** rf left
[06:00] *** jaguart left
[06:00] *** jaguart joined
[07:56] Yes, I think this is plain old syntactic ambiguity
[08:03] So it's not like Pairs are reinterpreted as named arguments - this calling syntax is for named arguments
[09:09] *** dakkar joined
[13:20] *** discord-raku-bot left
[13:38] *** jgaz joined
[13:56] *** rf joined
[16:12] *** Heptite left
[16:13] *** discord-raku-bot joined
[16:25] *** stevied_test left
[16:28] *** discord-raku-bot left
[16:28] *** discord-raku-bot joined
[16:49] *** stevied_test joined
[17:35] *** dakkar left
[18:22] *** Heptite joined
[18:56] *** NemokoschKiwi joined
[19:00] *** NemokoschKiwi left
[19:56] *** ab5tract joined
[20:31] *** ab5tract left
[20:47] can someone point me the docs for handling args for a raku command line script? can't find it
[20:47] looking for how to do getopt, specifically
[20:48] ok, just found it: https://docs.raku.org/language/create-cli
[21:08] *** rf left
[21:13] *** rf joined
[21:25] Getopt::Long6 is pretty good, too
[21:25] and it integrates with sub MAIN reasonably well
[22:02] *** rf left
[22:18] *** guifa_ left
[22:25] *** deoac joined
[22:27] I would like to create a regex like this: `^ h e l l o $`
[22:27] `I tried 'Hello'.comb.join()` without success
[22:28] Any ideas?
[22:35] hm, not sure you can generate such a regex just yet. However, this time around, it is actually close, RakuAST code generation reached the experimental stage
[22:35] for now, the "stable solution" would involve EVAL
[22:41] m: ("rx/ " ~ "Hello".comb.join() ~ " /").EVAL
[22:41] rakudo-moar 69fa6bbaf: ( no output )
[22:41] m: ("rx/ " ~ "Hello".comb.join() ~ " /").EVAL.raku
[22:41] rakudo-moar 69fa6bbaf: ( no output )
[22:42] m: ("rx/ " ~ "Hello".comb.join() ~ " /").EVAL.raku.say
[22:42] rakudo-moar 69fa6bbaf: OUTPUT: «rx/ Hfooefoolfoolfooo /»
[22:42] would be cool if the evalbot did $_.say if there was no output...
[22:50] Thanks, I'll give it a shot!
[23:00] m: ("rx/ " ~ "Hello".comb.join('') ~ " /").EVAL.raku.say
[23:00] probably the quotes help
[23:01] by default, would be like word quoting, more or less like 'foo' in this case
[23:05] Bingo! Exactly what I needed.