|
03:19
DarthGandalf left
03:20
DarthGandalf joined
03:32
DarthGandalf left
04:55
sibl joined
05:51
DarthGandalf joined
05:52
sibl left
07:58
Manifest0 joined
07:59
sibl joined
08:06
sibl left
08:28
sibl joined
08:37
sibl left
09:13
leifgunnar left
09:20
leifgunnar joined
11:31
human-blip left
11:35
human-blip joined
|
|||
| disbot4 | <simon_sibl> I am aware that may not be my brightest moment and is more on the side of 'clever' than readable but is there a way to have named variable here instead of using .[0] and .[1] like $^ip $^mask even tho thats an array ? | 13:30 | |
| <simon_sibl> $cidr.split('/', 2).&{min-max-ip(ipv4-to-uint32(.[0]), 0xFFFFFFFF +< (32 - .[1]))}.&{.[0] .. .[1]}.lazy.map(&uint32-to-ipv4); | |||
| lizmat | turn the Callable into a sub with arguments? | 13:32 | |
| disbot4 | <simon_sibl> like .&(-> [$ip, $mask] {}) ? | 13:33 | |
| thowe | I have a GraphQL interface that limits records it returns to 10000. If I want to take 2 identically structured JSON objects, and merge them, is that something one of the JSON libs will do? Alternatively, if I "from-json" them into Raku objects, is there some shortcut to merge those if they are structured the same, or do I just need to manually do it? | 15:46 | |
| disbot4 | <antononcube> What is the structure? | 16:13 | |
| <antononcube> @thowe From what I outlined I see several approaches, depending on factors, like, structure, desired speed of computations, etc. 1. Using "Hash::Merge" 2. Using the graph algebra functions of "Graph" 3. Just ask an LLM to do it (or five) | 16:16 | ||
| <antononcube> Mind you, in Raku, 3 can be done programmatically and be reliable. It can be direct manipulation by the LLM or generating corresponding code (Python, or Raku, or whatever.) | 16:17 | ||
| thowe | It's a simple structure, it's just that I have to eat it in multiple pieces. I can merge easily by looping through it, I just thought there might be a shortcut I didn't know about. | 16:41 | |
|
17:34
human-blip left
17:36
human-blip joined
|
|||
| disbot4 | <comborico> I wonder why the list data structure didn't get its own sigil. Probably an unnecessary addition just for technicality's sake. | 18:46 | |
| <comborico> docs.raku.org/language/101-basics I don't understand this interaction at $names.sort({ %sets {$_} }). How is $names connected to the hash table completely unaffiliated with it? $name is being sorted according to %sets, but what is connecting $names (a list of names) to %sets (table of names and values)? (I understand a bit about the topical variable -- that isn't the source of my confusion.) | 19:49 | ||
| <comborico> cdn.discordapp.com/attachments/768...f4013& | |||
| <librasteve> thowe: I used Hash::Merge recently … suggest you start with that | 19:51 | ||
| <comborico> @names.sort does the sorting alphabetically -- SORT working on the array elements in @names. But now SORT is working on %sets, yet it somehow matches the keys in $set with elements in array @names. | 19:53 | ||
| <librasteve> @comborico hi! thanks for your feedback on 101 … | |||
| <librasteve> I am curious, what languages (if any) do you know already? | |||
| <comborico> ...common lisp. | 19:54 | ||
| <comborico> But I'm pretty much a novice, though I've studied programming for years. I've studied others. | 19:55 | ||
| <librasteve> oh - that's helpful - thanks1 | 19:56 | ||
| <librasteve> on the sigils, Array @ and Hash % are the "fully loaded" types and get the sigil treatment - everything else List, Map, Set, Scalar and so on gets a $ | 19:57 | ||
| <comborico> I see. | 20:00 | ||
| <librasteve> looking at your question $names.sort({ %sets{$_} }) the sort method takes a block {} and sets the topic $_ of the block to the current value, it then uses the result of the block (so in this case the value of %sets for each name item) as the decider as to the sort order | 20:02 | ||
| <comborico> What is current value of the block at the beginning? | 20:04 | ||
| <comborico> Another angle, %sets.sort yields alphabetical order. %matches yields the same. How is even the value being reached to be ordered. I may have to take a break on this. I feel the mental gymnastics taking place in the old noggin'. You wrote that article then? | 20:06 | ||
| <librasteve> not guilty on writing that one! | 20:07 | ||
| <comborico> In the REPL, I tried %sets.sort{$_}, but error. I take it .sort and .sort with an argument of a block behave differently? | 20:08 | ||
| <librasteve> m: my @names = <a b c>; say @names | 20:10 | ||
| <Raku eval> [a b c] | |||
| <comborico> Go on. | |||