🦋 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:08
evalable6 left,
linkable6 left
00:09
evalable6 joined,
linkable6 joined
00:38
pecastro left
01:02
lucasb left
01:20
asymptotically left
01:22
cydf left
01:33
Doc_Holliwould left
01:34
pecastro joined
01:54
jmchael left
02:00
BenGoldberg joined
02:03
ggoebel left
02:04
ggoebel joined
02:11
ggoebel left
02:12
ggoebel joined
02:22
finsternis joined,
leont left
02:40
ggoebel left
03:14
pecastro left
|
|||
xinming | Is there a way to pause a Supply.interval(1) supply? | 03:34 | |
What I mean is something like, my Channel $c .= new; react whenever Supply.interval(1) { "pause interval here".say; my $t = $c.receive; "Process here"; "resume interval here again".say; } | 03:35 | ||
I know we have throttle already, But I wish to do it myself to understand how these kind of problems to be solved correctly. | 03:36 | ||
Hmm, BTW, I know I can use loop { .. sleep 1; .. } thing, But I wish to try it in Supply | 03:37 | ||
codesections | xinming: I'm not sure if this does quite what you're looking for (I haven't done a whole lot with Supplies), but how about: | 04:05 | |
my $s = Supply.interval(1).share; my $t0 = $s.tap; $t0.close; my $t1 = $s.tap | 04:08 | ||
04:14
ab5tract left
04:59
camelCaser left
05:01
Celelibi left
05:02
camelCaser joined
|
|||
xinming | codesections: hmm, not about tap, I mean pause the Supply source itself. :-) | 05:16 | |
05:19
Celelibi joined
|
|||
raku-bridge | <EsperLily> I can't figure out why (0, 0), (* Z+ (3, 1)) ... * produces ((0 0) (5) (4) (4) (4) (4) (4) (4) (4) ...) | 05:25 | |
<EsperLily> huh $(0, 0) Z+ (3, 1) produces (5). wtf? | 05:29 | ||
guifa2 | EsperLily: when using the whatever code, the * is getting treated in scalar contexts, and +(0,0) --> 2, and 2 Z+ (3,1) --> 5 as the 1 is seen as extra and is ignored | ||
compare | |||
raku-bridge | <EsperLily> ahhh I missed that +(0, 0) == 2. I had just come to the realization that * was being treated as scalar though | 05:30 | |
guifa2 | my @a = (0, 0), {$^i Z+ (3, 1)} ... *; say @a[0..20]; # explicit scalar | ||
evalable6 | ((0 0) (5) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4) (4)) | ||
guifa2 | my @a = (0, 0), {@^i Z+ (3, 1)} ... *; say @a[0..20]; # explicit array | ||
evalable6 | ((0 0) (3 1) (6 2) (9 3) (12 4) (15 5) (18 6) (21 7) (24 8) (27 9) (30 10) (33 11) (36 12) (39 13) (42 14) (45 15) (48 16) (51 17) (54 18) (57 19) (60 20)) | ||
guifa2 | my @a = (0, 0), {*<> Z+ (3, 1)} ... *; say @a[0..20]; # I wonder if zen operator works | ||
err | |||
raku-bridge | <EsperLily> yeah it does | 05:31 | |
guifa2 | m: my @a = (0, 0), *<> Z+ (3, 1) ... *; say @a[0..20]; | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Only identical operators may be list associative; since 'Z+' and '...' differ, they are non-associative and you need to clarify with parentheses at <tmp>:1 ------> 3my @a = (0, 0), *<> Z+ (3, 1)7… |
||
raku-bridge | <EsperLily> oh you need parens | ||
guifa2 | my @a = (0, 0), (*<> Z+ (3, 1)) ... *; say @a[0..20]; | ||
m: my @a = (0, 0), (*<> Z+ (3, 1)) ... *; say @a[0..20]; | |||
camelia | The iterator of this Seq is already in use/consumed by another Seq (you might solve this by adding .cache on usages of the Seq, or by assigning the Seq into an array) in block <unit> at <tmp> line 1 |
||
guifa2 | m: my @a = (0, 0), (|* Z+ (3, 1)) ... *; say @a[0..20]; | ||
camelia | The iterator of this Seq is already in use/consumed by another Seq (you might solve this by adding .cache on usages of the Seq, or by assigning the Seq into an array) in block <unit> at <tmp> line 1 |
||
guifa2 | m: my @a = (0, 0), (*.list Z+ (3, 1)) ... *; say @a[0..20]; | 05:32 | |
camelia | The iterator of this Seq is already in use/consumed by another Seq (you might solve this by adding .cache on usages of the Seq, or by assigning the Seq into an array) in block <unit> at <tmp> line 1 |
||
guifa2 | jeez | ||
haha | |||
raku-bridge | <EsperLily> I was testing with .head(10) myself | 05:33 | |
<EsperLily> hmm I can't seem to figure out how to iterate a sequence and stop once an element fails a predicate | 05:36 | ||
<EsperLily> (in a functional manner I mean) | 05:37 | ||
guifa2 | something probably like | 05:47 | |
.head( .first( not *, :k) ) | 05:48 | ||
but obviously in a way that it'll compiile | |||
lol | |||
05:55
frost-lab joined
05:59
BenGoldberg left
|
|||
raku-bridge | <EsperLily> The use here is for terminating an infinite sequence. Scanning it with first would presumably consume it so that's a no-go | 06:02 | |
06:05
BenGoldberg joined
06:06
xinming_ joined
|
|||
guifa2 | my @a = 1,2,3,4,5,Any,6,7,8,9,10; @a.map({ $^i // IterationEnd }).say | 06:06 | |
evalable6 | (1 2 3 4 5) | ||
guifa2 | Granted, that consumes it, but it also gets you the values. But you can do other things obviously inside the map and just terminate by returning IterationEnd whenever you hit an undefined or whatever sentinel value you want | 06:07 | |
06:09
xinming left
|
|||
raku-bridge | <EsperLily> Hmm | 06:20 | |
<EsperLily> Here's a weird one: (1, 2; 3, 4)[1; 1] returns 4 but (1, 2; 3, 4)[1; 1 % *] returns (4). What the heck? | 06:21 | ||
elcaro | m: say ((0, 0), (*[] Z+ (3, 1)) ...^ *[0] > 20); | 06:24 | |
camelia | ((0 0) (3 1) (6 2) (9 3) (12 4) (15 5) (18 6)) | ||
elcaro | or could use toggle | 06:25 | |
m: ((0, 0), (*[] Z+ (3, 1)) ... *).toggle(*[0] < 20); | |||
m: say ((0, 0), (*[] Z+ (3, 1)) ... *).toggle(*[0] < 20); | |||
camelia | (timeout) | ||
((0 0) (3 1) (6 2) (9 3) (12 4) (15 5) (18 6)) | |||
elcaro | if you've already got a (maybe infinite) sequence you want to stop when it fails (or passes) a predicate, use toggle | 06:26 | |
it's a generalization of takewhile/dropwhile/takeuntil/dropuntil... depending on how you use it | 06:27 | ||
guifa2 | EsperLily: Makes sense to me | 06:29 | |
[1; * % 1] is equivalent to [1; .elems % 1] | |||
Which is to say, [1; 1] | 06:30 | ||
elcaro | yep, and elems is 2, so `1 % 2` is still 1, so there's no difference in the output of both expressions | ||
guifa2 just finished getting the <units> element prepped for CLDR. Hooray. | 06:31 | ||
Although it's killed loading time, dang. I need to figure something out. .28s per language is too slow | 06:32 | ||
raku-bridge | <EsperLily> ok toggle looks neat, oddly hard to find | 06:37 | |
06:37
squashable6 left
|
|||
raku-bridge | <EsperLily> guifa2: [1; 1 % *] should be the same as [1; 1] in this case, but the output is different! | 06:37 | |
<EsperLily> Subscripting with [1; 1] gives me a single element. Subscripting with [1; 1 % *] gives me a list of one element | |||
guifa2 | Yeah | 06:38 | |
Because you can also do | |||
Well | |||
since 1 % * returns a single value, it shouldn't go into slicing mode | |||
raku-bridge | <EsperLily> it only seems to do this in the multidimensional subscript (or whatever you call the [a; b] form) | 06:39 | |
06:40
squashable6 joined
|
|||
guifa2 | Yeah, I think it's being overzealous perhaps with slices | 06:40 | |
m: say (1, 2; 3, 4)[*; 1] # that I expect to return a list | |||
camelia | (2 4) | ||
raku-bridge | <EsperLily> 3[0; 0 % *] returns (3) | ||
guifa2 | say (1, 2; 3, 4, 5, 6)[*; * % 2] | 06:41 | |
evalable6 | (1 3) | ||
raku-bridge | <EsperLily> also curiously, tacking additional ; 0s on the end doesn't unwrap the list. I have to use a separate subscript entirely | ||
guifa2 | oh there you go | ||
say (1, 2, 3, 4; 5, 6, 7, 8)[*; * % 2] | 06:42 | ||
evalable6 | (1 5) | ||
guifa2 | hmm I dunno, weird | ||
raku-bridge | <EsperLily> This feels like a bug | ||
<EsperLily> I'd just use multiple subscripts but AFIAK there's no way to say "subscript the invocant only if it's non-nil", and someNilValue[1 % *] gives a divide-by-zero error | 06:43 | ||
<EsperLily> oh, regarding toggle, it doesn't exist as a standalone sub so I can't use it with ==> :'( | 06:44 | ||
06:44
jmerelo joined
|
|||
raku-bridge | <EsperLily> well, I could use ==> { @^a.toggle(*.defined) }() but that just feels ugly | 06:44 | |
guifa2 | Actually wait. The reason is probably that whatever code could still potentially return a list | 06:48 | |
There's no reason to distinguish whatever code from any other callable | |||
06:49
lizmat left
06:50
lizmat joined
|
|||
guifa2 | Except a callable returning a list still gets evaluated as a number. Hm.. okay, I'm definitely agreeing with there's something weird going on here | 06:55 | |
bisectable: (1, 2; 3, 4)[1; 1 % *] | 07:03 | ||
bisectable6 | guifa2, Will bisect the whole range automagically because no endpoints were provided, hang tight | ||
guifa2, ¦6c (49 commits): «» | |||
guifa2, Nothing to bisect! | |||
guifa2 | so been that way for basically ever | ||
guifa2 is afk | 07:09 | ||
07:10
parabolize left
07:17
sjm_uk joined
07:25
Sgeo left
07:38
dmc00 left
|
|||
coldpress | Hi, what's the idiomatic way of grouping and then summing contiguous 1s in the array [1, 1, 0, 1, 0, 1, 1, 1]? The result should be [2, 1, 3] | 07:41 | |
07:41
domidumont joined
07:42
aluaces left
|
|||
moritz | coldpress: I don't understand how the grouping is supposed to work | 07:44 | |
07:44
aluaces joined
|
|||
moritz | split on 0s? | 07:44 | |
07:47
xinming_ left,
xinming_ joined
|
|||
coldpress | yes, split on 0s | 07:49 | |
07:52
aluaces left
|
|||
moritz | m: say [1, 1, 0, 1, 0, 1, 1, 1].join('').split(0).map(*.comb.sum) | 07:54 | |
camelia | (2 1 3) | ||
moritz | but that's cheating, assuming that each entry is just one digit | 07:55 | |
m: say [1, 1, 0, 1, 0, 1, 1, 1].grep(:k, 0) | 07:56 | ||
camelia | (2 4) | ||
moritz | this gives you the indexes to split on | ||
moritz too distracted with $work to come up with something clever | 07:57 | ||
I guess you could always just do a boring iteration | |||
m: say gather { my $sum = 0; for [1, 1, 0, 1, 0, 1, 1, 1] -> $x { if ( $x == 0 ) { take $sum; $sum = 0 } else { $sum += $x } } | 07:58 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing block at <tmp>:1 ------> 3e $sum; $sum = 0 } else { $sum += $x } }7⏏5<EOL> |
||
07:58
aluaces joined
|
|||
moritz | m: say gather { my $sum = 0; for [1, 1, 0, 1, 0, 1, 1, 1] -> $x { if $x == 0 { take $sum; $sum = 0 } else { $sum += $x } } | 07:59 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing block at <tmp>:1 ------> 3e $sum; $sum = 0 } else { $sum += $x } }7⏏5<EOL> |
||
moritz | m: say gather { my $sum = 0; for [1, 1, 0, 1, 0, 1, 1, 1] -> $x { if $x == 0 { take $sum; $sum = 0 } else { $sum += $x } } } | ||
camelia | (2 1) | ||
coldpress | moritz: yeah, assuming one digit is cheating | ||
moritz | m: say gather { my $sum = 0; for [1, 1, 0, 1, 0, 1, 1, 1] -> $x { if $x == 0 { take $sum; $sum = 0 } else { $sum += $x } }; take $sum } | ||
camelia | (2 1 3) | ||
coldpress | moritz: I am doing iteration, and I don't like it because it's too verbose. .grep(:k, 0) looks like a good solution | ||
moritz | a split + reduce approach would be more satisfying, I guess | ||
samebchase- | there should be a way to split on arrays like Str.split | 08:00 | |
coldpress | indeed | ||
samebchase- | which was take arbitary predicates | ||
s/was/can/ | 08:01 | ||
08:08
stoned75 joined
|
|||
coldpress | what's the Raku way to scan (as in parallel scan, as in hackage.haskell.org/package/foldl-...ml#v:scan) | 08:13 | |
(not necessarily parallel) | |||
08:13
sena_kun joined
08:40
dakkar joined
|
|||
moritz | sorry, I don't follow that terminology | 08:42 | |
frost-lab | Hi, everybody. How can I make sure that an array contains a specific part? For example, to determine whether [3,1,2,0,0,8,7] contains the part 2,0,0. | ||
08:42
ufobat joined
|
|||
moritz | coldpress: what do you want to achieve? | 08:42 | |
m: say [3,1,2,0,0,8,7] ~~ [*, 2, 0, 0, *] | 08:43 | ||
camelia | False | ||
frost-lab | I just know transform the array to a string and use string method to match the specific part, but is there any other way? | 08:44 | |
moritz | m: say any([3,1,2,0,0,8,7].rotor(4 => -3) ~~ [2, 0, 0] | 08: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 ------> 031,2,0,0,8,7].rotor(4 => -3) ~~ [2, 0, 0]7⏏5<EOL> |
||
moritz | m: say any([3,1,2,0,0,8,7].rotor(4 => -3)) ~~ [2, 0, 0] | ||
camelia | any(False, False, False, False) | ||
frost-lab | :m so [3,1,2,0,0,8,7].Str ~~ /'2 0 0'/ | ||
m:so [3,1,2,0,0,8,7].Str ~~ /'2 0 0'/ | |||
evalable6 | WARNINGS for /tmp/FYwaBQQD9e: Useless use of "so " in expression "so [3,1,2,0,0,8,7].Str ~~" in sink context (line 1) |
||
moritz | m: say any([3,1,2,0,0,8,7].rotor(3 => -2)) ~~ [2, 0, 0] | ||
camelia | any(False, False, False, False, False) | ||
frost-lab | p6:so [3,1,2,0,0,8,7].Str ~~ /'2 0 0'/ | 08:47 | |
evalable6 | WARNINGS for /tmp/2EYhR7PIFX: Useless use of "so " in expression "so [3,1,2,0,0,8,7].Str ~~" in sink context (line 1) |
||
moritz | m: say any([3,1,2,0,0,8,7].rotor(3 => -2)) ~~ (2, 0, 0) | ||
camelia | any(False, False, False, False, False) | ||
moritz | my: say so [3,1,2,0,0,8,7].Str ~~ /'2 0 0'/ | ||
m: say so [3,1,2,0,0,8,7].Str ~~ /'2 0 0'/ | |||
camelia | True | ||
frost-lab | yep | ||
moritz | frost-lab: nothing clever comes to mind | ||
frost-lab | moritz thanks for your answer. | 08:49 | |
08:56
cpan-raku joined,
cpan-raku left,
cpan-raku joined
09:02
rindolf joined
09:07
Altai-man joined
09:10
sena_kun left
09:11
pecastro joined
09:12
asymptotically joined
09:15
wamba joined
09:18
ufobat left,
ufobat joined
09:28
dakkar left
09:29
dakkar joined
09:38
albino left
09:42
cydf joined
|
|||
elcaro | frost-lab: To compare lists, you need to use `eqv`... so to fix moritz's example | 09:46 | |
m: say so any([3,1,2,0,0,8,7].rotor(3 => -2)) eqv (2,0,0); | |||
camelia | True | ||
frost-lab | Aha, interesting! | 09:51 | |
09:52
albino joined
10:13
MasterDuke joined
|
|||
frost-lab | m: (6,7,8) ~~ (6,7,8) | 10:18 | |
camelia | ( no output ) | ||
frost-lab | m: say (6,7,8) ~~ (6,7,8) | ||
camelia | True | ||
frost-lab | m: say ((6,7,8) | (6,8,7)) ~~ (6,7,8) | 10:19 | |
camelia | any(False, False) | ||
frost-lab | Weird, why (6,7,8) ~~ (6,7,8) is true but ((6,7,8) | (6,8,7)) ~~ (6,7,8) gets two fales? | 10:20 | |
moritz | the matcher is always on the right-hand side | 10:21 | |
m: say (6,7,8) ~~ (6,7,8) | (6, 8, 7) | |||
camelia | True | ||
frost-lab | Oh, I forget the characteristic of the ~~, thanks. | 10:22 | |
elcaro | you can also use `cmp` | 10:34 | |
m: say (1,1,1) cmp (1,1,1) | |||
camelia | Same | ||
elcaro | m: say (1,1,1) cmp (1,2,1) | ||
camelia | Less | ||
holyghost | DWIM ? | 10:38 | |
There's several equalitiy operators as you see | 10:40 | ||
eq? equal?, eqv? in Scheme for example | |||
moritz | stackoverflow.com/questions/176343...erators-eq | 10:56 | |
11:13
evalable6 left,
linkable6 left
11:14
linkable6 joined,
evalable6 joined
11:37
ggoebel joined
11:47
grondilu left
11:53
ufobat_ joined
11:56
ufobat left
|
|||
frost-lab | m:say ((1,2)|(2,1,9)).WAHT, ((1,2)|(2,1,9)).Seq.WHAT | 11:57 | |
evalable6 | (exit code 1) No such method 'WAHT' for invocant of type 'List'. Did you mean any of these: 'Rat', 'WALK', 'WHAT', 'WHO'? in block <unit> at /tmp/SzIDdH4LYN line 1 |
||
frost-lab | m:say ((1,2)|(2,1,9)).WHAT, ((1,2)|(2,1,9)).Seq.WHAT | ||
evalable6 | (Junction)(Junction) | ||
frost-lab | m: say ((1,2)|(2,1,9)).Seq eqv (1,2), ((1,2)|(2,1,9)) eqv (1,2) | ||
camelia | any(False, False)any(True, False) | ||
frost-lab | m: say so ((1,2)|(2,1,9)).Seq eqv (1,2), so ((1,2)|(2,1,9)) eqv (1,2) | 11:58 | |
camelia | FalseTrue | ||
frost-lab | What is the difference between ((1,2)|(2,1,9)).Seq and ((1,2)|(2,1,9)) ? | 11:59 | |
There are still things that confuse me X) . | 12:01 | ||
12:05
ggoebel left
12:12
frost-lab left
12:18
ggoebel joined,
ggoebel left
12:22
dmc00 joined
12:28
dakkar left,
dakkar joined
12:39
MasterDuke left
12:41
Black_Ribbon left
|
|||
moritz | Seq is an iterator type | 12:42 | |
with it, you can you produce potentially inifinte streams that are never held fully in memory | |||
perfect for things like a file iterator | |||
or a UNIX pipe | 12:43 | ||
notandinus | m: my @t = 0; push @t, 1..3; say @t.raku; | 12:48 | |
camelia | [0, 1..3] | ||
notandinus | m: my @t = 0; my @k = 1 .. 3; push @t, @k; say @t.raku; | ||
camelia | [0, [1, 2, 3]] | ||
notandinus | how do i do the above but make it push each element one by one instead of pushing the whole array? | 12:49 | |
m: my @t = 0; my @k = 1 .. 3; push @t, $_ for @k; say @t.raku; | |||
camelia | [0, 1, 2, 3] | ||
notandinus | like ^, for loop works fine, are there more ways? | ||
Altai-man | m: my @t = 0; my @k = 1 .. 3; push @t, |@k; say @t.raku; | ||
camelia | [0, 1, 2, 3] | ||
Altai-man | m: my @t = 0; my @k = 1 .. 3; @t.append(@k); say @t.raku; | 12:50 | |
camelia | [0, 1, 2, 3] | ||
notandinus | i see, thanks. | 12:51 | |
Altai-man | notandinus, use `append` or `|` "slip" operator. | ||
notandinus | also, is unshift more costly compared to push? cost being cpu time. | ||
dakkar | ah, we had the same question yesterday ☺ | 12:52 | |
I ran some benchmarks, and couldn't see a difference | |||
notandinus | yeah, looks like there is not much difference when testing against large arrays | ||
i found push to be faster on small arrays. | |||
Altai-man | github.com/MoarVM/MoarVM/pull/1392 ? | ||
push is faster in cases of large inputs, but in new release this will be fixed. :] | 12:53 | ||
notandinus | oh their raku initializes in less than 200ms | 12:54 | |
mine takes about 1s | |||
Altai-man | notandinus, what rakudo version do you use? | 12:55 | |
notandinus | ah yeah, i was talking about unshifing a single item vs initializing with that item and pushing the rest. looks like both are equally as fast. | 12:56 | |
Altai-man: It's Rakudo v2020.10 | |||
Altai-man | I see, that's pretty fresh. :) | ||
notandinus, for small inputs it won't really matter, I'd say. | |||
notandinus | yeah i compiled it myself, can i do anything to improve this initialization time? | 12:57 | |
Altai-man | notandinus, what do you mean by "initialization time"? Repl start? Particular script start? | 12:58 | |
notandinus | Altai-man: time taken to run "raku -e ''" | 12:59 | |
Altai-man | `Executed in 93,26 millis` for me. | ||
I don't think there is anything for the user to improve particularly that. | 13:00 | ||
notandinus | i see | ||
13:08
sena_kun joined
13:09
rindolf left
13:10
Altai-man left
13:20
rindolf joined
13:45
b2gills left,
b2gills joined
13:52
leont joined
14:02
jmerelo left
14:07
ggoebel joined
|
|||
ggoebel | raku: (|(1, 2..3)) | 14:08 | |
evalable6 | |||
ggoebel | raku: say (|(1, 2..3)) | ||
evalable6 | (1 2..3) | ||
ggoebel | raku: say (1, 2..3).flat | ||
evalable6 | (1 2 3) | ||
ggoebel | wondering why these are different? | ||
14:12
MasterDuke joined
14:31
ajdplaysalto joined
|
|||
tbrowder | .tell jmerelo i have NOT scheduled it | 14:41 | |
tellable6 | tbrowder, I'll pass your message to jjmerelo | ||
14:43
morayj joined
14:48
a3r0 left,
a3r0 joined
14:49
Sgeo joined
|
|||
guifa2 | ggoebel: a slip doesn't flatten | 15:10 | |
ggoebel | thx | 15:13 | |
guifa2++ | |||
15:21
brtastic1 joined
15:25
brtastic1 is now known as brtastic
15:45
morayj left,
ufobat_ left
15:47
ufobat joined
15:52
cydf left
15:56
morayj joined
15:57
jmchael joined
16:08
parabolize joined,
__jrjsmrtn__ joined
16:10
_jrjsmrtn left
16:16
Maylay left
16:18
cgfbee left
16:22
Maylay joined
16:25
guifa2 left
16:28
ajdplaysalto left
16:32
wamba left
16:35
jmerelo joined
16:37
guifa2 joined
16:39
guifa2 left
16:42
skids joined,
BenGoldberg left
|
|||
notandinus | what will be the equivalent of following perl code: | 16:46 | |
print sprintf('%02d ', $_) for(0...10) | 16:48 | ||
16:48
hal99999 joined
|
|||
lizmat | m: print sprintf('%02d ', $_) for ^11 | 16:48 | |
camelia | 00 01 02 03 04 05 06 07 08 09 10 | ||
lizmat | m: printf('%02d ', $_) for ^11 | 16:49 | |
camelia | 00 01 02 03 04 05 06 07 08 09 10 | ||
notandinus | oh | ||
thanks, i was trying something with say, map, sprintf | |||
lizmat | you don't have to use .fmt if you don't want to :-) | ||
notandinus | i don't know what fmt is, i'll check it otu | 16:50 | |
m: say (0 ... 10).fmt("%02d") | 16:51 | ||
camelia | 00 01 02 03 04 05 06 07 08 09 10 | ||
notandinus | thanks, that makes it easy | ||
lizmat | yw | ||
notandinus | is there a better way to get last index other than @_.elems - ? | 16:53 | |
@_.elems -1 | |||
lizmat | m: my @a = ^10; say @a[*-1] | 16:55 | |
camelia | 9 | ||
lizmat | m: my @a = ^10; say @a[*-1,*-2, *-3] | ||
camelia | (9 8 7) | ||
lizmat | notandinus: is that what you're looking for? | ||
m: my @a = ^10; say @a.end | |||
camelia | 9 | ||
lizmat | if you just want .elems - 1 | 16:56 | |
notandinus | no i was looking for the index | ||
yeah .end is what i was looking for :) | |||
MasterDuke | huh, i didn't know about .end | 16:57 | |
lizmat | .oO( it's not the end :-) |
16:58 | |
notandinus | yeah raku always has a method you dont know about | ||
dakkar imagines a raku repl with tab-completion of method names via the mop… | 17:01 | ||
tony-o | that'd not be difficult | ||
tellable6 | 2020-12-04T10:20:46Z #raku <patrickb> tony-o If there is any think I can help you with wrt. a new ecosystem please do contact me! | ||
dakkar | in the meantime, `.^methods` helps | 17:02 | |
tony-o | .tell patrickb i kind of gave up on it, there didn't seem to be a lot of discussion about it in raku community. if you think this is not the case please lmk and i'll resume testing and playing around with it | ||
tellable6 | tony-o, I'll pass your message to patrickb | ||
dakkar | m: my @a;say @a.^methods | ||
camelia | (iterator from-iterator from-list new STORE reification-target Method+{is-nodal}.new Method+{is-nodal}.new shape Method+{is-nodal}.new Method+{is-nodal}.new grab name of default dynamic clone Method+{is-nodal}.new Method+{is-nodal}.new Method+{is-noda… | ||
17:07
Altai-man joined
17:09
epony left
|
|||
jmerelo | dakkar: that would be pretty cool. With colors, too. | 17:10 | |
tellable6 | 2020-12-10T14:41:34Z #raku <tbrowder> jmerelo i have NOT scheduled it | ||
17:10
sena_kun left
|
|||
jmerelo | .tell tbrowder OK, I'm checking it and scheduling it then. | 17:10 | |
tellable6 | jmerelo, I'll pass your message to tbrowder | ||
tbrowder | thanks, jj, wordpress and i don't get along very well :-( | 17:12 | |
notandinus | .tell tellable6 hi | ||
tellable6 | notandinus, Thanks for the message | ||
dakkar | oh nice, REPL already has completion hooks (only for Linenoise, which doesn't install for me, but shouldn't be too hard to add them to readline as well) | 17:14 | |
jmerelo | tbrowder: does not seem to get along with anyone, up to and including my cable provider. I have to log via private navigation every time. | ||
tbrowder | is there any way to get Pod::To::HTML to get better styling for wordpress by creating a mustache template for it? | ||
jmerelo | Doesn't latest version have Mustache baked in? | ||
tbrowder | i really like using pod6 for writing this year! | 17:15 | |
17:16
guifa joined
|
|||
tbrowder | yeah, baked in i think, but it looks pretty bland when i view it locally with firefox, so i'm not sure. was i supposed to use partials or something like that? | 17:17 | |
btw, lizmat seems to have wordpress tamed pretty well, at least style-wise | 17:18 | ||
lizmat | it did take some getting used to | ||
and every now and then, it fights me still | 17:19 | ||
tbrowder | lizmat: i assume you use a script to collect the wkly info. do you create the html outside of wp and then copy/paste? | 17:21 | |
lizmat | only for the new / update modules | ||
tbrowder | hm. | 17:22 | |
lizmat | which gfldex kindly created a script for | ||
tbrowder | so the styling is from wp? | ||
lizmat | yup, for that style that I selected well over a year ago now | ||
it's only disadvantage is really is that Preview doesn't work | 17:23 | ||
OTOH, the editor is close enough so that doesn't really feel like a problem most of the time | |||
tbrowder | thnx | 17:24 | |
notandinus | how do you match something like "<this is a name>"in raku grammar? | 17:25 | |
i'm doing this: token name { '<' \w+ '>'} | |||
but it only matches when there are no space characters inside of '<>' | 17:26 | ||
dakkar | yes, because `\w` does not match spaces | ||
guifa | Easiest way is probably ‘<‘ ~ ‘>’ .*? | ||
MasterDuke | { '<' [^>]+ '>' } is the normal regex way | ||
dakkar | m: 'foo <bar baz> moo' ~~ /'<' [\w|\s]+? '>'/ | 17:27 | |
camelia | ( no output ) | ||
MasterDuke | and ^^^ is the raku way | ||
dakkar | m: say 'foo <bar baz> moo' ~~ /'<' [\w|\s]+? '>'/ | ||
camelia | 「<bar baz>」 | ||
dakkar | change that alternation to match what you mean | ||
tony-o | btw dakkar, Bench showed a pretty decent difference in shift/pop gist.github.com/tony-o/22bb89f23c4...7a76da4721 | ||
notandinus | i see | ||
dakkar | (I fear that guifa's suggestion may capture more than you want) | 17:28 | |
notandinus | also why doesn't '<' .* '>' work? | ||
is it because token doesn't backtrack? | |||
dakkar | tony-o: yes, but for me it was not stable, different runs would produce very different results | ||
guifa | notandinus because ‘>’ is a ., and tokens don’t backtrack | ||
dakkar | m: say 'foo <bar baz> moo' ~~ /'<' .*? '>'/ | ||
camelia | 「<bar baz>」 | ||
guifa | but if you make it frugal, it works | ||
tony-o | i'm skeptical of 2m ops with that taking less than .5s | 17:29 | |
guifa | I remember jnhtn saying that there can be a slight memory efficiency in using native strs (especially if in an array) | 17:30 | |
notandinus | guifa: i see, thanks | ||
dakkar: that last one works | |||
guifa | Is there much of a penalty for unboxing them? | ||
dakkar | tony-o: yes, me to | ||
MasterDuke | highly recommend www.amazon.com/Mastering-Regular-E...596528124/ one of only two programming books i've read cover to cover (the other being Programming Perl) | ||
tony-o | do you mind trying the one liner with Bench the way i wrote it? | ||
notandinus | '<' ~ '>' .* doesn't seem to work with that | ||
MasterDuke | also moritz++ has a good Raku grammar book | ||
guifa | moritz is the Raku grammar guru | 17:31 | |
MasterDuke | www.amazon.com/Parsing-Perl-Regexe...484232275/ | ||
dakkar | tony-o: (running) | 17:32 | |
notandinus | i see, i'll check those out | ||
btw i've never ever completed any programming book | |||
very bad at reading | |||
i lose focus after a while | 17:33 | ||
tony-o | dakkar: i'm asking because if Bench is broken then i'd like to fix it - it might've just evaluated Block rather than running it | ||
dakkar | tony-o: Benchy was the one that returned very fast, not Bench | ||
lizmat | fwiw, Benchy is up for adoption: github.com/raku-community-modules/Benchy | 17:34 | |
notandinus | so i wrote this grammar to parse a log file (included), anything i could improve there? paste.debian.net/hidden/a7a6275f/ | ||
lizmat | other modules up for adoption: github.com/Raku/ecosystem/blob/mas...DOPT-ME.md | 17:35 | |
dakkar | github.com/raku-community-modules/...hy.pm6#L24 would that actually call &old? | ||
guifa | notandinus: you might try jmerelo’s Recipes for Raku. It’s a bit more task-oriented but in bite-size pieces | 17:36 | |
jmerelo | guifa: thanks :-) | ||
guifa . o O ( you know my OCD is bad when I rename constants from FOO-OFFSET and BAR-A-OFFSEST to OFFSET-FOO and OFFSET-BAR-A so they vertically align ) | 17:37 | ||
lizmat | guifa: that's just doing your future self a favour! | ||
jmerelo | .tell tbrowder I think I've seen what you wanted to do; I've switched back the old version to draft, promoted the new version to be published in ~ 7 hours. | ||
tellable6 | jmerelo, I'll pass your message to tbrowder | ||
guifa | lizmat: I’ve taken vertical alignment to an extreme I think | 17:38 | |
notandinus | guifa: i see, can you link me to it? | ||
was that the first book you mentioned? | |||
guifa | but it’s so good for catching copy paste bugs | ||
MasterDuke’s recommendation is from moritz, this one is from jmerelo | 17:39 | ||
www.apress.com/gp/book/9781484262573 | |||
tony-o | m: sub b (&o) { my $i=-1; nqp::until(nqp::islt_i(1, $i = nqp::add_i($i, 1)), o, :nohandler); }; b({ 'hi'.say; }); | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Could not find nqp::add_i, did you forget 'use nqp;' ? at <tmp>:1 ------> 3il(nqp::islt_i(1, $i = nqp::add_i($i, 1)7⏏5), o, :nohandler); }; b({ 'hi'.say; }); |
||
guifa | They are both very good books | ||
tony-o | m: use nqp; sub b (&o) { my $i=-1; nqp::until(nqp::islt_i(1, $i = nqp::add_i($i, 1)), o, :nohandler); }; b({ 'hi'.say; }); | ||
camelia | hi hi |
||
tony-o | dakkar: looks like it should | ||
notandinus | thanks, i'll check it out | 17:40 | |
dakkar | tony-o: then I don't see why benchy was suspiciously fast for me | 17:41 | |
tony-o | what version of raku are you on? | ||
you might try that one nqp one liner and see if it outputs 'hi\nhi\n' | 17:42 | ||
dakkar | it does | ||
`raku -e 'use Benchy; my $a=0;my $b=0;my @front = ^100; my @back = ^100; b 2_000_000, { @front.unshift(1); @front.pop(); ++$a}, { @back.push(1); @back.shift(); ++$b };say $a;say $b'` prints 2000002 at the end | 17:43 | ||
so stuff gets called | 17:44 | ||
ok, Bench has finished, pop: 72.302 shift: 73.779 | |||
anyway, end of workday for me, see I'll be back on monday | 17:45 | ||
17:50
brtastic left
17:51
dakkar left
17:53
patrickb joined
|
|||
notandinus | so i wrote a script to find out the most active hour over here | 18:02 | |
paste.debian.net/hidden/c73a0889/ | |||
looks like it's 12:00 (UTC-5) | 18:03 | ||
tony-o | what were the other values dakkar? | 18:05 | |
my benchmark was on 2020.11 | 18:06 | ||
tbrowder | jmerelo: thanks! | 18:07 |