🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
00:00 reportable6 left 00:02 reportable6 joined
guifa whoa 00:33
my @a = 1,2,3; push(@a: 4); say @a 00:34
evalable6 [1 2 3 4]
guifa I always thought it HAD to be parentheses-less
00:37 statisfiable6 joined 00:38 swaggboi joined 00:58 gcd left, gcd joined 01:27 jpn joined 01:32 jpn left 01:46 benchable6 joined, releasable6 joined
tonyo what is the push(@a: 4) compiling to, i'd've figured a comma there 01:49
my @a = 1,2,3; push(@a, 4); dd @a; 01:50
evalable6 Array @a = [1, 2, 3, 4]
01:51 sourceable6 joined
tonyo guifa: isn't the `@a.push: ...` syntax just sugar for `push(@a, ...)` like in perl's `$a = T->new; $a->xxx` is just sugar for `$a = T::new(T); T::xxx($a);` 01:52
or whatever it is, i haven't had a perl job for six years now
01:53 coverable6 joined, committable6 joined
guifa There's a sub push(@,$) but then Array defines a method push($) 01:54
push(@a,4) calls the sub
push(@a: 4) calls the method
IIRC the sub just ends up calling the method anyways, but that doesn't have to be the case (even if it normally is) 01:55
tonyo interesting 01:56
guifa the idea is if I make a class
class Foo { method parrot($x) { say $x } }; my $f = Foo.new; $f.parrot('oo'); parrot $f: 'proc' 01:57
evalable6 oo
guifa I don't need to write the sub version manually
tonyo wonder where that came from 02:07
looks fp-ish
in spite of the source obviously being oo
guifa I always figured it was designed to make stuff very procedural 02:08
02:08 teatwo left
guifa but I guess both functional and procedurals tend to be more verb first, and OO more object first 02:10
fwiw this is in reference to github.com/Raku/problem-solving/issues/384 02:11
tonyo interesting, i'd echo codesection's comment 02:27
02:32 teatime joined
tonyo my Promise $p .=new; keep $p: 42; await $p; say $p.result 02:56
evalable6 42
03:04 linkable6 joined 03:15 jpn joined 03:20 jpn left 04:20 statisfiable6 left, benchable6 left, bloatable6 left, squashable6 left, bisectable6 left, quotable6 left, reportable6 left, evalable6 left, linkable6 left, committable6 left, coverable6 left, sourceable6 left, releasable6 left, tellable6 left, unicodable6 left, nativecallable6 left, greppable6 left, notable6 left, shareable6 left 04:21 sourceable6 joined, notable6 joined 04:22 benchable6 joined, statisfiable6 joined, reportable6 joined, shareable6 joined 04:23 unicodable6 joined, quotable6 joined 04:45 pjlsergeant__ left, pjlsergeant__ joined 05:02 pjlsergeant__ left, quotable6 left, unicodable6 left, shareable6 left, reportable6 left, statisfiable6 left, benchable6 left, notable6 left, sourceable6 left, teatime left, swaggboi left, avuserow left, nine left, tinita left, xelxebar left, avar left, ab5tract left, summerisle left, perlmaros left, defaultxr left, DarthGandalf left, m_athias left, z4kz left, Sgeo left, dg left, tjr left, ProperNoun left, Geth left, donpdonp|z_ left, jetchisel left, gcd left, buffet left, bartolin left, thebb left, xkr47 left, corwin left, ugexe left, vrurg left, rjbs left, tobs left, jrjsmrtn left, kaskal left, xinming left, dutchie left, sivoais left, lizmat left, tbrowder_ left, dogbert17 left, bdju left, justache left, oodani left, samcv left, gugod left, peder left, mark22k left, spacekookie left, rypervenche left, charsbar left, cm left, eseyman left, sftp left, kybr left, renormalist left, jmcgnh left, amenonsen left, kaol left, gabiruh left, tadzik left 05:03 MasterDuke joined, camelia joined, hexology joined, sjn joined, pat_js joined, merp joined, _________ joined, guifa joined, El_Che joined, RakuIRCLogger joined, lucerne joined, gfldex joined, bd3i joined, andinus joined, mjgardner joined, SmokeMachine joined, jast joined, polettix joined, patrickb joined, clarkema joined, atweedie joined, snonux joined, jdv joined, phogg joined, esh joined, ecocode joined, coleman joined, kawaii joined, jcallen joined, leedo joined, nebuchad` joined, timo joined, discord-raku-bot joined, human-blip joined, japhb joined, synthmeat joined, JRaspass joined, pierrot_ joined, gordonfish joined, zostay joined, Scotteh joined, leont joined, dpk joined, rba joined, BinGOs joined, tib joined, tbrowder__ joined, a3r0 joined 05:04 RakuIRCLogger left, jpn joined 05:09 jpn left 05:20 cliniclown joined 05:21 cliniclown left 05:23 nil joined 05:24 bloatable6 joined 05:26 squashable6 joined 05:27 bisectable6 joined, greppable6 joined 05:28 releasable6 joined, coverable6 joined, linkable6 joined 05:29 committable6 joined 06:00 reportable6 left 06:27 nil left 06:35 z4kz left 06:52 jpn joined 06:57 jpn left 07:31 jpn joined 07:37 Sgeo left, jpn left 07:47 nativecallable6 joined 08:07 tellable6 joined 08:09 abraxxa joined 08:10 dakkar joined 08:19 simcop2387 left, perlbot left, xkr47 left 08:21 teatwo joined 08:23 perlbot joined 08:24 teatime left 08:25 simcop2387 joined 08:52 jpn joined 09:11 Geth left, Geth joined 09:35 Manifest0 joined, Manifest0 left 09:39 jpn left 09:45 Manifest0 joined 09:50 jpn joined 09:54 reportable6 joined 10:04 Manifest0 left 10:35 jpn left, Manifest0 joined 10:39 evalable6 joined 11:25 jpn joined 11:27 HobGoblin left, goblin joined 11:35 jpn left 11:58 oodani left 11:59 oodani joined 12:00 reportable6 left 12:05 oodani left 12:20 oodani joined 12:50 xkr47 joined
xinming when we do .split, Is there a way to split on the first occurence of the space for the regex? 13:07
lizmat m: say "foo:bar:baz".split(":",2) ? 13:09
camelia ===SORRY!=== Error while compiling <tmp>
at <tmp>:1
------> say "foo:bar:baz".split(":",2)⏏ ?
expecting any of:
infix stopper
statement end
statement m…
lizmat m: say "foo:bar:baz".split(":",2)
camelia (foo bar:baz)
13:10 lizmat_ joined
xinming lizmat: SO the 2 here means $limit, right? 13:11
lizmat_ yes, it indicates the maximum number of parts you want
xinming I do checked the doc, I used .split(/<space>/, :limit(1)) Doesn't work, I thought it is used to specify times to match. 13:12
got it, thanks.
13:13 lizmat left
lizmat_ hmmm.. maybe limit *should* become a named argument 13:14
13:14 jpn joined
lizmat_ and actually: limit is a bad name in that context, just like "length" is 13:15
13:20 lizmat_ left, lizmat joined 13:21 jpn left
lizmat clickbaits rakudoweekly.blog/2023/09/11/2023-37-issuing/ 13:22
nemokosch in what regard is it a bad name? 13:30
lizmat because it is not clear whether you're specifying the number of splits, or the number of produced parts 13:31
nemokosch fair enough 13:44
13:47 jpn joined 13:49 destroycomputers left
fun times. I reorganized the "atom highlighter" so that one can maintain it without all the Coffeescript legacy. We have asked a move for VS Code from some ages old plist-format highlighter in a Perl package that nobody ever touches anymore 13:49
and after months of idling over it, dude just grabs two screenshots with the supposed highlighters with VSC on some snippet from wikipedia, says that there are some problems with the "Atom" version and rejects it 13:50
13:50 destroycomputers joined
ironically enough, the supposed "Atom highlighting" was highly different from the highlighting on Github 13:51
14:00 nicole left, nicole joined 14:44 jgaz joined
tonyo 'a:b:c'.split(':', :into(2)) would be nice 15:20
ugexe :into is already used to mean something else for 'classify' 15:26
lizmat I was more thinking :parts(2) 15:42
dakkar m: dd('a:b:c'.split(':',2)) 15:44
camelia ("a", "b:c").Seq
15:44 evalable6 left, linkable6 left 15:46 evalable6 joined, xinming left 15:48 xinming joined
ugexe i don't like parts either, because it really means 'max-parts'. in that sense limit makes more sense 15:53
lizmat :max-parts(2) would work for me 15:54
15:56 jpn left
ugexe in node, typescript, java, and julia its called limit, in c# its called count, in python its called max-split 15:58
lizmat max-split has the same semantics, as in number of max number of parts produced? 15:59
antononcube Does :max-parts(2) mean the first two elements of a split? If yes, is it a good idea to have :first(2) and :tail(3) ?
ugexe er, maxsplit rather
then again in python i guess thats just a positional parameter named maxsplit
i have ignored positional implementations 16:00
nemokosch What's wrong about it being a positional?
lizmat because it's an optional argument, and the other optionals are named arguments 16:01
antononcube @nemokosch I was going to suggest it, but that is what Mathematica does. (So, I restrained myself.) 16:02
ugexe max-splits reads better than max-split
nemokosch Depending of the scope of "the other optionals", that is, there are clearly optional positional parameters in the core 16:03
lizmat so max-splits => 1 would give you 2 parts ?
antononcube But since people bring Python examples (Python!!?), here is the Mathematica page for StringSplit : reference.wolfram.com/language/ref...Split.html
ugexe it would give you 1 or 2 parts 16:04
lizmat looks like Mathematica takes the current positional approach
maybe we just need to clarify the documentation, as the internal name of the argument shouldn't matter 16:05
antononcube @lizmat Yeah, that is why I am not suggesting it. 🙂
In Python positional arguments have names; in Mathematica they do not. 16:06
MasterDuke i'd vote for max-parts over max-split(s) if it's a user-visible name
antononcube I thinking options like ":first", ":tail", or ":upto" are better.
Actually, ":upto" is shorter and as descriptive as ":max-splits". 16:07
lizmat disagree 16:08
antononcube Ok, or ":up-to". 🙂
@lizmat I do not feel strongly about my suggestions. I am way too biased from/by Mathematica. 16:09
lizmat upto could be considered some kine of marker upto splits should be done
tonyo max-parts is nice 16:10
antononcube @lizmat Cool! 16:13
And a good example of my bias: reference.wolfram.com/language/ref/UpTo.html 16:14
tonyo upto sounds like it might truncate results, eg 'ab:c:d'.split(':', :upto(2)) -> 'ab', 'c' 16:15
ugexe max-elems is kind of nice in that it implies $splitted.elems <= $max-elems 16:16
although it would have the same problem as sounding like it might truncate results 16:17
tonyo max-splits seems to be the only one without the implication 16:19
16:37 dakkar left 16:48 abraxxa left 17:26 linkable6 joined 17:56 ab5tract left 18:01 reportable6 joined 18:51 notna joined 19:01 notna left 19:34 Sgeo joined
nemokosch however, that one does change the current semantics, not just the name 19:58
20:16 deoac joined 20:20 teatwo left 20:21 teatwo joined 20:27 swaggboi left 20:32 deoac left 21:13 swaggboi joined 22:13 committable6 left, bloatable6 left, greppable6 left, coverable6 left, squashable6 left, bisectable6 left, releasable6 left, sourceable6 left, unicodable6 left, statisfiable6 left, shareable6 left, reportable6 left, coverable6 joined, squashable6 joined, sourceable6 joined, shareable6 joined 22:14 greppable6 joined, bloatable6 joined, unicodable6 joined, bisectable6 joined 22:15 releasable6 joined, committable6 joined, statisfiable6 joined 22:16 reportable6 joined 23:16 linkable6 left, evalable6 left, linkable6 joined 23:18 evalable6 joined 23:47 Manifest0 left