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:13
frost left
00:28
ae_chep left
00:58
frost joined
02:34
frost left
02:37
frost joined
03:29
Heptite left
07:26
razetime joined
07:38
guifa left
07:39
guifa joined
07:55
frost left
08:00
dakkar joined
08:12
razetime left
08:31
razetime joined
08:42
CIAvash left,
crystalfrost[m] left
08:49
CIAvash joined
09:23
frost joined
09:27
crystalfrost[m] joined
11:26
frost left
11:42
frost joined
13:39
frost left
14:04
discord-raku-bot left,
discord-raku-bot joined
|
|||
jaguart | noob question - I want to subclass Hash and tweak the way that .keys.sort work - can't figure out how to get started | 14:28 | |
tried: class MyHash is Hash {}; my %h = MyHash.new( :a(1), :b(2), :c(3) ); dd %h # but no joy... | 14:30 | ||
Kaiepi | you could make `keys` return a subtype of `Seq` with the appropriate `sort` behaviour if you pass an `Iterator` to `new`. this is how `Iterable`-ish methods are generally implemented docs.raku.org/type/Iterator | 14:31 | |
you could make `keys` return a subtype of `Seq` with the appropriate `sort` behaviour if you pass an `Iterator` to `new`. `Iterator` is how `Iterable`-ish methods are generally implemented in core docs.raku.org/type/Iterator | 14:32 | ||
you could make `keys` return a subtype of `Seq` with the appropriate `sort` behaviour if you pass an `Iterator` to `new`. this is how `Iterable`-ish methods are generally implemented in core docs.raku.org/type/Iterator | |||
jaguart | fab thanks - will start looking there | 14:33 | |
15:23
Heptite joined
16:38
dakkar left
|
|||
lizmat | jaguart: perhaps also applicable: raku.land/zef:lizmat/Hash::Agnostic | 17:23 | |
17:32
razetime left
|
|||
jaguart | :lizmat++ thanks - finding my way. Is there a preferred pastbin for this channel | 17:37 | |
lizmat | nope, there isn't. Personally, I use gist.github.com | 17:38 | |
jaguart | this is where I'm going: gist.github.com/jaguart/bd64157bcf...9a286e0613 | 17:40 | |
the META6 class is a pain because of JSON key ordering... | 17:41 | ||
I'm thinking that by overriding the %h.sort method, we can get the META6 JSON in a reasonable order... | |||
lizmat | I see | 17:42 | |
one note: I guess the %w hash is immutalble, right ? | |||
my constant %w = ... | 17:43 | ||
jaguart | yeah - a const really | ||
lizmat | will make it a Map at compile time | ||
m: dd my constant %h = a => 42 | 17:44 | ||
camelia | :a(42) | ||
lizmat | m: dd my constant %h = a => 42, b => 666 | ||
camelia | Map.new((:a(42),:b(666))) | ||
jaguart | Nice thanks. This is a suggestion for github.com/jonathanstowe/META6/issues/15 | 17:48 | |
though I cant help but wonder id Hash::Ordered might also be a help | 18:07 | ||
lizmat | jaguart: github.com/timo/json_fast/pull/83 | 18:18 | |
jaguart | that would be awesome :) | 18:19 | |
I see that stowick already cascaded an issue to OrderedHash too - but the JSON::Fast is the ultimate destination of all roads :) | 18:20 | ||
lizmat | the actual code change is minimal: documentation was more work :-) | ||
jaguart | There is a second call to associative.sort around line 260... | 18:24 | |
I find updating the docs a good chore though - makes me think twice about the changes :) | 18:26 | ||
I havent fogotten that I was going to show you my first PHP::Tiny module - it's just that I'm not really sure the code is good enough. | 18:27 | ||
lizmat | jaguart++ good catch! | 18:28 | |
fix pushed | 18:30 | ||
jaguart | you are fast - I've only half finished my cuppa - and you've tied the issue with a bow! | 18:32 | |
lizmat | yy down x 15 p up dd | 18:35 | |
that was it :-) | |||
jaguart | You know that you have made the entire ecosystem more beautiful - on behalf of every human that reads their META6.json but uses the META6 class to generate/maintain it, I thank you :) | 18:36 | |
lizmat | you're welcome :-) | 18:37 | |
stevied | www.reddit.com/r/rakulang/comments...ainst_any/ | 18:57 | |
19:26
Heptite left
19:27
Heptite joined
19:46
discord-raku-bot left
19:47
discord-raku-bot joined
|