Raku Conference Day 2 on Youtube: www.youtube.com/watch?v=BL9-XdC9WYI 🦋 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 14 August 2022.
Nemokosch well, it is "normal", yes 00:17
[Coke] if you have a large script, move it to a module and 'use' it from the main script. then you get precompilation speedups on future runs. 00:53
grondilu Hi all. 07:38
tellable6 2022-09-03T14:17:28Z #raku <guifa> grondilu: best you can do is
grondilu I have a module C<unit module Foo; constant $foo = [ -> {} ]; $foo()> which executes fine but fails when used : "No lexical found with name '$_'" 07:40
that Foo example is just a golfed version of what I had initially when I encountered this. 07:41
m: module Foo { constant $foo = [ -> {} ]; $foo(); }; import Foo; 07:42
camelia No such method 'CALL-ME' for invocant of type 'Array'
in block <unit> at <tmp> line 1
grondilu m: module Foo { constant $foo = -> {}; $foo(); }; import Foo;
camelia ( no output )
grondilu oh sorry I copied it wrong 07:43
the module is C<unit module Foo; constant $foo = -> {}; $foo()>
not sure if I can reproduce the error in a one-liner 07:44
Nemokosch so... what is the code? 😅 07:59
Geth ecosystem: 5515f5be2e | (Elizabeth Mattijsen)++ | META.list
Remove 3 of Brian Duggan's modules that also live in CPAN

