This channel is intended for people just starting with the Raku Programming Language ( Logs are available at
Set by lizmat on 8 June 2022.
00:58 deoac joined 01:52 deoac left 07:47 Manifest0 joined 08:07 dakkar joined 11:35 teatwo left 11:36 teatwo joined 11:43 tea3po joined 11:47 teatwo left 13:03 wafflus joined
rcmlz m: for 0..6 -> \i { say "sin(i × π) = " ~ sin(i × π) } 13:56
Raku eval sin(i × π) = 0 sin(i × π) = 1.2246467991473532e-16 sin(i × π) = -2.4492935982947064e-16 sin(i × π) = 3.6739403974420594e-16 sin(i × π) = -4.898587196589413e-16 sin(i × π) = 6.123233995736766e-16 sin(i × π) = -7.347880794884119e-16
rcmlz I was wondering why that is not always 0. 13:57
nemokosch Because pi is not accurately represented (and it cannot really be, probably) 13:58
so the mistake probably adds up
rcmlz Yes, but I remember a discussion about log10(1000) not beeing 3 13:59
nemokosch the difference is, 10 and 1000 can be accurately represented 14:00
rcmlz and technically sin(2pi) == 0
nemokosch I mean, it could probably be hardcoded... to some extent I guess? But don't forget that Raku wouldn't become a symbolic computation system either way, so you could just multiply the value by some large number and the hardcoding would make the sin function utterly not continuous 14:01
rcmlz ok, understood. Thanks.
nemokosch basically you have to make this choice. Either special values are somehow detected (which is not even easy if they are just floating point numbers) and then you get accurate values for them, or the function can be continuous 14:02
but I think "doing it right" would only really be possible if pi wasn't just a floating point number 14:03
14:03 wafflus left
I wonder if somebody had this idea to create some symbols and symbolic expressions in Raku, with versions of pi and e that are not bare numbers 14:06
@librasteve maybe you know more about this 14:07
antononcube @rcmlz One would need "full blown" (or maybe just "partially blown") mathematical symbolic system for that. 15:19
rcmlz ok. 15:36
17:06 dakkar left
drudgesentinel What would be a correct way to strip whitespace from a file using a oneliner? I was trying raku -ne '.print.subst(/\s+/, "", :g);' file.example # no changes in printed output Which I believe to substitute any whitespace characters including newlines/tabs with nothing. I also tried s/// but I'm not sure of whether that works with $_, as in the examples everything is reassigned and uses the smart 18:01
match operator
I ended up just using tr since my use case was so simple but was curious as to what I was doing wrong 18:03
nemokosch All whitespace? 18:23
scullucs Swap the 'print' and 'subst': raku -ne '.subst(/\s+/, "", :g).print;' file.example 18:34
drudgesentinel Is it expected to not be able to use shell scripts (e.g., qx/VARNAME=VALUE ) to define environment variables? my $pod = "foobar" my $env-output = qx/export TFEPOD=$pod/; Probably another wrong tool for the job situation 19:34
nevermind, I didn't source things so this is a shell behavior 19:40
nemokosch You can define variables that processes launched from your Raku script can see 20:26
But (thankfully) you cannot leak variables without the caller agreeing to that; that would be hell 20:27
22:49 Manifest0 left 23:35 teatwo joined 23:36 teatwo left 23:37 teatwo joined 23:38 tea3po left