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. |
|||
01:47
camelia left
01:48
camelia joined
02:25
human_blip left
02:27
human_blip joined
09:15
dakkar joined
10:48
[Coke] left
12:46
[Coke] joined
13:39
habere-et-disper joined
|
|||
habere-et-disper | I expected an equivalence between (^Inf) and (^*) -- am I missing something ? | 13:42 | |
For example: (^Inf).map( * ** 3 ) could be (^*).map( * ** 3) | |||
13:51
habere-et-disper left
13:53
tbrowder left
13:54
tbrowder joined
|
|||
[Coke] | Don't think so - some operators might treat them the same, but it's not a universal. | 13:55 | |
docs.raku.org/language/operators#prefix_^ | |||
m: *.Numeric.say | |||
camelia | ( no output ) | ||
[Coke] | m: say *.Numeric; | ||
camelia | WhateverCode.new | ||
[Coke] | m say Inf.Numeric; | ||
m: say Inf.Numeric; | |||
camelia | Inf | ||
15:14
swaggboi left
15:40
swaggboi joined
|
|||
nahita3882 | it's not in line with ^$val being 0..^$val though, as 0..^* interprets the star as making the end point Inf | 16:40 | |
m: say ^12, 0..^12, ^*, 0..^* | |||
Raku eval | ^12^12WhateverCode.new0..^Inf | ||
nahita3882 | m: dd ^12, 0..^12, ^*, 0..^* | 16:41 | |
Raku eval | ^12 ^12 WhateverCode.new 0..^Inf | ||
[Coke] | Yup. I don't know if there's a reason for that inconsistency. Might be worth opening a problem solving ticket. | 16:54 | |
Seems like an easy change to make if it doesn't break anything. | |||
lizmat | m: dd ^* | 17:09 | |
camelia | WhateverCode.new | ||
lizmat | m: .say for (^*)(10) | 17:10 | |
camelia | 0 1 2 3 4 5 6 7 8 9 |
||
lizmat | so I think that's going to be a no-starter as it's valid syntax atm | ||
it may be a bit of a WAT | 17:11 | ||
[Coke] | m: .say for (^Inf)(10) | 17:35 | |
camelia | No such method 'CALL-ME' for invocant of type 'Range' in block <unit> at <tmp> line 1 |
||
[Coke] | m: .say for (^Inf)[10] | 17:36 | |
camelia | 10 | ||
[Coke] | ok. | ||
librasteve | m: say (^*)[10]; | 17:37 | |
Raku eval | WhateverCode.new | ||
librasteve | m: say (0..^*)[10] | 17:38 | |
Raku eval | 10 | ||
librasteve | can that be what was intended? | 17:39 | |
lizmat | ^* currently codegens to -> $_ { ^$_ } | 17:41 | |
17:43
stanrifkin joined
17:46
dakkar left
|
|||
librasteve | and presumably, +* codegens to > $ { +$ } ie coerce to Numeric | 17:48 | |
and ^ is the upto operator so that ^* should return the Range 0..^* except it returns WhateverCode.new | 17:50 | ||
m: say +*; | 17:53 | ||
Raku eval | WhateverCode.new | ||
librasteve | m: say (+*)(<2>).WHAT; | ||
Raku eval | (Int) | ||
librasteve | so the general case makes sense and even works when ^* is the second arg to the range operator like 0..^*, but raku forgets to special case when ^* is used standalone since there is no value coming to prime it | 17:55 | |
i got this general raku comment on my harc stack intro post over at /r/htmx Can I set a config so that it doesn’t let me get away with not typing things? ... I am reluctant to just say "no", but I don't know of any use super-strict; pragma that would require explicit types to be set everywhere | 18:07 | ||
18:13
habere-et-disper joined
18:29
habere-et-disper left
|
|||
[Coke] | You can self enforce, but there's no pragma to say, e.g. all user-space routines and variables must be typed. | 18:53 | |
librasteve | ah - I thought not but wanted to check - maybe a rakuAST linter could do this in the future... | 18:54 | |
tx | |||
[Coke] | ... wonder if that could live in module space. | ||
19:39
habere-et-disper joined
|
|||
habere-et-disper | How did @lizmat discover what (^*) codegens to as neither `dd` nor `raku` introspect fully? | 19:46 | |
[Coke] | she's a core dev. | 19:48 | |
probably looked at the source. | |||
librasteve - yes, probably easier in AST. | 19:58 | ||
20:00
habere-et-disper left
|
|||
[Coke] | I don't remember happening to see Device::Velleman::K8055 before | 20:14 | |
ww. | |||
20:36
stanrifkin_ joined
20:38
stanrifkin left
21:01
habere-et-disper joined
21:08
habere-et-disper left
21:22
notna joined
21:37
notna left
|