»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
BenGoldberg m: my $a = *-1; my $b = *-1; say $a===$b; 00:44
camelia False
BenGoldberg m: my $a = *; my $b = *; say $a===$b;
camelia True
BenGoldberg m: dd *-1 00:47
camelia { ... }
BenGoldberg m: dd (*-1).WHAT
camelia WhateverCode
BenGoldberg wonders how many WhateverCode objects get construced, and whether caching would improve memory consumption. 00:48
timotimo one for every occurence in the source, plus probably closure clones 00:49
BenGoldberg But a WhateverCode which doesn't refer to lexicals doesn't need to get cloned, no? 01:18
On an unrelated note, is there anything in perl6 similar to perl5's $, ? 01:19
Or to $" ?
MasterDuke_ the docs say no and no 01:22
BenGoldberg m: sub foo( &cb (@bar) ) { cb(["X"]) }; my $callback = sub (Str @baz) { say @baz }; foo($callback); 01:46
camelia Too few positionals passed; expected 1 argument but got 0 in sub-signature of parameter &cb
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
BenGoldberg is confused. 01:47
lookatme o/ 01:52
skids o/ 01:53
u-ou what's a better way of saying: <multi> [ ' * ' <multi> ]* 04:01
ugexe something like `<multi> *%% '*'` maybe 04:14
skids Note the difference: 04:20
m: say "foo,bar," ~~ /<ident>+ %% "," (.*)/
camelia 「foo,bar,」
ident => 「foo」
ident => 「bar」
0 => 「」
skids m: say "foo,bar," ~~ /<ident>+ % "," (.*)/
camelia 「foo,bar,」
ident => 「foo」
ident => 「bar」
0 => 「,」
u-ou cool 04:33
is there a way to make %%'s right hand operand a regex? 04:34
lookatme m: say "foo,bar-foo.bar" ~~ /<ident>+ %% <[\,\.\-]> (.*)/ 04:43
camelia 「foo,bar-foo.bar」
ident => 「foo」
ident => 「bar」
ident => 「foo」
ident => 「bar」
0 => 「」
lookatme u-ou, you mean this ? 04:44
u-ou yeah 04:46
samcv o/ everyone 05:16
lookatme samcv, o/ 05:20
japhdc Hello... On the archives of #perl6 I noticed a few reference to wanting a VirtualEnv like tool for Perl6... But it seems that share/nqp/lib/Perl6/*.moarvm and share/perl6/runtime/*.moarvm have the full compile time in the binary instead of a relative path... 05:23
samcv japhdc, yes they use hardcoded paths 05:25
lookatme I don't think so ~~
samcv i have builds/can show you how to make them relative
.o0(if we're both talking about the same thing)
japhdc samcv, yes, please show me how to make those paths relative 05:29
samcv ok
japhdc, this script will do it for you github.com/samcv/rakudo-appimage-m...ppimage.sh
samcv it clones and does it all for you. but. it builds as prefix /rsu then it goes through and replaces in binary the /rsu with ././ 05:30
samcv and uhm. then just gotta replace the perl6 script's cause i believe the substitution is different for those. i just copy my own 05:30
japhdc, github.com/samcv/rakudo-appimage-m...sh#L83-L96 mostly this 05:32
but without the appimage part
so these lines github.com/samcv/rakudo-appimage-m...sh#L83-L86 05:33
then copy this github.com/samcv/rakudo-appimage-m...erl6-basic
then after that start it up japhdc so that anything can make sure it's compiled. then after that move it however you want 05:34
I have appimages premade though github.com/samcv/rakudo-appimage-m...e/gh-pages 05:35
has some weirdness because it starts out in the fake directory of the appimage. but you can dl the appimage and run `theappimage --appimage-extract` 05:36
and it will extract itself. then just discard the appimage binary and everything is good to go
builds are nightly 05:37
lookatme great 05:39
japhdc That makes sense.... I think I see how it works and just need to give it a few tries. thanks for the thorough explanation! :-)
samcv ok no problem! 05:41
glad my hard work can help someone out 05:42
samcv took a while to get it right. and fyi the number of spaces is semi important 05:42
err
/rsu (4 character) => ././
so you need it to be (no trailing slash) divisible by 2
and if you do /rsu make sure to chown -R $USER /rsu
you can put it in any folder but. that's not the best idea. forget if i ran into problems with some perl6 moarvm bytecode having issues when i had like ./././././././././././././././ 05:43
err actualy one thing missing from the perl6 script that you will need 05:44
i will add it
samcv japhdc, ok here you go github.com/samcv/rakudo-appimage-m...erl6-basic 05:56
japhdc samcv, ic... must add LD_LIB_PATH so that it can find libmoar.so? 05:58
samcv uh just download perl6-basic
and replace the perl6 script from your build with that
samcv cause other paths in there are also messed up and need to be fixed, so easier and more fool proof to just copy the scripts 05:58
and use `find` to replace the binary data 05:59
japhdc will do. thank you samcv! 06:00
Geth Swapped META.info → META6.json in 1 dists in github.com/perl6/ecosystem/commit/68b3f3279a 06:31
Geth Swapped META.info → META6.json in 1 dists in github.com/perl6/ecosystem/commit/b6df013bec 07:31
japhdc samcv, i've been experimenting with the results of your build-appimage.sh script to allow the perl6 path to be moved, but this way it always requires that you `cd $PERL6_BASE_DIR`... 09:44
samcv japhdc, i don't see that var in my script? 09:45
japhdc samcv, just saying that if i run perl6 from outside of the base directory after doing the transformation, then the various perl6 components are unable to find each other... 09:47
samcv yep 09:48
that is true
so you can use an appimage if you want it to do its magic
samcv because the thing is japhdc perl6 NEEDS to be in the folder to find things 09:48
since everything is relative. it's all relative to that path
samcv what we need is a command line flag for perl6 that will chdir a the very first thing it does (before loading modules even) 09:49
japhdc so is the vision that apps built on perl6 are all going to have to use appimage for distribution?
samcv but i have not been able to figure out where the hell to put it
for now yes
japhdc, or you can hack it 09:50
uh
github.com/samcv/rakudo-appimage-m...rl6-stable
look at my hacks here
it chdirs into OWD (the dir the appimage was started from) then it figures out all of the scripts given to it on the command line are located relative to OWD 09:51
then it chdirs BACK into the appimage (or in your case would be $PERL6-BASEDIR
then starts it
i think i remember changing all the --libpath's to be absolute. pretty sure
yeah then it would break modules and stuff built into perl 6
i remember
japhdc yes. that's a workaround.... but isn't requiring either compile time install path OR fixed working directory "Less Than Awesome"? 09:52
samcv pretty much
japhdc :-) 09:53
samcv so big someone to figure out where to put that perl6 code
i'l add but i searched and couldn't figure out where to put it
now 100% sure how the command line flags and all work tbh. like parts of it sure. but not like. all of it
it's very abstracted
but theoretically there's somewhere we can add a chdir in there, add a perl6 --chdir flag 09:54
and then we will be gucci
and perl6 will still know where its things are and you'll still be in the right $*CWD
and can't put it in moarvm i already tried that. cause then moar starts up fine then all the modules are relative directories. so 09:55
they become relative to whatever it was when perl6 started
japhdc yes, that does make sense... sounds like the flag that does the --chdir to help perl6 find it's component parts would be the way to go if $*CWD would not be impacted... perhaps choose a name other than --chdir to make the meaning more easily discoverable 10:02
parv --startdir perhaps? 10:05
haxmeister moritz: got a second? 13:57
moritz haxmeister: yes-ish 13:58
haxmeister paste.pound-python.org/show/GwLeLk...VQmCOvo1z/
I have this json
and your module
but ignorant about how to get to the values once produced by your module :/
moritz
.oO( this is where it gets personal :-) )
13:58
haxmeister could you give a quick example?
not personal.. I'm very newby 13:59
moritz haxmeister: that was a joke
haxmeister oh..lol
moritz haxmeister: use JSON::Tiny; my %stuff = from-json($your-json-string)
haxmeister got that
but now a value
hash of hash.. I dunno what to do as far as syntax :( 14:00
moritz and then something like for %stuff.kv -> $name, %obj { say "$name has path %obj<path>" }
haxmeister kk I'll tinker with that.. ty
haxmeister ah I see.. say %mystuff.keys[0] 14:22
still more..
moritz haxmeister: I can recommend shop.oreilly.com/product/0636920065883.do for some introductory material to Perl 6 14:23
(my book isn't available for purchase right now)
(though USD 50.99 is quite a price...) 14:24
haxmeister moritz: I can't make a big purchase right now.. I'll just have to dig on google and ask silly questions for now
haxmeister but your module works and installs fine 14:24
I just realize I have no clue how to get data out of mixed data structures in perl6 14:25
moritz haxmeister: pro tip: go to github.com/LaurentRosenfeld/thinkperl6
clone the repo
cd book && pdflatex thinkperl6.tex 14:26
enjoy a free PDF version
haxmeister oh wow
thanks a million 14:27
curt_ m: use JSON::Fast; say to-json(Int); 14:32
camelia ===SORRY!===
Could not find JSON::Fast at line 1 in:
/home/camelia/.perl6
/home/camelia/rakudo-m-inst-1/share/perl6/site
/home/camelia/rakudo-m-inst-1/share/perl6/vendor
/home/camelia/rakudo-m-inst-1/share/perl6
CompUnit::…
haxmeister curt? 14:34
timotimo star: use JSON::Fast; say to-json(Int); 14:41
camelia Use of uninitialized value $obj of type Int in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.
in sub to-json at /home/camelia/star-2016.10/share/perl6/site/sources/11ED005DCC03AA42CAA87A439556…
curt_ Fix for JSON::Fast github.com/timo/json_fast/pull/23 14:49
[Coke] sadly adds a 1-star review to p6&parrot essentials with a note about parrot. 15:08
jdv79 is that book useful now? 15:09
jdv79 2004. wow time flies. 15:10
geekosaur thinks the language has drifted just a bit from then
Geth Swapped META.info → META6.json in 6 dists in github.com/perl6/ecosystem/commit/45fc38a106 15:33
haxmeister odd when addressing the data structure, I can leave the dots out???.. 16:26
dots or no dots... that is the question
%mystuff<mix-ins>[1]<shortname>; is the same as %mystuff.<mix-ins>.[1].<shortname>; 16:27
either perl6 is really really smart.. or that's not supposed to work..lol 16:28
timotimo yeah you can leave the dots out
haxmeister man that is badass 16:29
timotimo i think of it more like "you can put dots there if you want"
haxmeister who sat around and thought of all these conveniences.. brilliance in the little stuff
timotimo well, we took enough time :)
haxmeister lol.. I like it a lot
timotimo but many things were already in relatively early
haxmeister I was tromping through tuts and docs to try and figure how I was going to extract certain values from a mixed and nested data structure.. but wow.. I was over thinking it 16:30
#Perl6JustWorks 16:31
timotimo yeah, it really does 16:32
have you seen autovivification?
m: my @thing; %thing<mix-ins>[2]<shortname> = "hey"; say %thing.perl
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '%thing' is not declared. Did you mean '@thing'?
at <tmp>:1
------> 3my @thing; 7⏏5%thing<mix-ins>[2]<shortname> = "hey"; s
timotimo m: my %thing; %thing<mix-ins>[2]<shortname> = "hey"; say %thing.perl
camelia {:mix-ins($[Any, Any, {:shortname("hey")}])}
haxmeister I can't make sense of all that 16:33
timotimo by addressing things inside a structure you can build a structure even if it wasn't there before 16:34
in other languages the same code would be like:
haxmeister oh you added list item to the shortname key 16:34
timotimo "if 'mix-ins' not in %thing: %thing<mix-in> = Hash.new; ..."
"if len(%thing<mix-ins>) < 2: %thing<mix-ins>[2] = Hash.new" 16:35
etc etc
BBL
haxmeister I'm digging in.. data structures are kindof important 16:36
ty
timotimo same with pure arrays
m: my @foo; @foo[1;4;3;6;8;7] = "hi"; say @foo.perl
camelia [Any, [Any, Any, Any, Any, [Any, Any, Any, [Any, Any, Any, Any, Any, Any, [Any, Any, Any, Any, Any, Any, Any, Any, [Any, Any, Any, Any, Any, Any, Any, "hi"]]]]]]
timotimo you don't have to go through each dimension and make sure it has an array in there 16:37
or create a full array of arrays of arrays of arrays of arrays of arrays up front
and if you don't want to have autovivification you set a type constraint on your leaf arrays/hashes so putting a hash or array in them wouldn't be acceptable: 16:38
m: my @foo; @foo[2]<hey> = 1; say @foo; # autovivification of stuff inside @foo elements allowed
camelia [(Any) (Any) {hey => 1}]
timotimo m: my Str @foo; @foo[2]<hey> = 1; say @foo; # autovivification of stuff inside @foo elements allowed
camelia Type check failed in assignment to @foo; expected Str but got Hash (${})
in block <unit> at <tmp> line 1
haxmeister ah yes.. I do like the constraint mechanism
timotimo not allowed ^
not only access with postcircumfix:<{ }> and postcircumfix:<[ ]> autovivifies 16:39
"push" also does
and append and unshift
haxmeister first time I've seen the @foo[1;2;5;6] syntax.. for multi-dim arrays.. (learned a new neat trick)
timotimo m: my %foo; push %foo<yeah>, "hi"; say %foo.perl
camelia {:yeah($["hi"])}
timotimo ^- creates an aray inside of the yeah key inside %foo 16:40
haxmeister this needs to be in a tut specifically about complex data structures (aside from class/objects) 16:41
timotimo m: my $foo; push $foo, "yeah"; say $foo.WHAT; say $foo.perl
camelia (Array)
$["yeah"]
timotimo ^- creates an array inside a $foo variable
(because arrays are what you push to)
haxmeister my @foo[2]<mykey> = 1 the fact that this will create/nest a hash into the array and set a key/value pair just blows my mind 16:56
changing the way I would normally use this stuff
gfldex haxmeister: multidim subscripts leave room for improvement, see: gfldex.wordpress.com/2017/04/17/sl...nfig-file/ 17:03
TreyHarris print TODO[@Writing] Take a look at tut haxmeister mentioned above 17:08
d'oh
TreyHarris From the logs, it seems like some folks have written Weechat scripts for typing Perl6 unicode characters even when the terminal only offers ascii input (like latex_unicode.py). Have any of you shared your script? I'm writing one for RFC 1345 and don't want to reinvent wheels 17:44
(partly because latex is too verbose, partly because latex interferes with Perl6 syntax, and partly because latex_unicode.py doesn't support the full range of symbols I'd like)- 17:45
tyil !p say "t" ~~ ["t", "b"] 19:45
p6: say "t" ~~ ["t", "b"]
camelia False
tyil hmm
I was hoping this to return True
gfldex m: say <t> ∈ <t e>; 19:46
camelia True
tyil I dont even know where to start creating that character :p
gfldex tyil: you could start here: gfldex.wordpress.com/2016/08/31/on...ingertips/ 19:47
tyil I use neither irssi nor screen tho 19:48
I just want to check wether a val exists in an array
gfldex tyil: this might help docs.perl6.org/language/unicode_entry 19:49
tyil it would, if I know what chain to make with compose for it
gfldex tyil: you could steal (most) of github.com/gfldex/digraphs/blob/ma...igraphs.pl 19:50
haxmeister recommend good XML parsing package? 19:52
haxmeister nvm.. found them all 19:59
Zoffix tyil: all fancy ops have ASCII alternatives: docs.perl6.org/language/unicode_texas 20:06
Zoffix tyil: and you l 20:06
tyil: and you likely want .first method unless you don't care about speed or edge cases 20:07
tyil I already found those
I just want to see if a $value exists in a @array
Zoffix ∈ is a set op, so it spends time converting the arrat to a set and then then you have the object identity issues 20:08
tyil I settled for just looping through the array to see if the value exists 20:09
Zoffix m: say 5 (elem) [1, 2, 5]
camelia True
tyil because that other guy was insisting solely I stick to unicode chars that he demands I use irssi and screen for
lucs Zoffix: Hey, never got around to thank you for adding the "try out the code" thing in your P6 tweets. 20:10
tyil and I honestly just want it to work
lucs So, thanks!
Zoffix m: say 5 (elem) <1 2 5> # false Int 5 and IntStr 5 are not the same
camelia False
Zoffix tyil: just use (elem) instead of that thing
tyil that still returned false for me, idk 20:10
Zoffix tyil: what sort of stuff is in your array/$value? 20:11
tyil a String $value and an @array of Strings
Zoffix Yeah, you probabpy have allomorphs in it 20:12
$value (elem) @array>>.Str 20:14
$value.Str (elem) @array>>.Str
tyil: $value eq any @array
Zoffix m: say 5 == any <1 2 5> 20:15
camelia any(False, False, True)
Zoffix m: say so 5 == any <1 2 5>
camelia True
tyil termbin.com/kazx
that was what I was originally trying 20:16
Zoffix tyil: that looks like array is the wrong type for the job
tyil what should I use instead? 20:17
Zoffix buggable: Set
huggable: Set
huggable Zoffix, Immutable collection of distinct objects: docs.perl6.org/type/Set
Zoffix m: my $stuff = set <foo bar meow>; my $value = 'meow'; if $stuff{$value} { say "in it" } 20:18
camelia in it
Zoffix m: my $stuff = set <foo bar meow>; my $value = 'meowaaa'; if $stuff{$value} { say "in it" }
camelia ( no output )
Zoffix m: my $stuff = set <foo bar meow>; my $value = 'meow'; if $value (elem) $stuff { say "in it" } 20:19
camelia in it
Zoffix some more docs on this stuff: docs.perl6.org/language/setbagmix 20:20
And there's an article on advent blog 20:21
huggable: advent
huggable Zoffix, github.com/perl6/mu/blob/master/mi...6/schedule
tyil that seems to work, thanks Zoffix 20:21
Zoffix this one perl6advent.wordpress.com/2016/12/07/ 20:22
cool
raiph m: my $value = 'abc'; my @array = 'abc', 'def'; say @array (cont) $value # tyil: you had the args the wrong way round; `foo (cont) bar` means "array foo (cont)ains item bar" 20:39
camelia True
raiph tyil: the (cont) op is the inverse of the (elem) op
tyil hmm 20:42
but I just changed it around to use a set ;~;
raiph that's another way 20:43
tyil its github.com/scriptkitties/p6-MPD-Cl...k.pm6#L185
there's probably tons of other things that could be done better
raiph i like how you have it. reads clearly to me. 20:44
AlexDaniel huggable: advent :is: github.com/perl6/mu/blob/master/mi...7/schedule
huggable AlexDaniel, Added advent as github.com/perl6/mu/blob/master/mi...7/schedule
tyil gonna add another page of mpd calls tomorrow probs 20:45
once I have them all, I'll add it to ecosystem
unless I get around to adding a proper travis test before that point already
jetjr I'm having an issue with pattern matching a string. It's acting "greedy" but I want each match to count: pastebin.com/fYATRmQF 21:26
timotimo then put a ? after the ** 21:28
i think
jnthn m: my $s = "ATGXXXXXTAGXXXATGXXXXXTAG"; say $s ~~ m:g/ATG .**? 5..* TAG/; 21:29
camelia (「ATGXXXXXTAG」 「ATGXXXXXTAG」)
jnthn All the quantifiers are greedy by default, but can be followed with a ? to make them frugal 21:30
jetjr Great! Thanks it works.
jnthn (??, +?, *?, **?)
perlpilot That third * in jetjr's RE was slightly difficult for me to parse. My brain kept wanting to make it a quantifier. 21:38
timotimo :D 21:39
i wouldn't have put the TAG directly after the * like that
oh, jetjr already left
perlpilot Maybe I'm just too used to see .* in regex and so my brain naturally goes there
timotimo i would have pointed out that you're free to put spaces into your regexen
:D
jnthn Yeah, I re-formatted it when trying it here :P 21:44
Oh, but another space coulda been good after the . too :) 21:45
hythm m: say 1+-+-+-+-2 21:46
camelia 3
AlexDaniel hythm: yea :) 21:59
you can put any amount of infixes there
timotimo but those are mostly prefixes?
AlexDaniel this is what I meant…
m: say 1+!!-+-?+!-+-?2
camelia 1
AlexDaniel was thinking not to say infix and in the end said it -_- 22:00
timotimo :D
also don't put ?? in there by accident
AlexDaniel m: say 1+!!-+-?\?+!-+-?2
camelia 2
hythm At first was thinking its a bug on my local rakudo version, Wanted to make sure 22:01
jnthn Perl 6's parsing rules are, in this case, really very simple 22:04
After an infix, the only possible things we can be looking for are a term or a prefix
So 1 is a term, + is an infix, after that we must parse prefixes 22:05
So it's, counting aside, "easy to read" provided you know the langauge. :P
timotimo and it's important to know if the code included a module that provides an +-+-+-+-+ infix operator :D
hythm easy to read now :p 22:06
jnthn timotimo: Then it's a different language ;-)
timotimo that's true
cat is demanding belly rubs now 22:07
jnthn :)
jnthn demands sleep
'night o/ 22:08
timotimo nite jnthn!
AlexDaniel
.oO( belly ribs? What? … ah… rubs… )
22:13
krshn I just installed Rakudo Star 2017.04. Installed Rakudo Star for the first time. Earlier been using rakudobrew. I noticed that I am not able to use zef out-of-the-box 23:46
Steps to replicate on mac-osx: Copy the Rakudo folder to Applications shortcut. Add to PATH variable as mentioned in the README. Run zef install Math::Primesieve 23:47
Got the following error --
gist.github.com/skrisna/140372f1ea...b0e7877649 23:50
I haven't seen this before when using rakudobrew
timotimo interesting, let's see. 23:51
could you set the environment variable ZEF_PLUGIN_DEBUG so we can find out what fetcher it's trying to use? also --verbose or something for the zef commandline? 23:54
krshn Sorry, need more info. What do I set ZEF_PLUGIN_DEBUG to? 1?
timotimo any non-empty string, i expect
perhaps not 0
hm, actually, the update of the p6c ecosystem stuff doesn't really fail, just spits out some errors and continues working anyway 23:55
i can't install primesieve either but that's because i don't have the library installed
krshn gist.github.com/skrisna/23bc0e5a3b...9cc74e1609 23:57
Sorry -- gist.github.com/skrisna/7de76ef638...0a2b544072 23:58