🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
JustThisGuy I'll come back tomorrow. 00:00
Xliff RaycatWhoDat: If you want to write a language compiler that supports regular expressions or grammar like features, you COULD do that. It will be easier when RakuAST is released, however. 01:46
The only other way to do it would be to build a string piecemeal and execute it with /<$mystring>/ 01:47
Which would then need a MONKEY-SEE-NO-EVAL
notandinus is there a search for raku doc? 06:44
coldpress notandinus: the search bar at docs.raku.org/ is ok 07:53
argent0 Hi, why can't I map with Int as in @input.map(Int) where @input are the lines from a file? 08:06
my @input = List('input'.IO.lines);
jmerelo .tell melezhik why did you take your article back to draft? It's scheduled to be published in 36 hours. 08:07
tellable6 jmerelo, I'll pass your message to melezhik
jmerelo argent0: You probably don't need to map to Int
tellable6 2020-12-04T20:42:00Z #raku <JJAtria[m]> jmerelo: I've saved the post as a draft... I think. Let me know if you need me to do anything else! 08:08
jmerelo .tell jjatria[m] checked it out, it's fine. I'll schedule it.
tellable6 jmerelo, I'll pass your message to JJAtria[m]
jmerelo m: my @input = <2 3 4>; say @input.map: *+3
camelia (5 6 7)
jmerelo argent0: ^^^
argent0 ok, I see 08:09
notandinus coldpress: oh i didnt see that because js was disabled 08:12
yeah that is what i was looking for, thanks 08:13
brass argent0: @input.map(*.Int), or @input>>.Int 08:36
argent0 brass, thanks for the help 08:50
coldpress Is an anon sub mainly used to define recursive anonymous functions? 09:21
argent0 coldpress: could also be used for things like List.first 09:23
coldpress argent0: sorry, could you elaborate? 09:26
argent0 m: (1, 2, 3).first({ $_ == 2}); 09:27
camelia ( no output )
argent0 say (1, 2, 3).first({ $_ == 2});
evalable6 2
argent0 coldpress: ^^^
of course you can write (1, 2, 3).first: * == 2;
I'm new to rakudo BTW (couple of hours) 09:28
coldpress that's just a normal anonymous function, I'm specifically asking for `anon sub` (ctrl+F for it at learnxinyminutes.com/docs/raku/) 09:31
don't worry, I'm new too
moon-child coldpress: you can use 'samewith' for anonymous recursive functions 09:35
coldpress moon-child: thanks, there's so much to read, I missed that piece of documentation 09:36
cpan-raku New module released to CPAN! Module2Rpm (0.1) by 03WBIKER 09:48
coldpress1 m: (.+1 for $_) for (0..5) 09:50
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed postfix call
at <tmp>:1
------> 3(.+7⏏051 for $_) for (0..5)
coldpress1 m: ($_+1 for $_) for (0..5)
camelia WARNINGS for <tmp>:
Useless use of "+" in expression "$_+1" in sink context (line 1)
coldpress1 sorry, was just wondering whether some operators distribute over nested arrays. So .comb does, but .chr does not 10:02
m: say do .comb for (('65','66'),('67','68'))
camelia ((6 5 6 6) (6 7 6 8))
coldpress1 also, + does not distribute 10:03
m: say do $_+1 for ((65,66),(67,68));
say do ($_+1 for $_) for ((65,66),(67,68))
camelia (3 3)
evalable6 ((66 67) (68 69))
argent0 my raku solution to AOC 2020's day 01. It's "slow" for the second part. github.com/argent0/adventOfCode202...day01.raku 10:43
volatilebit's reddit's onliners work at a similar speed: say [*] @input.combinations(3).first: *.sum == 2020; 10:47
argent0 the issue is that I don't need all combinations. Is there a better way to write my funcion `tails`? 10:51
notandinus what is a good resource for functional / object oriented programming? its too confusing, i'm mixing both 11:01
argent0 notandinus: maybe you could try a purely funcional programming language (like haskell) to get an intuitive idea of functional programming. Many languages mix both to certain extent (ex: Python) 11:10
I'm not sure about raku's OO 11:11
I'm 4 hours new
argent0 Also can a `--> Pair` return type be constrained to be a pair of ints? 11:19
MasterDuke argent0: you should be able to do something like `--> Pair[Int]`. but you'll have explicitly construct the returning pair as that type, a pair which just happens to have two Ints won't work 11:38
for that you'd need to create a subset beforehand and use that. e.g., `subset PairOfInts of Pair where { .key ~~ Int and .value ~~ Int }; <...>; --> PairOfInts` 11:40
argent0 MasterDuke: thanks for the help 11:52
jmerelo argent0: you can define a Subset of Array of length 2: docs.raku.org/type/Array docs.raku.org/language/typesystem#...set-subset 12:18
ggoebel_ .. 12:24
ggoebel_ RaycatWhoDat: regarding haskell|raku and compilers/interpreters... Audrey Tang pushed the limitations of haskell while leading the pugs project to implement Perl6(Raku) in haskell. Some of the areas where contributions were made to haskell to support implementing perl6 were: compile-time gradual typing, PatternGuards, Type Families, Quasi-Quoting, GADTs, Parsec Transformers, Dynamic-linkable binaries and Data Parallelism. You can 12:29
read about this and other things which go over my head in Audrey's post pugs 2010 write-up: pugs.blogs.com/pugs/2010/04/how-to...in-10.html
jmerelo ggoebel_: wow, amazing :-) 12:32
tbrowder lizmat: i'm actively using Astro::Sunrise and have submitted a PR. I would like to enter some issues but can't find where. 12:37
tellable6 2020-12-04T06:32:09Z #raku <jmerelo> tbrowder they're probably OK. Thanks!
tbrowder Also I would like to work on it to make a usable README and turn it into an mi6 repo if there are no objections. 12:39
codesections what am I getting wrong in the second line below? 15:56
m: sub add($a, $b) { $a + $b }; dd my $add1 = -> { add($_, 1) } # This works
camelia Block $add1 = -> { #`(Block|85502952) ... }
codesections m: sub add($a, $b) { $a + $b }; dd my $add1 = add(*, 1) # This doesn't 15:57
camelia Cannot resolve caller Numeric(Whatever:D: ); none of these signatures match:
(Mu:U \v: *%_)
in sub add at <tmp> line 1
in block <unit> at <tmp> line 1
Xliff Will junctions auto parallelize for large tasks? 16:02
m: my @a = (40 * rand).Int xx 20000; say 55 == @a.any; 16:03
camelia any(False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, Fa…
Xliff m: my @a = (40 * rand).Int xx 20000; say so 55 == @a.any
camelia False
Xliff m: my @a = (40 * rand).Int xx 20000; say so 55 == @a.any
camelia False
Xliff m: my @a = (40 * rand).Int xx 20000; say so 20 == @a.any
camelia True
Xliff m: my @a = (40 * rand).Int xx 200000; say so 20 == @a.any
camelia True
Xliff m: my @a = (40 * rand).Int xx 200000; say so 20 == @a.any; say now - INIT now 16:04
camelia True
2.12475912
Xliff m: my @a = (40 * rand).Int xx 2000000; say so 20 == @a.any; say now - INIT now
Ouch
camelia True
21.2083994
[Coke] I don't think they do; you can generate the AST to see if they do, I think. 16:05
codesections Xliff: by "will" do you mean now or in The Future™? My understanding is that much of the auto-parallel stuff is NYI but still planned 16:06
Xliff m: my @a = (40 * rand).Int xx 2000000; say @a,hyper.grep(* = 20); say now - INIT now
camelia 5===SORRY!5=== Error while compiling <tmp>
Whitespace required after keyword 'hyper'
at <tmp>:1
------> 3(40 * rand).Int xx 2000000; say @a,hyper7⏏5.grep(* = 20); say now - INIT now
Xliff m: my @a = (40 * rand).Int xx 2000000; say @a,hyper.grep(* = 20); say now - INIT now
camelia 5===SORRY!5=== Error while compiling <tmp>
Whitespace required after keyword 'hyper'
at <tmp>:1
------> 3(40 * rand).Int xx 2000000; say @a,hyper7⏏5.grep(* = 20); say now - INIT now
Xliff m: my @a = (40 * rand).Int xx 2000000; say @a.hyper.grep(* = 20); say now - INIT now
camelia Cannot modify an immutable Whatever (*)
in block <unit> at <tmp> line 1
Xliff m: my @a = (40 * rand).Int xx 2000000; say @a.hyper.grep(* == 20); say now - INIT now 16:07
camelia (20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2…
Xliff m: my @a = (40 * rand).Int xx 2000000; say @a.race.grep(* == 20).elems.say; say now - INIT now
camelia 50394
True
5.2824256
Xliff \o/
does .hyper and race default to the number of cores? 16:14
[Coke] I believe so. checking for docs link 16:19
Xliff codesections: Thanks. I thought that might have been done by now.
[Coke] hurm. hyper shows defaults to batch64/degree 4
I thought some work had been done to identify the # of cores available, perhaps not plugged in here yet 16:21
lizmat code looks like: max(nqp::cpucores() - 1,1)
codesections did anyone have thoughts on the whatever-currying syntax question I asked about a few minutes ago, by the way? 16:23
[Coke] wonder if defaults for foo.race vs race foo are different. 16:23
lizmat Xliff: Junctions currently do *not* parallellize anytihng 16:24
MasterDuke codesections: i don't have a full explanation for why, but Whatevers can't be used like that 16:25
timotimo or lizmat can probably explain better 16:26
lizmat the docs say: "When * is used in term position, that is, as an operand, in combination with most operators, the compiler will transform the expression into a closure of type WhateverCode, which is actually a Block that can be used wherever Callables are accepted." 16:27
codesections: the "add" sub is *not* an operator 16:28
codesections Oooh, I see. I thought "in term position" was broader than "as an opperand"; now I get it. Thanks, lizmat++ 16:31
lizmat I mean, you can make a "add" candidate that takes a Whatever, and then make that do what you intended
but it doesn't happen automagically 16:32
codesections I see; that makes sense (I was thinking of the "transforms the expression" as a literal syntax transform, the way a macro would. Good to get my misunderstanding cleared up) 16:35
tbrowder l 18:40
.ask lizmat can you please fix the raku-community-modules/Astro-Sunrise repo so issues can be filed? i can't see a way to do it so far. but still looking. 18:42
tellable6 tbrowder, I'll pass your message to lizmat
lizmat tbrowder: will look 18:43
now
should be open to issues now 18:45
tbrowder i just found it.
ok, thnx. there's a pr when you get a chance to look. and i'm working on a new pr after that. 18:46
pmurias hi 19:05
tellable6 2020-08-20T06:44:59Z #raku-dev <patrickb> pmurias If you find the time I'd value your insights on github.com/Raku/nqp/issues/656
2020-10-27T01:48:12Z #raku-dev <[Coke]> pmurias there are some js specific opcodes at gist.github.com/coke/f87ab505c6cb8...b5cb6a8990 like "attrhintfor" that could use some docs.
2020-10-27T01:52:43Z #raku-dev <[Coke]> pmurias I mean like asyncreadbyte
lizmat pmurias o/ 19:05
pmurias how have things been going? 19:06
personally I haven't really touched anything Perl/Raku related in quite a while :/ 19:09
lizmat pmurias: well, we're in the middle of the Advent posts 19:17
and quite some exciting projects are going on at the moment
pmurias ohh, what are the most exciting project? 19:19
lizmat rakuast and newdisp are two very explicit projects 19:20
there's a bunch of more implicit projects, like the new coercion protocol
nine's work on in-process preo-compilation
and nwc10's work on getting MoarVM more stable and closer to the metal as in "keep those L1 caches stuffed" :-) 19:21
and native shaped array access just became 60x as fast in the past week 19:22
accessing native arrays about 40% faster
I should say: native shaped 1dimensional arrays
afk for a few hours& 19:23
MasterDuke pmurias: i made the moarvm source code changes to switch from tommath to gmp (which is much faster) for our biginteger support. only need to figure out a build problem and it should be good to go 19:27
Geth ¦ problem-solving: Altai-man assigned to JJ Issue Documentation search categories are not standartized github.com/Raku/problem-solving/issues/250 19:28
brass Hey, can I get some help debugging my day 4 part 2 answer? There seems to be something small wrong but I can't figure out what it is 20:12
It's probably a typo but it's driving me nuts 0x0.st/ihom.raku 20:14
Apparently my answer is too high 🤔 20:15
codesections brass: I haven't looked at your code, but I can tell you that the "something small" that drove me nuts was not rejecting a field with *too many* digits. Could that be it? 20:16
Xliff What does it mean when code drops out with 'emit without supply or react', when I am not directly using a Supply? 20:17
rindolf lizmat: hi, shavua tov, sup?
Xliff I *am* however using S*SCHEDULER.cue 20:17
Also using .race 20:18
brass codesections: I think my regexes are on point, but I can't figure it out... I might have to look at someone else's answer to get a clue :p
Xliff And like with most asyncronous code, it's happening intermittently and is resisting my attempts to debug it. 20:19
rindolf lizmat: you probably know that i've been talking with wendy a lot on facebook
codesections brass: now I *have* looked at your code, and I stand by my earlier guess :D looks like you have the same bug that drove me crazy for a bit 20:21
brass Oh no haha 20:22
codesections m: say '01234567899999' ~~ / \d ** 9 /;
camelia 「012345678」
brass @.@
I fixed it, thanks for your help :) 20:23
codesections happy to :) 20:24
Xliff What day is this, guys? 20:29
codesections 04 (yesterday)
JustThisGuy Hi all! I have a couple of questions. I'm trying to do something like this: 20:36
say '"in quotes"' ~~ / '"' <-[ " ]> * '"'/;
From docs.raku.org/language/regexes "Enumerated character classes and ranges"
But, I want more that one type of quote. Something like this, but this doesn't work:
token attribute_value { <quote> ($<-quote>) $<quote> };
evalable6 「"in quotes"」 20:36
JustThisGuy token quote { <["']> };
I found this discussion which is also similar, but it didn't seem to go anywhere: github.com/Raku/problem-solving/issues/97.
Any answers or alternatives are appreciated! 20:37
stanrifkin rakubrew.org offline? 20:59
Ayoub Hi, How do I report a possible perl6 bug? 21:21
Ayoub The problem is with the shell perl6 routine. 21:25
The shell perl6 routine craps up when given binary data as standard output from the system shell. 21:27
brass Ayoub: what do you mean? 21:30
Ayoub I have a C program giving non-text data to its standard output. I am calling it from perl6 using the shell routine. 21:31
Perl6 rejects the data saying it is not valid utf8 21:32
Xliff Ayoub: How are you invoking the shell script? 21:33
Ayoub $proc = shell "./guard --guard $SENTRY_ROOT/tests/ref-data/orig.png" ~ " -o nofile_dummy.out", :out, :err; 21:35
Ayoub In C++ you tell the IO you are handling binary data but this perl6 routine does not give you the option to deal with binary data. 21:47
Or if the option is there it is not obvious from the docs I see. 21:48
guifa The option is normally :bin 22:00
guifa docs.raku.org/type/Proc#routine_new shows a :bin option, and shell is basically syntactical sugar for making a Proc 22:03
Ayoub OK thanks, I will check it out. 22:12
guifa .tell JustThisGuy: honestly, the best way to do that is to use a multi for each type of quote you want to support. Especially if you later need to handle matching quotes or need to have escape sequences that can complicate things (you can btw pass arguments, so you could do <quote> {} <content: $<quote>> <quote> and let the content bit handle all of your escaping stuff 22:14
tellable6 guifa, I'll pass your message to JustThisGuy
Xliff my @a = ({ a => 1, b => 2, c => 3}, { d => 4, c => 3 a => 2 }); @a[2] = @a[0]; @a[0]<b> *= 2; my $aa = @a[0]; say $aa eqv @a.none 22:28
m: my @a = ({ a => 1, b => 2, c => 3}, { d => 4, c => 3 a => 2 }); @a[2] = @a[0]; @a[0]<b> *= 2; my $aa = @a[0]; say $aa eqv @a.none
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3 => 1, b => 2, c => 3}, { d => 4, c => 37⏏5 a => 2 }); @a[2] = @a[0]; @a[0]<b> *= 2
expecting any of:
infix
infix stopper
Xliff m: my @a = ({ a => 1, b => 2, c => 3 }, { d => 4, c => 3, a => 2 }); @a[2] = @a[0]; @a[0]<b> *= 2; my $aa = @a[0]; say $aa eqv @a.none
camelia none(True, False, True)
Xliff m: my @a = ({ a => 1, b => 2, c => 3 }, { d => 4, c => 3, a => 2 }); @a[2] = @a[0].clone; @a[0]<b> *= 2; my $aa = @a[0]; say $aa eqv @a.none 22:29
camelia none(True, False, True)
Xliff m: my @a = ({ a => 1, b => 2, c => 3 }, { d => 4, c => 3, a => 2 }); @a[2] = { a => 1, b => 2, c => 3 }; @a[0]<b> *= 2; my $aa = @a[0]; say $aa eqv @a.none 22:29
camelia none(True, False, False)
Xliff m: my @a = ({ a => 1, b => 2, c => 3 }, { d => 4, c => 3, a => 2 }); @a[2] = { a => 1, b => 2, c => 3 }; @a[0]<b> *= 2; my $aa = @a[0]; say ($aa eqv @a.none).so 22:30
camelia False
stanrifkin is rakubrew.org down or is it just me? 22:38
tadzik downforeveryoneorjustme.com/rakubrew.org
stanrifkin ok
just me :(
tadzik ah, it does respond but the content is clearly missing
I get The requested domain is currently not reachable
so it's at least down for the two of us :) 22:39
stanrifkin thanks... maybe some maintaining than
leont r: sub MAIN(Int(Str) :$foo) {} 22:55
camelia Invocant of method 'Int' must be an object instance of type 'Str', not
a type object of type 'Str'. Did you forget a '.new'?
in sub MAIN at <tmp> line 1
in block <unit> at <tmp> line 1
Invocant of method 'Int' must be an object instance of type 'Str', not a type object of type 'Str'. Did you forget a '.new'?
in sub MAIN at <tmp> line 1
leont That doesn't seem like useful behavior
Seems to me like the default should be a type object of the target type, not of the constraint type 22:56
cpan-raku New module released to CPAN! Astro::Sunrise (0.0.2) by 03TBROWDER
Geth ecosystem: 2f216b9dd5 | (Elizabeth Mattijsen)++ | 2 files
Tom Browder++ has adopted Astro::Sunrise! Kudos!
23:05
leont Filed a bug 23:11
Geth doc/failure-handled-rw: 3f011d8f1a | (Stoned Elipot)++ | doc/Type/Failure.pod6
Failure.handled() is rw
23:38
Geth doc: stoned++ created pull request #3726:
Failure.handled() is rw
23:38