This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
arkiuat Cannot convert string to number: base-10 number must begin with valid digits or '.' in '⏏–2000' (indicated by ⏏) 00:36
m: say '-2000'.Rat 00:37
camelia -2000
arkiuat I do not understand how I can possibly be getting this error message.
It begins with a minus sign, sure, and not a digit or '.', but it works fine for camelia 00:38
librasteve: I think you mean //= 00:41
deoac: I'd probably write that as `$FOO //= $foo` 00:43
but you could do it with `with` as ab5tract suggests, and jubilatious is perfectly correct: the way you wrote it the first time is fine. 00:45
especially if you're not going to recognize what `with` or `//=` are doing when you come back to read the code later
anyway, I figured out my mysterious error. The data file my code is trying to read is using en-dashes instead of hyphens to represent minus signs. 01:16
.uniname to the rescue 01:17
this is what I get for copy-and-pasting data tables out of PDFs that were produced by who knows what editing/publishing software 01:19
02:28 arkiuat left 02:34 arkiuat joined 02:39 arkiuat left 02:48 arkiuat joined 02:53 arkiuat left 03:01 arkiuat joined 04:32 arkiuat left 04:33 arkiuat joined 04:38 arkiuat left 04:40 arkiuat joined 04:45 arkiuat left 04:50 sibl joined 05:14 arkiuat joined 05:19 arkiuat left 05:24 arkiuat joined 05:28 sibl left 05:29 sibl joined 05:33 arkiuat left 05:45 arkiuat joined 05:50 arkiuat left 05:53 sibl left 06:12 arkiuat joined 06:17 arkiuat left 06:31 sibl joined 06:44 arkiuat joined 06:50 arkiuat left 07:13 arkiuat joined 07:18 arkiuat left 07:21 arkiuat joined 07:26 arkiuat left 07:40 arkiuat joined 08:51 arkiuat left 09:03 arkiuat joined 09:08 arkiuat left 09:14 arkiuat joined 09:19 arkiuat left 09:48 arkiuat joined 09:53 arkiuat left 10:15 arkiuat joined 10:20 arkiuat left 10:32 sibl left
ab5tract well `//=` isn't applicable here right? because it is `$foo` that is being checked for defined-ness, rather than `$FOO`? 10:38
lizmat indeed 10:42
10:48 arkiuat joined
ab5tract but `$FOO = $foo // $FOO` would be another way to do this 10:52
10:53 arkiuat left
lizmat m: sub infix:<=//>(\a,\b) { a = $_ with b }; my $a =// 42; say $a 10:55
camelia ===SORRY!=== Error while compiling <tmp>
Null regex not allowed. Please use .comb if you wanted to produce a
sequence of characters from a string.
at <tmp>:1
------> />(\a,\b) { a = $_ with b }; my $a =//<HERE> 42; say $a
lizmat weird
m: say $*VM.version 10:56
camelia v2026.02
lizmat m: sub infix:<=//>(\a,\b) { a = $_ with b }; my $a; $a =// 42; say $a 10:57
camelia 42
lizmat aha
ab5tract ah, so it can't get past `//` when parsing it as a declaration 10:58
another perlism protection situation, I believe? 10:59
lizmat yeah, but "no isms" doesn't help either 11:00
ah... and in use v6.* it's interpreted as = //42 11:02
m: use v6.*; say //42
camelia True
lizmat m: use v6.*; say //Any
camelia False
lizmat aka prefix:<//>
ah well, just an idea that popped up in my mind this morn 11:03
11:16 arkiuat joined
ab5tract maybe a `with=` or something.. `=//` seems a bit to close to `//=` not to cause a bit of confusion 11:16
anyway, we've already got a few ways to do it :)
lizmat yeah, but I also do find $a = $_ with $b a bit cumbersome :-) 11:17
wouldn't mind some syntactic sugar for that
11:21 arkiuat left
ab5tract yeah fair 11:40
11:45 arkiuat joined 11:50 arkiuat left 11:56 arkiuat joined 12:00 arkiuat left 12:02 arkiuat joined 12:07 arkiuat left 12:20 arkiuat joined 12:25 arkiuat left, arkiuat joined 12:30 arkiuat left 12:59 arkiuat joined 13:04 arkiuat left 13:19 arkiuat joined 13:24 arkiuat left 13:37 arkiuat joined 13:41 arkiuat left 13:42 arkiuat joined
arkiuat huh, I thought it was the same 13:44
m: my ($F,$f); $F //= $f; dd :$F; $f = 1; $F //= $f; dd :$F
camelia :F(Any)
:F(1)
arkiuat m: my ($F,$f); $F = $_ with $f; dd :$F; $f = 1; $F = $_ with $f; dd :$F 13:45
camelia :F(Any)
:F(1)
arkiuat so what's the difference exactly?
lizmat /= means: assign if the LHS is undefined 13:46
//= means: assign if the LHS is undefined
(one / eaten :-)
$a = $_ with $b means: assign RHS if RHS is defined 13:47
arkiuat oh right! OP was asking about assigning if RHS is defined 13:48
lizmat yup
arkiuat I misread the original question
sorry deoac
I don't run into that situation nearly as often as I want to assign to LHS but only if it's not already defined 13:50
thanks for explaining 13:52
lizmat yw :-) 13:53
13:53 sibl joined 13:57 arkiuat left
librasteve think I’ll go and crawl into a hole (thanks for correcting me) 13:57
13:57 arkiuat joined
arkiuat eh, you're fine. I made a worse mistake 14:12
you just made a typo in a question. I went blathering on answering a question that hadn't been asked 14:13
14:48 sibl left 15:39 arkiuat left 15:52 arkiuat joined 20:13 arkiuat left 20:14 arkiuat joined 20:23 atcroft left