🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 8 June 2022.
00:07 reportable6 left 00:08 reportable6 joined 00:10 [Coke] left 00:20 [Coke] joined 00:50 simcop2387 joined 00:52 perlbot joined 01:07 kjp left 01:29 perlbot left 01:30 simcop2387_ joined, simcop2387 left 01:31 simcop2387_ is now known as simcop2387 01:33 perlbot joined 01:37 Sankalp left 01:38 Sankalp joined 01:57 frost joined 02:15 Sankalp left 02:17 Sankalp joined 03:17 linkable6 left, bloatable6 left, benchable6 left, evalable6 left, greppable6 left, notable6 left, statisfiable6 left, quotable6 left, unicodable6 left, releasable6 left, shareable6 left, coverable6 left, sourceable6 left, committable6 left, reportable6 left, tellable6 left, nativecallable6 left, bisectable6 left, linkable6 joined, evalable6 joined 03:18 quotable6 joined, benchable6 joined, notable6 joined, unicodable6 joined, coverable6 joined 03:19 bloatable6 joined, statisfiable6 joined, sourceable6 joined, greppable6 joined, bisectable6 joined 03:20 committable6 joined, shareable6 joined, tellable6 joined, releasable6 joined, reportable6 joined, nativecallable6 joined 03:59 simcop2387 left, perlbot left 04:09 simcop2387 joined 04:10 perlbot joined 04:18 vrurg_ joined, vrurg left 05:18 nativecallable6 left, unicodable6 left, statisfiable6 left, tellable6 left, notable6 left, reportable6 left, coverable6 left, quotable6 left, evalable6 left, committable6 left, benchable6 left, shareable6 left, linkable6 left, greppable6 left, sourceable6 left, bisectable6 left, bloatable6 left, releasable6 left 05:19 evalable6 joined, releasable6 joined, bisectable6 joined, sourceable6 joined 05:20 bloatable6 joined, statisfiable6 joined, tellable6 joined, greppable6 joined, quotable6 joined, reportable6 joined, nativecallable6 joined 05:21 committable6 joined, benchable6 joined, coverable6 joined, unicodable6 joined, notable6 joined, linkable6 joined 05:22 shareable6 joined 06:09 reportable6 left, reportable6 joined 06:51 ToddAndMargo joined 07:03 Sgeo left 07:43 ProperN[out] left 07:44 ProperNoun joined 07:59 Kaiepi left, Kaiepi joined 08:05 sena_kun joined 08:19 abraxxa joined 08:25 kaskal left 08:26 abraxxa left, abraxxa joined 08:53 lockywolf_ joined 08:54 lucs left, lucs joined, lockywolf left 08:55 lockywolf_ is now known as lockywolf 09:12 lichtkind joined 09:15 Kaiepi left 09:19 Sankalp left 09:21 Sankalp joined 09:36 mexen joined 09:44 jaguart joined
jjatria melezhik: I saw that you had sent it, but I haven't had a chance to take a proper look. I'll try to look at it over the weekend 🙇 10:04
tellable6 jjatria, I'll pass your message to melezhik
10:05 Altai-man joined 10:31 sena_kun_ joined, Altai-man left 11:14 sacomo left
SmokeMachine s/suiting/studying/ 11:34
m: use v6.e.PREVIEW; m: my @a=<a b c d>; my %h{||@a} = True; dd %h;
camelia ===SORRY!=== Error while compiling <tmp>
Invalid hash shape; type expected
at <tmp>:1
------> PREVIEW; m: my @a=<a b c d>; my %h{||@a}⏏ = True; dd %h;
expecting any of:
SmokeMachine gfldex: I think that's the way I mostly use .none... :) Good to know I was useful for something... 11:36
m: use v6.e.PREVIEW; my @a=<a b c d>; my %h{||@a} = True; dd %h; 11:38
camelia ===SORRY!=== Error while compiling <tmp>
Invalid hash shape; type expected
at <tmp>:1
------> .e.PREVIEW; my @a=<a b c d>; my %h{||@a}⏏ = True; dd %h;
expecting any of:
SmokeMachine m: use v6.e.PREVIEW; my @a=<a b c d>; (my %h){||@a} = True; dd %h 11:39
camelia Hash %h = {:a(${:b(${:c(${:d(Bool::True)})})})}
11:50 frost left 12:00 frost joined 12:05 frost left 12:08 reportable6 left 12:11 reportable6 joined 12:54 habu joined
habu Hello, does Raku have fast native shaped arrays a-la-numpy? 12:55
or, better, is it straightforward to use numpy with Inline::Python 12:56
13:08 habu left
SmokeMachine lizmat: maybe that's not rak's duty but would it make sense to allow something like this? `rak --allow-json --allow-yaml '*.<bla>.defined'` and that would parse any json or yaml files and show the ones that has a `bla` key defined at the structure of the document? Maybe 2 patterns, one when the file is json/yaml and other when its not? (Sorry, I'm just asking because I just needed something like that.) 13:10
lizmat well, we already have JSON::Fast as a dependency, so handling JSON files would be trivial 13:13
Nemokosch by the way, I suspect JSON::Fast might be still way too slow 13:14
lizmat Nemokosch: perhaps, but "rak" is not about speed, but about features :-) 13:15
tellable6 lizmat, I'll pass your message to Nemokosch
lizmat much like Raku for that matter
Nemokosch well, for rak, it would be good to keep it useful
what's the use of finding the needle in the haystack if it turned winter in the meantime 13:16
lizmat well, I keep efficiency in mind, but not at all cost 13:17
Nemokosch by the way, no, perhaps it's not JSON::Fast that is too slow
took around 10 seconds to parse a 4,5 MB JSON string
that's okay by me
well then I have no idea what Cro is doing with that request...
SmokeMachine But it would only be slower if a flag was used... 13:18
lizmat Nemokosch: if the outer part of your JSON is an array, you could use raku.land/zef:lizmat/JSON::Fast::Hyper to make things about 3x as fast 13:19
tellable6 lizmat, I'll pass your message to Nemokosch
Nemokosch I'm afraid that isn't the case 13:20
but I wonder
it takes around 10 seconds for Cro to get a response
SmokeMachine lizmat: would that also be faster for something like `{ "count": 999999999, "items": [ ... ] }`? 13:21
Nemokosch if I take the response as string and parse it with JSON::Fast, that would take an additional 10 seconds
what on earth is Cro doing that it doesn't finish in a minute 13:22
is it stuck?
SmokeMachine (with `*.items` being an array with 999999999 items (the size is just an example))
lizmat perhaps ask on #cro ?
SmokeMachine is there a #rak? or should I keep asking/suggesting stuff about oak here? 13:23
s/oak/rak/ 13:24
lizmat there's no #rak, but maybe there should be a #raku-rak ?
but I'm happy with rak being mentioned here :-)
for now, anyway
SmokeMachine :)
13:25 Nemokosch joined
SmokeMachine now I thought about auto-parsing json I am think if something like auto-parsing Raku would be useful, but someday it would be cool to search by RakuAST... (probably that should be a different tool...) 13:27
lizmat fwiw, I intend rak to be a customizable swiss-army knife :-) 13:35
14:03 dogbert17 left 14:14 Nemokosch left 14:32 dogbert17 joined 14:35 dogbert11 joined 14:38 ToddAndMargo left 14:39 dogbert17 left 14:40 Nemokosch joined 14:58 dogbert17 joined 15:01 dogbert11 left 15:15 abraxxa left 15:18 abraxxa-home joined 15:26 kaskal joined, dogbert17 left
SmokeMachine lizmat: so, searching by Raku's (and maybe other languages) AST is an option? 15:30
15:32 kaskal left
SmokeMachine lizmat: could/should it have different treats/plugins for each file type? 15:38
lizmat: should the block needle be able to receive an IO::Path instead of the content of the file? (or maybe something like IO::Path but also with the content, maybe the content as a Supply, something like node's vinyl-file (github.com/gulpjs/vinyl)) 15:42
that way you could also use the file name to filter 15:43
maybe the object representing the file could have a `.parsed` method that would return a data structure that would be the file content parsed if that's a json (for example)...that way, my first suggestion from today could be written like: `rak --allow-json --allow-yaml '*.?parsed.<bla>.defined'` 15:46
`rak --allow-json --allow-yaml '*.parsed andthen .<bla>.defined' 15:47
lizmat: (sorry for keep talking, but I got exited...) 15:49
excited 16:01
16:02 morte_ joined 16:11 Nemokosch left 16:13 sena_kun_ left 16:14 sena_kun_ joined
[Coke] fast way to find if dupes in a list of no more than 25 items? I am doing .sort.unique.elems == $original_length 16:18
SmokeMachine m: say so <a b c a d e f>.Bag.values.any > 1 16:23
camelia True
SmokeMachine m: say so <a b c a d e f>.Bag.values.max > 1 16:24
camelia True
16:26 kaskal joined
SmokeMachine m: say so <a b c a d e f>.repeated 16:27
camelia True
Nemokosch repeated 💪 16:28
SmokeMachine [Coke]: hy are you sort()ing before unique()ing? You need that for squish() but not for unique(), right? 16:30
[Coke] m: my @a=<1 3 2 3>. dd @a.unique 16:32
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> my @a=<1 3 2 3>. dd⏏ @a.unique
expecting any of:
infix stopper
statement end
[Coke] m: my @a=<1 3 2 3>; dd @a.unique
camelia (IntStr.new(1, "1"), IntStr.new(3, "3"), IntStr.new(2, "2")).Seq
[Coke] ... habit, I guess. Thank you. :) 16:33
16:33 Sgeo joined
SmokeMachine m: .repeated.so.say for [<a e I o u>, <a e I o u a>, <a a e I o u>] 16:34
camelia False
Voldenet not sure if using .repeated is the fastest way 16:36
m: sub has-duplicates { my $h = SetHash.new(); for @^a { return True if $h.EXISTS-KEY($_); $h.set($_) }; False }; .&has-duplicates.say for [<a e I o u>, <a e I o u a>, <a a e I o u>]; 16:37
camelia False
Voldenet m: sub has-duplicates { my $h = SetHash.new(); for @^a { return True if $h{$_}; $h.set($_) }; False }; .&has-duplicates.say for [<a e I o u>, <a e I o u a>, <a a e I o u>]; 16:38
camelia False
Nemokosch it would be pretty bizarre if it isn't, that's for sure though
SmokeMachine .repeated returns a Seq, so I suppose when converting to Bool it would return on the first repeated found... but I haven't read the code yet... 16:39
Nemokosch Oh right, there was a conversion 16:40
Then it's quite possible that calculating the bool value eagerly is faster; not sure if these conversions are implemented effectively 16:42
Voldenet I'm sure the above can be rewritten with nqp::hash 16:43
16:45 dogbert17 joined
SmokeMachine usercontent.irccloud-cdn.com/file/...2%402x.png 16:47
Voldenet SetHash doesn't seem efficient enough compared to nqp::hash 16:48
though practically you're testing against the worst case 16:49
SmokeMachine I think this is it: github.com/rakudo/rakudo/blob/af31...1950-L1960
yes, I'm testing over the worst case...
usercontent.irccloud-cdn.com/file/...6%402x.png 16:52
Voldenet .repeated.so will shortcircuit too, so to beat it by anything one would have to copy the code of pull-one and optimize it for returning bool 16:57
SmokeMachine I think so...
But I think `.repeated.so` is fast enough... 16:59
Nemokosch nice 17:03
17:06 sena_kun_ left
SmokeMachine just out of curiosity: usercontent.irccloud-cdn.com/file/...5%402x.png 17:07
17:50 swaggboi joined 18:06 reportable6 left, eseyman left 18:08 reportable6 joined 18:15 sftp_ joined, sftp left, sftp_ is now known as sftp 18:21 jaguart left 18:32 jmcgnh left 18:42 sftp_ joined 18:44 sftp left, sftp_ is now known as sftp 18:45 eseyman joined 18:47 jmcgnh joined 19:01 eseyman left 19:22 vrurg_ is now known as vrurg 19:36 abraxxa-home left 19:45 sena_kun left 19:47 sena_kun joined 20:20 jgaz joined 20:22 morte_ left 20:30 morte_ joined 20:56 simcop2387 left 20:57 perlbot left 20:58 morte_ left, morte_ joined 20:59 simcop2387 joined, perlbot joined 21:02 sena_kun left
lizmat SmokeMachine: to see whether a key exists in a JSON file, wouldn'r '"keyname":' suffice ? 21:17
% rak '"depends":' META6.json
8:"depends": [
21:26 jgaz left 21:59 kaskal left 22:13 saint- joined
saint- Hey, I was wondering why as part of a Grammar, this works: token sentRefEnd { <char>+? <endPunc> <ref> } but not this: token sentFrag { <char>+? } 22:16
token sentRefEnd { <sentFrag> <endPunc> <ref> }
In other words, I replace the <char>+? with another token, sentFrag, and then it doesn't work for whatever reason 22:17
Nemokosch I wonder what happens if you use `regex` instead of `token` 22:20
22:25 kaskal joined
SmokeMachine lizmat: no, because it also can be a value… 22:34
And it can be oddly idented 22:35
22:38 Tirifto left
SmokeMachine And maybe you need something like: `rak —allow-json ‘*.parsed andthen.<bla> ~~ [**, “specific value”, **]’ 22:38
m: say <bla ble bli blo blu> ~~ [**, “bli”. **] 22:39
camelia ===SORRY!=== Error while compiling <tmp>
Unsupported use of . to concatenate strings. In Raku please use: ~.
at <tmp>:1
------> say <bla ble bli blo blu> ~~ [**, “bli”.⏏ **]
22:39 Tirifto joined
SmokeMachine m: say <bla ble bli blo blu> ~~ [**, “bli”, **] 22:39
camelia True
SmokeMachine m: say <bla ble bli blo blu> ~~ [**, “bla”, **] 22:40
camelia True
SmokeMachine m: say <bla ble bli blo blu> ~~ [**, “blu”, **]
camelia True
22:40 morte_ left
SmokeMachine lizmat: keyname could also be on a path different from the one you want it… matching that would get every time that was used as key… and that may not be what you want… 22:56
22:57 kaskal- joined 22:58 kaskal left
saint- Could anyone tell me why this code doesn't work (but the commented line works) www.toptal.com/developers/hastebin...properties 23:38
23:58 evalable6 left, linkable6 left 23:59 evalable6 joined