🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
00:01 wamba left
codesections m: say <1 2 3>[0 .. *]; say <1 2 3>[0 .. *-0] 00:04
camelia (1 2 3)
(1 2 3 Nil)
codesections moon-child: ^^^^^
moon-child a ha! 00:05
so it's just * being magic, as usual 00:06
00:11 wingfold joined, wingfold left 00:12 wingfold joined 00:21 aindilis joined 00:32 b2gills left 00:36 dogbert11 joined 00:39 dogbert17 left 00:41 dogbert11 left, dogbert11 joined 00:42 dogbert11 left 00:43 dogbert11 joined 00:44 dogbert11 left 00:45 dogbert11 joined 00:47 Doc_Holliwood left 00:48 mowotter left 00:51 dogbert17 joined 00:52 _jrjsmrtn joined 00:53 Black_Ribbon joined 00:54 dogbert11 left, __jrjsmrtn__ left 00:59 wingfold left, wingfold joined 01:00 wingfold_ joined, wingfold left 01:01 wingfold joined, wingfold_ left 01:06 wingfold left, wingfold joined 01:11 wingfold left, dogbert17 left, brtastic left 01:14 b2gills joined 01:18 monkey__ joined
japhb moon-child: a bare * is just a Whatever. You get a WhateverCode when you apply certain operators to it. 01:21
01:23 wingfold joined 01:25 blaboeir left 01:28 wingfold left 01:29 sxmx left 01:32 monkey__ left 01:36 londoed left 01:37 londoed joined 01:41 wingfold joined 01:49 wingfold left 01:51 dogbert17 joined 01:52 sxmx joined
sxmx anyone have an issue where raku repl doesn't show the prompt and just hangs after showing "Built on Moar..." 02:09
02:09 wingfold joined
sxmx I am on openbsd 6.9 02:09
02:11 wingfold_ joined, wingfold left 02:12 sena_kun left, wingfold_ left, wingfold joined 02:13 kvw_5 joined 02:16 kvw_5_ left 02:17 wingfold left 02:18 Xliff left 02:27 sena_kun joined 02:32 sxmx left 02:34 sxmx joined
moon-child sxmx: it takes a long time to start up if not in cache; how long did you wait? 02:35
02:42 wingfold joined 02:43 g0nk left 02:50 wingfold left 03:11 berber44 joined, wingfold joined
sxmx a minute or two, I'll give it another shot moon-child 03:13
you were right moon-child , I was just impatient 03:16
moon-child I mean in fairness, a minute or two is a pretty long time for a repl to take to start up 03:17
I think it's caching the bootfiles
(so, should be faster in the future, until the next upgrade) 03:18
sxmx This is on a VPS, and it wasn't literally a minute, more like 20 seconds 03:23
03:30 DarthGandalf left 03:41 DarthGandalf joined 03:53 kaiwulf left 04:01 maggotbrain left 04:03 wingfold left 04:16 wingfold joined 04:23 wamba joined 04:26 Altai-man_ joined 04:28 sena_kun left 04:29 monkey__ joined 04:32 monkey__ left 04:42 ex_nihilo joined 04:49 defaultxr left 05:00 defaultxr joined 05:03 wingfold left 05:15 wingfold joined 05:21 parabolize left 05:26 samebchase-5 is now known as samebchase- 05:38 berber44 left 05:53 Doc_Holliwood joined 06:02 wingfold left 06:15 brtastic joined, wingfold joined 06:28 brtastic left 06:33 squashable6 left 06:35 squashable6 joined, wamba left 06:41 wamba joined 06:45 aluaces joined 06:46 frost-lab joined 07:04 wingfold left 07:06 abraxxa left, abraxxa joined 07:12 wingfold joined 07:18 ufobat joined 07:37 Sgeo left 07:51 Doc_Holliwood left 07:55 guifa2 joined 07:57 wingfold_ joined, wingfold left 08:02 wingfold_ left, rindolf joined 08:05 domidumont joined 08:22 wingfold joined 08:29 wingfold_ joined, wingfold left 08:31 frost-lab left 08:33 wingfold_ left 08:35 frost-lab joined 08:38 aborazmeh joined 08:40 aluaces left, aluaces joined, wingfold joined 08:42 ufobat_ joined, ufobat left 08:43 guifa2 left, guifa2 joined 08:59 Kaiepi left 09:02 jmerelo joined 09:05 frost-lab left 09:10 pecastro joined 09:23 Altai-man_ left 09:25 sena_kun joined 09:26 wingfold left 09:30 PimDaniel joined 09:31 PimDaniel left 09:32 PimDaniel joined 09:35 frost-lab joined 09:40 wingfold joined 09:46 frost-lab88 joined 09:49 Black_Ribbon left 09:50 frost-lab left 10:00 Heijki joined 10:01 Heijki left 10:02 frost-lab88 left 10:14 wingfold left, guifa2 left, wingfold joined 10:29 aborazmeh left 10:30 Matze37 joined, guifa2 joined
Matze37 Hello. I get stuck and like to ask for a hint. I have list of word in a file. I would like to map this list to a hash mit a key '1'. I am trying to do this in an one-liner, but i dont dig it.. 10:33
i was trying something like my %str = map(@arr.list, '1');
the array holds the list
10:36 clickmesh joined 10:37 clickmesh left 10:38 aluaces left 10:40 frost-lab joined 10:44 wamba left 10:48 Doc_Holliwood joined 10:49 aindilis left, aindilis joined
guifa2 Matze37: what you're doing is just creating a 1 for each item in the list, and that assigns a long sequence of 1s to %str 10:50
tellable6 2021-03-18T20:53:08Z #raku <summerisle> guifa2 that did it. no clue why that didn't occur to me. this week has been cursed.
10:51 wamba joined
guifa2 m: say map( <a b c d>, 1 ) 10:51
camelia Cannot resolve caller map(List:D, Int:D); none of these signatures match:
(&code, +values)
in block <unit> at <tmp> line 1
guifa2 actually, ha, I guess it doesn't work at all that way
anyways
lizmat Matze37: feels to me you're creating a Set 10:52
guifa2 What you'll want is to do the map on the array.
lizmat my %str is Set = @arr
guifa2 ^^ yeah, set (or maybe ultimately a bag, if there's going to be coutning)
If you're just needing a true/false (for the word existing or not), you'll want to use a set as lizmat says. 10:53
To actually map on the array, you'll want to use a slightly different syntax.
my @arr = <a b c>; my %str = @arr.map( * => '1' ); say %str 10:54
evalable6 {a => 1, b => 1, c => 1}
Matze37 mhm 10:58
10:59 Kaiepi joined
Matze37 looks like that my file is something crappy 11:00
this daid, something like that should work i guess: y %s = slurp('strings.csv').map(* => 'a'); 11:01
*my
my @arr = slurp('list.txt'); gives me [one 11:04
two
]
lizmat Matze37: if you have CSV files, you should probably be using Text::CSV ? 11:05
Matze37 i just named it so..its just a one-word list
11:07 aluaces joined
Matze37 ok..its my slurp line..this is working well: for "list.txt".IO.lines -> $l { @arr.push: $l; } 11:07
11:09 benkolera left
Matze37 so the question is, how to slurp a list into  @arr? 11:09
11:31 guifa2 left
lizmat weekly: www.edument.se/en/blog/post/comma-in-2020 11:31
notable6 lizmat, Noted! (weekly)
CIAvash Matze37: `my @arr = 'list.txt'.IO.lines;` or `my %set is Set = 'list.txt'.IO.lines;`? 11:32
11:39 guifa2 joined
guifa2 lol, "While my code style choices are obviously the correct ones, in a magnanimous moment I decided that Comma should cater better to those who feel otherwise" 11:41
12:14 frost-lab left 12:17 frost-lab joined
xinming_ SmokeMachine: How do we pass rhs side sql value to filter? 12:18
Something like, Model.^all.grep({ .creation_time >= "(now() - Interval '1d')" })
12:29 xinming_ left, xinming_ joined 12:42 frost-lab left 12:43 Doc_Holliwood left 12:49 frost-lab joined 12:56 DiffieHellman left 13:03 DiffieHellman joined 13:23 domidumont left 13:27 samcv_ joined 13:29 xinming joined, lucs_ joined 13:31 andinus joined 13:33 xinming_ left, wamba left, b2gills left, spacebat2 left, samcv left, lucs left
Matze37 Well done - thank you guifa2, CIAvash! 13:34
13:40 spacebat2 joined 13:41 wamba joined, b2gills joined 13:42 ensamvarg left
Matze37 my %s = 'list.txt'.IO.lines.map(* => '1');  .. beautiful :) 13:43
moritz or even my %s = 'list.txt'.IO.lines X=> 1; 13:44
13:47 jmerelo left 13:51 Doc_Holliwood joined 13:55 brtastic joined 13:59 aindilis left 14:05 Sgeo joined 14:06 frost-lab left 14:18 abraxxa left
codesections this seems like a common practice for user-implemented custom value types (or, if not, like it should be): 14:18
m: class C { has Str $.stuff; method WHICH { ValueObjAt.new("C|{use nqp; nqp::sha1($.stuff)}")}}; say C.new(:stuff<bar>).WHICH
camelia C|62CDB7020FF920E5AA642C3D4066950DD1F01F4D
codesections is there any particular reason why we don't expose nqp::sha1 in Raku? 14:19
ugexe why would we? 14:20
codesections to encourage the idiom above. 14:21
ugexe i'm not sure use of sha1 is something to encourage 14:22
vrurg codesections: why not $.stuff.WHICH?
ugexe and the use of sha1 internally is an implementation detail that users shouldnt try to be interfacing with
moritz rakudo happens to implement some packaging stuff with certain cryptographic hashes
but if it changes that to something else, it likely won't keep a sha1 implementation around 14:23
so exposing sha1 as a public API "just because" seems wrong
codesections moritz: ? If I'm reading the source correctly, sha1 is where WHICH comes from for all non-trivial value types in Rakudo 14:24
that doesn't have anything to do with packaging 14:25
ugexe its still an implementation detail
14:25 Doc_Holliwood left
codesections vrurg: $.stuff.WHICH returns the stringified $stuff. Which is fine for simple things, but not great for larger ones (as Raku seems to agree, based on the code) 14:27
m: Bag.new(1).WHICH
camelia ( no output )
codesections m: say Bag.new(1).WHICH
camelia Bag|A7ECAB1324EE10383A958D58A3120EBBEC860F8E
codesections ugexe: it's an implementation detail that _users_ need to implement for their types if they want them to act like built-in onse 14:29
ugexe it doesn't have to be sha1
vrurg So it seems that exposing objectid generation API would be beneficial, not sha1 in particular. 14:30
moritz agreed!
ugexe and when/if the core decides to move off sha1 we would have to keep it around because we already encouraged users to do it that way
codesections vrurg++ that's a much better idea
14:38 lucs_ is now known as lucs 14:47 brtastic left 14:50 Matze37 left 14:52 CodeR32 joined
CodeR32 Hello 14:53
codesections o/ 14:56
14:56 CodeR32 left 14:57 imcsk8 left 14:58 muffindrake joined, imcsk8 joined 15:03 parabolize joined 15:04 Doc_Holliwood joined, brtastic joined
jjatria Hm, I seem to be unable to install JSON::Fast:ver<0.15> at the moment 15:06
zef doesn't seem to find any candidates for that, even though it worked before. I can install 0.14, though
15:09 berber44 joined 15:28 Kaiepi left 15:34 Kaiepi joined 15:39 Kaiepi left 15:42 Kaiepi joined
ugexe m: say (CompUnit::Repository::Distribution but role :: { method Str { "mystring" } }).id; # totally up to spec! 15:43
camelia 9CE3EA4D6FAC2165933B3971E6D5A13753C7D878
16:04 Doc_Holliwood left 16:07 cetjs2 left 16:16 samcv_ is now known as samcv, samcv left, samcv joined 16:28 samcv left 16:31 ex_nihilo left 16:32 daimon is now known as daemon 16:33 brtastic left 16:43 guifa2 left 16:50 londoed is now known as parsec
tonyo_ m: grammar G { rule TOP { ^ . $ }; }; role A { method TOP($/) { say $/ ~~ m/'a'/; }; }; G.parse("b", :actions(A)); 16:50
camelia Cannot assign to a readonly variable or a value
in method TOP at <tmp> line 1
in regex TOP at <tmp> line 1
in block <unit> at <tmp> line 1
16:50 parsec is now known as londoed
summerisle is there a way to figure out at what point in a corpus of text a grammar stops matching? 16:53
16:57 mahafyi joined
tonyo_ there's grammar::tracer 16:57
you can see the steps the grammar goes through and when it stops matching
17:30 samcv joined 17:37 aborazmeh joined 17:45 muffindrake left, muffindrake joined 18:00 wingfold_ joined, wingfold left 18:39 ufobat_ left
raydiak m: grammar G { rule TOP { ^ . $ }; }; role A { method TOP($m) { say $m ~~ m/'a'/; }; }; G.parse("b", :actions(A)); 18:45
camelia False
raydiak m: "b" ~~ m/^.$/; say $/ ~~ m/"a"/ 18:53
camelia True
raydiak m: "a" ~~ m/^.$/; say $/ ~~ m/"a"/
camelia ï½¢aï½£
raydiak m: "b" ~~ m/^.$/; say $/.clone ~~ m/"a"/ 18:56
camelia False
19:00 berber44 left 19:11 dataangel joined 19:30 aborazmeh left 19:44 Doc_Holliwood joined 19:50 xinming left 19:52 xinming joined 20:04 guifa2 joined 20:11 epony left, epony joined 20:28 xinming left 20:35 PimDaniel left 20:37 mowcat joined 20:46 aindilis joined 20:48 guifa2 left, rindolf left 20:52 wamba left 21:53 Black_Ribbon joined
summerisle so i have an action method that uses make to attach a payload to a match. i'd like to be able to inspect that payload in a later action method, but it appears to be unset 21:59
and i can verify they execute in the desired order
tonyo_ how are you trying to access the made later? 22:06
i have a toml 1.0.0 compliant grammar/action that i'm testing now, i can put somewhere if an example would help.
summerisle could be my mistake on my part. this week has been a trip. 22:10
seeing the expected behavior in other atcion methods
22:10 Sgeo_ joined, UukGoblin joined
tonyo_ an example might help me (or others) help ya 22:12
22:12 HobGoblin left, vike left, jjatria_ joined, a6502_ joined, [Coke]_ joined, jjatria left, a6502 left, [Coke]_ left, [Coke]_ joined 22:13 Sgeo left, jjatria_ is now known as jjatria, vike joined, [Coke] left 22:18 vike left 22:28 vike joined 22:33 vike left 22:34 muffindrake left, muffindrake joined 22:45 vike joined
vrurg Anyone to remind me if regexes have something to express <-[ $char ]> without string interpolation in <{ }>? 22:47
*in -> with
summerisle ok, more grammar stuff, is there a way when specifying a <token-name> within the body of another token to specify that any corresponding action method not be run? 23:01
or would i just want to create a copy of token-name without a corresponding action method 23:02
23:05 vike left
MasterDuke vrurg: istr some discussion about that a little while ago, but i don't think there was a conclusion other than what you just said 23:09
23:12 monkey__ joined 23:27 vike joined
vrurg MasterDuke: thanks! I also remember the discussion existed, but otherwise nothing about it. 23:34
summerisle: I don't think so. An action method is invoked unconditionally.
summerisle yeah, i ended realising i had a bad design in that area anyways so i'm reworking it 23:35
MasterDuke vrurg: github.com/Raku/problem-solving/issues/97 23:36
23:38 monkey__ left
vrurg MasterDuke: thanks! 23:40
MasterDuke np 23:42
23:57 mowcat left