To prevent double mentions in raku.land
08:33
grondilu the code is just 'use Foo' 09:11
or -MFoo
anyway, on an other note, I was supposed to get the first 64 bits of the fractional part of sqrt(2) and it seems raku truncated it 09:15
m: put (($_ - .Int)*2**64).Int.fmt("%0x") given sqrt 2 09:17
camelia 6a09e667f3bcd000
grondilu correct result is 6a09e667f3bcc908
Nemokosch isn't that too much for an IEEE 754 floating point number?
I don't know but wouldn't be surprised
I mean doesn't matter what you are doing if you lose precision on sqrt 2 itself
grondilu probably yes
isn't there a way to do better than IEEE754 here? 09:18
lizmat FatRat ?
grondilu sqrt 2 is not a rational 09:19
Nemokosch but you can only approximate it either way
grondilu isn't there a FatNum or something lol?
isn't there a FatNum or something lol? 09:20
Nemokosch Raku is not a numeric platform to deal with formulae
so everything _is_ rational one way or another, right?
and if you want accurate digits, it cannot be a bad idea to use rationals 09:21
grondilu I suppose I could tweak the equation to look for an integer 09:23
(2**64 + x)**2 == 2**128 or something?
lizmat grondilu: ah duh, yeah :-) 09:24
grondilu bad formula here, x = 0 lol 09:25
something similar should work though
Nemokosch anyway, why does 2.FatRat.sqrt give a Num?
doesn't seem too friendly
"Where a Rat degrades to a Num, math with a FatRat keeps chugging along:" says the docs 09:26
then why does it turn back into a Num
grondilu I think I would need the integer algorithm for sqrt anyway 09:32
m: say sqrt(1 + 2**64)
camelia 4294967296
grondilu 🤔
m: say sqrt(1 + 2**128) 09:33
camelia 1.8446744073709552e+19
grondilu yeah that's what I thought, there is no multi candidate for large integers
Nemokosch sqrt exists on Cool and Numeric so in theory that shouldn't be a problem 09:36
but does the implementation actually preserve all that data....
grondilu integer square root is a thing en.wikipedia.org/wiki/Integer_square_root 09:37
I'm surprised it's not in Raku's core
not complaining, just noticing
lizmat grondilu: there's your chance to gain immortality :-) 09:41
Nemokosch well tbh this seems niche enough for a "general-purpose programming language" 09:42
I'm more concerned about what I was pointing out
.sqrt shouldn't collapse a FatRat into a Num
and very apparently this is what happens
Nahita it took ~28 years for Python to add `math.isqrt`
Nemokosch again, implying that it wouldn't rather belong to some numerical calculations package 09:44
or if we really insist that FatRat is a "true rational" and shouldn't be used for approximations, then at least there should really be a FatNum
some arbitrary precision type that doesn't collapse into Num when sqrt is used
grondilu m: gist.github.com/grondilu/72daaea1a...5d29ce6fee 09:55
camelia 6a09e667f3bcc908
grondilu quite involved, but will do 09:56
lizmat feels like a module :-)
grondilu it's in rosetta code 10:00
btw I can't log in rc anymore since the update, kind of annoying 10:01
Xliff m: '🤔'.uniname.say 10:17
camelia THINKING FACE
Xliff m: '🤔'.unichar.say
camelia No such method 'unichar' for invocant of type 'Str'
in block <unit> at <tmp> line 1
Xliff m: '🤔'.chr.say
camelia Cannot convert string to number: base-10 number must begin with valid digits or '.' in '⏏🤔' (indicated by ⏏)
in block <unit> at <tmp> line 1
Xliff m: '🤔'.ord.say
camelia 129300
lizmat and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2022/09/05/2022-...-in-at-50/ 13:25
guifa lizmat++ 13:28
Nemokosch being on the IEEE list _at all_ is a good sign in my opinion 14:15
lizmat my thoughts exactly :-) 14:16
Nemokosch it can get things started, like one can show it around, "see it's that language I'm using, not something esoteric joke" 14:17
it can get things started, like one can show it around, "see it's that language I'm using, not some esoteric joke"
the current "did you know" even works with .= 14:22
lizmat sure, but I wanted to keep it one feature at a time :-) 14:25
that's laziness for you :-)
nothing happens until something actually needs the values
in this case, it's the "say" command
Nemokosch I SAID .= WORKS FOR THAT EXAMPLE 14:43
^is that what you mean? 🤣
I just used the say command 14:44
lizmat yes, and that's what's causing the Seq to actually be executed 14:46
Nemokosch Apparently I don't get how rak works 16:14
I have HTML files in a folder, generated by HTML::Tag - the whole file is one humonguous line 16:15
I wanted to see where the images are
I did `grep "img src" *` but obviously it would just give me whole, megabyte-sized files
I did `rak "img src"` and it did nothing
I thought it would at least find the files as grep did, perhaps produce a more manageable output even 16:16
but it produced no output whatsoever 16:17
when I added `--extensions=html`, it did work 16:24
so there must be something I'm missing
lizmat Nemokosch: no, it's me who missed adding .htm and .html in a #html group 17:28
tellable6 lizmat, I'll pass your message to Nemokosch
lizmat it will be in the next release 17:33
p6steve on extended precision topic, I have added Raku here en.wikipedia.org/wiki/Arbitrary-pr...plications 17:41
also ... I think it is a fair design decision to NOT attempt integer sqrt, but to degrade to Num for both Int and FatRat ... otherwise we (i.e. you) will be building a new tower of ln, log, sin, cos, tan... libraries 17:44
since all of these produce irrational numbers
melezhik how one can configure rakudo to search packages in alternative locations? 17:53
gist.github.com/melezhik/29ad03155...4224358d92 17:56
I am trying to build alpine packages for rakudo installed into /opt/rakudo-pkg/ prefix
app does not allow to build packages into `/opt` path 17:57
so here is my problem, how can I make rakudo installed into `/opt/rakudo-pkg/` prefix look up packages installed into `/usr/` prefix ?
which is legit prefix for alpine packages ... 17:58
lizmat El_Che might know 18:04
melezhik thanks!
El_Che as far as a know is /opt valid in linux and unix 18:14
/usr besides /usr/local is mostly reserved for the OS itself 18:15
If by packages you mean libraries? env RAKUDOLIB? or add it at build time?
melezhik El_Che I mean this - github.com/alpinelinux/abuild/blob...ld.in#L761 18:19
ugexe m: role Foo { method bar { ... } }; class MyClass { has Foo $.foo; }; my $c = MyClass.new; say $c.foo; say $c.foo.?bar 18:21
camelia (Foo)
Method 'bar' must be implemented by Foo because it is required by roles: Foo.
in block <unit> at <tmp> line 1
ugexe does that make sense?
melezhik gist.github.com/melezhik/4a8ec17d5...abuild-L29 and this
ugexe i assume its called the stubbed bar method, but i really want .?bar to only call bar if an implementation exists 18:22
melezhik if one tries to build an alpine package for Raku module using standard "$pkgdir" path they sendup having package files into `/usr` prefix, so rakudo installed  into `/opt/rakudo-pkg` prefix won't see them 18:23
obvious way to overcome that is to use `$pkgdir"/opt/rakudo-pkg/` for install-dist.raku however it results in the mentioned error when trying to build a package using `abuild -r` 18:24
please see this - gist.github.com/melezhik/4a8ec17d5...nt-4290938 18:25
El_Che melezhik: so the solution would be adding /usr/local/raku (or something) to the search path of rakudo-pkg? (security consideration aside for a moment) 18:34
?
melezhik yeah, so as I started my question from the very beginning I would like say to build alpine packages for Raku modules for rakudo distribution shipped into `/opt/rakudo-pkg` and looks like alpine only allows me to ship packages into `/usr` prefix not `/opt/rakudo-pkg` , so look like we need to be able to configure `rakudo-pkg` to see packages in 18:36
`/usr` path
by configuring a `rakudo-pkg` I mean any way to achieve this , maybe via some env var? 18:37
El_Che if you're setting env vars, you can set RAKUDOLIB? 18:40
melezhik yes, I guessed that , however I just wanted to clarify here, maybe there is a better approach ?
El_Che wel, i am doubtful 18:41
if you create packages of libs, I think it makes sense to link to the system rakudo 18:42
I mean distributable packages not private ones
if you want to create packages for lib that use rakudo-pkg I would put that in /usr/local and set the environment 18:44
or use another tooling that does to impose that check
(I use github.com/goreleaser/nfpm)
melezhik yeah, make a sense, the reason I try to build for the distribution supported by you is that official alpine distribution gets stuck in old versions 18:45
El_Che melezhik: I was under the impression they had recent releases, maybe is my info outdated
melezhik let me check real quick 18:46
so - pkgs.alpinelinux.org/package/edge/...4le/rakudo 2022.06 - so not that bad
in that case maybe I'd continue my journey with official alpine rakudo distro 18:47
El_Che yes, that sounds sane to me
melezhik anyway - thanks!
El_Che np 18:48
gfldex lolibloggedalittle: PWC SPOILER ALERT! gfldex.wordpress.com/2022/09/05/va...peratures/ 20:22