🦋 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.
Geth ecosystem: Demayl++ created pull request #618:
remove Email::Valid Sys::IP and Terminal::Size
07:42
Geth ecosystem/main: 38f22680f4 | (Denis Kanchev)++ (committed using GitHub Web editor) | META.list
remove Email::Valid Sys::IP and Terminal::Size as they live now in the fez ecosystem (#618)
09:24
_________ m: class A { our enum E <V1 V2>; has E $.E is rw; }; class B { our enum E <V1 V2>; has E $.E is rw; }; A.new(E => B::V1); 10:00
camelia Type check failed in assignment to $!E; expected E but got E (E::V1)
in block <unit> at <tmp> line 1
_________ "expected E but got E" ;D
lizmat just blogged again: dev.to/lizmat/a-practical-example-...kuast-18jk 10:01
thundergnat lizmat++  BTW  instalment -> installment, RakUAST -> RakuAST 10:14
lizmat instalment is UK spelling, installment is US 10:14
guifa Brits hate Ls, Americans hate Us 10:15
lizmat anyways, fixed: thundergnat++ 10:16
timo we can use RakUAST for any user-added ast bits, kind of like the linux subsystems "uinput" :D 10:17
lizmat that's what macros are all about, no?
timo i guess so yeah 10:18
Voldenet it would be nice if `use RakuAST::Regex` could be done, so `CharClassEnumerationElement::Character, Assertion::CharClass and CharClassElement::Enumeration` could be directly used 11:24
lizmat Voldenet: I think we will see some official and semi-official shortcuts 11:25
I'm not sure "use RakuAST::Regex" would help: I would be in favour of moving pragmas from "use" to a dedicated such as "pragma foo" and "pragma foo :off" 11:27
in fact: in RakuAST, pragmas already have their own class: 11:29
m: say Q|use strict|.AST.statements.head
Voldenet `import RakuAST::Regex as Rx` ;)
camelia RakuAST::Pragma.new(
off => 0,
name => "strict"
)
lizmat Voldenet: you can already do that with a constant?
my constant Rx = RakuAST::Regex ??
Voldenet neat 11:31
in that case I'm guessing the code can be massively shortened 11:32
being able to import whole RakuAST and RakuAST::Regex would be easier to work with locally, but `my constant R = RakuAST; my constant Rx = R::Regex;` would look more pleasant 11:36
lizmat: btw pre-cursor -> precursor 11:38
lizmat thanks, fixed 11:39
jdv lizmat: cool rakuast posts 14:56
Xliff_ elcaro: It may not be exactly what you want, but you could always .encode the Str when you get it. 15:16
How difficult would it be to implement COMPOSE? 15:19
Xliff_ I am currently hacking away with a .Init method, but it would be nice to have a formal mechanism to properly incorporate roles into an object. Consider: role A { has $.a; method value { ... }; submethod COMPOSE { $!a = self.value / 2; }; }; class B { has $.b is built; method value { $.b }; }; my $b.new(b => 32); $b does A; 15:22
Xliff Is there an idomatic way of saying I would like an array containing the 100 values between 5 and 255? 17:39
I think this would be analogous to the Javascript map function. 17:40
lizmat which 100 values between 5 and 255 ? 17:41
that'd be 201 values ?
Xliff Or not...
lizmat well, 199 maybe then ?
Xliff No. Take 5..255 and get an array of 100 values between the two representing the stops.
lizmat (5..255).pick(100) 17:42
Xliff Nope. That's random. I want a linear function.
And my brain just doesn't want to Math right now.
lizmat I don't understand the question then 17:43
Xliff m: my $s = 250 / 100; say (5..255) »+»$s
camelia (7.5 8.5 9.5 10.5 11.5 12.5 13.5 14.5 15.5 16.5 17.5 18.5 19.5 20.5 21.5 22.5 23.5 24.5 25.5 26.5 27.5 28.5 29.5 30.5 31.5 32.5 33.5 34.5 35.5 36.5 37.5 38.5 39.5 40.5 41.5 42.5 43.5 44.5 45.5 46.5 47.5 48.5 49.5 50.5 51.5 52.5 53.5 54.5 55.5 56.5 57.…
Xliff my $s = 250 / 100; say 5, |(6..255) »+» $s 17:45
evalable6 5(8.5 9.5 10.5 11.5 12.5 13.5 14.5 15.5 16.5 17…
Xliff, Full output: gist.github.com/596e553a291fc12eed...907916c6a7
Xliff my $s = 250 / 100; say |5, |(6..255) »+» $s
evalable6 5(8.5 9.5 10.5 11.5 12.5 13.5 14.5 15.5 16.5 17…
Xliff, Full output: gist.github.com/1694c39b0d62560f48...cc9ee6ca3d
Xliff Hrm.
my $s = 250 / 100; my @a = (5); @a.append: |(6..255) »+» $s; @a.gist.say
evalable6 [5 8.5 9.5 10.5 11.5 12.5 13.5 14.5 15.5 16.5 1…
Xliff, Full output: gist.github.com/47f4663954b1369042...002bdaa7c5
Xliff my $s = 100 / 249; my @a = (5); @a.append: |(6..255) »+» $s; @a.gist.say 17:49
evalable6 [5 6.401606 7.401606 8.401606 9.401606 10.40160…
Xliff, Full output: gist.github.com/d821a78e61d24ca87b...029088748e
Xliff (0..99).map( * * 100) » 18:05
m: sub linear ($p, $s, $x = 0) { (0..$p).map( * * $s ) »+» $x }; linear(100, 2.5, 5).gist.say 18:08
camelia (5 7.5 10 12.5 15 17.5 20 22.5 25 27.5 30 32.5 35 37.5 40 42.5 45 47.5 50 52.5 55 57.5 60 62.5 65 67.5 70 72.5 75 77.5 80 82.5 85 87.5 90 92.5 95 97.5 100 102.5 105 107.5 110 112.5 115 117.5 120 122.5 125 127.5 130 132.5 135 137.5 140 142.5 145 147.5 …
Xliff sub linear ($r, $p) { $r.map( * * $r.max / $p) »+» $r.min }; (5..255).linear(100).gist.say 18:12
m: sub llinear ($r, $p) { $r.map( * * $r.max / $p) »+» $r.min }; (5..255).linear(100).gist.say 18:13
camelia No such method 'linear' for invocant of type 'Range'. Did you mean
'lines'?
in block <unit> at <tmp> line 1
Xliff m: sub linear ($r, $p) { $r.map( * * $r.max / $p) »+» $r.min }; (5..255).linear(100).gist.say
camelia No such method 'linear' for invocant of type 'Range'. Did you mean
'lines'?
in block <unit> at <tmp> line 1
Xliff m: sub linear ($r, $p) { $r.map( * * $r.max / $p) »+» $r.min }; (5..255).&linear(100).gist.say
camelia (17.75 20.3 22.85 25.4 27.95 30.5 33.05 35.6 38.15 40.7 43.25 45.8 48.35 50.9 53.45 56 58.55 61.1 63.65 66.2 68.75 71.3 73.85 76.4 78.95 81.5 84.05 86.6 89.15 91.7 94.25 96.8 99.35 101.9 104.45 107 109.55 112.1 114.65 117.2 119.75 122.3 124.85 127.4 1…
Xliff m: sub linear ($r, $p) { $r.map( * * ($r.max - $r.min) / $p) »+» $r.min }; (5..255).&linear(100).gist.say
camelia (17.5 20 22.5 25 27.5 30 32.5 35 37.5 40 42.5 45 47.5 50 52.5 55 57.5 60 62.5 65 67.5 70 72.5 75 77.5 80 82.5 85 87.5 90 92.5 95 97.5 100 102.5 105 107.5 110 112.5 115 117.5 120 122.5 125 127.5 130 132.5 135 137.5 140 142.5 145 147.5 150 152.5 155 157…
Xliff Why won't my brain MATH?
Xliff m: sub linear ($r, $p) { $r.map( * * $r.max / ($r.max - $r.min) ) »+» $r.min }; (5..255).&linear(100).gist.say 18:14
camelia (10.1 11.12 12.14 13.16 14.18 15.2 16.22 17.24 18.26 19.28 20.3 21.32 22.34 23.36 24.38 25.4 26.42 27.44 28.46 29.48 30.5 31.52 32.54 33.56 34.58 35.6 36.62 37.64 38.66 39.68 40.7 41.72 42.74 43.76 44.78 45.8 46.82 47.84 48.86 49.88 50.9 51.92 52.94 5…
Xliff m: sub linear ($r, $p) { $r.map( * * ($r.max - $r.min) / $p.pred ) »+» $r.min }; (5..255).&linear(100).gist.say 18:16
camelia (17.626263 20.151515 22.676768 25.20202 27.727273 30.252525 32.777778 35.30303 37.828283 40.353535 42.878788 45.40404 47.929293 50.454545 52.979798 55.505051 58.030303 60.555556 63.080808 65.606061 68.131313 70.656566 73.181818 75.707071 78.232323 80.…
Xliff m: sub linear ($r, $p) { $r.map( * * ($r.max - $r.min) / $p.elems ) »+» $r.min }; (5..255).&linear(100).gist.say
camelia (1255 1505 1755 2005 2255 2505 2755 3005 3255 3505 3755 4005 4255 4505 4755 5005 5255 5505 5755 6005 6255 6505 6755 7005 7255 7505 7755 8005 8255 8505 8755 9005 9255 9505 9755 10005 10255 10505 10755 11005 11255 11505 11755 12005 12255 12505 12755 130…
Xliff sub linear ($r, $p) { my $s = ($r.max - $r.min) / $p.pred; say " {$r.min} / { $s }"; $r.kv.map( -> $k, $v { $k * $s + $r.min }) }; (5..255).&linear(100).gist.say 18:22
evalable6 5 / 2.525253
(5 7.525253 10.050505 12.575758 1…
Xliff, Full output: gist.github.com/3cbe60687e300a8901...a414ca0bdd
Xliff lizmat: ^^
Nahita that goes until 636.313131, shouldn't it stop at 255 or around 255 18:26
kv seems to be the responsible 18:27
Xliff Hrm. Still not right then. # Nahita 18:30
sub linear ($r, $p) { my $s = ($r.max - $r.min) / $p.pred; say " {$r.min} / { $s }"; $r.kv.map( -> $k, $v { $k * $s + $r.min }) }; (5..255).&linear(100).elems.gist.say
evalable6 5 / 2.525253
251
Xliff sub linear ($r, $p) { my $s = ($r.max - $r.min) / $p.pred; say " {$r.min} / { $s }"; $r.kv.map( -> $k, $v { $k * $s + $r.min }) [^$p] }; (5..255).&linear(100).gist.say
sub linear ($r, $p) { my $s = ($r.max - $r.min) / $p.pred; say " {$r.min} / { $s }"; $r.kv.map( -> $k, $v { $k * $s + $r.min })[^$p] }; (5..255).&linear(100).gist.say 18:31
evalable6 5 / 2.525253
(5 7.525253 10.050505 12.575758 1…
Xliff, Full output: gist.github.com/c7bd4df734286b62d0...791454f01b
Xliff sub linear ($r, $p) { my $s = ($r.max - $r.min) / $p.pred; say " {$r.min} / { $s }"; $r.kv.map( -> $k, $v { $k * $s + $r.min })[^$p] }; (5..255).&linear(100).tail.say
evalable6 5 / 2.525253
255
Xliff There.
Yay! I've mathed. Now I can nap. 18:32
librasteve m: sub linear( @a, \c ) { my ( \s, \f ) = |@a.bounds; s, * + (f - s) / c ... f }; say linear (5..255),100 18:50
Raku eval (5 7.5 10 12.5 15 17.5 20 22.5 25 27.5 30 32.5 35 37.5 40 42.5 45 47.5 50 52.5 55 57.5 60 62.5 65 67.5 70 72.5 75 77.5 80 82.5 85 87.5 90 92.5 95 97.5 100 102.5 105 107.5 110 112.5 115 117.5 120 122.5 125 127.5 130 132.5 135 137.5 140 142.5 145 147.5 150 152.5 155 157.5 160 162.5 165 167.5 170 172.5 175 177.5 180 182.5 185 187.5 190 192.5 195 197.5 200 202.5 205 207.5 210 212.5 215 217.5 220 222.5 225 227.5 230 18:51
232.5 235 237.5 240 242.5 245 247.5 250 252.5 ...)
tbrowder__ lizmat: fyi, deepmap solved all my "multiply all values by a common factor problem" even for a hash of hashes! 19:04
tellable6 2023-05-25T17:59:05Z #raku <uzl[m]> tbrowder__ Thanks for the heads up! What's the repo mentioned?
Xliff librasteve++ # Thanks! 19:07
tbrowder__ uzl[m]: the repo is at the publisher's github site and is in the booki have to find it. i'll fork it if i haven't and let you know. 19:09
tbrowder__ uzl[m]: it's at JJ's public site at 'github.com/JJ/perl6em' 19:15
rf Afternoon folks 20:27
gfldex Hi rf! Sorry, we are busy reading lizmat's new blogpost. 20:45
gfldex .oO( raku -e 'try our $language;' ) 21:11
Geth advent: tbrowder++ created pull request #106:
prep for the upcoming season
22:41
elcaro I think raku.land has stopped rebuilding. Or at least. I updated a module yesterday and it's still not there. 22:46
tbrowder__ gfldex: which post? monday's weekly? or? 23:00
gfldex dev.to/lizmat/a-practical-example-...kuast-18jk