»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
wildtrees star, though it doesnt seem to have zef 00:00
AlexDaniel wildtrees: I'd say it's a bit too old
wildtrees perl6 pines for zef install linenoise or readline though 00:01
I tried zef and it didnt work
searched around for zef perl6 on nixos and didnt get much 00:02
wildtrees there is something called rakudobrew, does anyone use that? 00:02
AlexDaniel wildtrees: you can install zef manually: github.com/ugexe/zef#manual
wildtrees not sure how that will work with nix, I am kinda new to nixos 00:03
wildtrees is rakudo-star really old? 00:08
AlexDaniel wildtrees: the latest rakudo star version is 2019.03 00:10
wildtrees yea I noticed that 00:11
AlexDaniel, thank you for your help, I gotta run 00:12
Xliff m: say 5 »**« (^5) 00:41
camelia Lists on either side of non-dwimmy hyperop of infix:<**> are not of the same length while recursing
left: 1 elements, right: 5 elements
in block <unit> at <tmp> line 1
Xliff m: say 5 «**» (^5)
camelia (1 5 25 125 625)
Xliff m: say 4 «**» (^5) 00:41
camelia (1 4 16 64 256)
Xliff m: say 4 «**» (^6) 00:42
camelia (1 4 16 64 256 1024)
kawaii morning o/ 08:22
noisegul Good morning :) 08:23
antoniogamiz o/
Geth ¦ doc: antoniogamiz self-assigned No space after category comma in indices (and in general generated pages with leading whitespace) github.com/perl6/doc/issues/2884 09:19
El_Che when was #= addes to sub MAIN? 09:45
it does nothing on 2019.3.1
moritz a loong time ago 10:23
commit fbfccfa2ff30f6093176fa34da038442d8d427d5 10:24
Author: Elizabeth Mattijsen [email@hidden.address]
Date: Thu Oct 11 15:55:35 2018 +0200
Make handling of MAIN completely pluggable and documentable
might have been even before then
El_Che mmm 10:26
El_Che checks his code again
antoniogamiz each element in the meta part of every reference in the documentation should apper only once? 10:45
antoniogamiz s/apper/appear 10:45
or what should be unique is the entire meta part? 10:46
(I ask for this issue => github.com/perl6/doc/issues/1912)
lizmat isn't sure 10:51
lizmat will follow jmerelo's thoughts on this
antoniogamiz lizmat: ok, I will talk with him :) 10:53
is there a function to classify the duplicates in a list?
I mean, for instance if we have this list [1,2,1,2,2] 10:54
lizmat you want to know which ones occur more than once? repeated
docs.perl6.org/routine/repeated
antoniogamiz the output would be something like 1 => 2, 2 => 3
oh, I will check it out
lizmat .repeated.Bag
then the frequency in the Bag is 1 less from the actual frequency 10:55
antoniogamiz perl6 is amazing, ty lizmat :)
lizmat if you just want all the frequencies, then just .Bag :-) 10:56
candr anyone use perl6-mode and flycheck? I'm not getting any linting... 13:12
timotimo can you get it to output the exact commandline it's calling perl6 with? 13:35
github.com/hinrik/flycheck-perl6/b...rl6.el#L54 - this? 13:36
candr hmm... I don't have any of those "flycheck-per6-..." command available with M-x... 13:51
or "flycheck-define-checker" 13:52
I don't have a deep emacs understanding though so I might not be understanding what you are asking me to do... 13:53
I have flycheck-perl6 installed... and in a .pm6 file i can see Perl6 ant FlyC modes are enabled 13:55
El_Che releasable6: status 14:14
releasable6 El_Che, Next release will happen when it's ready. R6 is down. At least 1 blocker. 666 out of 680 commits logged
El_Che, Details: gist.github.com/7300f7414c7b30c232...0498253f44
El_Che while waiting on the new release, added packages for recently released alpine 3.9 en 3.10, Fedora 30, Debian 10, Ubuntu 19.04. Travis is building them. This way people that are waiting for packages don't have to wait for a new version. 14:15
candr can I define a dynamically scoped subroutine? i.e. I want it to use the variables in-scope where it is called. 14:21
timotimo only works for variables that are "is dynamic", but then you can use CALLER:: for that purpose
if you're on 6.c, $_ is always dynamic 14:22
(which was a major hindrance to optimizations)
ugexe my &*FOO = ... ? 14:23
timotimo i think they mean it a little differently
ugexe my &*foo 14:24
candr so I have a multiple subroutines and they all share a lot of code so I want to factor out the code that is different and then pass that in as a &sub.... I want it to be dynamically scoped though so I dont need to pass it a ton of variables it depends on... 14:25
timotimo m: my $a = 1; my $b = 2; my $c = 3; sub testsub(*%a) { .say for %a }; testsub(|@(::.kv)) 14:27
camelia Too many positionals passed; expected 0 arguments but got 30
in sub testsub at <tmp> line 1
in block <unit> at <tmp> line 1
timotimo m: my $a = 1; my $b = 2; my $c = 3; sub testsub(*%a) { .say for %a }; testsub(|%(::.kv))
camelia GLOBALish => (GLOBAL)
$/ => (Any)
$=pod => []
$! => (Any)
EXPORT => (EXPORT)
::?PACKAGE => (GLOBAL)
$c => 3
$_ => (Any)
$¢ => (Any)
$a => 1
&testsub => &testsub
!UNIT_MARKER => (!UNIT_MARKER)
$b => 2
$=finish => (Mu)
$?PAC…
timotimo m: my $a = 1; my $b = 2; my $c = 3; sub testsub(*%a) { .say for %a }; testsub(|%(MY::.kv))
camelia $b => 2
$/ => (Any)
$=finish => (Mu)
$a => 1
$=pod => []
GLOBALish => (GLOBAL)
$! => (Any)
::?PACKAGE => (GLOBAL)
$_ => (Any)
$?PACKAGE => (GLOBAL)
!UNIT_MARKER => (!UNIT_MARKER)
$¢ => (Any)
$c => 3
&testsub => &testsub
EX…
timotimo probably not the best idea to have that in mainline
m: sub contains-stuff { my $a = 1; my $b = 2; my $c = 3; sub testsub(*%a) { .say for %a }; testsub(|%(MY::.kv)) }; contains-stuff
camelia $c => 3
&testsub => &testsub
$¢ => (Any)
$b => 2
$_ => (Any)
$! => (Any)
$a => 1
$*DISPATCHER => (Mu)
$/ => (Any)
timotimo well, it has $a, $b, and $c
candr m: sub dynamic() {say $a}; my $a='a'; dynamic() 14:33
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$a' is not declared
at <tmp>:1
------> 3sub dynamic() {say 7⏏5$a}; my $a='a'; dynamic()
candr ^ i want a way to do that...
timotimo m: macro dynamic { quasi { call-dynamic($a) } }; my $a = "a"; sub call-dynamic($a) { say "a is $a" }; dynamic 14:35
camelia 5===SORRY!5=== Error while compiling <tmp>
Use of macros is experimental; please 'use experimental :macros'
at <tmp>:1
------> 3macro7⏏5 dynamic { quasi { call-dynamic($a) } };
timotimo m: use experimental :macros; macro dynamic { quasi { call-dynamic($a) } }; my $a = "a"; sub call-dynamic($a) { say "a is $a" }; dynamic
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$a' is not declared
at <tmp>:1
------> 3s; macro dynamic { quasi { call-dynamic(7⏏5$a) } }; my $a = "a"; sub call-dynamic($
timotimo ah 14:36
jnthn m: sub dynamic() {say $*a}; my $*a='a'; dynamic() 14:37
camelia a
jnthn Just use dynamic variables if you want it to be dynamic :)
candr ah perfect! thx! 14:38
antoniogamiz is there a prefedefined regex to match everything? 16:30
s/prefedefined/predefined
sena_kun <?> 16:31
also .*
antoniogamiz oh
so <?+> will match every word? including weird unicode characters?
sena_kun .* is even a better option, because `<?>` just makes your regex matching everything without capturing 16:32
antoniogamiz good, thanks sena_kun :)
sena_kun antoniogamiz, what do you mean by "everything"? any possible input? I believe `.*` does that.
m: say ' asdf ' ~~ /<?>/ 16:33
camelia 「」
sena_kun m: say ' asdf#$@$ ' ~~ /<?>/
camelia 「」
sena_kun m: say ' asdf#$@$ ' ~~ /.*/
camelia 「 asdf#$@$ 」
timotimo <?> is for causing match success without matching anything
sena_kun m: say 'はは攻撃好きですか' ~~ /.*/
camelia 「はは攻撃好きですか」
timotimo show off newlines, too
sena_kun m: say "はは攻撃好きですか\n" ~~ /.*/ 16:34
camelia 「はは攻撃好きですか
antoniogamiz gooooooooood :D 16:35
Kaypie not so fun thing about perl 6 is getting used to how good its regex is then going to languages like js and realizing how crippled their implementation of it is 16:38
timotimo omg yes 16:38
it can really hurt
Kaiepi js only *just* got lookbehind
and i still don't think you can use it on multiline strings, not sure about that though 16:39
timotimo that sounds too terrible to be true
Kaiepi > /a\nb/.test("a\nb") 16:40
true
guess not
i remember there being something weird about newlines and regex in js though
timotimo potentially related to ^ and $ 16:41
Kaiepi ahhhhh i remember now
bastille% node -e 'console.log(/.../.test("a\nb"))'
false
. doesn't match newlines
moritz might need (?s:.) 16:42
Kaiepi only thing other languages have over perl 6 when it comes to regex is they will throw if you try to use quantifiers on zero-width stuff 16:44
i opened an issue about it but apparently it's really hard to fix or something
timotimo i think maybe it'd be a natural fit to put that in the optimizer
that goes through the regex qast
a few cases may be very easy to spot, but others might be much harder 16:45
ugexe "only thing" is pretty strong. consider the speed difference of `for (1..1000000) { my $foo = "abc" ~~ /bc/ }`. Perl5 is 0.105s, Perl6 4.592 16:51
timotimo perl5 would surely turn that into the equivalent of *.contains("bc") 16:51
ugexe the implementation details are irrelevant though 16:52
timotimo point is, we can do that particular optimization, too
ugexe cracks whip
timotimo 0.94user 0.03system 0:01.00elapsed 97%CPU (0avgtext+0avgdata 90336maxresident)k 16:55
0.71user 0.00system 0:00.72elapsed 99%CPU (0avgtext+0avgdata 5084maxresident)k
perl6 only slightly slower than perl5 in this
when the regex gets optimized to the .contains thing
ugexe the same speed difference can be found with /\wbc/ though 16:58
timotimo OK 16:59
i sure hope the regex engine already turns scan followed by cclass to findcclass 17:00
if not, there's a cheap win to be found there
truthfully, though, just /./ already takes 4.8s to run that many times
timotimo oh, who would have thought that rm-rf'ing my site's precomp folder would make startup of moarperf slower, lol 17:03
lizmat weird
timotimo d'oh, i also rm'd all the js 17:04
lizmat BTW, `for ^100000 { my $foo = "abc" ~~ /bc/ }` creates 200000 Match object, I would expect it to only create 100000
timotimo Match is equivalent to Cursor now
surely it'll !start_cursor somewhere or something
one to scan, then to go forward
lizmat ok, 100000 in !cursor_start and 100000 in !cursor_init 17:05
BTW, the profile for "for ^100000 { my $foo = "abc" ~~ /bc/ }" is borked for me in the Routines tab 17:06
top entry: 100% (18446744073709.51ms)
which skews all of the other ones 17:07
timotimo brrr
hrmpf, did i accidentally delete an important file from moarperf when i needed to free up disk space? i thought i only deleted the node_modules folder 17:08
lizmat: you have moarperf, right? does yours have a static/js/main.js? 17:10
rfold If NFG code point synthesis a DoS hazard?
timotimo rfold: yes, if your attacker is able to spam terabytes of strings at you without you noticing 17:11
i didn't check what the exact numbers would be
lizmat timotimo: what would be the name it got git-cloned with ? 17:12
timotimo lizmat: how do you mean?
lizmat I can't find a dir called "moarperf" in my Github dir
:-(
timotimo ooh never mind
i just wasn't patient enough for the js to compile 17:13
lizmat *phew* yeah, that can take a while
timotimo Regex's ACCEPTS already takes 2 seconds on its own without the actual regex matching it seems like 17:16
lizmat yeah, it doesn't JIT
timotimo potentially the callerskipthunks op? 17:17
anyway, i gotta go AFK for a little 17:18
lizmat wouldn't be surprised... haven't looked at a spesh log since the PTS
timotimo is it right that the Regex gets cloned every time around the loop?
it's only 400ms in total compared to the ACCEPTS which is at 5.4s 17:19
github.com/rakudo/rakudo/blob/mast...ch.pm6#L43 - where does this method allocate an Int, is it the || op? does anybody want to try turning that into an nqp:: logic op that returns native int directly perhaps? 17:20
lizmat looks 17:21
timotimo oh wow that's a hilarious side-effect 17:22
m: for 1..100000 -> int $_ { my $foo = "abc" ~~ /bc/ }
camelia This type cannot unbox to a native integer: P6opaque, Str
in block <unit> at <tmp> line 1
timotimo it's trying to set the LHS of the ~~ as the $_ on the RHS 17:23
but it's defined to be native int
ok BBL
rfold Does IO::Socket provide any sort of input buffering for binary data? Or does .read always do a read system call? Looking at Rakudo, NQP and MoarVM the latter appears to be the case but I may be missing something. 17:38
timotimo lizmat: cool, is it a noticeable change with your latest commit? 17:45
lizmat for that one method from 88ms to 84ms .... so not a lot 17:46
for 100000 iterations
timotimo GC time went down a little?
lizmat no, but there was one GC less 17:47
timotimo so that ought to save one or two miliseconds, too
lizmat average was about 1.55 ms 17:48
so yes
actually, no that was nursery collection time
it's all pretty much in noise 17:49
timotimo that code never runs the full gc since nothing ever lands in the old generation :)
i wonder what allocates both Hash and BOOTHash in <anon> from the -e
timotimo ah, the BOOTHash could well be inside the Hash 17:51
antoniogamiz m: "dd dd" ~~ /[.<-[ ]>]*/
camelia ( no output )
antoniogamiz mm why that regex does not return "dd" 17:52
I want every character possible except for a space
timotimo spaces inside char classes aren't significant 17:54
sena_kun m: 'dd dd' ~~ /\w/
camelia ( no output )
sena_kun m: say 'dd dd' ~~ /\S/
camelia 「d」
timotimo you can backslash it
sena_kun m: say 'dd dd' ~~ /<-[\ ]>/
camelia 「d」
antoniogamiz but \S works with all unicode characters? 17:55
timotimo yeah
lizmat everything that does not have the whitespace property
antoniogamiz oh good :DDDDDDDDDDD
timotimo the thing that bails ACCEPTS from Regex is actually getlexrelcaller 17:58
not ctxcallerskipthunks
timotimo that is only missing from the exprjit 17:58
wildtrees how can I use $ in a string context? 18:30
wildtrees like with ~ 18:30
antoniogamiz scaping it? \$ 18:33
moritz or if you mean a variable in string contest, $var.Str or ~$var 18:37
wildtrees no I mean $ by itself as a variable 18:39
like: say "number of lines" ~ $ ; 18:42
El_Che new pkgs for recently released distributions: github.com/nxadm/rakudo-pkg/releas...19.03.1-02 18:47
weekly: new pkgs for recently released distributions: github.com/nxadm/rakudo-pkg/releas...19.03.1-02 18:48
notable6 El_Che, Noted!
El_Che once rakudo 2019.07 is out, pks will be released inmediately
(I see disco needs to be added) 18:50
masak m: sub foo($a, :$b, $c = "default") {} 18:51
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot put optional positional parameter $c after variadic parameters
at <tmp>:1
------> 3sub foo($a, :$b, $c = "default"7⏏5) {}
expecting any of:
constraint
masak ^^ isn't this error message wrong? $c is after :$b, which is not a variadic parameter, but a named one.
wildtrees m: say $ 18:53
camelia (Any)
wildtrees m: say $++ 18:54
camelia 0
wildtrees m: say $++ ; say "number of lines: " ~ $ ; 18:54
camelia 0
Use of uninitialized value element of type Any in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.
number of lines:
in block <unit> at <tmp> line 1
wildtrees how would I use '$' in that ~ context? 18:55
antoniogamiz why do you want to use $? 18:59
ugexe m: say "Number of lines: " ~ (my $ = "") 19:01
camelia Number of lines:
ugexe if you want to reuse the earlier $++... well no 19:01
that would simply be 2 anonymous vars 19:02
if you want to reuse, then dont make it anonymous
$ isn't some global, its simply anonymous
m: say $++; say $++
camelia 0
0
19:03
lizmat weekly: thenewstack.io/getting-started-at-...on-perl-6/
notable6 lizmat, Noted!
ugexe m: say "Number of lines: " ~ ++$ 19:03
camelia Number of lines: 1
wildtrees ugexe, how do I just get the value of '$' by itself then? 19:15
moritz wildtrees: if you need to get the value in another place, don't use just $
use a proper, named variable
ugexe how would you access an anonymous class in two places? you cannot 19:16
m: class :: { method bar { say 42 } }; # This has no name... how do you call it in 2 different expressions?
camelia ( no output )
ugexe m: class :: { method bar { say 42 } }.new.bar # we can do it once
camelia 42
ugexe but clearly there is no way to get at the *anonymous* class again 19:17
ugexe I wondered if `my $x := $` would work, but no 19:21
ugexe you could use an explicit state var instead of the anonymous state var though 19:25
m: say "Number of lines: " ~ (state $x += 1); say $x
camelia Number of lines: 1
1
ugexe m: say (state $x += 1) for 1..3; say $x 19:28
camelia 1
2
3
3
Altreus ${} is a hash, right 19:33
Hash %constructor = { ... :roles(:${ }) } 19:34
Altreus Have confusion, will paste 19:36
Altreus gist.github.com/Altreus/0bb08d6045...ad6d5ef61a 19:49
Altreus from-json should probably define :U on the invocant but I can do that later 19:50
I don't understand why what looks like a hash in %constructor<roles> doesn't populate the roles property
OK I think I have to link to my actual file 19:52
Altreus in this method it seems I successfully construct the roles property github.com/shuppet/p6-api-discord/...d.pm6#L167 19:55
Then I call this method on the returned object github.com/shuppet/p6-api-discord/...d.pm6#L129
that ends up here github.com/shuppet/p6-api-discord/...d.pm6#L214 19:56
Then I call this method on the Member object and $.guild.roles is empty github.com/shuppet/p6-api-discord/...d.pm6#L196
El_Che weekly: new pkgs for recently released distributions: github.com/nxadm/rakudo-pkg/releas...19.03.1-03 (correct release, fixed Mint repo's) 20:10
notable6 El_Che, Noted!
leont Does Alexander Kiryuhin use this channel? If so what's his username? 20:13
Altreus I've determined that the hash shown in my gist does not produce a Guild with any roles in it 20:17
It fails to populate roles whether it is $.roles or %.roles 20:21
El_Che leont: I think he goes by sena_kun 20:23
leont: looking at his talk subject op yapce 20:24
s/looking at/deduced from/
sena_kun leont, that's me
El_Che \o/
Sherlock Homes skillz
leont Cool
Basically, I was planning to write ASN.1 and LDAP stuff at some point, because I felt perl6 would be a good match, but apparently you already did it so I don't have to :-p 20:25
sena_kun leont, patches are welcome, there are a looot of work(for ASN.1, at least, because I implemented only parts needed for ldap).
leont, ASN.1 support is pretty incomplete(no values, only types, not all types, no restrictions etc), LDAP support is, well, I am working on it, a lot of stuff just works, I am in the middle of writing StartTLS(LDAPS is supported), but if you are fancy to write tons of extensions(they are easy to implement), you are welcome. 20:27
:)
I think you can 1)ask me about various things; 2)write patches for things that you need and are NYI, I'll gladly accept them. 20:28
and feature requests along with bug reports are insanely welcome, of course. 20:30
Altreus Is there a property of an object that lets me identify it? So I can see whether an object in one place is the same as in another? 20:31
Demos[m] lol does there exist ANY not imcomplete implementation of ASN.1
sena_kun dunno 20:32
leont Well, I'm kind of short on time lately, but I'll try to take a look at it later 20:33
sena_kun I didn't intend to implement it at all. for my master's paper I wanted to write ldap in cro, but I didn't know much about it. and then I digged deeper, saw ASN.1 and was like oh noooo, I guess we'll do it.
leont My "favorite" sentence from the spec: «The resulting type and value of an instance of use of the new value notation is determined by the value (and the type of the value) finally assigned to the distinguished local reference identified by the keyword VALUE, according to the processing of the macrodefinition for the new type notation followed by that for the new value notation.» 20:34
sena_kun leont, no problem, just tickets are ok. I have talks planned for Perlcon for both ASN.1 and Cro::LDAP and trying to make it polished(docs wise, real testing against openldap wise etc) until then.
leont I saw, that's how I discovered you were working on it. 20:35
sena_kun \o/
leont LDAP is uniquely suitable for async operation, because unlike most protocols requests and responses don't have to be in the same order
Since you're using cro I'm guessing/hoping the same is true in your implementation 20:36
sena_kun you do get promise for a normal request and a supply of entries+refs for search request
leont Makes sense 20:38
sena_kun I will appreciate a lot opinions about it, since I literaly didn't know a thing about it until I started implementing, so I am not so aware about common patterns and things like that. Was inspired by a couple of other implementations including Net::LDAP, while keeping things Cro-based.
(not something I should be proud about or write openly, of course) 20:39
sena_kun Altreus, I think there is an operator for identity. 20:48
likely =:=
m: my $a = 5; say $a =:= 5; say $a =:= $a; #`( beware! it checks for container identity, so if you don't have one... ) my \foo = 10; say foo =:= foo; say foo =:= 10; 20:49
camelia False
True
True
True
ugexe I've been doing exploratory LemonLDAP stuff at work 21:14
irced hey all, how can I stringify a map so that a Str stores a listing of each keys contents as key => contents, or key => [contents, contents]. basically, how can I stringify the output of say %map (except get all the values , no ellipses ... and print a newline after each key value pair). one solution seems to me to be to iterate %map.kv -> $key, $val {} and somehow stringify the result of say $key and say 21:55
$val. any thoughts?
sena_kun m: my %a = :1a, :2b; my $str; for %a.kv -> $k, $v { $str ~= "$k => $v\n" }; say $str; 21:57
camelia b => 2
a => 1
sena_kun m: my %a = :1a, :2b; my $str; for %a.kv -> $k, $v { $str ~= "$k => [$v]\n" }; say $str;
camelia b => [2]
a => [1]
sena_kun m: my %a = :1a, :2b, c => <1 2 3>; my $str; for %a.kv -> $k, $v { $str ~= "$k => [$v]\n" }; say $str;
camelia c => [1 2 3]
a => [1]
b => [2]
irced sena_kun, that can work, thanks, I can just output a single value as an array. (you can imagine my goal is to be able to export/import using regular expressions). 21:58
ugexe .classify
MasterDuke irced: maybe also try .put
sena_kun irced, .perl/EVAL is not your case? 21:59
irced MasterDuke: that works too.
MasterDuke: i think , lemme see
sena_kun m: my %a = :4a; my $store = %a.perl; say $store; my %b = EVAL $store; say %b;
camelia 5===SORRY!5=== Error while compiling <tmp>
EVAL is a very dangerous function!!! (use the MONKEY-SEE-NO-EVAL pragma to override this error,
but only if you're VERY sure your data contains no injection attacks)
at <tmp>:1
------> 3%a.perl; …
sena_kun m: use MONKEY; my %a = :4a; my $store = %a.perl; say $store; my %b = EVAL $store; say %b; 22:00
camelia {:a(4)}
{a => 4}
sena_kun I think you don't need to play with regexps to export/import, if it is Perl 6-only thing.
irced with objective being to make a parseable map output, sena_kun's would be more on track to parse arrays where values have spaces 22:01
sena_kun: yes, import/export regex is my game plan.
sena_kun: is there a perl6 way?
sena_kun: besides my roundabout way
sena_kun m: my %a = :1a, :2b, c => <1 2 3>; my $str; for %a.kv -> $k, $v { $str ~= "$k => [{$v.elems == 1 ?? $v !! $v.join(" DELIMITER ") }]\n" }; say $str;
camelia a => [1]
c => [1 DELIMITER 2 DELIMITER 3]
b => [2]
sena_kun irced, ^
irced sena_kun: that is a more complete solution to my specific problem, thanks. still, it does require playing with regexps to export/import, wouldn't you agree? 22:03
err, import anyway
sena_kun irced, agreed. You can do it with .perl/EVAL too, I posted an example above.
irced sena_kun: oh thanks for bringing my attention to that
sena_kun but, of course, bear in mind that EVAL will execute any arbitrary code, so it is a nice way to shoot in one's foot. and probably in feet of all people who can use your software. 22:04
sena_kun I wonder if there is something like pickle(or how is it named?) from python. 22:04
irced sena_kun: i wonder if there is some way I can profit from increased podiatrist business. 22:05
sena_kun: like some investment instrument.
oops so off topic
irced is trying the .perl/EVAL suggestion. 22:06
sena_kun irced, anyway, we can go a level above if you want: you need to store/load, but for what? some super-generic solution?
lizmat sena_kun: not to my knowledge.... in the Perl world usually called "Storable" or "Sereal"
sena_kun lizmat, would be really nice to port something like this to Perl 6. Unfortunately, I suspect there are a lot of things to take care about, memory layouts and so on, scary stuff, and requires knowlege of guts too. 22:07
irced I want to serialize a %map to a file and load the map in a another script to manipulate it. basically, serialization but serialization modules seem too heavy a manual on what there is clearly a short solution for as you have demonstrated.
sena_kun:
lizmat I've looked at Sereal some years ago now... but that is too tightly bound to Perl 5 guts
irced sena_kun: so i will put %map contents in a Str write it to a file read it into or slurp it in whatever script. 22:08
sena_kun irced, I wonder if a really nice solution is json or yaml. :)
lizmat I think FROGGS looked at storing it as MoarVM bytecode
irced sena_kun: and build a map from it
lizmat sleep&
sena_kun irced, just store it as json and you have both 1)short and simple code; 2)no security issues with EVAL
lizmat, good night. o/ 22:09
and 3)interoperability with various other tools, languages and so on that understand json
irced sena_kun: well, JSON could work as well, and would be a solid choice if the values become complex, but this is a simple case 22:10
sena_kun: flattened case if you will
sena_kun irced, if it is really a simple case, then a couple of lines as shown above will do. otherwise you can scale with json. seems enough to me.
irced sena_kun: however, JSON libraries usually require a lot of code
sena_kun: i mean, i've done JSON in C with libjansson and the modules in perl6 i think are just as cumbersome. 22:11
sena_kun: i think.
sena_kun irced, `use JSON::Fast; spurt 'my-file' to-json %map;`, on receiving side: `use JSON::Fast; my %map = from-json slurp 'my-file'`
irced sena_kun: now that's nice
sena_kun it doesn't require a lot of code, does it?
irced sena_kun: thanks for highlighting the module for me! 22:12
sena_kun m: say to-json 1234;
camelia 1234
Saw 1 occurrence of deprecated code.
================================================================================
Sub to-json (from GLOBAL) seen at:
<tmp>, line 1
Please use JSON::Fast, JSON::Tiny or JSON::Pretty from modu…»
sena_kun m: say to-json {:5a, :42b};
camelia {
"a": 5,
"b": 42
}
Saw 1 occurrence of deprecated code.
================================================================================
Sub to-json (from GLOBAL) seen at:
<tmp>, line 1
Please use JSON::Fast, JSON::Tiny or JSON:…
sena_kun m: my $a = to-json {:5a, :42b}; say $a; my $b = from-json $a; say $b; 22:13
camelia {
"a": 5,
"b": 42
}
Saw 2 occurrences of deprecated code.
================================================================================
Sub from-json (from GLOBAL) seen at:
<tmp>, line 1
Please use JSON::Fast, JSON::Tiny or JS…
sena_kun m: my $a = to-json {:5a, :42b}; my $b = from-json $a; say $b;
camelia {a => 5, b => 42}
Saw 2 occurrences of deprecated code.
================================================================================
Sub from-json (from GLOBAL) seen at:
<tmp>, line 1
Please use JSON::Fast, JSON::Tiny or JSON::Pretty f…
sena_kun irced, ^ it uses deprecated internal rakudo parser(hence the warnings), but with `use JSON::Fast` you will be safe.
irced sena_kun: ok, i will look at the module and try your suggestions a little later. thanks so much! 22:14
sena_kun irced, you are welcome!
irced thanks MasterDuke for the input as well. 22:18
MasterDuke np 22:22
wildtrees what are these "string".IO being returned from dir() ? how do I get rid of the IO on them 23:41
jnthn IO::Path objects. I figure by "get rid of" you want to turn it into a string, which you could maybe do with the ~ prefix operator or calling .Str, though there's other ways depending on exactly what string you want: doc.perl6.org/type/IO::Path 23:45
(Most useful methods in there or it: basename, relative, absolute) 23:46