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. |
|||
00:39
hythm left
01:00
hythm joined
01:09
Manifest0 left
04:23
hythm left
04:46
raiph left
05:24
jgaz left
06:07
siavash joined
07:23
kjp left
07:27
kjp joined
07:30
deoac left
07:56
siavash left
09:59
Manifest0 joined
10:03
habere-et-disper joined
|
|||
habere-et-disper | m: enum ConfigValues ("Hello\nWorld".lines.map({ my ($key, $value) = .words; $key => $value })); | 10:04 | |
camelia | ===SORRY!=== Error while compiling <tmp> Using a type object as a value for an enum not yet implemented. Sorry. at <tmp>:1 ------> ey, $value) = .words; $key => $value }))⏏; |
||
habere-et-disper | Is the documentation sometimes ahead of the implementation? | 10:05 | |
Workaround: | 10:06 | ||
m: enum ConfigValues ("Hello\nWorld".lines.pairs.Map); | |||
camelia | ( no output ) | ||
habere-et-disper | m: say enum ConfigValues ("Hello\nWorld".lines.pairs.Map); | 10:07 | |
camelia | Map.new((0 => Hello, 1 => World)) | ||
nemokosch | What is the difference? | 10:08 | |
habere-et-disper | I'm not sure. | 10:13 | |
nemokosch | I mean, what to see here? | 11:22 | |
habere-et-disper | I don't grok the error -- how are they not equivalent? | 11:24 | |
nemokosch | I also don't grok the error but I also don't think they are even similar | 11:25 | |
In the second case, the indices served as the key of the pairs. There is nothing like that in the first case, simply a string got broken up into, well, one piece | 11:26 | ||
"The one piece is real!" 😄 | |||
lizmat | habere-et-disper: you're both using .lines AND .words that doesn't feel right ?? | ||
so $value will be Any, thus causing the error message | 11:27 | ||
nemokosch | Oh, apparently I didn't even read the error right | 11:28 | |
It makes sense this way | |||
habere-et-disper | Thanks lizmat . This example is from just before: | 11:31 | |
<docs.raku.org/language/typesystem#..._Enums> | |||
lizmat | m: my ($key,$value) = "Hello".words; dd $key, $value | 11:32 | |
camelia | Str $key = "Hello" Any $value = Any |
||
lizmat | it's a problem in your code habere-et-disper ^^ | ||
habere-et-disper | It's not my code -- it's from the enum docs. | 11:34 | |
lizmat | aaah... ok, then it's a doc issue: the code is wrong | 11:35 | |
nemokosch | I still can't see that | ||
lizmat | or... maybe not | ||
11:36
teatwo joined
|
|||
nemokosch | Oh, right above the linked anchor | 11:36 | |
lizmat | m: enum ConfigValues ("a 1\nb 2".lines.map({ my ($key, $value) = .words; $key => $value })); | ||
camelia | ( no output ) | ||
nemokosch | But it didn't imply wrong input | ||
lizmat | m: enum ConfigValues ("a 1\nb 2".lines.map({ my ($key, $value) = .words; $key => $value })); dd a, b | 11:37 | |
camelia | ConfigValues::a ConfigValues::b |
||
nemokosch | It just assumed there will be right input, and the one you gave was not the right format | ||
lizmat | indeed | ||
(assuming you were addressing habere-et-disper :-) | |||
11:37
tea3po joined
|
|||
nemokosch | Yep | 11:37 | |
11:39
teatime left
|
|||
The one lizmat gave is a sufficient format | 11:40 | ||
11:40
teatwo left
|
|||
habere-et-disper | Right -- it all makes sense now ! =D | 11:41 | |
Does a where clause not effect multi-dispatch priority? | 12:32 | ||
lizmat | afaik a where clause is an arbitrator... | 12:38 | |
so it will be applied to all candidates that match the signature without the where clause | |||
nemokosch | So you do know the multi resolution order? | 12:49 | |
habere-et-disper | I've read the docs, so it seems to consider type and arity. I am confused by the "where clause" and "is default" not adding greater specificity in my minimal working example: | 13:08 | |
github.com/habere-et-dispertire/sc...patch.raku | |||
lizmat | it takes the first with the if-clause matching | 13:11 | |
so if you change the order of the candidates, you should be fine | 13:12 | ||
habere-et-disper | That's the issue. I'm trying a declarative programming approach and I don't want the order to matter. | 13:16 | |
nemokosch | That's not the only issue really | 13:17 | |
The resolution order seems to be obscure and underspecified | 13:18 | ||
lizmat | gist.github.com/lizmat/d63d0ed8e4c...37fa0a6813 | 13:29 | |
habere-et-disper ^^ | |||
habere-et-disper | Wow, thanks. (y) So if I grok this now then as long as the predicates are mutually exclusive we can forgo candidate order. | 13:41 | |
lizmat | yup | ||
otherwise order becomes meaningful | |||
habere-et-disper | Lesson learnt. Merci ! | ||
14:15
raiph joined
15:04
jgaz joined
15:14
habere-et-disper left
17:20
deoac joined
19:09
hythm joined
19:18
raiph left
19:30
deoac left
20:53
hythm left
21:16
ab5tract left
21:17
ab5tract joined
21:57
codesections joined
21:59
kdon joined
|
|||
kdon | hello, i would like learn what can be done with raku languaje | 22:01 | |
22:22
codesections left
22:30
codesections joined
22:43
kdon left
22:57
kdon joined
|
|||
lakmatiol | string processing of most kinds can be expressed really nicely. | 23:04 | |
23:31
Camaleon joined
23:36
tea3po left,
tea3po joined
23:40
Camaleon left
23:54
teatwo joined
23:57
tea3po left
|