»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg p6eval perl6: ... | irclog: irc.perl6.org/ | UTF-8 is our friend!
Set by sorear on 4 February 2011.
TimToady rosettacode.org/wiki/Pattern_matching#Perl_6 <-- Red/Black trees (sig patterns, not regex patterns) 04:05
sorear TimToady: How much are Perl 6 metaoperators related to J metaoperators? 04:12
TimToady not very
I did decide to make dwimmy hyper cyclic after seeing some APL though 04:13
TimToady I also decided to (continue to) make metaops visually distinctive in Perl 6 after seeing how APL didn't :) 04:15
TimToady so far I think that has been quite successful 04:16
uvtc TimToady: I was just thinking about back when svn replaced cvs. 04:18
I remember it being marketed heavily as the cvs replacement.
Maybe the same thing happend with Java and C++... 04:19
It's interesting, Perl 6 seems to be taking the opposite approach.
For example, the perl6.org site saying that Per 6 is Perl 5's spunky little sister. 04:20
uvtc It made me think of a part of the "who killed the electric car" movie. At one point, 04:21
the narrator was listing the reasons why GM killed the EV-1. One of the reasons was
that to properly advertise the electric car meant also implicitly listing why the fossil-fuel vehicles were ... worse. 04:22
And GM wouldn't do that to their bottom line. 04:23
Gah. Sorry for blathering. Just saw some parallels there.
TimToady when the time is right, Perl 6 will advertise itself 04:24
uvtc I understand.
Thanks for the reply. TimToady++ :) 04:25
sorear perl 6 has slept for many years in dark obscurity, but when the stars are right, it will rise, and no agency of man will be able to stop it... 04:47
moritz good morning fellow lambdazebras 06:12
mberends good morning moritz. I hope your Norwegian family are all safe after yesterday's terrible events. 06:21
moritz mberends: safe but shocked 06:22
mberends everyone here in .nl is also shocked 06:23
sorear o/ moritz 06:30
o/ mberends too 06:31
moritz perl6: say ~'123'.match(:g, :p(0), /\d/) 06:40
p6eval niecza v7-44-g54b5188: OUTPUT«Unhandled exception: Unable to resolve method match in class Str␤ at /tmp/SruhkI59qc line 1 (MAIN mainline @ 1) ␤ at /home/p6eval/niecza/lib/CORE.setting line 1933 (CORE C906_ANON @ 2) ␤ at /home/p6eval/niecza/lib/CORE.setting line 1934 (CORE module-CORE… 06:41
..rakudo 922500: OUTPUT«1 2 3␤»
..pugs: OUTPUT«*** No such method in class Str: "&match"␤ at /tmp/35NaTNVfTb line 1, column 5 - line 2, column 1␤»
moritz rakudo: say ~'1x3'.match(:g, :p(0), /\d/)
p6eval rakudo 922500: OUTPUT«1 3␤»
mberends o/ sorear. it's fun to see all the "little animal farm" programs evolve, even as a lurker. don't worry at all about the arbitrary 100 line goal, you'll get more satisfaction by simply ignoring it. 06:56
moritz the goal of the 100 line limit is not to encourage golfing, but to encourage soluations that are not bloated 07:01
niecza: $_ = "aba"; s:g[a] = do { say $/.from; 'FOO' }; .say 07:09
p6eval niecza v7-44-g54b5188: OUTPUT«0␤2␤FOObFOO␤»
moritz so the second match has seen the original string 07:10
masak morning, #perl6. 07:20
masak feels sadness for the shootings 07:21
:/
moritz too 07:22
masak mberends: indeed, the 100-LoC goal was mainly to get out of the OO thinking that led to bloat already by the first test, with the promise of much more to come.
moritz I raelly hope they won't lead to the kind of security paranoia/theatre that we see in the US (and parts of Europe too) 07:23
masak moritz: I thought we already had that.
moritz: though I do see more guards in France and Poland than I do in Sweden. it never really occurred to me that you can screen the bags in the entrance to a library or a science park. 07:24
sorear hmm. how heterogenous is Europe on security theatre? is any of it worse than the US? 07:27
masak doubts that 07:28
only leaving Russia was I ever asked to take off my shoes so they could have my socks screened.
moritz on the one hand they forbid liquids on flights, but nobody would stop you from driving on a big ferry with a truck full of explosives 07:34
masak nobody ever said security theatre would make much sense. 07:35
mathw I don't think we're as bad as the US for security theatre 07:47
Although we may be worse in the UK
I remember flying back from Germany once, they seemed to have a special extra security line for us :/
I suppose that might have been something connected with us not being part of Schengen 07:48
tadzik mathw: where are you from?
mathw England
tadzik oh
mathw So kind of European but kind of not European, thanks stupid governments 07:49
Oh and stupid tabloid newspapers who keep writing ridiculous, easily-disprovable stories about things the EU apparently make us do 07:50
Khisanth there is an easy solution for that :) 07:53
masak mathw: there are so many unions and trade associations and whatnot, either of which you could be or not be a member of: www.boingboing.net/2011/03/12/venn-...lustr.html
moritz mathw: it's the British that want the additional security, not the Germans (at the airports at least) 07:54
mathw moritz: thought it might be 07:56
masak: yes it's complicated isn't it 07:57
masak how feasible is it for subtypes to have methods? 08:10
ruz hi, would lovely to be able to extend subsets with methods and attributes: gist.github.com/1101175
masak ruz++
(we were just privmsging about it) 08:11
moritz I'm not sure if that's how subsets are meant to be in Perl 6 08:15
tadzik I look at it as a way of easy inheritance
so, class Direction is Str { but bla bla } 08:16
masak ...which is probably wrong :)
moritz subsets inherently break Liskov, which inheritance is meant to preserve
tadzik oh, that... right
just saw that one coming
moritz note that if you add methods ore attributes, you need to change storage
masak in particular, subset membership is defined (dynamicaaly!) by the object's properties.
tadzik right 08:17
ruz ok
it should be syntax I presented
moritz so you can't make subset Positive of Int where * > 0; 1 ~~ Positive work (at least not without major hacks)
ruz is there clear way to jump from subsets to classes?
masak begins a slow migration to the airport 08:18
ruz moritz: Liskov? 08:19
tadzik moves out too
dalek kudo/nom: 98fed2e | moritz++ | src/core/Str.pm:
implement :overlap in Str.match
moritz ruz: en.wikipedia.org/wiki/Liskov_substi..._principle
kudo/nom: 1123ec5 | moritz++ | / (3 files):
&truncate
moritz nom: m:g/a/ 08:45
p6eval nom: OUTPUT«Null PMC access in clone()␤current instr.: 'nqp;QRegex;P6Regex;Grammar;nibbler' pc 34669 (src/stage2/QRegex.pir:11430) (src/stage2/QRegex.nqp:771)␤»
felher TimToady++ (Rosetta Code). You've written that perl6 does not _(yet)_ have algebraic datatypes. Are they planned to come in near future? 09:37
sorear Perl 6 is designed for unplanned extension 09:52
felher sorear: guess that means they are not plannend but may very well come. thnx. :) 09:56
TiMBuS i know this is a perl 6 channel, but: Can't locate object method "getline" via package "IO::Handle" <- honestly stumped here 09:57
since the IO::Handle doc says right there, method $io->getline
sorear TiMBuS: have you use'd the appropriate module? 09:58
TiMBuS WHAT KIND OF SECOND RATE PROGRAMMER DO YOU THINyeah thats probably it 09:59
:p
sorear truism of the day: only second-rate programmers can see second-rate bugs easily 10:09
felher :D 10:10
masak good evening, #perl6 17:40
mberends hi masak, just departing to London for a few days o/ 17:57
masak ...preserving the eternal balance of Stroopwafel fans on the channel :) 18:01
moritz the stroopwafel concentration is deplorably low in Erlangen, Germany 18:43
yath .nl is too far... 18:46
masak we have wafels here in Sweden, but it's not the same. 18:47
they just don't stroop like those in .nl do 18:48
masak tries a root beer and concludes that it must be one of those "acquired taste" things 18:49
moritz makes waffles too, but it's just not the same 18:53
sorear good * #perl6 20:06
pmurias sorear: hi 20:14
masak good *, sorear 20:19
masak I like it when changes due to a new test turn old tests red because they don't follow the rules of the new test. :) 20:45
in that vein, my farm game now has the monozooism restriction, too. 20:47
sorear monozooism? 20:49
masak the one we discussed yesterday. 20:50
only one animal either bought or sold.
in my code, the corresponding boolean test turned out to be spelled '1 == [+] %trade{'selling'|'buying'}.values' 20:51
masak perl6: my @e = 1, 2, 3; .say for @e[0 ..^ *] 21:46
p6eval rakudo 922500, niecza v7-44-g54b5188: OUTPUT«(timeout)»
..pugs: OUTPUT«pugs: out of memory (requested 1048576 bytes)␤»
masak for something I think should work, the implementations seem unusually united against me. 21:47
masak goes to read S09
std: my @seasons[4:map(*%4)]; 21:51
p6eval std 516268a: OUTPUT«ok 00:01 122m␤»
masak \o/
moritz nom: my @e = 1, 2, 3; .say for @e[0 ..^ *] 21:52
p6eval nom: OUTPUT«1␤2␤3␤» 21:53
masak hugs nom
huh!? S09 talks about substr on an array of uint8 without batting an eye... I'm not sure I like that idea. 21:55
correction. I am sure I don't like that idea. 21:56
moritz array of unit8... a Buf? 21:57
moritz -> sleep 21:58
sorear masak: S09 is a living fossil
masak isomorphically, yes. but it's declared as 'my uint8 @buffer;'.
sorear: I am aware that much of S09 is blue-skying. but this seems different; it seems more like dangerous certitude. 21:59
sorear masak: I mean that large parts of S09 date from the time before we had Buf and Str straight 22:00
masak hm, I hope that's the reason in this case.
but we've had Bug and Str straight for a few years now. longer than S09 has gone without edits. 22:01
and I don't believe anyone has ever seriously proposed substr working on arrays (except by stringifying them first).
am I understanding correctly that 'my @a = [42]; say @a[0;0]' will lead to an error? 22:04
flussence "Bug and Str"? :)
(it's technically correct...)
rakudo: my @a = [42]; say @a[0;0] 22:05
p6eval rakudo 922500: OUTPUT«42␤»
flussence not what I'd expect... 22:06
masak flussence: oops. s/Bug/Buf/. guess I'm used to writing the former more often... :)
flussence: Rakudo doesn't implement the semantics of ; inside of .[] yet, so you only get the last 0 from that indexing. 22:07
rakudo: my @a = [42]; say @a[65535;0]
p6eval rakudo 922500: OUTPUT«42␤»
flussence rakudo: my $a = 42; say $a[0] 22:09
p6eval rakudo 922500: OUTPUT«42␤»
flussence I'm not sure whether that's right or wrong, actually...
rakudo: my $a = 42; say $a[0][0]
p6eval rakudo 922500: OUTPUT«42␤»
flussence it's 42 all the way down 22:10
masak that's correct. 22:11
.[0] is a no-op for scalar values.
Tene That kind of duck typing still seems wrong to me. :(
masak I have no strong opinion either way. to me it feels neither more nor less wrong than list flattening in various situations. 22:13
it's... just something that happens in Perl :)
Tene :)
masak ok, S09 supports my belief that @e[0 ..^ *] shouldn't loop infinitely. 22:15
masak submits rakudobug
flussence I think the 0;0 case could at least warn when it hits a scalar before the end, since it's being given enough information to know the user's expecting something else.
masak flussence: again, Rakudo doesn't implement any of the multidim indexing stuff. 22:16
flussence yeah, but when it does.
masak flussence: S09 seems to indicate that doing .[0;0] on a normally declared array is erroneous, yes. 22:17
masak 'night, #perl6 22:19
TimToady o/
sorear I don't understand how @a[0;0] is supposed to work at all 22:25
flussence AIUI (as a lowly user), @a[$x;$y;$z] is similar to doing @a[$x]».[$y]».[$z] 22:37
(except that the postcircumfix is given full knowledge of what it's returning, so it's free to optimise into something less stupid than I'd write :) 22:40
TimToady nom: say ((0),(0)).lol.perl 23:09
p6eval nom: OUTPUT«LoL.new(0, 0)␤»
TimToady nom: say ((0,),(0,)).lol.perl
p6eval nom: OUTPUT«LoL.new((0,), (0,))␤»
TimToady that's really uninformative 23:10
nom: say ((1..10),<a b c>)[1].perl 23:11
p6eval nom: OUTPUT«2␤»
TimToady nom: say ((1..10),<a b c>).lol[1].perl
p6eval nom: OUTPUT«("a", "b", "c")␤»
TimToady basically subscripts bind with lol semantics to **@x, so @x[0] is the first lazy list, @x[1] is the second, etc 23:12
TimToady with [0;0] it's just that either list has only one element 23:13
but [1..10;<a b c>] would be two lists
when everything is done with nested references, it doesn't buy you much, but we have shaped arrays that can calculate multi-dim offsets, it's starts getting all fortrany 23:15
well, apart from column-major vs row-major...
TimToady and yes, it does have the auto-hyper between subscripts as flussence++ points out, so that multi-dim slices work the way mathematicians think they oughta 23:16
we probably also need a way to express ideas like @a[0;0], @a[1;1], @a[2;2]... 23:19
flussence @a.rotate(45°)[0][*] # :) 23:20
TimToady this is much the same problem as making the right side of X depend on the current value of the left side
sorear @a[i;0] 23:27
TimToady well, I was thinking of 𝘪
.u 𝘪 23:28
phenny U+1D62A MATHEMATICAL SANS-SERIF ITALIC SMALL I (𝘪)
TimToady I meant 𝑖
.u 𝑖
phenny U+1D456 MATHEMATICAL ITALIC SMALL I (𝑖)
TimToady we could either have an an explicit 𝑖<- or >-𝑖, or we could implicitly label them 𝑖, 𝑗, 𝑘 23:29
TimToady so the diagonal would be expressed as [*; �] 23:30
but still thinking about that 23:31
that's another bit that ties in with bindings to non-sigiled readonly syms that I was mentioning the other day 23:32
anyway, if we come up with a notation for [;], it should also work for X 23:33
and enable multi-dimensional list comprehensions
well, easier ones
TimToady not thinking this is for 6.0.0, just future directions 23:34
TimToady I meant [*; 𝑖], wasn't suggesting using REPLACEMENT CHARACTER :) 23:42
TimToady well, more likely we'll just grab bare ->$i without a block, or some such, and pass it through to the implicit loop of ; or X 23:44
so you can write for 1..10 -> $i X $i..10 -> $j {...} and such 23:46
flussence (for a diagonal slice, wouldn't something like ||(1..* xx @a.elems) work?)
oh wait, that's wrong
TimToady only if you have a form that takes (0,0), (1,1), (2,2) as subscripts
oh, the double ||, hmm 23:47
it still seems wrongish 23:48
first, it'd have to be @a.dimensions 23:50
and second, it'd make [1..*; 1..*] which isn't gonna work
well, 0..*
APL/J probably has some magical way of turning a list of tuples into multidim subscripts 23:51
flussence
.oO( I'm not quite in my right mind at the minute, I've been reading about PHP again... )
TimToady is that cause or effect? :)
flussence it doesn't help that I'm trying to fit multidimensional arrays into my head at the same time :) 23:52
TimToady multiple dimensions are supposed to help with that sort of thing... 23:54