»ö« 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.
Hotkeys AlexDaniel: removing zeroes from the start and end of an array 00:03
m: my @a = [0, 0, 0, 8, 1, 4, 3, 5, 6, 4, 1, 2, 0, 0, 0, 0]; my &f = {@_.[.first(?*,:k).. .grep(?*,:k)[*-1]]}; f(@a).say
camelia rakudo-moar 691b39: OUTPUT«Use of uninitialized value $i of type Any in string context␤Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in block at /tmp/g1M0Wu4Flz line 1␤Effective index out of range. Is: -1, should be in 0..Inf␤ in block <uni…»
Hotkeys er
m: my @a = [0, 0, 0, 8, 1, 4, 3, 5, 6, 4, 1, 2, 0, 0, 0, 0]; my &f = {@_.[.first(?*,:k).. .grep(?*,:k)[@_-1]]}; f(@a).say
camelia rakudo-moar 691b39: OUTPUT«Use of uninitialized value $i of type Any in string context␤Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in block at /tmp/7EaWWXJZyd line 1␤Use of uninitialized value $e of type Any in string context␤Any of .^name…»
Hotkeys oh
i copied the wrong one 00:04
m: my @a = [0, 0, 0, 8, 1, 4, 3, 5, 6, 4, 1, 2, 0, 0, 0, 0]; my &f = {@_[.first(?*,:k)..@_.grep(?*,:k)[*-1]]}; f(@a).say
camelia rakudo-moar 691b39: OUTPUT«Use of uninitialized value $i of type Any in string context␤Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in block at /tmp/1J3NMgaSHG line 1␤Method 'succ' not found for invocant of class 'Any'␤ in block <unit> at …»
Hotkeys m: my @a = [0, 0, 0, 8, 1, 4, 3, 5, 6, 4, 1, 2, 0, 0, 0, 0]; my &f = {@_[@_.first(?*,:k)..@_.grep(?*,:k)[*-1]]}; f(@a).say
camelia rakudo-moar 691b39: OUTPUT«(8 1 4 3 5 6 4 1 2)␤»
Hotkeys there
AlexDaniel: 00:05
Haven't posted it yet
because I feel like it's too long still
AlexDaniel it's too long 00:06
even if it is the best we can get it don't post it. Such a shame :D
-it
Hotkeys pff
it's 42 bytes
if anything that's a great number
:p
AlexDaniel Hotkeys: ok well I know how to make it shorter 00:09
Hotkeys cool
there better not be a built-in for this
AlexDaniel Hotkeys: I haven't found it
yet 00:10
Hotkeys: but just replace @_ with $_
Hotkeys: and then instead of doing $_.grep do just .grep
Hotkeys: and instead of @_[] you can do .[]
Hotkeys I tried .[]
it got angry
I tried .grep and that got angry
AlexDaniel m: my @a = [0, 0, 0, 8, 1, 4, 3, 5, 6, 4, 1, 2, 0, 0, 0, 0]; my &f = {.[.first(?*,:k).. .grep(?*,:k)[*-1]]}; f(@a).say
camelia rakudo-moar 691b39: OUTPUT«(8 1 4 3 5 6 4 1 2)␤»
Hotkeys well fine 00:11
arnsholt r: my @a[2]; # ?
camelia rakudo-jvm f99bdb: OUTPUT«5===SORRY!5=== Error while compiling /tmp/tmpfile␤Shaped arrays not yet implemented. Sorry. ␤at /tmp/tmpfile:1␤------> 3my @a[2]7⏏5; # ?␤ expecting any of:␤ constraint␤»
( no output )
Hotkeys m: my @a = [0, 0, 0, 8, 1, 4, 3, 5, 6, 4, 1, 2, 0, 0, 0, 0]; my &f = {.[.first(?*,:k).. .grep(?*,:k)[*-1]]}; f(@a).say 00:12
camelia rakudo-moar 691b39: OUTPUT«(8 1 4 3 5 6 4 1 2)␤»
Hotkeys I TRIED THIS I SWEAR
AlexDaniel Hotkeys: ok you can save 1 byte by using .first(?*):k 00:13
Hotkeys oh
AlexDaniel Hotkeys: that is, no comma required
Hotkeys I didn't know you could put those outside
I thought there would be something like that
AlexDaniel yeah perhaps you can also use that trick in other golfing tasks
Hotkeys m: my &f = {.[.first(?*):k.. .grep(?*):k[*-1]]}; say f([0,0,1,2,0,3,2,1,0,0,0]).say 00:14
camelia rakudo-moar 691b39: OUTPUT«Unexpected named parameter 'k' passed␤ in block <unit> at /tmp/xeNjsDj4VS line 1␤␤»
AlexDaniel nope that'd be too much
Hotkeys m: my &f = {.[.first(?*):k.. .grep(?*,:k)[*-1]]}; say f([0,0,1,2,0,3,2,1,0,0,0]).say 00:15
camelia rakudo-moar 691b39: OUTPUT«(1 2 0 3 2 1)␤True␤»
AlexDaniel Hotkeys: honestly I have no idea how this code works 00:15
Hotkeys it does @a[<first non-zero>..<last non-zero>] 00:16
Hotkeys by doing .grep(?*) it evaluates things as a boolean 00:16
and only takes the truthy ones 00:17
AlexDaniel oh, okay
Hotkeys unfortunately there is no ".last" sister for ".first" 00:17
so I had to use grep for that one
and get the last element
AlexDaniel maybe there has to be one
Hotkeys oh actually 00:18
Hotkeys m: my &f = {.[.first(?*):k.. .first(?*,:k,:end)]}; say f([0,0,1,2,0,3,2,1,0,0,0]).say 00:19
camelia rakudo-moar 691b39: OUTPUT«(1 2 0 3 2 1)␤True␤»
Hotkeys there's a :end parameter
AlexDaniel is it shorter?
Hotkeys but the grep one is shorter
:(
AlexDaniel wait
Hotkeys m: my &f = {.[.first(?*):k.. .first(?*:k:end)]}; say f([0,0,1,2,0,3,2,1,0,0,0]).say 00:20
camelia rakudo-moar 691b39: OUTPUT«5===SORRY!5=== Error while compiling /tmp/QXpciUjDa3␤You can't adverb ␤at /tmp/QXpciUjDa3:1␤------> 3my &f = {.[.first(?*):k.. .first(?*:k7⏏5:end)]}; say f([0,0,1,2,0,3,2,1,0,0,0]).␤ expecting any of:␤ pair value␤»
Hotkeys m: my &f = {.[.first(?*):k.. .first(?*,:k:end)]}; say f([0,0,1,2,0,3,2,1,0,0,0]).say
camelia rakudo-moar 691b39: OUTPUT«(1 2 0 3 2 1)␤True␤»
Hotkeys m: my &f = {.[.first(?*):k.. .first(?*,:k:end)]}; say f([0,0,1,2,0,3,2,1,0,0,0])
camelia rakudo-moar 691b39: OUTPUT«(1 2 0 3 2 1)␤»
Hotkeys there's another byte
now it's as short as the grep one
AlexDaniel Hotkeys: any idea why we can't do (?*):k:end here? 00:21
it doesn't work
Hotkeys m: my &f = {.[.first(?*):k.. .first(?*):k:end]}; say f([0,0,1,2,0,3,2,1,0,0,0])
camelia rakudo-moar 691b39: OUTPUT«Unexpected named parameter 'k' passed␤ in block <unit> at /tmp/VG3wtnk0G7 line 1␤␤»
Hotkeys m: my &f = {.[.first(?*):k.. .first(?*):k]}; say f([0,0,1,2,0,3,2,1,0,0,0]) 00:22
camelia rakudo-moar 691b39: OUTPUT«Unexpected named parameter 'k' passed␤ in block <unit> at /tmp/HTouTJm3GN line 1␤␤»
Hotkeys not sure
AlexDaniel m: my &f = {.[.first(?*):k.. (.first(?*):k:end)]}; say f([0,0,1,2,0,3,2,1,0,0,0])
camelia rakudo-moar 691b39: OUTPUT«(1 2 0 3 2 1)␤»
Hotkeys that's longer
AlexDaniel and so we can remove the space now
Hotkeys oh
AlexDaniel same length
Hotkeys I suppose it does look better without the space 00:24
m: my &f = {.[.first(?*):k.. .first(?*):k]}; say f([0,0,0,0,0,0])
camelia rakudo-moar 691b39: OUTPUT«Unexpected named parameter 'k' passed␤ in block <unit> at /tmp/YFgOTUTYR9 line 1␤␤»
Hotkeys er 00:25
Hotkeys m: my &f = {.[.first(?*):k.. (.first(?*):k:end)]}; say f([0,0,0,0,0,0]) 00:25
camelia rakudo-moar 691b39: OUTPUT«Use of uninitialized value $i of type Any in string context␤Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in block at /tmp/d7QF1dEPuF line 1␤Use of uninitialized value $e of type Any in string context␤Any of .^name…»
Hotkeys m: my &f = {.[.first(?*):k.. (.first(?*):k:end)]}; say f([0,0,0,1,0,0,0])
camelia rakudo-moar 691b39: OUTPUT«(1)␤»
Hotkeys m: my &f = {.[.first(?*):k.. (.first(?*):k:end)]or0}; say f([0,0,0,1,0,0,0]) 00:26
camelia rakudo-moar 691b39: OUTPUT«5===SORRY!5=== Error while compiling /tmp/TDO9ZrBbcg␤Bogus statement␤at /tmp/TDO9ZrBbcg:1␤------> 3= {.[.first(?*):k.. (.first(?*):k:end)]o7⏏5r0}; say f([0,0,0,1,0,0,0])␤ expecting any of:␤ whitespace␤»
Hotkeys m: my &f = {.[.first(?*):k.. (.first(?*):k:end)] or0}; say f([0,0,0,1,0,0,0])
camelia rakudo-moar 691b39: OUTPUT«5===SORRY!5=== Error while compiling /tmp/H6vnntFxyY␤Bogus statement␤at /tmp/H6vnntFxyY:1␤------> 3 {.[.first(?*):k.. (.first(?*):k:end)] o7⏏5r0}; say f([0,0,0,1,0,0,0])␤ expecting any of:␤ whitespace␤»
Hotkeys m: my &f = {.[.first(?*):k.. (.first(?*):k:end)] or 0}; say f([0,0,0,1,0,0,0])
camelia rakudo-moar 691b39: OUTPUT«(1)␤»
Hotkeys m: my &f = {.[.first(?*):k.. (.first(?*):k:end)]or 0}; say f([0,0,0,1,0,0,0])
camelia rakudo-moar 691b39: OUTPUT«(1)␤»
Hotkeys m: my &f = {.[.first(?*):k.. (.first(?*):k:end)]or[]}; say f([0,0,0,0,0,0]) 00:27
camelia rakudo-moar 691b39: OUTPUT«Use of uninitialized value $i of type Any in string context␤Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in block at /tmp/nQGb3Y6r50 line 1␤Use of uninitialized value $e of type Any in string context␤Any of .^name…»
Hotkeys m: my &f = {.[.first(?*):k.. (.first(?*):k:end)]or []}; say f([0,0,0,0,0,0])
camelia rakudo-moar 691b39: OUTPUT«Use of uninitialized value $i of type Any in string context␤Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in block at /tmp/qy3xo_FV68 line 1␤Use of uninitialized value $e of type Any in string context␤Any of .^name…»
Hotkeys ugh
m: my &f = {.[.first(?*):k.. (.first(?*):k:end)]//0}; say f([0,0,0,0,0,0]) 00:28
camelia rakudo-moar 691b39: OUTPUT«Use of uninitialized value $i of type Any in string context␤Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in block at /tmp/VV8HVpbwBK line 1␤Use of uninitialized value $e of type Any in string context␤Any of .^name…»
AlexDaniel Hotkeys: spam-spam-spam
b2gills m: say {.[.grep(?*,:k).minmax]||0}([0,0,0,1,0,0,0])
camelia rakudo-moar 691b39: OUTPUT«(1)␤» 00:29
Hotkeys true
b2gills: you're a wizard
AlexDaniel b2gills: yup. was looking for that :)
now that's ok
b2gills .oO( Let me just push this pointy hat over behind this wall so you can't see it ) 00:30
Hotkeys why doesn't that one get angry
AlexDaniel m: say {.[.grep(?*,:k).minmax]//0}([]) 00:31
camelia rakudo-moar 691b39: OUTPUT«()␤»
AlexDaniel I think that this is better
b2gills m: say {.grep(?*,:k).minmax}([0,0,0,0,0,0])
camelia rakudo-moar 691b39: OUTPUT«Inf..-Inf␤»
Hotkeys ah
AlexDaniel now remove that comma 00:32
m: say {.[.grep(?*):k.minmax]//0}([0,0,2,5,8,0,0])
camelia rakudo-moar 691b39: OUTPUT«(2 5 8)␤»
AlexDaniel kk we're getting somewhere
Hotkeys m: say {.[.grep(?*):k.minmax]//0}([0,0,0,0]) 00:32
camelia rakudo-moar 691b39: OUTPUT«()␤»
b2gills It returns a defined empty list 00:33
Hotkeys right
m: say {.[.grep(?*):k.minmax]||0}([0,0,0,0])
camelia rakudo-moar 691b39: OUTPUT«0␤»
Hotkeys the test case for all zeroes has it returning nothing 00:34
AlexDaniel what's the link by the way?
Hotkeys codegolf.stackexchange.com/question...ing-zeroes 00:34
b2gills One of the things I don't like is the code highlighter that CG uses thinks // is a comment in Perl 6 but not Perl 5
AlexDaniel m: say {.[.grep(?*):k.minmax]}([]) # that works fine by the way…
camelia rakudo-moar 691b39: OUTPUT«()␤» 00:35
Hotkeys yeah don't really need ||0
if it just wants nothing returned
I assume an empty list is sufficiently nothingy
AlexDaniel what means “nothing”???
Hotkeys well a list of 0s with all the 0s removed is an empty list anyway
b2gills If anything it would be 「|||()」
Hotkeys m: say {.[.grep(?*):k.minmax]|||[]}([0,0,0,0]) 00:36
camelia rakudo-moar 691b39: OUTPUT«()␤»
Hotkeys m: say {.[.grep(?*):k.minmax]|||()}([0,0,0,0])
camelia rakudo-moar 691b39: OUTPUT«()␤»
b2gills m: say {.[.grep(?*):k.minmax]|||[]}([0,0,0,0]).perl
camelia rakudo-moar 691b39: OUTPUT«slip()␤»
Hotkeys m: say {.[.grep(?*):k.minmax]}([0,0,0,0]).perl 00:37
camelia rakudo-moar 691b39: OUTPUT«()␤»
Hotkeys why is a slip any better?
AlexDaniel m: say {.[.grep(?*):k.minmax]||Any}([])
camelia rakudo-moar 691b39: OUTPUT«(Any)␤»
AlexDaniel or Nil
Hotkeys An empty list satisfies "Output the list with trailing and leading zeroes removed."
AlexDaniel “Vim 16 Keystrokes” – haha 00:39
Hotkeys "Mathematica has a builtin for determining goats. I don't know how to feel about that." beautiful 00:39
codegolf.stackexchange.com/question...r-downgoat 00:40
AlexDaniel m: say {+($_,*/2...^*!%2)}(20) 00:41
camelia rakudo-moar 691b39: OUTPUT«5===SORRY!5=== Error while compiling /tmp/rbWibEog3g␤Cannot negate % because multiplicative operators are not iffy enough␤at /tmp/rbWibEog3g:1␤------> 3say {+($_,*/2...^*!7⏏5%2)}(20)␤ expecting any of:␤ infix␤ infix s…»
AlexDaniel Hotkeys: ↑ your example does not run
Hotkeys: it works without !% I think 00:42
Hotkeys strange
it worked before
m: my &f = {+($_,*/2...^*%2)}; f(20)
camelia ( no output )
Hotkeys m: my &f = {+($_,*/2...^*%2)}; f(20).say
camelia rakudo-moar 691b39: OUTPUT«2␤»
Hotkeys oh
m: my &f = {+($_,*/2...^*!%2)}; f(20).say
camelia rakudo-moar 691b39: OUTPUT«5===SORRY!5=== Error while compiling /tmp/OQiZr4HwmZ␤Cannot negate % because multiplicative operators are not iffy enough␤at /tmp/OQiZr4HwmZ:1␤------> 3my &f = {+($_,*/2...^*!7⏏5%2)}; f(20).say␤ expecting any of:␤ infix␤ …»
arnsholt m: my $_=[0,0,2,5,8,0,0]; .shift while !.[0];.pop while !.[*]; .say # Should do it, I think
camelia rakudo-moar 691b39: OUTPUT«Potential difficulties:␤ Redeclaration of symbol $_␤ at /tmp/lpUjEcIpb7:1␤ ------> 3my $_7⏏5=[0,0,2,5,8,0,0]; .shift while !.[0];.po␤[2 5 8 0 0]␤»
Hotkeys yeah
it works without the negation 00:43
arnsholt m: $_=[0,0,2,5,8,0,0]; .shift while !.[0];.pop while !.[*]; .say # Durr.
camelia rakudo-moar 691b39: OUTPUT«[2 5 8 0 0]␤»
Hotkeys I edited wrong is all
arnsholt Oh. It's *-1, I guess
m: $_=[0,0,2,5,8,0,0]; .shift while !.[0];.pop while !.[*-1]; .say
camelia rakudo-moar 691b39: OUTPUT«[2 5 8]␤»
AlexDaniel arnsholt: and we have a winner!
arnsholt The power of implicit invocants compels you! =) 00:44
Hotkeys {.shift while !.[0];.pop while !.[*-1];}([0,0,2,5,8,0,0,0]).say
m: {.shift while !.[0];.pop while !.[*-1];}([0,0,2,5,8,0,0,0]).say 00:45
camelia rakudo-moar 691b39: OUTPUT«Nil␤»
arnsholt Not sure if my code is shorter, but it's pretty straightforward
Hotkeys or is yours a full program
m: {.shift while !.[0];.pop while !.[*-1];$_}([0,0,2,5,8,0,0,0]).say
camelia rakudo-moar 691b39: OUTPUT«[2 5 8]␤»
Hotkeys ah
that works
not shorter than the greppy one though which got down to 23 bytes 00:47
AlexDaniel m: say {chars .base(2)~~/0+$/}(20) # oh well… that's so long
camelia rakudo-moar 691b39: OUTPUT«2␤»
Hotkeys fixed my post 00:48
I love beating golf langs 00:50
AlexDaniel are you going to post leading/trailing zeroes thing? 00:51
Hotkeys only if b2gills doesn't want to
he did nearly half the length
maybe not quite half but quite a bit 00:52
AlexDaniel Hotkeys: haven't thought that a solution with … could be so short 00:54
Hotkeys: it also works with negative numbers but hangs on 0 00:55
Hotkeys the original question specifies non-zero input 00:56
AlexDaniel I don't like that it happens on SE though. Would've been much better if it was just a plain wiki 00:57
Hotkeys hm? 00:58
AlexDaniel Hotkeys: code golf I mean. stackexchange-like posting and voting does not really fit code golf I think 00:59
Hotkeys oh
Questions often have a script that makes a leaderboard by length
Actually I haven't seen it much recently 01:00
but they did
this has it codegolf.stackexchange.com/question...e-official 01:01
Kitt3n is there a (sane) way to cross compile perl6? 01:03
AlexDaniel Hotkeys: nope, that's still by vote count 01:03
Hotkeys The code snippet under "Leaderboard" 01:04
AlexDaniel aaa
ok
Hotkeys show it and then hit run code snippet
ya
BenGoldberg_ m: {.shift until .[0];.pop until .[*-1];$_}([0,0,2,5,8,0,0,0]).say 01:07
camelia rakudo-moar 691b39: OUTPUT«[2 5 8]␤»
BenGoldberg_ m: {.shift until.[0];.pop until.[*-1];$_}([0,0,2,5,8,0,0,0]).say 01:08
camelia rakudo-moar 691b39: OUTPUT«5===SORRY!5===␤Whitespace required after keyword 'until'␤at /tmp/rObnchegaX:1␤------> 3{.shift until7⏏5.[0];.pop until.[*-1];$_}([0,0,2,5,8,0,0␤Whitespace required after keyword 'until'␤at /tmp/rObnchegaX:1␤------> 3{.shift until7…»
BenGoldberg_ m: {.shift until .[0];.pop until .[-1];$_}([0,0,2,5,8,0,0,0]).say 01:10
camelia rakudo-moar 691b39: OUTPUT«5===SORRY!5=== Error while compiling /tmp/hIrutpBbP1␤Unsupported use of a negative -1 subscript to index from the end; in Perl 6 please use a function such as *-1␤at /tmp/hIrutpBbP1:1␤------> 3{.shift until .[0];.pop until .[-1]7⏏5;$_}([0,0,…»
Herby_ Evening, everyone! 01:10
masak Herby_: good antenoon :) 03:00
Herby_ \o 03:04
DoverMo no matter what language i use to output hello world, the world never replies to me ;-; 03:05
Herby_ m: say "Hello, DoverMo." 03:06
camelia rakudo-moar 691b39: OUTPUT«Hello, DoverMo.␤»
DoverMo O:
timotimo i still think we should have camelia put things like the user name that requested the evaluation into an environment variable 03:08
DoverMo m: say "Goodbye cruel world." 03:08
camelia rakudo-moar 691b39: OUTPUT«Goodbye cruel world.␤»
Herby_ >:( 03:09
sortiz timotimo, It is a good idea! 03:17
\o Herby_
Herby_ o/ 03:18
masak timotimo: sounds like a job for a separate bot, if you ask me ;) 03:20
azawawi hi 04:53
im using %?RESOURCES and im asking myself what's the point of making installed resources folder flat? 04:54
since %?RESOURCES can be used to share files with other libraries/external processes (e.g. electron) 04:55
and hence one needs to reconstruct the folder from its flat structure 04:56
sortiz .seen lizmat 04:59
yoleaux I saw lizmat 12 Feb 2016 08:40Z in #perl6: <lizmat> *caused
ugexe azawawi: i agree
azawawi ugexe: and good morning or afternoon:) 05:00
so basically now i have to manually copy resources before handing them to the external processes by traversing %?RESOURCES 05:01
ugexe its because of the same reason they use sha1 names still. if they solve 1, they solve the other 05:03
azawawi pasteboard.co/1w0CRId7.png # does not compute :)
ugexe and they use sha1 names because your file system might not support the characters the name of the file wants to use 05:05
azawawi so basically they solved problems and created another 05:07
at the expense of more load/execution time
ugexe you can also generate the name on the fly i think. the sha1 is just (i think) sha1($path)
for resources anyway
azawawi lately i have seen slowness in the package installers(s) commits 05:09
nothing to do? or waiting for something?
ugexe what do you mean
dalek albot: 5eabe3e | (Aleks-Daniel Jakimenko-Aleksejev)++ | evalbot.pl:
Put user name that requested the eval into ENV variable
azawawi panda is not seeing any commits lately 05:12
AlexDaniel m: say ‘hi’ 05:13
azawawi ugexe: but zef is moving nicely :) 05:13
camelia rakudo-moar 691b39: OUTPUT«hi␤»
AlexDaniel m: say “I love %*ENV<ME>” 05:13
camelia rakudo-moar 691b39: OUTPUT«I love AlexDaniel␤»
AlexDaniel timotimo: I don't know why but there you go
MadcapJake AlexDaniel++ 05:15
azawawi MadcapJake: hey 05:16
dalek albot: e600617 | (Aleks-Daniel Jakimenko-Aleksejev)++ | evalbot.pl:
Set %ENV<ME> variable only when actually required
05:18
AlexDaniel okay that's slightly better I think
BenGoldberg m: say %ENV<ME> 05:19
camelia rakudo-moar 691b39: OUTPUT«5===SORRY!5=== Error while compiling /tmp/xinJKGw2nV␤Variable '%ENV' is not declared␤at /tmp/xinJKGw2nV:1␤------> 3say 7⏏5%ENV<ME>␤»
AlexDaniel it's %*ENV
BenGoldberg m: say %*ENV<ME>
camelia rakudo-moar 691b39: OUTPUT«BenGoldberg␤»
BenGoldberg Whee!
azawawi ugexe: does this seem to you or is there an alternative syntax? github.com/azawawi/perl6-electron/...A.info#L21 05:22
ugexe: s/seem to/seem right to/
AlexDaniel m: say “I love %*ENV<ME>” # just in case 05:24
camelia rakudo-moar 691b39: OUTPUT«I love AlexDaniel␤» 05:25
AlexDaniel camelia: ;)
AlexDaniel m: my $terminator = DateTime.new(:2029year:10month:26day); my $*TZ = -1420070400; say $terminator.local 05:51
camelia rakudo-moar 691b39: OUTPUT«1984-10-26T00:00:00-394464:00␤»
sortiz .tell lizmat I found additional gains for Internals. Can you take a look at gist.github.com/salortiz/6555993cc5cbe746dd85 06:00
yoleaux sortiz: I'll pass your message to lizmat.
llfourn .seen nine 06:14
yoleaux I saw nine 11 Feb 2016 06:48Z in #perl6: <nine> AI has been solved? Nice...
llfourn .tell nine friendly poke github.com/rakudo/rakudo/pull/694 :) 06:15
yoleaux llfourn: I'll pass your message to nine.
petercommand why the unless construct cannot an else clause? 06:58
that should be reasonable.. 06:59
sortiz petercommand, To avoid the cognitive impedance of the double negation. If you feed that need it, invert the order and use if. 07:02
petercommand okay... 07:03
sortiz s/feed/feel/ 07:04
petercommand self.bless(:$name,:$age,:$sex,:$nationality); 08:35
what does the : before the symbol $ do? 08:36
is it something like name => $name, age => $age (some sort of macro?)? 08:37
petercommand it is in this tutorial: perl6intro.com/#_named_vs_positional_arguments 08:38
sortiz petercommand, yes. 08:43
petercommand sortiz: it is a macro? 08:44
sortiz petercommand, Not exactly. The compiler implements all those Pair constructors. 08:46
petercommand okay, thanks!
also, it seems that perl6 does not have a keyword for overriding method? 08:47
i just started to look into perl6
something like java's @Override 08:48
sortiz After perl6intro, look the documents at doc.perl6.org/language.html
sortiz In doc.perl6.org/language/objects you can learn about perl6 objects, inheritance, etc. 08:50
petercommand Thanks, sortiz. I'll look into it
sortiz yw 08:51
petercommand wow, perl6 has type objects.. 08:54
sortiz m: say "Hello".WHAT 08:57
camelia rakudo-moar 691b39: OUTPUT«(Str)␤»
petercommand m: say "hello".WHAT.WHAT 08:58
camelia rakudo-moar 691b39: OUTPUT«(Str)␤»
petercommand m: say 1.WHAT
camelia rakudo-moar 691b39: OUTPUT«(Int)␤»
petercommand m: say 1.WHAT.WHAT
camelia rakudo-moar 691b39: OUTPUT«(Int)␤»
petercommand seems that there are no kinds (type of types)?
sortiz m: Str.WHAT.say 08:59
camelia rakudo-moar 691b39: OUTPUT«(Str)␤»
skids Well, there are metaobjects.
m: 1.HOW.WHAT.say
camelia rakudo-moar 691b39: OUTPUT«(ClassHOW)␤»
petercommand m: 1.HOW
camelia ( no output )
petercommand what is the HOW method? 09:00
sortiz A method to obtain the metaclass
m: say 1.HOW.methods
camelia rakudo-moar 691b39: OUTPUT«Too few positionals passed; expected 2 arguments but got 1␤ in any methods at gen/moar/m-Metamodel.nqp line 490␤ in block <unit> at /tmp/UpUlrPUPHX line 1␤␤»
skids m: (role A { }).HOW.WHAT.say
camelia rakudo-moar 691b39: OUTPUT«(ParametricRoleHOW)␤»
skids m: say 1.HOW.^methods 09:01
camelia rakudo-moar 691b39: OUTPUT«Method 'gist' not found for invocant of class 'NQPRoutine'␤ in block <unit> at /tmp/k6W1caPALH line 1␤␤»
skids Still some interface consistency issues down that low.
m: say 1.HOW.^methods».name 09:02
camelia rakudo-moar 691b39: OUTPUT«(archetypes new new_type add_fallback compose roles role_typecheck_list concretization is_composed setup_junction_fallback find_method_fallback has_fallbacks submethod_table add_role can does array_type generate_mixin trusts rw method_table type_check publ…»
sortiz m: say 1.^methods
camelia rakudo-moar 691b39: OUTPUT«(Int Num Rat FatRat abs Bridge chr sqrt base polymod expmod is-prime floor ceiling round lsb msb narrow Range sign sin tan cotan acosech conj atan2 cosec pred asec acotan cosh acos acosec sech unpolar log10 atanh log exp acosh truncate sinh tanh acotanh Re…»
sortiz fingers frozen!
petercommand is the metaclass a superclass? 09:04
skids Not of the class. Itself, it could be a superclass for other metaclasses. 09:05
m: 1.HOW.HOW.WHAT.say 09:06
camelia rakudo-moar 691b39: OUTPUT«Method 'say' not found for invocant of class 'NQPClassHOW'␤ in block <unit> at /tmp/bndrFXg8Pg line 1␤␤»
sortiz No, the metaclass is a class for manipulate classes.
skids m: 1.HOW.HOW.name.say
camelia rakudo-moar 691b39: OUTPUT«Too few positionals passed; expected 2 arguments but got 1␤ in any name at gen/moar/stage2/nqpmo.nqp line 1216␤ in block <unit> at /tmp/Fp6Wk6LOI1 line 1␤␤»
skids m: 1.HOW.HOW.^name.say
camelia rakudo-moar 691b39: OUTPUT«NQPClassHOW␤»
skids Eventually that should be made to behave itself I guess. 09:07
sortiz m: say 1.HOW.methods(Int) 09:09
camelia rakudo-moar 691b39: OUTPUT«(Int Num Rat FatRat abs Bridge chr sqrt base polymod expmod is-prime floor ceiling round lsb msb narrow Range sign sin tan cotan acosech conj atan2 cosec pred asec acotan cosh acos acosec sech unpolar log10 atanh log exp acosh truncate sinh tanh acotanh Re…»
stmuk video.fosdem.org/2016/STATUS.txt 09:13
h2214 was perl 09:14
sortiz skids, accustomed to the ^ syntax, I always forgot that ClassHOW's methods needs a Type as argument! :) 09:15
skids m: .WHAT.^name.say for 1.HOW.WHAT.^roles(:!local)
camelia rakudo-moar 691b39: OUTPUT«Perl6::Metamodel::Naming␤Perl6::Metamodel::Documenting␤Perl6::Metamodel::Versioning␤Perl6::Metamodel::Stashing␤Perl6::Metamodel::AttributeContainer␤Perl6::Metamodel::MethodContainer␤Perl6::Metamodel::PrivateMethodContainer␤Perl6::Metamodel::M…»
petercommand hmm..so i need to look into how the meta* thing works in perl6 09:19
skids Well, most of us just et it do its thing and don't worry about it too much :-) 09:20
masak that's not satisfactory from a knowledge perspective! :) 09:24
I have one tip along the way: prefer the terminology "class metaobject", which is clearer and less confusing than "metaclass"
(because it's actually an *object* responsible for a certain class, not a class)
petercommand yeah..I need to understand the language design to gain more understanding into how to language works :D 09:27
masak: so..class themselfs are not objects, right? 09:28
themselves
sortiz petercommand, listen to masak, it is one of the designers of this matter and teacher of many around here
petercommand :)
sortiz A class is an object. 09:29
petercommand ok 09:30
skids Each class has an instance of a metaclass behind it.
Thus as masak said, "class metaobject"
sortiz petercommand, you can read about the MOP: doc.perl6.org/language/mop 09:33
petercommand thx!
[Tux] test 22.708 09:41
test-t 12.191
csv-parser 51.441
sortiz masak, thanks for the details on the terminology.
masak petercommand: in Perl 6, when we say "class", we can actually be referring to *three* different objects, each capturing some aspect of what it is to be a class. 09:56
(a) the type object, like when you do `my $d = Dog;` instead of `my $d = Dog.new;` 09:57
(b) the package-like global name, the thing that actually goes in the package namespace when you say `class Dog { ... }` 09:58
(c) the class metaobject, Dog.HOW, which governs things like how attributes, methods, inheritance, method lookup etc function for the Dog class 09:59
so it's not really "a class is an object", unless you say it three times in different tone of voice ;)
sortiz masak, Is the type the actual instance of the metaclass? 10:01
masak no, I wouldn't say so. not in the sense that Dog ~~ Dog.HOW 10:02
petercommand masak: ok, I got it :D
masak m: class say Dog {}; say Dog ~~ Dog.HOW
camelia rakudo-moar 691b39: OUTPUT«5===SORRY!5=== Error while compiling /tmp/0xVhRj0B6R␤Unable to parse class definition␤at /tmp/0xVhRj0B6R:1␤------> 3class say7⏏5 Dog {}; say Dog ~~ Dog.HOW␤ expecting any of:␤ generic role␤»
masak m: class Dog {}; say Dog ~~ Dog.HOW
camelia rakudo-moar 691b39: OUTPUT«False␤»
masak "meta" here doesn't indicate an instantiation relationship. it indicates that the class metaobject is describing how the class works. 10:03
actually, it's ultimately called "meta" because we're using the OO system to specify how the OO system works.
a neat trick. 10:04
sortiz Ok, not in that sense, but in the sense that a type is created instantiating a [meta]object of the metaclass ClassHOW, no? 10:07
skids More like you create that instance and then install it in some special places. 10:08
sortiz A really neat trick, indeed. 10:09
petercommand can I say that the class syntax is a syntatic sugar? 10:09
skids The mere existence of an instance of ClassHOW does't magically make "Foo.new" parse the Foo
masak sortiz: you seem to be asking whether $class_metaobject.new gives you the class itself. no, it doesn't. 10:10
petercommand: yes, syntactic sugar.
in the sense that you can do everything through the MOP.
sortiz masak, I was thinking in ClassHOW.new_type(...), so I look that as a factory for types. 10:13
masak that's correct.
but the objects .new_type produces are not instances of the class metaobject's type
sortiz That is clear, that only the type. 10:14
sortiz The semantic is complex, and I need to understand it well so I can be capable of explain with precision in Spanish! :) 10:20
masak we're happy to help :) 10:22
maybe it would make sense to find some old advent post by jnthn++ -- he explains it quite well 10:23
sortiz I have been reading many hours a day for the last six weeks, and somehow I still feel lost at times. 10:26
petercommand reading what? 10:28
sortiz But now I can read the Perl6 source and understand it reasonably well.
petercommand oh perl6..
sortiz petercommand, every blog I found, the old advents, masak's blog, etc. A lot has been written in recent years. 10:32
petercommand is the old advents this website? perl6advent.wordpress.com/2014/12/...junctions/ 10:33
sortiz Yep. The old and the new ones. Unfortunately lacks good index. 10:36
I need some sleep o/ 10:41
nine messages? 10:51
yoleaux 06:15Z <llfourn> nine: friendly poke github.com/rakudo/rakudo/pull/694 :)
nine .tell jnthn funny question: what should we do with commits that make TODO tests in 6.c roast pass? Shouldn't 6.c roast be fudge free? 11:03
yoleaux nine: I'll pass your message to jnthn.
masak sortiz: there's an index: perl6advent.wordpress.com/category...-contents/ 11:07
(but there's no link to that URL anywhere outside of the admin area, which is a pity) 11:08
also, we never seemed to get a table of contents for 2015, unless I'm missing something.
p6newbee hi all 11:12
m: my @a = 12,12,12; my $p := @a; say @a.WHAT; say $p.WHAT; 11:14
camelia rakudo-moar 691b39: OUTPUT«(Array)␤(Array)␤»
p6newbee $p is a pointer, right?
m: my @a = 12,12,12; my $p := @a; say @a.WHERE; say $p.WHERE;
camelia rakudo-moar 691b39: OUTPUT«140034835862328␤140034835862328␤»
p6newbee Is there a way to figure out what type the $p is? 11:15
and when I assign $p to a class variable like MyClass.new(p => $p); Is the class variable a pointer then or is the array copied? 11:18
RabidGravy no, for the most part: 11:21
m: class F { has $.g }; class G {}; my $g = F.new; say $g.WHICH; my $f = F.new(g => $g); say $f.g.WHICH
camelia rakudo-moar 691b39: OUTPUT«F|68313728␤F|68313728␤»
RabidGravy er, wait 11:22
lizmat computer, messages
yoleaux 06:00Z <sortiz> lizmat: I found additional gains for Internals. Can you take a look at gist.github.com/salortiz/6555993cc5cbe746dd85
RabidGravy m: class F { has $.g }; class G {}; my $g = F.new; say $g.WHICH; my $f = F.new(g => $g); say $f.g.WHICH 11:23
camelia rakudo-moar 691b39: OUTPUT«F|56701568␤F|56701568␤»
RabidGravy is what I meant, not enough coffee
p6newbee hehe
ok, so there are no pointers? 11:24
RabidGravy pointer would not be the right term no
p6newbee I can think of all is copied by value not by reference 11:25
RabidGravy all values can be thought of as objects
masak p6newbee: there are pointers/references in Perl 6, just like in Java or Python.
p6newbee: but you don't often need to think in terms of them.
let me demonstrate. 11:26
m: my @a = 1, { foo: 42 }, "OH HAI"; my @b = @a; @a[1]<foo> = 5; say @b.perl 11:27
camelia rakudo-moar 691b39: OUTPUT«Type Block does not support associative indexing.␤ in block <unit> at /tmp/4XqtOvKBdf line 1␤␤Actually thrown at:␤ in block <unit> at /tmp/4XqtOvKBdf line 1␤␤»
masak m: my @a = 1, { foo => 42 }, "OH HAI"; my @b = @a; @a[1]<foo> = 5; say @b.perl
camelia rakudo-moar 691b39: OUTPUT«[1, {:foo(5)}, "OH HAI"]␤»
masak gah, JavaScript interference :)
p6newbee in perl5 I have a pointer to a hash with. with my $p = { "hello" => "perl6" }. What does my $p := %hash do?
:-)
masak p6newbee: if it was all copied by value, then @b would still have an object with :foo(42) above. QED, there are pointers. 11:28
p6newbee sorry, I need some time to get this
RabidGravy for the most part you don't need to care 11:29
masak that's not satisfactory from a knowledge perspective! ;)
p6newbee so my @b = @a does not copy the array. its creates a reference? 11:30
masak (but it's true)
p6newbee: it copies the array in that case, but the array has references as some of the elements
petercommand does perl6 provides anything to explicit operate on pointers? (say, for ffi) 11:31
masak petercommand: yes. see NativeCall 11:32
p6newbee masak. aaah. { foo: 12} is a reference, of course. and what if I want to have a pointer to @a? my $p := @a;? 11:33
petercommand masak: i see 11:34
masak p6newbee: I think you are coming at this from a C/C++ perspective, perhaps. in that case, expect surprises in how this works :)
p6newbee you're right. I still struggle with the conecpt of perl6. However I like it and would like get better 11:35
masak p6newbee: specifically, after you do that binding, $p will not be a "pointer object" or a "reference object", but an reference to the array in @a, identical to @a and just as much "an Array" as @a 11:36
p6newbee Hmm ok 11:36
masak p6newbee: I wrote this long ago, but perhaps it'll shed some light: strangelyconsistent.org/blog/plain-...ky-binding
p6newbee cool thx masak! 11:37
dalek kudo/nom: 78d2c71 | lizmat++ | src/core/Rakudo/Internals.pm:
Remove superfluous line, sortiz++
11:43
lizmat .tell sortiz: the || suggestion gives a tiny slowdown in my benchmarks, so I didn't apply that 11:46
yoleaux lizmat: What kind of a name is "sortiz:"?!
lizmat .tell sortiz the || suggestion gives a tiny slowdown in my benchmarks, so I didn't apply that 11:46
yoleaux lizmat: I'll pass your message to sortiz.
RabidGravy speaking of binding, I doing something with a language where '=' and ':=' have different semantics to that of Perl 6 (actually of most languages and keeps confusing me) 12:04
stmuk pascal? :) 12:14
RabidGravy nah 12:22
savonet.sourceforge.net/doc-svn/language.html 12:23
petercommand m: 1.^methods.perl 12:29
camelia ( no output )
petercommand m: say 1.^methods.perl 12:31
camelia rakudo-moar 78d2c7: OUTPUT«(method Int (Int $: *%_) { #`(Method|47171384) ... }, method Num (Int:D $: *%_) { #`(Method|47171536) ... }, method Rat (Int:D $: $?, *%_) { #`(Method|47171688) ... }, method FatRat (Int:D $: $?, *%_) { #`(Method|47171840) ... }, method abs (Int:D $: *%_) …»
stmuk ah a DSL for streaming 13:18
hankache hello#perl6 13:22
masak hellohankache 13:27
hankache hello masak 13:29
:)
do we have something that reads a module code and generate the classes and their methods/attributes in some textual format? 13:33
or something close that can be reused/augmented?
moritz hankache: you mean besides cat? 13:52
hankache moritz cat? 13:53
moritz hankache: cat MyModule.pm6 # prints the class and their methods and attributes 13:56
masak in some textual format!
'night, #perl6 13:57
RabidGravy I've got a little hack somewhere that generates stub pod from a module but I usually end up tailoring it to circumstances of each module 14:14
st_iron hello my friends 14:16
nine .tell llfourn pr 694 regresses several spec tests in the 6.c branch (some of them the S01 integration tests) 14:19
yoleaux nine: I'll pass your message to llfourn.
petercommand is there a difference between 15:06
my $sig = :($Int $a, Str);
opps, i mean my $sig = :(Int $a, Str);
and my $sig = :(Int, Str);
they should be the same signature right? 15:07
skids No the name is indeed recorded in the sig. 15:08
skids m: my $a, $b; :($a, $b) = 1, 2; $a.say; $b.say 15:08
camelia rakudo-moar 78d2c7: OUTPUT«5===SORRY!5=== Error while compiling /tmp/oAM6lKKzHH␤Variable '$b' is not declared␤at /tmp/oAM6lKKzHH:1␤------> 3my $a, 7⏏5$b; :($a, $b) = 1, 2; $a.say; $b.say␤»
skids m: my $a; my $b; :($a, $b) = 1, 2; $a.say; $b.say
camelia rakudo-moar 78d2c7: OUTPUT«Cannot modify an immutable Signature␤ in block <unit> at /tmp/BmKyfx7P0T line 1␤␤»
skids oh 15:08
m: my $a; my $b; :($a, $b) := 1, 2; $a.say; $b.say 15:09
camelia rakudo-moar 78d2c7: OUTPUT«1␤2␤»
petercommand oh, i see
hankache Me: Will you be my valentine?
Girl: No way
Me: sudo Will you be my valentine?
Girl: Yes..yes..yes! Let's go!
skids But for the purpose of multidispatch, it of course does not consider the name
petercommand m: my Int $x where { loop (my $i = 0; $i > -1; $i++) { }; $_ > 3 } = 7; 15:15
camelia rakudo-moar 78d2c7: OUTPUT«(timeout)» 15:16
petercommand turing complete run-time type check.. 15:17
petercommand for something like "my Int $x where { $_ < 3 } = 2", i think this is much easier to write than the agda/idris variant of the Fin type 15:21
though it might not terminate at all..
skids We call that case DHWDT 15:23
petercommand what does that mean? 15:24
skids "Doctor it Hurts When I Do This" 15:25
("So Don't do That")
petercommand lol
stmuk hmm gitlab allows use of github signin but pushing to it seems slow :/ 15:29
petercommand skids: what's the main usage for this kind of type? 15:31
skids There are two main usages. Subset types, and dispatch checks for subs/methods. 15:32
The latter is more common. 15:33
skids m: multi sub a ($ where 2) { 1.say }; multi sub a ($ where 3) { 2.say }; a(2); a(3); 15:35
camelia rakudo-moar 78d2c7: OUTPUT«1␤2␤»
skids m: multi sub a (2) { 1.say }; multi sub a (3) { 2.say }; a(2); a(3); # basically the same thing 15:36
camelia rakudo-moar 78d2c7: OUTPUT«1␤2␤»
petercommand oh..that's an interesting feature..
RabidGravy very useful 15:37
petercommand skids: does it try the method in the sequence i defined them? 15:40
a(2) then a(3)
skids Yes. (There are a couple places where rakudo messes this up currently, but in general, yes) 15:41
After elimination throuh nominal type check, though.
petercommand skids: what about multi sub from different modules? 15:45
skids Yes you can add to a multi from different modules. As long as the proto is in a scope that's accessible. So, that would be, if the module exports them.
m: multi sub a (Int $ where { "a checked".say; $_ == 2 }) { 1.say }; multi sub a (Int $ where { "b checked".say; $_ == 3 }) { 2.say }; multi sub a (Str $ where { "c checked".say; $_ == "2" }) { 3.say }; a(2); a(3); a("2");
camelia rakudo-moar 78d2c7: OUTPUT«a checked␤a checked␤1␤a checked␤b checked␤b checked␤2␤c checked␤c checked␤3␤»
skids (Seems to be an extra ceck in there for now) 15:46
petercommand so what will be the sequence for dispatching multi from different modules?
skids The use statements count as declarations, I would suppose. 15:47
Never tested that.
petercommand hmm..that sounds bad.... 15:48
skids howso?
petercommand that will mean that changing the sequence of the use statements changes the semantic of the program 15:49
yheif does perl6 have an equivalent of R copy-on-modify semantics? 15:50
skids In general there aren't too horribly many places where declaration order matters. (Personally, coming from the rough-and-tumble perl 5/C world, I expect the order of "use" statements to matter) 15:51
AlexDaniel .tell hankache Girl: [sudo] password for Girl: 15:54
yoleaux AlexDaniel: I'll pass your message to hankache.
skids yheif: Not built in, that I've seen. It should be easy to implement though so I imagine a module might be able to make a trait for that. 15:55
AlexDaniel m: sub foo($x is copy) { say $x.WHERE; $x = 35; say $x }; my $z = 25; say $z.WHERE; foo($z) 15:59
camelia rakudo-moar 78d2c7: OUTPUT«139712022043168␤139712022043168␤35␤»
yheif skids: in R I think it is useful when dealing with tables because you end up having multiple instances of the same data with additional columns allocating memory only when you really need
AlexDaniel haha. Well, that's not it 15:59
m: sub foo($x is copy) { say $x.WHERE; $x = 35; say $x.WHERE }; my $z = 25; say $z.WHERE; foo($z) # that's what I meant 16:00
camelia rakudo-moar 78d2c7: OUTPUT«139666929756760␤139666929756760␤139666929649664␤»
petercommand skids: hmm..i come from haskell...where something like this result in compilation error by default, and module import order doesn't matter at all 16:01
skids Classic functional vs procedral difference of viewpoint :-) 16:01
petercommand yeah..but at least there should be a warning or sth for that 16:03
petercommand so the user can know that something might go wrong there 16:04
ugexe to be fair: "or there is a single prior or outer proto in the same file"
skids It's generally considered to be icky to create a situation like that, culturally (don;t do it or if you do, bears documenting). I could see a linter or compiler feature to look for things of that sort being useful. 16:05
RabidGravy in reality the order of the multis shouldn't matter as if you have two that tie you get at least a warning
skids Yeah only with where clauses does it matter. 16:06
AlexDaniel m: class C { has $.f is rw }; sub foo($x is copy) { $x.f = 49 }; my $z = C.new(:25f); say $z; foo($z); say $z
camelia rakudo-moar 78d2c7: OUTPUT«C.new(f => 25)␤C.new(f => 49)␤»
AlexDaniel what kind of a copy is that?… 16:07
:)
I'm joking of course
petercommand RabidGravy: then the thing it checks should be something decidable
then can know whether there is a tie 16:08
RabidGravy don't know what 'decidable' means
yheif Do you think that in the parse tree that is the result of a complex regular expression (like a grammar) in Perl6, all the string are copy of the parsed text? 16:10
petercommand RabidGravy: it needs to be sure that the check it is performing is always terminating
so it won't get stuck.. 16:11
RabidGravy right, 16:11
petercommand wait, in compile time, it is not possible to determine whether the checks can tie in general..even if they all terminate 16:21
petercommand i think it should just warn for any multi defined in different module 16:24
skids You wouldn't have to warn unless there were where clauses, I don't think. 16:25
petercommand yep, there has to be where clauses
AlexDaniel yheif: good question :) 16:31
yheif: as far as I remember Strs were immutable, so I don't think that it would make any sense to do that 16:32
yheif: however, rakudo is not very optimized right now, so who knows? 16:33
yheif AlexDaniel: yep, there should be a reason why strings are immutable 16:35
RabidGravy well that was the stupidest refactor I've ever done, I appear to have wound up with *more* code 16:46
jnthn yheif left already, but to answer the question anyway: Match objects store from/to and a reference to the original string 16:50
yoleaux 11:03Z <nine> jnthn: funny question: what should we do with commits that make TODO tests in 6.c roast pass? Shouldn't 6.c roast be fudge free?
jnthn If you ask for the string preresentation of that matched range, yes, it's a new Str, though on MoarVM it will also just be a reference to the original string and a start offset. 16:51
So, not copying.
.tell nine I don't know that we need to do anything; a pass with some passing TODO'd tests is still a perfectly fine pass.
yoleaux jnthn: I'll pass your message to nine.
b2gills The part about it not copying is an implementation detail that should not be noticeable by code which does not peak behind the curtain 16:53
jnthn b2gills: Sure, though people usually ask these things with the performance/memory behavior in mind :) 16:54
b2gills Now that we pretty much have what 6.c means, can @a.permutations be fixed where @a is 0 or 1 elements long (Rakudo PR #686 and Roast PR #98) 16:58
jnthn b2gills: Don't see why those two can't go in. 17:00
b2gills The only debate that would affect it (other than waiting on version stuff) was what permutations(0) returned. It should numify to 1 because that is its mathematical definition. (the PR does/tests that) 17:04
dalek p: a59d662 | hoelzro++ | src/HLL/Compiler.nqp:
Move continuation detection into eval

With this change, eval can return the output of running the code, or a sentinel value that indicates that more input is needed to run a chunk of code. This is so that more advanced forms of detecting when we need more input, such as if the user is entering input for a multi-line statement like a block.
This is just a proof-of-concept change; I don't really like how eval indicates to its caller that it needs more input. But at least this will get people to try and see if multi-line input could be feasible.
We also add a new method to HLL::Compiler - needs-more-input, which is used in conjunction with the sentinel value returned by eval.
17:38
p: a789a7e | hoelzro++ | src/HLL/Compiler.nqp:
Check if we need more input due to trailing backslash

This is a bit of a hack, but it's good enough for this experiment
p: b31afba | hoelzro++ | src/HLL/Compiler.nqp:
Merge branch 'multi-line-repl'
dalek kudo/nom: 9576596 | hoelzro++ | tools/build/NQP_REVISION:
Require NQP for multi-line REPL
17:40
rakudo/nom: 6015ce7 | hoelzro++ | src/ (2 files):
rakudo/nom: Add pos attribute to X::Syntax
hankache github.com/hankache/perl6intro needs your stars :) 17:54
yoleaux 15:54Z <AlexDaniel> hankache: Girl: [sudo] password for Girl:
hankache .tell AlexDaniel [sudo] password for Girl: input credit card number 17:56
yoleaux hankache: I'll pass your message to AlexDaniel.
AlexDaniel :) 17:56
yoleaux 17:56Z <hankache> AlexDaniel: [sudo] password for Girl: input credit card number
atweiden any hint as to why this exception handling code would be exiting with "This exception is not resumable"? ix.io/omG 18:03
jnthn atweiden: Probably the default. You can't rely on all exceptions being resumable. Generally, you should only rely on exceptions types you throw yourself to be. 18:06
(Or others that are explicitly documented as being) 18:07
atweiden ty, it was the default {...} block doing it 18:09
dalek p: b9ab65b | (Pawel Murias)++ | / (3 files):
[js] Implemente simple conversion/wrapping of some basic things between NQP/native js.
18:16
p: 45927a6 | (Pawel Murias)++ | src/vm/js/ (4 files):
[js] add a --source-map-debug flag to help with getting correcting source maps
dalek p: ac4325c | (Pawel Murias)++ | src/vm/js/Compiler.nqp:
[js] Better source maps for ops with side-effects.
18:50
RabidGravy I'm struggling to make an interesting and possibly useful example of Audio::Liquidsoap without bringing in a veritable boat load of dependencies 19:22
Herby_ Afternoon, everyone! 19:29
Begi is the "&" new with Perl6 or already exists with Perl 5 ?
pmurias Begi: & in what context? 19:38
Begi my &x = &method 19:39
RabidGravy it has a similar thing in Perl 5
atweiden is there a more p6 idiomatic way to create a subroutine with a signature of `multi sub step($container where {$_ !~~ Positional}, Int $step)`
something to filter out all non-positionals 19:40
RabidGravy however it behaves differently, to get the "reference" of a sub in perl5 one would typically do \&foo
Begi Oh ok, thanks
atweiden select for non-pos*
RabidGravy rather than just declare it as a named argument? 19:42
or is that above "one integer and a single named argument"? 19:44
geekosaur in perl6 &foo is a way to refer to a sub by name, as opposed to calling it. but it can't be used as a declarator
er perl5
Hotkeys m: my @a; my @b = [0,1,0]; @a.push(@b); @a.say; @b = [0,0,1]; @a.say
camelia rakudo-moar 97eafa: OUTPUT«[[0 1 0]]␤[[0 0 1]]␤»
Hotkeys how do I push @b as a value?
instead of as a reference to @b
hankache push |@b
Hotkeys m: my @a; my @b = [0,1,0]; @a.push(|@b); @a.say; @b = [0,0,1]; @a.say
RabidGravy .append
camelia rakudo-moar 97eafa: OUTPUT«[0 1 0]␤[0 1 0]␤»
Hotkeys genius 19:45
er
I want the whole array pushed as an array
not as individual values
but I don't want the one in @a to change if @b is modified
RabidGravy [|@b] then 19:46
Hotkeys m: my @a; my @b = [0,1,0]; @a.push([|@b]); @a.say; @b = [0,0,1]; @a.say
camelia rakudo-moar 97eafa: OUTPUT«[[0 1 0]]␤[[0 1 0]]␤»
Hotkeys fancy
thanks
timotimo o/ 19:49
RabidGravy RARR!
Herby_ \o 19:50
BenGoldberg m: my @a; my @b = (0,1,0); @a.push: item @b; @a.say; 19:51
camelia rakudo-moar 97eafa: OUTPUT«[[0 1 0]]␤»
BenGoldberg m: my @a; my @b = (0,1,0); @a.push: item @b; @a.say; @b.push: 2; @a.say; 19:52
camelia rakudo-moar 97eafa: OUTPUT«[[0 1 0]]␤[[0 1 0 2]]␤»
Hotkeys m: my @a = [[1,0,1],[0,0,0]]; say @b (elem) @a; say ?@a.grep(@b); 20:12
camelia rakudo-moar 97eafa: OUTPUT«5===SORRY!5=== Error while compiling /tmp/uFF5_oCpMT␤Variable '@b' is not declared␤at /tmp/uFF5_oCpMT:1␤------> 3my @a = [[1,0,1],[0,0,0]]; say 7⏏5@b (elem) @a; say ?@a.grep(@b);␤»
Hotkeys m: my @a = [[1,0,1],[0,0,0]]; my @b = [0,0,0]; say @b (elem) @a; say ?@a.grep(@b); 20:13
camelia rakudo-moar 97eafa: OUTPUT«False␤True␤»
Hotkeys the (elem) operator is quite confusing
timotimo how so? it just coerces to Set before acting on stuff 20:14
that's where the exact semantics come from
Hotkeys but @b is an element of @a isn't it? 20:21
in that example
timotimo oh, heh. 20:27
m: my @b = [0,0,0]; say @b.perl
camelia rakudo-moar 97eafa: OUTPUT«[0, 0, 0]␤»
timotimo m: my @a = [[1,0,1], [0,0,0]]; my $b = [0,0,0]; say $b (elem) @a; say so @a.grep($b)
camelia rakudo-moar 97eafa: OUTPUT«False␤True␤»
timotimo m: my @a = [1,0,1], [0,0,0]; say @a.Set.perl 20:27
camelia rakudo-moar 97eafa: OUTPUT«set($[1, 0, 1],$[0, 0, 0])␤»
timotimo probably is because arrays aren't a value type? 20:28
Hotkeys hm I guess 20:34
there should be an op similar to python's 'in' IMO
I know you can do ?@a.grep($thing) 20:35
Hotkeys shrug
ugexe @b ~~ any(@a) ? 20:40
timotimo yeah, usually we recommend "any" 20:40
Hotkeys 'oh
right
hankache m: say 4 R/ 12; 20:48
camelia rakudo-moar 97eafa: OUTPUT«3␤»
hankache i wonder what is the use case for the reverse operator? 20:49
Hotkeys I can't think of any off the top of my head
but sometimes it makes the order of things nicer etc. 20:50
or you can do things like
m: my @a = ^10; say [R,] @a;
camelia rakudo-moar 97eafa: OUTPUT«(9 8 7 6 5 4 3 2 1 0)␤»
hankache oh ok
ugexe m: 1 R= my $a; say $a 20:51
camelia rakudo-moar 97eafa: OUTPUT«1␤»
Hotkeys oo
that's neat
ugexe combine with <== for great fun
Hotkeys <== ? 20:52
is that less-than or equal to assignment
hankache m: my @array = <7 8 9 0 1 2 4 3 5 6 7 8 9 0 1 2>; @array ==> unique() ==> sort() ==> reverse() ==> my @final-array; say @final-array; 20:53
camelia rakudo-moar 97eafa: OUTPUT«[9 8 7 6 5 4 3 2 1 0]␤»
hankache is like this ^^ but in reverse
hankache it chains methods 20:54
hankache Hotkeys see perl6intro.com/#_feed_operator 20:55
ugexe m: my @a <== grep * > 3 <== (^5) R= my @f; say @a
camelia rakudo-moar 97eafa: OUTPUT«[4]␤»
Hotkeys oh
ugexe: wot 20:56
oh
I see
ugexe the job security operators/methods
Hotkeys lol 20:57
it's neat that it can feed into a new variable
Hotkeys I like that 20:57
ugexe ==>> will let it feed into *two* different arrays (its nyi) 20:58
Hotkeys well that's ridonkulous 20:58
ugexe or maybe the other way around, 2 into 1 20:59
but all the pipe stuff will be cool when its done
Hotkeys 2 into 1 should be ====> 20:59
:p 21:00
rudi_s_ Hi. Can I specify that a type should be either an Int or a Str in the type signature? 21:13
yoleaux 1 Dec 2015 21:08Z <FROGGS> rudi_s_: please pull all the things and rebuild rakudo, Pointer is rw works now like shown in this test: github.com/rakudo/rakudo/commit/2b5c41e94f
ugexe use a multi method (one for each type) or use foo($a where Int|Str) 21:15
rudi_s_ ugexe: Thanks. Does that also work with optional argments? I get "Constraint type check failed for parameter '$user'" with sub file (:$user where Int|Str) { } when called as file; 21:17
ugexe hmm. well one way would probably be Int|Str|Nil, or setting a default value of '' 21:19
timotimo you could "where any(Int|Str, !*.defined)" perhaps? 21:21
i wonder if that works
ugexe m: sub foo(Str(Cool) :$user = "") { say $user.perl; }; foo(user => "str"); foo(user => 1); foo() # if you dont care about turning Int into a Str 21:22
camelia rakudo-moar 97eafa: OUTPUT«"str"␤"1"␤""␤»
rudi_s_ Yeah, I thought about Cool too, but I'd like to keep the type. 21:46
ugexe: Thanks, will try |Nil.
Hm. |Nil doesn't work, same error message. 21:47
= '' would work, but that's a bit ugly.
rudi_s_ where any(Int|Str, !*.defined) works too, but that's a bit ugly. 21:48
Is there a shorter way? 21:49
timotimo you're not getting a Nil there
if you know what exactly you get, you can put that in the initial | 21:50
actually, Int | Str | !*.defined should work
ugexe m: proto sub foo(|) {*}; multi sub foo(Int :$user!, |c) { samewith(user => ~$user, |c) }; multi sub foo(Str :$user) { say $user.perl; }; foo(user => 1); foo(user => "one"); foo(); 21:54
camelia rakudo-moar 97eafa: OUTPUT«"1"␤"one"␤Str␤»
rudi_s_ timotimo: I get the value that Perl uses as default value if no arguments are given. I've no idea what that is. .WHAT says Any, but that isn't useful. 21:57
Yeah, that works. Still a bit long though .. 21:58
timotimo why not?
you can Int | Str | Any:U
Any is totally a thing
rudi_s_ timotimo: Didn't think of :U - but won't that also allow something like foo(Str)? 21:59
timotimo ah, yes, it would
rudi_s_ Hm. !*.defined also allows Str.
Hm.
timotimo true 22:01
rudi_s_ It looks like I need :D everywhere. Is it possible to tell Perl to automatically enforce :D? Looks weird that I can have types but they don't have to be values but can be classes as well.
timotimo you can define a sentinel value for "this argument not passed"
rudi_s_ ugexe: Sadly the function takes many arguments, so multi doesn't help. 22:02
rudi_s_ Yeah, = '' would be good enough in my case, but feels a little ugly. I'd like to easily check for undefined values and still tell Perl to verify the type. 22:02
AlexDaniel timotimo: what else do you want to have in ENV variables? 22:08
m: say %*ENV<ME>
camelia rakudo-moar 97eafa: OUTPUT«AlexDaniel␤»
timotimo if we could put arrays into %*ENV, that'd be cool for the whole nicklist 22:08
how do you feel about last line said?
AlexDaniel timotimo: well, I can make camelia say that she loves me 22:10
but besides that it's useless
and the whole nicklist is even more useless, I guess
timotimo that's not useless
AlexDaniel timotimo: what's the use-case then? 22:11
timotimo i have no idea
someone will come up with something
Ben_Goldberg m: say 0 == Numeric.new
camelia rakudo-moar 97eafa: OUTPUT«Memory allocation failed; could not allocate 58880 bytes␤»
timotimo endless recursion ^ 22:12
AlexDaniel and what about the nicklist? Sure you can annoy random people but…
Ben_Goldberg m: say Numeric.HOW 22:13
camelia rakudo-moar 97eafa: OUTPUT«Perl6::Metamodel::ParametricRoleGroupHOW.new␤»
timotimo yeah, ok, the nicklist *is* useless
Hotkeys in what cases can you do things like @a.grep($foo):k instead of @a.grep($foo,:k) 22:16
AlexDaniel Hotkeys: in all cases? 22:17
Hotkeys I've tried it in many places
AlexDaniel Hotkeys: except when it creates parsing problems (e.g. it is not clear what you have meant)
Hotkeys and gotten "unexpected parameter :foo passed"
AlexDaniel Hotkeys: because you are trying to adverb something else
in which case you have to put parens to force it to do what you want 22:18
Hotkeys like "[R-] @h.grep($w,:k)"
(but with :k outside)
AlexDaniel m: say [~] %*ENV<ME>.comb.pick: * 22:19
camelia rakudo-moar 97eafa: OUTPUT«leaADlxeni␤»
AlexDaniel m: say [~] %*ENV<ME>.comb.pick: *
camelia rakudo-moar 97eafa: OUTPUT«eelnaxlADi␤»
AlexDaniel m: say [~] %*ENV<ME>.comb.pick: *
camelia rakudo-moar 97eafa: OUTPUT«inexDlelAa␤»
AlexDaniel timotimo: ↑ ? :/
timotimo :D 22:19
eelnaxLadi, totally sounds like something out of a sci-fi show
AlexDaniel lead lxeni
m: say ([~] %*ENV<ME>.comb.pick: *).lc.tc 22:20
camelia rakudo-moar 97eafa: OUTPUT«Nldxeeaali␤»
AlexDaniel m: say ([~] %*ENV<ME>.comb.pick: *).lc.tc
camelia rakudo-moar 97eafa: OUTPUT«Aelleniadx␤»
AlexDaniel m: my $s = ‘heLLo’; say tc lc [~] $s.comb.pick: *
camelia rakudo-moar 97eafa: OUTPUT«Ohlel␤»
AlexDaniel m: say tc lc [~] %*ENV<ME>.comb.pick: * 22:21
camelia rakudo-moar 97eafa: OUTPUT«Aaldeenlxi␤»
timotimo you know about tclc and friends?
m: say "LOLWUT".tclc
camelia rakudo-moar 97eafa: OUTPUT«Lolwut␤»
AlexDaniel timotimo: I have no idea
never had to change the case
timotimo it's a rare case
BBIAB 22:22
timotimo oh well. 22:30
AlexDaniel Hotkeys: are you saying that you can't use that on method calls? 22:40
Hotkeys m: my @h = 5,1,2,3,4,5; my $w = 5; say [R-] @h.grep($w):k;
camelia rakudo-moar 97eafa: OUTPUT«Unexpected named parameter 'k' passed␤ in block <unit> at /tmp/8sQcBXwuA6 line 1␤␤»
Hotkeys AlexDaniel:
AlexDaniel m: my @h = 5,1,2,3,4,5; my $w = 5; say [R-] (@h.grep($w):k); 22:41
camelia rakudo-moar 97eafa: OUTPUT«5===SORRY!5=== Error while compiling /tmp/W_jO0_ZkyH␤Bogus postfix␤at /tmp/W_jO0_ZkyH:1␤------> 3,3,4,5; my $w = 5; say [R-] (@h.grep($w)7⏏5:k);␤ expecting any of:␤ infix␤ infix stopper␤ statement end␤ …»
Hotkeys m: my @h = 5,1,2,3,4,5; my $w = 5; say [R-] @h.grep($w,:k);
camelia rakudo-moar 97eafa: OUTPUT«5␤»
AlexDaniel m: my @h = <1 1 2 1 1>; @h.grep(1):k.say
camelia rakudo-moar 97eafa: OUTPUT«(0 1 3 4)␤»
AlexDaniel m: my @h = <1 1 2 1 1>; say @h.grep(1):k 22:42
camelia rakudo-moar 97eafa: OUTPUT«(0 1 3 4)␤»
Hotkeys why would it try to adverb [R-]
m: my @h = <1 1 2 1 1>; say [R-] @h.grep(1):k
camelia rakudo-moar 97eafa: OUTPUT«Unexpected named parameter 'k' passed␤ in block <unit> at /tmp/e_nvUF6eao line 1␤␤»
Hotkeys this is interesting: 22:43
m: my @h = <1 1 2 1 1>; say @h.grep:k:k: 1
camelia rakudo-moar 97eafa: OUTPUT«(1 1 1 1)␤»
Hotkeys bug?
AlexDaniel m: my @h = <1 1 2 1 1>; say @h.grep:k: 1 22:44
camelia rakudo-moar 97eafa: OUTPUT«(1 1 1 1)␤»
AlexDaniel m: my @h = <1 1 2 1 1>; say @h.grep:k: 2
camelia rakudo-moar 97eafa: OUTPUT«(2)␤»
AlexDaniel Hotkeys: nope, it actually works
Hotkeys well yes but it doesn't return the keys
AlexDaniel you can pass the same argument multiple times if you really want to…
ah
Hotkeys it just works normally
AlexDaniel xD
Hotkeys m: my @h = <1 1 2 1 1>; say @h.grep:nonsense: 1 22:45
camelia rakudo-moar 97eafa: OUTPUT«(1 1 1 1)␤»
AlexDaniel Hotkeys: well, it adverbs something!
Hotkeys: the question is: what exactly?
ok we need design docs… 22:46
Hotkeys hmm
m: my @h = <1 1 2 1 1>; say @h.grep:nonsense: 1; goto nonsense
camelia rakudo-moar 97eafa: OUTPUT«5===SORRY!5=== Error while compiling /tmp/RxvvxP37Aw␤Undeclared routine:␤ nonsense used at line 1␤␤»
Hotkeys aw
m: my @h = <1 1 2 1 1>; say @h.grep:nonsense: 1; nonsense.^name.say
camelia rakudo-moar 97eafa: OUTPUT«5===SORRY!5=== Error while compiling /tmp/hY30t2EEwa␤Undeclared routine:␤ nonsense used at line 1␤␤»
Hotkeys just checking 22:47
AlexDaniel m: sub foo(:$x) { say $x }; foo :25x :45x 22:52
camelia rakudo-moar 97eafa: OUTPUT«45␤»
AlexDaniel “Perl 6 allows multiple same-named arguments, and records the relative order of arguments with the same name. When there are more than one argument, the @ sigil in the parameter list causes the arguments to be concatenated” 22:53
m: sub fun (Int :@x) { say @x }; fun( x => 1, x => 2 );
camelia rakudo-moar 97eafa: OUTPUT«Type check failed in binding @x; expected Positional[Int] but got Int␤ in sub fun at /tmp/qtZ_IgESat line 1␤ in block <unit> at /tmp/qtZ_IgESat line 1␤␤»
jnthn fwiw, I'd be surprised if that was every implemented.
*ever
It's likely incompatible with multi-dispatch for now. 22:54
uh, for one
Heh, one typo per line. Go me.
Should probably get tossed from the design docs, anyway.
I suspect that .foo:bar: 1 is being parsed as a method name with colonpair parts, but somehow the latter part is getting dropped... 22:56
m: 42.foo:sym<bar>
camelia rakudo-moar 97eafa: OUTPUT«Method 'foo' not found for invocant of class 'Int'␤ in block <unit> at /tmp/eTh9RDyze5 line 1␤␤»
jnthn Same there
I suspect given we use such names for action methods, we should do something about canonicalizing the colonpairs into the name before doing the method dispatch 22:57
Just as in
m: say infix:< + >(1, 2)
camelia rakudo-moar 97eafa: OUTPUT«3␤»
jnthn So, the method one counts as an NYI. Dunno if it's in RT. 22:58
AlexDaniel jnthn: github.com/perl6/doc/issues/394 is it ok? 23:00
jnthn AlexDaniel: Sure :) 23:01
atweiden m: my $array-index = *-1; say so $array-index ~~ *-1 23:03
camelia rakudo-moar 97eafa: OUTPUT«Cannot call Numeric(WhateverCode: ); none of these signatures match:␤ (Mu:U \v: *%_)␤ in block <unit> at /tmp/MhEkRebx87 line 1␤␤»
atweiden is it possible to smart match WhateverCode values? e.g. can you check for *-0 vs *-1 in a list?
m: my @wecodes = [*-0, *-1, *-2, *-3]; say @wecodes.grep({$_ === *-1}).perl 23:05
camelia rakudo-moar 97eafa: OUTPUT«(WhateverCode.new, WhateverCode.new, WhateverCode.new, WhateverCode.new).Seq␤»
jnthn Smart-matching against a piece of code calls it 23:06
jnthn With the thing on the LHS of the smartmatch as an argument 23:06
dalek kudo-star-daily: 6a58e6a | coke++ | log/ (9 files):
today (automated commit)
jnthn m: say [*-0, *-1, *-2, *-3].grep({ .(0) == -1 }) 23:07
camelia rakudo-moar 97eafa: OUTPUT«(WhateverCode.new)␤»
jnthn Something like that would work
atweiden :o thanks
jnthn (That is, is this a bit of code where, if I give it a 0, it spits out a -1)
In general though, code is not comparable... 23:08
jnthn hides behind a huge "halting problem" sign :)
atweiden m: my @z = qw<zero one two three four five six seven>; say @z[[*-0, *-1, *-2, *-3].grep({.(0) == -1})] 23:10
camelia rakudo-moar 97eafa: OUTPUT«(seven)␤»
AlexDaniel jnthn: I don't really understand the method:foo thing. What kind of a bug report should I submit? 23:12
jnthn AlexDaniel: Probably a "Method calls with colonpairs in name NYI" or something 23:33
AlexDaniel okay
jnthn sleep & 23:42