🦋 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. |
|||
00:19
pilne joined
00:30
RobRaku joined
00:42
sena_kun left
00:57
sena_kun joined
01:10
chloekek left
01:21
RobRaku left
01:46
wildtrees left
01:58
mahmudov left,
mahmudov joined
02:36
mahmudov left
02:41
sena_kun left
02:57
sena_kun joined
04:42
sena_kun left
04:56
sena_kun joined
05:40
Voldenet left
05:45
Voldenet joined,
Voldenet left,
Voldenet joined
05:53
johnjohn101 left
06:42
sena_kun left
06:57
sena_kun joined
07:13
holyghost left
07:51
wamba joined
08:03
Poohmaan joined
08:07
Poohman left
08:16
mahmudov joined
08:25
mahmudov left
08:30
benjif_ joined
08:32
benjif left
08:35
jmerelo joined
08:36
rindolf joined
08:42
sena_kun left
08:53
rindolf left
08:58
sena_kun joined
08:59
rindolf joined
09:04
mahmudov joined
09:07
xinming left,
xinming joined
09:09
holyghost joined
09:14
AlexDaniel left,
AlexDaniel joined,
AlexDaniel left,
AlexDaniel joined
|
|||
AlexDaniel | m: say DateTime.new("2020-01-01T10:00:00").later(:5seconds-on-mars) | 09:29 | |
camelia | 2020-01-01T10:00:05Z | ||
Geth_ | doc: 950cb60b74 | (Stoned Elipot)++ | doc/Language/typesystem.pod6 xref HyperWhatever |
09:30 | |
AlexDaniel | sourceable6: DateTime.new("2020-01-01T10:00:00").later(:5seconds-on-mars) | 09:31 | |
sourceable6 | AlexDaniel, github.com/rakudo/rakudo/blob/186c...e.pm6#L318 | ||
09:32
mahmudov left
09:37
mahmudov joined
|
|||
jmerelo | releasable6: status | 09:38 | |
releasable6 | jmerelo, Next release will happen when it's ready. There are no known blockers. 0 out of 323 commits logged | ||
jmerelo, Details: gist.github.com/43366d654d32bab5ac...99d0d94399 | |||
AlexDaniel | sena_kun: btw can you change the release guide file so that releasable6 picks up the new estimated date? | ||
Xliff | Happy New Year, everyone | 09:40 | |
jmerelo | Happy new year! | 09:42 | |
Xliff | m: DateTime.now.later.^candidates.name.say | ||
camelia | No time unit supplied in block <unit> at <tmp> line 1 |
||
Xliff | m: DateTime.now.later.^candidates.say | ||
camelia | No time unit supplied in block <unit> at <tmp> line 1 |
||
Xliff | m: (&DateTime.now.later).^candidates.say | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Illegally post-declared type: DateTime used at line 1 |
||
Xliff | m: DateTime.now.^can('later').candidates.say | 09:43 | |
camelia | No such method 'candidates' for invocant of type 'List' in block <unit> at <tmp> line 1 |
||
Xliff | m: DateTime.now.^can('later').elems.name.say | ||
camelia | No such method 'name' for invocant of type 'Int'. Did you mean any of these? base none note take in block <unit> at <tmp> line 1 |
||
Xliff | m: DateTime.now.^can('later').map( *.signature ).gist.say | ||
camelia | ((DateTime:D: :$earlier, *%unit --> DateTime:D)) | ||
AlexDaniel | Xliff: I mean… sourceable6 gave the right link… | 09:44 | |
Xliff | AlexDaniel: How does sourceable resolve that code to a file and line number? | ||
AlexDaniel | Xliff: magic | ||
Xliff | I mean... you showed a gist, earlier... | ||
AlexDaniel | I don't have the debug output for this case but yes it uses bruteforce :) | 09:45 | |
gist.github.com/AlexDaniel/46495f5...7bbb93ab94 | |||
Xliff | m: DateTime.now.^can('later').map( *.cando( \( :later ) ).gist.say | 09:46 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 1) at <tmp>:1 ------> 3r').map( *.cando( \( :later ) ).gist.say7⏏5<EOL> |
||
AlexDaniel | github.com/perl6/whateverable/blob...p6#L49-L70 | 09:47 | |
Xliff | m: DateTime.now.^can('later').map( *.cando( \( :$later ) ).gist.say | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '$later' is not declared at <tmp>:1 ------> 3ime.now.^can('later').map( *.cando( \( :7⏏5$later ) ).gist.say |
||
AlexDaniel | m: my $code = 「DateTime.new("2020-01-01T10:00:00").later(:5seconds-on-mars)」; my @wild-guesses = gather { for $code ~~ m:ex/^ (.+) ‘.’ (<[\w-]>+) [ [‘: ’ (.*)] | [‘(’ (.*) ‘)’]? ] $/ -> $/ { take 「(%s).^can(‘%s’).map(*.cando(\((%s), |\(%s)))).first(*.so)[0]」.sprintf: $0, $1, $0, $2 // $3 // ‘’ } }; .say for @wild-guesses | 09:48 | |
camelia | (DateTime.new("2020-01-01T10:00:00")).^can(‘later’).map(*.cando(\((DateTime.new("2020-01-01T10:00:00")), |\(:5seconds-on-mars)))).first(*.so)[0] (DateTime).^can(‘new’).map(*.cando(\((DateTime), |\("2020-01-01T10:00:00").later(:5seconds-on-ma… |
||
AlexDaniel | e: my $code = 「DateTime.new("2020-01-01T10:00:00").later(:5seconds-on-mars)」; my @wild-guesses = gather { for $code ~~ m:ex/^ (.+) ‘.’ (<[\w-]>+) [ [‘: ’ (.*)] | [‘(’ (.*) ‘)’]? ] $/ -> $/ { take 「(%s).^can(‘%s’).map(*.cando(\((%s), |\(%s)))).first(*.so)[0]」.sprintf: $0, $1, $0, $2 // $3 // ‘’ } }; .say for @wild-guesses | ||
evalable6 | (DateTime.new("2020-01-01T10:00:00")).^can(‘l… | ||
AlexDaniel, Full output: gist.github.com/43bafac6a76002f459...f708bc7929 | |||
Xliff | m: DateTime.now.^can('later').map( *.cando( \( (:$later) ) ).gist.say | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '$later' is not declared at <tmp>:1 ------> 3me.now.^can('later').map( *.cando( \( (:7⏏5$later) ) ).gist.say |
||
AlexDaniel | Xliff: ↑ one of these should work | ||
m: say (DateTime.new("2020-01-01T10:00:00")).^can(‘later’).map(*.cando(\((DateTime.new("2020-01-01T10:00:00")), |\(:5seconds-on-mars)))).first(*.so)[0] | 09:49 | ||
camelia | later | ||
AlexDaniel | that one I guess | ||
Xliff | m: DateTime.now.^can('later').map( *.cando( |\(:5seconds-on-uranus) ) ).gist.say | 09:50 | |
camelia | Too few positionals passed; expected 2 arguments but got 1 in block <unit> at <tmp> line 1 |
||
Xliff | m: DateTime.now.^can('later').map( *.cando( \(DateTime), |\(:5seconds-on-uranus) ) ).gist.say | 09:51 | |
camelia | (()) | ||
Xliff | m: DateTime.now.^can('later').map( *.cando( \(DateTime.now), |\(:5seconds-on-uranus) ) ).gist.say | ||
camelia | ((later)) | ||
Xliff | m: DateTime.now.^can('later').map( *.cando( \(DateTime.now), |\(:5seconds-on-uranus) ) ).map( *.^name ).gist.say | ||
camelia | (List) | ||
Xliff | m: DateTime.now.^can('later').map( *.cando( \(DateTime.now), |\(:5seconds-on-uranus) ) ).map( *[0].^name ).gist.say | ||
camelia | (Method) | 09:52 | |
Xliff | m: ((DateTime.now.^can('later').map( *.cando( \(DateTime.now), |\(:5seconds-on-uranus) ) ).map( *[0] ) xx 2) ».« (file, name))».say | 09:54 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Malformed postfix call at <tmp>:1 ------> 3onds-on-uranus) ) ).map( *[0] ) xx 2) ».7⏏5« (file, name))».say |
||
Xliff | m: ((DateTime.now.^can('later').map( *.cando( \(DateTime.now), |\(:5seconds-on-uranus) ) ).map( *[0] ) xx 2) ».» (file, name))».say | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Malformed postfix call at <tmp>:1 ------> 3onds-on-uranus) ) ).map( *[0] ) xx 2) ».7⏏5» (file, name))».say |
||
Xliff | m: ((DateTime.now.^can('later').map( *.cando( \(DateTime.now), |\(:5seconds-on-uranus) ) ).map({ .[0].file, .[0].name }).say | 09:55 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Unable to parse expression in parenthesized expression; couldn't find final ')' (corresponding starter was at line 1) at <tmp>:1 ------> 3s) ) ).map({ .[0].file, .[0].name }).say7⏏5<EOL> … |
||
Xliff | m: (DateTime.now.^can('later').map( *.cando( \(DateTime.now), |\(:5seconds-on-uranus) ) ).map({ .[0].file, .[0].name }).say | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Unable to parse expression in parenthesized expression; couldn't find final ')' (corresponding starter was at line 1) at <tmp>:1 ------> 3s) ) ).map({ .[0].file, .[0].name }).say7⏏5<EOL> … |
||
AlexDaniel | well, you can also do that locally, and in private chat with camelia, and on #whateverable, and … | ||
Xliff | :P | ||
Like anyone else is talking here. | |||
Xliff stalks off to cuddle camelia. | |||
Geth_ | doc: b2836942d7 | (Stoned Elipot)++ | doc/Language/typesystem.pod6 Be more demonstrative in examples |
09:56 | |
Xliff | I love MOP | 09:57 | |
And people like AlexDaniel give me ideas to do bad things. :D | |||
.cando is evil. | 09:58 | ||
AlexDaniel++: How long did it take you to write that brute of an algorhythm? | 10:00 | ||
AlexDaniel | two days I think | 10:01 | |
Xliff | "algorithm" | ||
I always get that wrong... :s | |||
Oh... and Happy New Year! 8-) | |||
AlexDaniel | CoreHackers::Sourcery does something similar, just without bruteforce: github.com/AlexDaniel/perl6-CoreHa...urcery.pm6 | 10:02 | |
Xliff | AlexDaniel: I am thinking about writing a cro based application server... as soon as I can spec one out. | ||
AlexDaniel | nice | 10:03 | |
10:03
wamba left
10:05
cpan-raku left
|
|||
Xliff | AlexDaniel: Aren't your multis for sourcery missing "sub" ? | 10:05 | |
L36-38 | 10:06 | ||
Oh... and L26 | |||
AlexDaniel | it accepts a “thing” and a capture, so I think you can use it for subs | 10:07 | |
sourceable6 doesn't use that module at all so it doesn't matter | |||
10:08
cpan-raku joined,
cpan-raku left,
cpan-raku joined
|
|||
Xliff | Um... no. | 10:08 | |
shouldn't "multi sourcery" be "multi sub sourcery" ? | 10:09 | ||
AlexDaniel | ah | ||
“multi” is a multi sub | 10:10 | ||
Xliff | And yeah... I just got to that part and.... this is really nice! | ||
m: multi a (Int) { 'Int' }; multi a (|) { 'Anything else' }; a(42).say; a(π).say | 10:11 | ||
camelia | Int Anything else |
||
Xliff | Huh. | ||
TIL | |||
OK. Good night! | 10:12 | ||
10:16
wamba joined
|
|||
xinming | docs.perl6.org/routine/listen <--- In this page, there is an example which is $tap = do whenever $listener -> $con { ... } Anyone here would clarify this for me? Where did the tap returned from? | 10:18 | |
Or, $tap = do whenever $listener -> $con { ... } is kind of syntax we should remember. | |||
I just a little bit confused about this | 10:19 | ||
stoned75 | I think the tap is returned from the Supply, which is returned from the IO::Socket::Async.listen() | 10:30 | |
see docs.perl6.org/language/concurrency#react | |||
jmerelo | Meanwhile, the Raku Advent Calendar blog has totalled circa 9K visits, 2k visitors for the month. | 10:32 | |
Most incoming links from raku.org, followed by slashdot and then the Rakudo Weeekly blog. Top 5 closed by Twitter. So, keep twitting. | |||
Top five countries: US, UK, Germany, France and, surprisingly, Australia. Then Switzerland, Spain, Canada, India and Netherlands. | 10:33 | ||
Most read articles by me (no wonder, the one that opened and closed), tbrowder, altai-man, tyil, scimon. | 10:34 | ||
I see there are more than a few outgoing links to docs.perl6.org. Anyone that inserted them, please fix that. | 10:35 | ||
Meanwhile, the call for contributors to 2020's advent calendar is officially open github.com/Raku/advent/blob/master...authors.md This year there are no preassigned slots, and we'll admit as many authors as request it. But articles will need to be ready by Dec 1st, and will be scheduled when ready. | 10:38 | ||
If there are more than 24 articles, we'll publish them as bonus articles. | 10:39 | ||
10:42
sena_kun left
10:46
rindolf left
10:47
rindolf joined
10:58
sena_kun joined
11:08
sena_kun left
11:09
sena_kun joined
11:22
mahmudov left
12:06
mahmudov joined
12:25
chloekek joined
|
|||
sarna | is [1,2,3] any different from [1;2;3]? | 12:28 | |
chloekek | p6: say [1,2,3] cmp [1;2;3] | 12:38 | |
camelia | Same | ||
chloekek | p6: say [1,2,3].perl eq [1;2;3].perl | ||
camelia | True | ||
sarna | nice, thanks | 12:39 | |
AlexDaniel | m: say [1,2;3,4;5,6] | 12:41 | |
camelia | [(1 2) (3 4) (5 6)] | ||
12:41
sena_kun left
|
|||
chloekek | p: say [1,;2] | 12:45 | |
p6: say [1,;2] | |||
camelia | [(1) 2] | ||
chloekek | p6: my @xs := 1, 2, 3; say [@xs].perl | 12:46 | |
camelia | [1, 2, 3] | ||
chloekek | p6: my @xs := (1; 2; 3); say @xs.perl | ||
camelia | (1, 2, 3) | ||
chloekek | It seems that , and ; are both list constructors, and [] is just a circumfix operator that creates an array from a list. | ||
sarna | I like , more :) | 12:52 | |
m: "1234".trim.comb | 12:53 | ||
camelia | ( no output ) | ||
sarna | m: dd "1234" .trim.comb # note the space | ||
camelia | ("1", "2", "3", "4").Seq | ||
sarna | m: dd "1234".trim.comb>>.Int # no space | ||
camelia | (1, 2, 3, 4) | ||
sarna | m: dd "1234" .trim.comb>>.Int # space anywhere | 12:54 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing << or >> at <tmp>:1 ------> 3dd "1234" .trim.comb>>.7⏏5Int # space anywhere |
||
sarna | why? :( | ||
can I resolve that ambiguity somehow? | |||
lizmat | precedence | ||
12:56
sena_kun joined
|
|||
lizmat | m: dd ("1234" .comb)>>.Int # sarna | 12:56 | |
camelia | (1, 2, 3, 4) | ||
sarna | lizmat: I see. I encountered this when I split a call into multiple lines, and parens don't really look well there :( | 12:58 | |
I'm using .map instead now | |||
lizmat | that should work fine as well :-) | 12:59 | |
m: dd "1234" .comb.map: *.Int | |||
camelia | (1, 2, 3, 4).Seq | ||
chloekek | p6: say "1234".comb »+» 0 | 13:15 | |
camelia | (1 2 3 4) | ||
sarna | okay, I don't get this | 13:16 | |
m: my $test = False; my $foo = 0; $test ?? Nil !! $foo += 1; dd $foo | 13:17 | ||
camelia | Int $foo = 1 | ||
sarna | why is $foo 1 now? | ||
chloekek | Because $test is false so it executes the part after the !!. | ||
m: my $test = True; my $foo = 0; $test ?? Nil !! $foo += 1; dd $foo | 13:18 | ||
camelia | Cannot modify an immutable Str (Nil) in block <unit> at <tmp> line 1 |
||
sarna | I don' goofd! | ||
chloekek | And apparently ?? !! has higher precedence than += lmao | ||
m: my $test = True; my $foo = 0; $test ?? Nil !! ($foo += 1); dd $foo | |||
camelia | Int $foo = 0 | ||
sarna | m: my $test = True; my $foo = 0; $test ?? $foo !! $foo += 1; dd $foo | 13:19 | |
camelia | Int $foo = 1 | ||
sarna | :I | ||
should I file a bug report, I don't think this should happen | |||
chloekek | You can do that in C++ too but the precedence is different. :) | 13:20 | |
(a ? b : c) += 1; | |||
sarna | shouldn't ?? !! have the lowest precedence? so I don't have to wrap the stuff inside in () | 13:21 | |
moritz | m: my $test = True; my $foo = 0; $test ?? $foo !! ($foo += 1); dd $foo | ||
camelia | WARNINGS for <tmp>: Useless use of $foo in sink context (line 1) Int $foo = 0 |
||
chloekek | That would make sense. | ||
moritz | precedence misuse, not a bug | ||
chloekek | ??!! seems to have rather high precedence: docs.raku.org/language/operators | ||
moritz | and that's because you often use them as the RHS of an assignment | 13:22 | |
chloekek | But only one level higher than assignment. | ||
moritz | $a = $b ?? $c !! $d | ||
for that, it needs to be tighter than assignment | |||
sarna | oh.. yeah I'll have to remember this then | 13:23 | |
moritz | and since += inherits its prec from = (and not +), it causes confusion when you use += inside ?? !! | ||
sarna | thanks for the help :) | ||
yeah | |||
13:27
mahmudov left
|
|||
moritz | my pleasure | 13:27 | |
chloekek | Enough questionable mutation syntax, time to watch MRE reviews. | 13:28 | |
tbrowder | happy new year, #raku people! | 13:50 | |
lizmat: i checked and domain "raku-advent-calendar.blog" is available | 13:51 | ||
are there any nay votes? | 13:52 | ||
MRE? | 13:55 | ||
meals ready to eat? | |||
tadzik | mmm MREs | 13:59 | |
chloekek | Military rations | 14:00 | |
uzl[m] | Happy new year to everyone!!! | 14:37 | |
tellable6 | 2019-12-25T22:02:42Z #raku <sena_kun> uzl[m] hi! it seems there are some issues with installing modules.raku.org/dist/QM:cpan:UZLUISF, it would be awesome if you could check it out, doesn't seem like a recent regression | ||
uzl[m] | sena_kun: Thanks for letting me know. Will check it out when I've the time. | 14:38 | |
14:39
mahmudov joined
14:42
sena_kun left
|
|||
xinming | docs.perl6.org/routine/listen <--- In this page, there is an example which is $tap = do whenever $listener -> $con { ... } returns tap instead of last state ment the block. | 14:43 | |
14:49
Manifest0 left
14:58
sena_kun joined,
patrickb joined
|
|||
Poohmaan | Wishing you all a very happy and blessed new year! | 15:07 | |
15:19
Manifest0 joined
|
|||
Poohmaan | m:@lines = [ 'name = aa; age = 10', 'name = cc; age = 11', 'name = bb; age = 12']; @lines.sort | 15:21 | |
evalable6 | (exit code 1) 04===SORRY!04=== Er… | ||
Poohmaan, Full output: gist.github.com/16d9f47b4a08cd3214...eb332d07b3 | |||
Poohmaan | m: @lines = [ 'name = aa; age = 10', 'name = cc; age = 11', 'name = bb; age = 12']; @lines.sort | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '@lines' is not declared. Did you mean '&lines'? at <tmp>:1 ------> 3<BOL>7⏏5@lines = [ 'name = aa; age = 10', 'name |
||
Poohmaan | m:my @lines = [ 'name = aa; age = 10', 'name = cc; age = 11', 'name = bb; age = 12']; @lines.sort | ||
evalable6 | |||
Poohmaan | m:my @lines = [ 'name = aa; age = 10', 'name = cc; age = 11', 'name = bb; age = 12']; say @lines.sort | ||
evalable6 | (name = aa; age = 10 name = bb; age = 12 name = cc; age = 11) | ||
Poohmaan | hello all, how can I sort using the age in the above example - in other words, how can I use a customer routine in sort in this case - for example, read lines from file, use regex or json to get a particular field to sort | 15:23 | |
15:31
wamba left
|
|||
AlexDaniel | m: my @lines = [ 'age=15', 'age=11', 'age=12']; say @lines.sort(+*.split(‘=’)[1]) | 15:32 | |
camelia | (age=11 age=12 age=15) | ||
AlexDaniel | Poohmaan: I'm not sure I understand the question. You'd have to parse the data yourself | ||
15:35
wamba joined
|
|||
Poohmaan | m: my @lines = [ 'age=15', 'age=11', 'age=12']; say @lines.sort | 15:36 | |
camelia | (age=11 age=12 age=15) | ||
AlexDaniel | m: my @lines = [ 'age=9', 'age=11', 'age=12']; say @lines.sort(+*.split(‘=’)[1]) | 15:37 | |
camelia | (age=9 age=11 age=12) | ||
AlexDaniel | m: my @lines = [ 'age=9', 'age=11', 'age=12']; say @lines.sort | ||
camelia | (age=11 age=12 age=9) | ||
15:42
wamba left
15:43
wamba joined
|
|||
chloekek | m: my @lines = [ 'age=15', 'age=11', 'age=12']; say @lines.coll | 16:15 | |
camelia | No such method 'coll' for invocant of type 'Array'. Did you mean any of these? Bool all comb conj in block <unit> at <tmp> line 1 |
||
chloekek | m: my @lines = [ 'age=15', 'age=11', 'age=12']; say @lines.collate | ||
camelia | (age=11 age=12 age=15) | ||
chloekek | m: my @lines = [ 'age=15', 'age=11', 'age=2']; say @lines.collate | ||
camelia | (age=11 age=15 age=2) | ||
16:15
thundergnat joined
|
|||
chloekek | L A M E | 16:15 | |
thundergnat | Poohmaan: Depending on your usage, it may be easier to set-up and work with an HoH instead of an AoH. | 16:18 | |
m: gist.github.com/thundergnat/fadc9a...0945c43687 | |||
camelia | Sorted by age, descending: ID# 2) Name: bb, Age: 22 ID# 3) Name: cc, Age: 11 ID# 1) Name: aa, Age: 9 |
||
thundergnat | (Or an array of strings, I guess.) | 16:19 | |
Though I guess if you really want to you could do something like: | 16:23 | ||
use Sort::Naturally; put [ 'age=15', 'age=11', 'age=2'].sort: &naturally; # -> (age=2 age=11 age=15) | |||
16:23
johnjohn101 joined
|
|||
chloekek | Oh this is actually quite the footgun. | 16:35 | |
p6: sub f($x) { my @a = $x; say @a.perl }; f((1, 2, 3)); | |||
camelia | [(1, 2, 3),] | ||
chloekek | Oh it’s fine. | ||
p6: sub f($x is raw) { my @a = $x; say @a.perl }; f((1, 2, 3)); | |||
camelia | [1, 2, 3] | ||
16:41
sena_kun left
|
|||
chloekek | p6: sub f($x) { $x = 1 }; f(1) | 16:47 | |
camelia | Cannot assign to a readonly variable or a value in sub f at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
chloekek | p6: sub f($x) { say $x.VAR.WHAT }; f(1) | 16:48 | |
camelia | (Scalar) | ||
chloekek | So scalars can be “read-only”? | 16:50 | |
Is it possible to make a my variable a read-only Scalar? | 16:51 | ||
p6: my $x := $(1); say $x.VAR | |||
camelia | 1 | ||
chloekek | p6: my $x := $(1); say $x.VAR.WHAT | ||
camelia | (Int) | ||
chloekek | p6: sub f($x) is raw { $x }; my $a := f(1); say $a.VAR.WHAT | 16:56 | |
camelia | (Scalar) | ||
chloekek | p6: sub f($x) is raw { $x }; my $a := f(1); $a = 2 | ||
camelia | Cannot assign to a readonly variable or a value in block <unit> at <tmp> line 1 |
||
chloekek | :) | ||
16:56
sena_kun joined
16:58
rindolf left
17:06
veesh_ joined
|
|||
Poohmaan | Thanks AlexDaniel and thundergnat | 17:07 | |
17:07
veesh left,
veesh_ is now known as veesh
|
|||
Poohmaan | My question is about the function for the sort function - I read that I can give sort a "custom routine" of my own | 17:09 | |
if I use a function - how can I access the members of the array in the function | 17:10 | ||
sena_kun | two arguments will be passed to a function | 17:11 | |
Poohmaan | m: my @lines = [ 'age=15', 'age=11', 'age=12']; say @lines.sort(my_function) | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Undeclared routine: my_function used at line 1 |
||
sena_kun | e.g. | ||
m: [6,1,2,3,4,5].sort({ $^a < $^b }).say; | |||
camelia | (6 5 4 3 2 1) | ||
sena_kun | but | ||
m: [6,1,2,3,4,5].sort({ $^a > $^b }).say; | |||
camelia | (1 2 3 4 5 6) | ||
sena_kun | m: [6,1,2,3,4,5].sort(-> $a, $b { $a < $b }).say | ||
camelia | (6 5 4 3 2 1) | ||
sena_kun | or | 17:12 | |
m: sub f($a, $b) { $a < $b }; [6,1,2,3,4,5].sort(&f).say | |||
camelia | (6 5 4 3 2 1) | ||
sena_kun | Poohmaan: ^ with a function | ||
if you want to access attributes of objects sorted, you can just use getter of $a and $b | 17:13 | ||
Poohmaan | let me try that | 17:14 | |
sena_kun: thanks | |||
sena_kun | m: my @lines = 'age=15', 'age=11', 'age=12'; say @lines.sort(-> $a, $b { $a.split('=')[1].Int < $b.split('=')[1].Int }).say; | ||
camelia | (age=15 age=12 age=11) True |
||
sena_kun | while in reality I suggest you to check if the input is valid, of course | 17:15 | |
Poohmaan | gotcha | 17:16 | |
thanks | |||
johnjohn101 | what is the latest version of raku? | 17:18 | |
sena_kun | language or compiler? | 17:19 | |
johnjohn101 | i want to install on ubuntu... | 17:21 | |
sena_kun | johnjohn101: github.com/nxadm/rakudo-pkg#os-repositories <- | ||
17:21
veesh left
|
|||
johnjohn101 | thanks | 17:21 | |
17:22
rindolf joined
|
|||
chloekek | 2019.11 is the latest version. | 17:26 | |
You can find the list of versions on github.com/rakudo/rakudo/releases | |||
Geth_ | doc: 4a05a2f8df | (JJ Merelo)++ | doc/Type/Map.pod6 Links to the page Within-page links will not work when that fragment is included somewhere else. Closes #3130 |
17:28 | |
doc: e09686fee1 | (JJ Merelo)++ | doc/Type/Map.pod6 Reflow |
17:35 | ||
17:37
wildtrees joined
|
|||
Poohmaan | thanks - got my sort working | 17:38 | |
Geth_ | doc: 4a64a52412 | (JJ Merelo)++ | doc/Type/Map.pod6 Another instance for #3130 fixed. |
17:39 | |
jmerelo | releasable6: status | 17:40 | |
releasable6 | jmerelo, Next release will happen when it's ready. There are no known blockers. 0 out of 323 commits logged | ||
jmerelo, Details: gist.github.com/30bb3b8197f4b2250f...4297ba8a85 | |||
sena_kun | jmerelo: release will happen mid-January, I hope | 17:41 | |
jmerelo | sena_kun: great :-) | 17:42 | |
17:43
veesh joined
|
|||
Poohmaan | just curious, is all this possible in other dynamic languages | 17:45 | |
sena_kun | sure, why not | ||
maybe in different syntactic ways, of course | 17:46 | ||
Poohmaan | I meant usage of functions and user defined routines directly as arguments for sort | ||
functional first languages would support them | 17:47 | ||
Grinnz | it was originally a feature of perl, yes | ||
perl hasn't quite got it looking as pretty as raku does yet | |||
Poohmaan | because I was able to read the line from the file - parse it as Json in the function and then use that as an argument for the sort - found that to be pretty cool | 17:50 | |
thanks again all | |||
stoned75 | hi. where can I find an usage example of traits leading_docs or trailing_docs ? | 17:51 | |
jmerelo | stoned75: hi. Great work, BTW, in the documentation | 17:52 | |
tobs | `sub f { 42 }; say &f` <- I tripped over this more than once when switching between Raku and Perl... | ||
stoned75 | jmerelo: you're welcome ! | ||
jmerelo | stoned75: I'll tell you all my dirty tricks as a documentor | ||
stoned75 | nice ! :) | ||
jmerelo | stoned75: first, you look in roast. If it's spec, there's a high likelihood there's some example there. | 17:53 | |
17:53
veesh left
|
|||
jmerelo | stoned75: second, look in github at large. Just use the Github search engine to look for examples "in the wild". Even if something has not been documented _or_ specced, brave souls sometimes manage to use it in the wild | 17:53 | |
17:54
veesh joined
|
|||
jmerelo | stoned75: stoned75 that might turn some code in Rakudo, usually. Which sometimes is hard to follow, even more so if it includes NQP code. The commit that changed the code might help | 17:54 | |
stoned75: so use git blame to look for the particular commit, which might take you to maybe an issue, or at least some context or additional documentation. | 17:55 | ||
stoned75: that might fail, however. So just start and program an example in the way you think that would work. It might not work, but error messages might put you in the right direction. | 17:56 | ||
stoned75 | ok great! many thanks for the hints ! | ||
jmerelo | stoned75: or you may github-search the error message and get to the code. | ||
in this case, I couldn't say, really... | 17:57 | ||
stoned75: but please raise an issue anyway, or assign that issue to yourself if it's created. | |||
stoned75 | ok understood | 17:58 | |
jmerelo | stoned75: there's this issue github.com/Raku/doc/issues/2825 which's got lots of stuff. Just say in a comment you're working on those. | 17:59 | |
18:00
cqd joined
|
|||
stoned75 | jmerelo: ok I see | 18:00 | |
sena_kun | github.com/perl6/perl6-examples/issues/66 | ||
jmerelo | sena_kun++ | 18:02 | |
18:05
xinming left,
xinming joined
|
|||
johnjohn101 | ok dumb question | 18:06 | |
how to i run a raku script? just need simple helloworld to get started | 18:07 | ||
Geth_ | doc: 88a0af3b83 | (JJ Merelo)++ | doc/Type/Map.pod6 Reduces line length. |
||
veesh | if you have it installed, there's a REPL where you can do those fun things | ||
it meaning raku, it comes with the REPL | 18:08 | ||
otherwise you could use a shebang line `#!/usr/bin/env raku` | |||
or manually call the raku program on your script | |||
johnjohn101 | i just installed using the ppa repo on ubuntu | ||
i run raku and it can't find the program | 18:09 | ||
sudo apt-get install rakudo-pkg is what i ran | 18:10 | ||
chloekek | What does perl6 --version say? | 18:12 | |
johnjohn101 | not foud | ||
ok it's in /opt let me see if in path | 18:13 | ||
Grinnz | that doesn't seem right for something from apt | 18:14 | |
chloekek | Why would a .deb package install something to /opt | ||
johnjohn101 | that is what surprised me | ||
veesh | you use rakudo-pkg? | 18:15 | |
it doesn't add raku to your path for you | |||
johnjohn101 | what ever was in these instructions | ||
github.com/nxadm/rakudo-pkg#os-repositories | 18:16 | ||
veesh | read a little bit lower, you needa set the path | ||
Grinnz | ahh, not official repo, that makes sense | ||
johnjohn101 | ok sorry i was assuming | 18:18 | |
stoned75 | jmerelo: thanks again. and FIY I tracked down leading_docs to this commit github.com/rakudo/rakudo/commit/88...0e04999754 | 18:20 | |
and similarlyfor trailing_docs | |||
andso its related to roast/S26-documentation/block-{leading,trailing}.t | 18:21 | ||
xinming | Where can I check the logic for do whenever please? | 18:24 | |
jmerelo | stoned75: great job! That one is only for Attributes, however. There are three versions of them. | 18:25 | |
xinming: is it not well covered in the documentation? | |||
xinming | I just now googled a lot, find nothing, and no any useful info on docs.raku.org either, So, this makes me quite curious about behavior of 'do whenever ... { }', As far as I tried, It always returns a Tap.new | 18:26 | |
jmerelo: Nope. | |||
18:26
cqd left
|
|||
johnjohn101 | ok where is panda? | 18:26 | |
xinming | jmerelo: there is documentation about whenever, but nothing about `do whenever` | ||
18:26
cqd joined
|
|||
jmerelo | johnjohn101: deprecated | 18:26 | |
xinming: can you please raise an issue? | |||
johnjohn101 | how can i install dbiish? | ||
xinming | The only reference is here docs.perl6.org/routine/listen | ||
jmerelo | johnjohn101: zef install DBIish | ||
johnjohn101 | ok thanks | 18:27 | |
xinming | jmerelo: Ok. | ||
18:27
cqd left
|
|||
johnjohn101 | sorry complete noob here. | 18:27 | |
jmerelo | johnjohn101: no problem, just ask | ||
johnjohn101 | is that global or per project? | ||
xinming | johnjohn101: You'll love it here, all people here are newbie friendly. :-) | ||
jmerelo | johnjohn101: panda was deprecated some time ago, but it's still in some documentation... | ||
johnjohn101: zef is the only module and dependency management app now | 18:28 | ||
xinming | jmerelo: where should I create the ticket? | ||
18:29
cqd joined,
johnjohn101 left
|
|||
veesh | why does raku create a .precomp in the directory that it was run in, and not in some fixed location in your home directory? | 18:30 | |
my system is littered with lib/.precomps everywhere | |||
xinming | jmerelo: I know it's github, I just don't know the repo for docs. :-) | 18:31 | |
18:31
johnjohn101 joined
|
|||
xinming | veesh: Because they are pre-compiled files for faster loading. | 18:31 | |
veesh | no, but wouldn't you want them in one well-know place on the system | ||
stoned75 | jmerelo: roast covers all variations. and as the code involved in their implemention hints it the leading,trailing}_docs really seem to be internals one | 18:32 | |
and indirectly they are documented in language/pod#Declarator_blocks ;-) | |||
xinming | veesh: Well, You asked something I wanted to know, but low priority to me. :-) | ||
18:33
chloekek left
|
|||
stoned75 | jmerelo: and I found the answer to my original question: "and usage example of traits trailing_docs" :-) | 18:40 | |
it is in rakudo/src/Perl6/Pod.nqp:document() ;-) | 18:41 | ||
eg github.com/rakudo/rakudo/blob/mast...d.nqp#L152 | 18:42 | ||
18:42
sena_kun left
18:57
sena_kun joined
|
|||
xinming | jmerelo: github.com/Raku/doc/issues/3136 | 19:00 | |
jmerelo | xinming: github.com/Raku/doc Recently moved | ||
stoned75: great :-) | |||
xinming | Yea, I just googled the address | ||
jmerelo | xinming: sorry, got distracted | ||
xinming | Ok, It'll be best if you tell me what exactly does `do whenever` do :-)\ | 19:02 | |
uzl[m] | .tell Poohmaan You could use an array of Pairs instead. That would simplify the body of the sub/block passed to sort. E.g., my @lines = age => 15, age => 11, age => 12; @lines.sort(-> $a, $b { $a.value > $b.value }).say | 19:09 | |
tellable6 | uzl[m], I'll pass your message to Poohmaan | ||
19:13
kensanata joined
|
|||
jmerelo | xinming: thanks! | 19:13 | |
uzl[m] | m: my %h = :1a; my %o = l => %(:2b, :3c); %h.push(%o<l>); say %h; | 19:28 | |
camelia | Trailing item in Hash.push {a => 1} in block <unit> at <tmp> line 1 |
||
19:28
wamba left
|
|||
uzl[m] | How do I append a hash to another hash? | 19:28 | |
wildtrees | you could convert them both to arrays of key value pairs, then concatenate the arrays together to form a new array, then convert the new array into the final hash, but you might lose some information if there are key collisions | 19:30 | |
not sure how to do that in perl6 though :-/ | |||
lizmat | wildtrees: you mean raku? :-) | 19:31 | |
uzl[m] | m: my %h = :1a; my %o = l => %(:2b, :3c); for %o<l>.pairs { %h{$_.key} = $_.value }; say %h | ||
camelia | {a => 1, b => 2, c => 3} | ||
jmerelo | m: my %one = :a, :b; my %two = :c, :d; say %one ∪ % two | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Two terms in a row at <tmp>:1 ------> 3= :a, :b; my %two = :c, :d; say %one ∪ %7⏏5 two expecting any of: infix infix stopper postfix statement e… |
||
jmerelo | m: my %one = %(:a, :b); my %two = %(:c, :d); say %one ∪ % two | 19:32 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Two terms in a row at <tmp>:1 ------> 3, :b); my %two = %(:c, :d); say %one ∪ %7⏏5 two expecting any of: infix infix stopper postfix statement e… |
||
uzl[m] | I figured I could do as above but I'm wondering if there's something simpler. | ||
jmerelo | m: my %one = %(:a, :b).Bag; my %two = %(:c, :d).Bag; say (%one ∪ % two).Hash | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Two terms in a row at <tmp>:1 ------> 3; my %two = %(:c, :d).Bag; say (%one ∪ %7⏏5 two).Hash expecting any of: infix infix stopper statement end … |
||
lizmat | m: my %a = a => 42; my %b = b => 666; my %c = %a, %b; dd %c | ||
camelia | Hash %c = {:a(42), :b(666)} | ||
lizmat | m: my %a = a => 42; my %b = b => 666; my %c = %a, %b; dd %c | ||
veesh | m: my %one = (:a, :b); my %two = (:c, :d); say %one ∪ %two | ||
camelia | Hash %c = {:a(42), :b(666)} | ||
set(a b c d) | |||
jmerelo | lizmat++ | 19:33 | |
The union would have been cool... | |||
19:34
chloekek joined
|
|||
uzl[m] | m: my %h = :1a; my %o = l => %(:2b, :3c, :4a); %h = %h, |%o<l>; say %h | 19:35 | |
camelia | {a => 4, b => 2, c => 3} | ||
uzl[m] | my %h = :1a; my %o = l => %(:2b, :3c); %h ,= |%o<l>; say %h | ||
evalable6 | {a => 1, b => 2, c => 3} | ||
jmerelo | m: my %h = :1a; my %o = %(:2b, :3c); %h ,= %o; say %h | 19:36 | |
camelia | {a => 1, b => 2, c => 3} | ||
uzl[m] | ^ seems to be fine as long as there's no collisions. | ||
lizmat | m: my %a = a => 42; my %b = a => 666; my %c = %a, %b; dd %c # last one wins | 19:37 | |
camelia | Hash %c = {:a(666)} | ||
wildtrees | whats dd? | 19:38 | |
lizmat | dd is the tiny data dumper, so tiny it lost its t | ||
jmerelo | wildtrees: a pretty printer, basically. Also, rakudo-specific | 19:39 | |
lizmat | it basically does `note arg.perl` | ||
with some extra checks and introspection | |||
19:39
lucasb joined
19:45
jmerelo left
20:02
chloekek left
20:05
wamba joined
20:35
mahmudov left
20:41
sena_kun left,
chloekek joined
20:44
mahmudov joined
20:55
sena_kun joined
21:25
kensanata left
|
|||
tbrowder | any blockers or nay votes for domain name “raku-advent-calendar.blog”? going twice... | 21:30 | |
sena_kun | tbrowder: raku-advent.blog is? | 21:31 | |
tbrowder | proposed website name for the new raku advent calendar | 21:32 | |
21:33
chloekek left,
rindolf left
|
|||
sena_kun | tbrowder: sorry, I mean, can't we get a shorter name, `raku-advent.blog`, or `raku-advent-calendar.blog` is the only option? | 21:35 | |
tbrowder | well, that was lizmat’s suggestion. what do you suggest? i do like the .blog tld. you should be able to test to see if your desired name is available before proposing it. | 21:38 | |
try using any registrar for the search, i use namecheap.com | 21:39 | ||
i do like raku-advent.blog | 21:40 | ||
lizmat: ^^^ | |||
jmerelo: ^^^ | |||
tellable6 | tbrowder, I'll pass your message to jmerelo | ||
tbrowder | moritz: ^^^ | ||
lizmat | fine by me :-) | ||
tbrowder | ok, both “raku-advent.blog” and “rakuadvent.blog” are available... | 21:44 | |
21:47
cpan-raku left,
cpan-raku joined,
cpan-raku left,
cpan-raku joined
|
|||
tbrowder | i’m reluctant to choose a name without more than a couple of up votes | 21:49 | |
22:13
Jack-20 joined
|
|||
Jack-20 | hi | 22:13 | |
what is the difference between "carton" and "cpanmius" ? | 22:14 | ||
22:30
wamba left
22:41
sena_kun left
22:56
sena_kun joined
22:59
lucasb left
23:06
kensanata joined
23:07
melezhik joined
|
|||
melezhik | Hi! And happy new year to everyone | 23:07 | |
AlexDaniel: lizmat: chloekek: I've started to implement RakuDist, first report is available, might give you an impression of the idea github.com/melezhik/RakuDist | 23:09 | ||
I have no final version for the name of service, so far it is RakuDist | 23:10 | ||
lizmat | melezhik: "dicker images" ?? | ||
:-) | |||
melezhik | upss | ||
fixed | |||
it got passed by my nano/aspell | 23:11 | ||
the thing is everyone could drop a very simple high-level scenario to prepare environment to test theirs modules, using Sparrow6 DSL, for example - github.com/melezhik/RakuDist/blob/...parrowfile | 23:12 | ||
23:36
patrickb left
23:47
mahmudov left
23:53
melezhik left
|
|||
cpan-raku | New module released to CPAN! Sparrowdo (0.1.2) by 03MELEZHIK | 23:58 |