»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg camelia perl6: ... | irclog: irc.perl6.org | UTF-8 is our friend!
Set by sorear on 25 June 2013.
lue I should also note that the totally-not-written-by-me-at-all S15 should demonstrate that strings (of characters) in Perl 6 are not quite that analogous to binary streams of data, compared to P5. 00:01
00:01 skraito-0x71 joined
grondilu lue: that's probably because S15 focuses on Str, doesn't it? 00:01
skraito-0x71 hey guys
timotimo hi there
skraito-0x71 what's up
lue It focuses on Unicode actually, but string types tend to come up there :)
skraito-0x71 how do you declare variable 00:02
grondilu to be precise, it's the Str type which comes up there.
timotimo skraito-0x71: using the "my" syntax, like "my $shiny_variable = 1234"
skraito-0x71 oh now we should use my ?
grondilu in other words "strings of text" ;-)
skraito-0x71 we can't use it without my?
let me test it 00:03
but loop doesn't work
00:03 kivutar joined
diakopter skraito-0x71: what loop? 00:03
skraito-0x71 like loop forever 00:04
there for (1) { }
i try for (1) and for (0) is just loop one time
there is logic error there need to be coded again
smls lue: To me, "string" (in the general sense) is a concept on the same level as, and in fact similar to, "array".
diakopter for doesn't loop; it iterates
smls But arrays emphasize random access and treat their elements as self-contained objects that could just as well exists separately from each other...
diakopter loop loops 00:05
smls ...whereas strings are made up of things that inherently belong together in that order to form a greater whole.
00:05 skraito-0x71 left
lue smls, grondilu: what you call "string" I call "stream", and what you call "string of character" I call "string" :) 00:05
smls, grondilu: P6 agrees with me when it comes to Str, but somehow disagrees with me by making Str into a more array-ish thing. 00:06
*with Bufs
smls I think treating binary data as arrays of unsigned integers (which, if I understand correctly, is what you prefer) is insufficiently generic
"string of bytes" makes no assumption of how the bytes are to be interpreted 00:07
or, indeed, if they have an interpretation in their own
(outside of the whole)
lue smls: yes, but Buf (which is the designated "string of bytes" type) includes a lot of operations and design choices that only make sense with Str, aka "string of characters", to me. 00:08
smls like what?
things like concatenation seem generic enough to me 00:09
lue I specifically want to play with the binary data in a generic fashion, because Perl 6 has no way of playing with it built-in. I don't appreciate string-of-char design choices tainting Bufs in those cases.
grondilu lue: if you call a string of characters just "string" and refuse to admit that it is indeed a string of characters, then you abuse the metaphor as you use the word supposed to designate a piece of rope as if it was obvious that it is actually text.
lue r: my @a = 1,2,3; my @b = 4,5,6; @a ~= @b; say @a;
00:09 rurban1 joined
camelia rakudo-parrot 263aa0, rakudo-jvm 263aa0: OUTPUT«1 2 34 5 6␤» 00:09
lue smls: that shouldn't work for Bufs either, for example.
grondilu: Most everyone (and P6's Str type) says "string" eq "text". I of course admit it's a "string of characters" and have said as much when I needed to be clear, but *you* can't deny how language has morphed "string" to refer to a specific kind of data. 00:10
Again, pretend "Str" is actually named "Txt" in Perl 6, maybe then my objections won't be as confusing. 00:11
I don't think Buf should be polluted with operators and design choices that are designed to work on Txt-based data. 00:12
00:14 rurban1 left 00:15 ajr_ left
smls lue: Well I don't care much about *names* of concepts 00:15
I just thing that Str = "$X of characters", Buf = "$X of bytes" is a coherent analogy 00:16
grondilu but you have to. I mean, even if we tend to use the word "string" to mean "text", in computer science (en.wikipedia.org/wiki/String_(comp...science)), strings are indeed data structure that are not necessarily text: « A string is generally understood as a data type and is often implemented as an array of bytes (or words) that stores a sequence of elements, *typically* characters, using some character encoding. »
smls &think
lue smls: Yes. I'm just frustrated that the concept of "Buf shouldn't be a funny view of text" is being so difficult. 00:17
smls no matter what name you prefer for $X
(and no, I don't think "stream" is the perfect word for it, as it implies data being made available over time)
lue smls: yeah, "stream" is merely the closest word I'd reach for. I usually don't have a distinct word for it, it's just data. 00:18
grondilu: I really don't care about the formal definition of a "string". I care about Buf being given design choices that only make sense, to me, for textual data, like you see in the Str, Uni, etc. types. 00:19
grondilu string is just fine, as long as you don't think that means "text". "string" means: "someting that looks like a piece of rope"
00:19 aindilis` joined
lue I don't feel like saying more, but Perl 6 quite clearly disagrees with you there :) . "string" is "text". 00:19
timotimo but on moarvm strings are ropes 00:20
grondilu lue: it makes sense only to you but string algorithms are quite important and I'm pretty sure they can be used for other things than text.
lue: no, according to Perl 6, "Str" is text. There's a slight difference.
lue Str is specifically a sequence of Unicode characters. It can't be used for more than that unless you supersede or augment the class.
00:21 aindilis left
grondilu I meant that you should be able to use string algorithms with Buf. 00:21
Because that would make some sense, since they have the same structure. 00:22
lue I will say again, that I don't want Buf to be polluted with design choices that only make sense for Str. That's the thing I feel like arguing about now, not so much the specific meaning of "string"
grondilu the problem is that the reasons you think the design choices made only sense for Str are related to what you think a string is. 00:23
using concatenation ~ for instance can be useful with Buf because ~ is heavily used in string algorithms. And you may very well need string algorithms with Buf. 00:24
because Buf are strings, just not text. 00:25
lue Array.push() is equivalent. That's how I think when I want to use a binary collection of data.
smls lue: But why do you feel that concatenation with the concatenation operator is a design choice that only makes sense for a "string-rope-stream-whatever" of characters, and not for a "string-rope-stream-whatever" of bytes?
lue because I see Buf as a low-level Array-like type, *not* as a generalized stream-thing type. 00:26
Remember, I just want open("file", :bin).read($bytes) and similar to give me results in a data type that won't screw me over because I'm thinking with arrays.
grondilu isn't ther a IO.bytes method? 00:27
lue nope. All binary dealings in IO are with Bufs.
Look at how C++'s iostream objects handle binary data vs. string^Wtext data. That's what I want when I do binary IO. 00:28
grondilu r: say .list.WHAT given my $ = Buf.new: ^10; 00:29
camelia rakudo-parrot 263aa0, rakudo-jvm 263aa0: OUTPUT«(Array)␤»
00:30 rurban1 joined
smls It certainly makes sense to have a way to treat binary data as an array of integers, and as grondilu just demo'ed is seems theres is, but I don't agree that it should be the "default" for binary data returned from built-in IO methods. 00:33
I think "Buf a.k.a. string of bytes" is a better suited for that, because it makes no assumption about the interpretation of the data. It just says that it has "string/rope/stream-like" structure. 00:35
lue I'm fine with a numerical view of Strs, despite my feelings that it's totally useless, but I either want Buf to act more like array objects because that's what it purports to be, in some way, or for another type to be returned by binary IO, or... 00:36
for someone to finally, FINALLY, make native types work in Rakudo, so I can just use Array[int8] and be done with it.
00:36 thou left
grondilu I agree with smls. I like how Buf is capable of behaving both as a string and as an array. Seems compliant to TIMTOWTDI. 00:37
lue But it isn't! Where's Buf.push(), for instance?
And it should really be called a StrArray if that's what you want :/ 00:38
grondilu no, since Str is already used to mean "text"
lue oh, right, your definition of string. 00:39
grondilu me is beginning to seriously think that "Str" should really be named "Txt" 00:40
but that would be a lot to ask to the designers :/
lue People would start asking "how do I use strings in Perl 6?" too. S15 makes it so that P6 doesn't really *need* Str anyway, but getting rid of it would cause too many problems. 00:43
grondilu I do agree. It would confuse people.
00:44 BenGoldberg left
grondilu
.oO( role Str { }; class Buf does Str does Array { }; class Txt does Str { } } )
00:48
lue You're looking for Stringy I think :) 00:49
grondilu oh there is such a thing indeed
00:51 rurban1 left, rurban1 joined 00:55 berekuk left 00:56 jnap joined 01:05 smls left 01:07 abnorman left 01:33 abnorman joined 01:36 abnorman left
timotimo great. now i forgot to stash away the exact numbers of the tests that failed before i did my changes to moarvm 01:52
cool. my changes get rid of 8 failing tests 01:53
12 to go
02:01 jnap left 02:03 benabik joined, benabik left 02:07 thou joined
timotimo r: say -5 div 9; say -5 div 10; say -5 div 11; 02:08
camelia rakudo-jvm 263aa0: OUTPUT«-1␤-1␤-1␤»
..rakudo-parrot 263aa0: OUTPUT«0␤0␤0␤»
timotimo ... didn't i just fix this?
oh crap. i may have done it the wrong way around :o 02:10
r: say -5 div $_ for (4..6);
camelia rakudo-parrot 263aa0: OUTPUT«-1␤-1␤0␤»
..rakudo-jvm 263aa0: OUTPUT«-2␤-1␤-1␤»
timotimo yeah, that's -1 -1 -2 for moarvm now m) 02:11
02:12 gcole_ left 02:13 gcole joined
timotimo r: say -5 div 2; say 5 div 2; 02:13
camelia rakudo-jvm 263aa0: OUTPUT«-3␤2␤»
..rakudo-parrot 263aa0: OUTPUT«-2␤2␤»
02:16 gcole_ joined
timotimo doesn't have the brainpower right now to solve this properly, so will hack it in instead later tonight 02:18
02:20 gcole left
japhb That backlog was headache-inducing. 02:27
timotimo because of strings? 02:28
japhb Yeah.
It felt like there was confusion about "what's been implemented" versus "what's been designed".
timotimo mhm 02:29
japhb Also, IO wants to work with Buf because it's a *BUFfer* 02:30
02:30 raiph joined
timotimo i did not pay close attention 02:30
japhb It's not a string, though you can encode a Str to a Buf. It's not an array of numbers, though you can split it on boundaries of 2**n bytes and call it an array of integers if you like. 02:31
timotimo yes, though automatic conversions to Dand from the conconfigured encoding of either the program, scope or file descriptor
japhb But really it's just a buffer for opaque data to be exchanged with the OS.
timotimo would be okay
japhb Sure, we can sugar it like a donut. Fine by me (and actually nice, because I like easy things to be easy.)
But if you want "array of numbers", then you want Array of <numeric type>. AKA 'my int8 @little-numbers' 02:32
If that doesn't work yet, that's just an implementation problem, not a design defect. 02:33
timotimo well the returned buf could have a default encoding that gets set when you read from a file and used if you did not specify an encoding to use for the specific call
japhb Using buf8 as a workaround is still a workaround, it's not a design problem with buf8.
timotimo that way, sincebuff is(?) Cool, it could coerce to Str properly
japhb r: say buf8.^mro 02:34
camelia rakudo-parrot 263aa0, rakudo-jvm 263aa0: OUTPUT«(Buf[uint8]) (Any) (Mu)␤»
timotimo hm, k 02:35
japhb And the reason for ~ being concatenation isn't just because it looks like a lazy S or like a piece of string, but because it connotes sewing together pieces.
timotimo hehe 02:36
japhb Pulling together multiple OS buffers into one (at least conceptually) doesn't just make sense, it's how you have to do performance-critical IO. "Scatter-gather" 02:37
Well, not have to in the general case, but for certain common cases, like slapping multiple levels of header or framing onto a piece of data you've already mapped into a memory buffer. 02:38
And "string of things" technically makes sense -- you can consider each thing to be a bead on a string necklace -- but it's confusing. Just because something has a known meaning in Computer Science literature doesn't mean it was well named. 02:40
timotimo yes
japhb Applying the conceptual design of string algorithms to other types of conceptually positional data makes sense, but I've always hated that history got baked into the naming there. 02:41
timotimo aye
japhb They're really sequence searching algorithms.
Bus stop, afk for a bit &
02:47 logie_ left 02:53 gcole_ left 02:57 gcole joined 03:01 jnap joined 03:06 jnap left 03:15 mavcunha left 03:20 FROGGS[mobile] left 03:21 FROGGS[mobile] joined 03:23 FROGGS[mobile] left, FROGGS[mobile] joined 03:25 BenGoldberg joined
timotimo r: say -5 div $_ for (4..6); 03:32
camelia rakudo-parrot 263aa0: OUTPUT«-1␤-1␤0␤»
..rakudo-jvm 263aa0: OUTPUT«-2␤-1␤-1␤»
timotimo why do i constantly do things orwng?!?
jercos because you're human?
at least I presume you're not some sort of perl6-based robot. 03:33
lue japhb: considering Buf as an opaque thing really meant to exchange data, rather than manipulate it, feels oddly... right to me. Would clear up how I hate Buf's awkward halfway-ness in relation to Str and arrays.
timotimo :) 03:34
if i was a perl6-based robot, i would function even slower than i actually do
oh. now i understand what i was doing wrong 03:35
wow. i'm pretty dumb sometimes
03:36 FROGGS[mobile] left, FROGGS[mobile] joined 03:40 ponbiki left
lue r: my $foo = "Foo"; $foo.=subst(/Foo/, "Bar"); say $foo; 03:58
camelia rakudo-parrot 263aa0, rakudo-jvm 263aa0: OUTPUT«Bar␤»
04:02 jnap joined
lue Hrm. Rakudo's IO doesn't have :rw, and I'm having no luck in finding a way to overwrite certain bytes in a file. :/ 04:04
04:07 jnap left
lue Without, that is, reading the entire file into a Buf. I rather wished I didn't have to do that. 04:08
04:12 logie_ joined 04:24 thou left 04:32 preflex_ joined, ChanServ sets mode: +v preflex_ 04:33 preflex left, preflex_ is now known as preflex 04:38 rurban1 left 04:39 rurban1 joined 04:53 thou joined, araujo left 05:29 raiph left 05:46 rurban1 left
segomos_ lue: that seems like a common operation that rakudo would handle (not saying you're wrong, it's just odd) 05:53
lue segomos_: The :a (append) mode doesn't let you move where you write to, and :w clears the file before you start writing to it. 05:55
I'm just assuming :rw would Do What I Want, because you can't read a cleared file now can you? :)
06:05 ponbiki joined 06:17 rurban1 joined 06:19 raiph joined 06:20 BenGoldberg left 06:21 laidback_01 left 06:22 rurban1 left 06:34 darutoko joined 06:47 ssutch left 07:03 hummeleBop joined 07:32 dmol joined 08:04 raiph_ joined
jnthn waves from l'airport 08:05
08:08 hoverboard joined
moritz waves back. Have a good flight! 08:08
p: enum Bla 'A'..'Z'; 08:10
camelia rakudo-parrot 263aa0: OUTPUT«===SORRY!=== Error while compiling /tmp/EHSRXwX9UF␤Undeclared name:␤ Bla used at line 1␤Undeclared routine:␤ enum used at line 1␤␤»
moritz p: enum Bla ('A'..'Z');
camelia ( no output )
jnthn std: enum Bla 'A'..'Z';
camelia std 09dda5b: OUTPUT«===SORRY!===␤Illegal redeclaration of symbol 'Bla' (see line 1) at /tmp/CpE8k8aMB8 line 1:␤------> enum Bla⏏ 'A'..'Z';␤Two terms in a row at /tmp/CpE8k8aMB8 line 1:␤------> enum Bla ⏏'A'..'Z';␤…»
jnthn LTA, std... :)
moritz backtracking issue, I guess
jnthn yeah 08:11
masak good morning, #perl6 08:13
jnthn o/ masak 08:14
nwc10 good UGT jnthn 08:15
jnthn o/ 08:16
08:18 rurban1 joined 08:19 ssutch joined 08:22 eternaleye left 08:23 eternaleye joined, rurban1 left 08:26 xinming joined
jnthn Time to go fly...got some way with a hopefully nice thing, though... :) 08:36
bbl
08:44 thou left 08:46 Woodi joined
FROGGS[mobile] o/ 08:47
09:01 raiph_ left 09:02 raiph left
masak jnthn: if you unexpectedly need to take over the helm, remember that pushing the steering wheel forward causes the plane to descend, and pulling it towards you causes it to ascend. 09:03
09:10 uon joined
moritz why don't they tell you *that* in the pre-flight briefing? 09:12
09:16 skids left 09:20 uon1 joined, uon left 09:21 sqirrel joined 09:30 araujo joined 09:43 berekuk joined 09:50 berekuk left 09:51 berekuk joined 09:53 kaare_ left
masak .oO( "In the unlikely event of having to take control of the aircraft..." ) 09:54
FROGGS pull the steering wheel firmly over mouth and nose? 09:56
09:57 aindilis` left 09:59 aindilis joined 10:05 uon1 left 10:11 xinming left, xinming joined 10:12 SamuraiJack joined 10:17 xinming left 10:18 xinming joined
masak FROGGS: make sure you administer your own steering wheel before you help others. 10:19
10:20 denisboyun joined, berekuk left 10:30 berekuk joined
tadzik and breath normally 10:32
10:32 berekuk left 10:56 xinming left 10:57 xinming joined 11:06 cognominal__ left 11:09 preflex_ joined, ChanServ sets mode: +v preflex_, cognominal joined 11:10 preflex left, preflex_ is now known as preflex 11:13 atroxaper joined 11:20 hoverboard left, berekuk joined, FROGGS[mobile] left 11:21 FROGGS[mobile] joined 11:30 sqirrel left 11:33 berekuk left, FROGGS[mobile] left 11:34 FROGGS[mobile] joined 11:35 pdcawley left 11:36 berekuk joined 11:54 aindilis left
dalek p: 204c5ce | jonathan++ | src/vm/moar/ (12 files):
Updates to use MoarVM serialization improvements.
11:56
11:58 Piers joined 11:59 spider-mario joined 12:00 rindolf joined 12:05 xinming left 12:06 xinming joined 12:09 berekuk left 12:12 berekuk joined 12:24 pjcj_ left 12:33 psch joined 12:34 Piers left
psch hi #perl6 12:35
masak hi psch 12:39
12:43 Piers joined 12:44 cognominal left 12:45 cognominal joined
timotimo hi psch 12:57
13:01 Piers left 13:03 pjcj joined 13:08 berekuk left 13:10 berekuk joined 13:19 Rotwang joined 13:20 kivutar left 13:24 cognominal left, cognominal joined 13:30 berekuk left
timotimo so ... what is needed to make for loops always sink? 13:32
dalek pan style="color: #395be5">perl6-examples: deb3cb6 | (Shlomi Fish)++ | euler/README:
Remove trailing space.
pan style="color: #395be5">perl6-examples: 79b721d | (Shlomi Fish)++ | euler/README:
Some grammar/spelling/etc. fixes for the README.
pan style="color: #395be5">perl6-examples: 25efd58 | (Shlomi Fish)++ | euler/prob188-shlomif.pl:
[Euler] Add my solution to Euler #188.
pan style="color: #395be5">perl6-examples: 9c30576 | timo++ | euler/ (2 files):
Merge pull request #15 from shlomif/master

Euler: remove trailing space, fix grammar+spelling and add #188 .
13:33 treehug88 joined, berekuk joined
rindolf nuzzles dalek 13:34
13:39 rindolf left 13:41 kivutar joined 13:42 rindolf joined 13:58 atroxaper left, pecastro joined 14:10 Piers joined 14:22 mavcunha joined 14:24 beastd joined 14:27 lue left 14:28 treehug88 left 14:29 Piers left 14:30 berekuk left, berekuk_ joined 14:31 treehug88 joined 14:33 treehug88 left 14:35 mavcunha left, berekuk_ left, FROGGS[mobile] left, FROGGS[mobile] joined 14:36 berekuk joined 14:41 treehug88 joined, lue joined 14:50 treehug88 left
masak hehe. xkcd.com/1306/ 14:50
14:54 rurban1 joined
masak I'm toying with a DSL, and though it's not finalized yet, the parameters have a $ sigil. 14:56
mostly to avoid collisions with other terms in the language.
14:56 berekuk left, berekuk joined
masak I could remove the sigils, but then I'd need scoping to disambiguate some things. 14:57
14:58 filly left 15:03 berekuk left 15:09 berekuk joined
timotimo how do you feel about the concept of putting a number, then a sigil, then the name, to reference an exact variable based on lexpad depth? :P 15:09
sounds like a great feature for languages
"even harder to refactor without an IDE than java!"
hey, that way you could turn a definition into just "0$foo" 15:12
actually
-1$foo would be the definition and 0$foo is access in the direct sibling scope/lexpad/depth/thingie
15:12 pmurias joined
masak timotimo: parsing-wise, it feels too close to integer literals. 15:20
rindolf Hi all! How can I add a new method .sum to List to do [+]?
15:20 pjcj left
masak timotimo: I'd prefer something like $OUTER::foo 15:21
15:21 pjcj joined
masak p: sub sum(@list) { [+] @list }; say (1, 2, 3, 4, 5).&sum 15:21
camelia rakudo-parrot 263aa0: OUTPUT«15␤»
masak rindolf: ^^ like that. 15:22
rindolf masak: OK, is there anyway I can use ".sum" instead of ".&sum"?
grondilu MONKEY_TYPING 15:23
[Coke] make it a method instead of a sub.
15:23 pmurias left
grondilu use MONKEY_TYPING; augment class List { method sum { [+] self } }; 15:23
masak p: use MONKEY_TYPING; augment class Parcel { method sum { [+] self } }; say (1, 2, 3).sum 15:24
camelia rakudo-parrot 263aa0: OUTPUT«6␤»
15:24 denisboyun left
rindolf masak: thanks. 15:24
masak p: method sum(@list:) { [+] @list }; say (1, 2, 3, 4, 5).sum
camelia rakudo-parrot 263aa0: OUTPUT«Useless declaration of a has-scoped method in mainline (did you mean 'my method sum'?)␤No such method 'sum' for invocant of type 'Parcel'␤ in block at /tmp/uOtfV109KG:1␤␤»
masak p: my method sum(@list:) { [+] @list }; say (1, 2, 3, 4, 5).sum 15:25
camelia rakudo-parrot 263aa0: OUTPUT«No such method 'sum' for invocant of type 'Parcel'␤ in block at /tmp/GtXer0ZZ1F:1␤␤»
masak [Coke]: nope, that isn't enough :)
rindolf Also, what is the equivalent of List::MoreUtils::any in Perl 6?
masak [Coke]: (fortunately)
rindolf: .any.Bool, prehaps?
rindolf masak: what?
masak p: say (True, False, False).any
camelia rakudo-parrot 263aa0: OUTPUT«any(True, False, False)␤» 15:26
masak p: say (True, False, False).any.Bool
camelia rakudo-parrot 263aa0: OUTPUT«True␤»
rindolf masak: I want to evaluate and short-circuit a predicate though.
masak p: say ?(True, False, False).any # works, too
camelia rakudo-parrot 263aa0: OUTPUT«True␤»
moritz p: say 'e' eq any <a b c d e>
camelia rakudo-parrot 263aa0: OUTPUT«any(False, False, False, False, True)␤»
moritz p: say so 'e' eq any <a b c d e>
camelia rakudo-parrot 263aa0: OUTPUT«True␤»
masak rindolf: then just any() a map()
rindolf masak: ah, will it short circuit?
masak ...no. 15:27
rindolf masak: oh.
masak at least I don't know of any optimizer that does that.
rindolf masak: should it short-circuit?
In theory?
masak it has hyper semantics rather than lazy semantics, so... maybe not.
but it certainly could.
maybe :)
colomon grep 15:28
but that requires the input list to be lazy to short-circuit 15:29
r: my @a := 1, 1, *+* … *; if @a.grep(* > 20) { say "Worked"; }; 15:30
camelia rakudo-parrot 263aa0: OUTPUT«===SORRY!=== Error while compiling /tmp/lqeT7JrTsu␤Two terms in a row␤at /tmp/lqeT7JrTsu:1␤------> my @a := 1, 1, *+* ⏏… *; if @a.grep(* > 20) { say "Worked"; ␤ expecting any of:␤ postfix␤ …»
..rakudo-jvm 263aa0: OUTPUT«===SORRY!=== Error while compiling /tmp/HyOYKcyRDp␤Two terms in a row␤at /tmp/HyOYKcyRDp:1␤------> my @a := 1, 1, *+* ⏏… *; if @a.grep(* > 20) { say "Worked"; ␤ expecting any of:␤ postfix␤ …»
masak rindolf: there's also .first which might serve you here. 15:32
colomon ugh, idiot IRC client is converting … to as single Unicode character.
colomon supposes Rakudo probably should support that
masak p: if [1..100].first({ $_ > 50 && $_ %% 3 }) -> $value { say "Look, I found $value!" } 15:33
colomon masak: I think grep is preferable in this case.
camelia rakudo-parrot 263aa0: OUTPUT«Look, I found 51!␤»
masak p: if [1..100].first({ $_ > 50 && $_ % 10 == 3 }) -> $value { say "Look, I found $value!" }
camelia rakudo-parrot 263aa0: OUTPUT«Look, I found 53!␤»
colomon p: if [1..20].first({ $_ > 50 && $_ % 10 == 3 }) -> $value { say "Look, I found $value!" }
masak colomon: depends if you want the first, or all of the values, I guess.
camelia ( no output )
rindolf OK, why does this program take such a long time? pastie.org/8623862 . 15:34
colomon masak: no, no, when you call .Bool on it, grep only returns whether there was a value
p: if [-20..20].first({ $_ == 0 }) -> $value { say "Look, I found $value!" }
camelia ( no output )
masak colomon: in such a scenario, I would use .first to get the short-circuiting.
colomon: yes, semi-predicate problem alert, I know :) 15:35
colomon .grep does short-circuiting in this use AND it doesn't matter whether the value returned is true or no.
p: if [-20..20].grep({ $_ == 0 }) { say "Look, I found it!" } 15:36
camelia rakudo-parrot 263aa0: OUTPUT«Look, I found it!␤»
colomon p: if [-20..20].first({ $_ == 0 }) { say "Look, I found it!" }
camelia ( no output )
colomon p: if *-20..*).grep({ $_ == 0 }) { say "Look, I found it!" }
camelia rakudo-parrot 263aa0: OUTPUT«===SORRY!=== Error while compiling /tmp/RrLvk2TdDJ␤Missing block␤at /tmp/RrLvk2TdDJ:1␤------> if *-20..*⏏).grep({ $_ == 0 }) { say "Look, I found␤ expecting any of:␤ postfix␤ parameteriz…»
colomon p: if (-20..*).grep({ $_ == 0 }) { say "Look, I found it!" }
camelia rakudo-parrot 263aa0: OUTPUT«Look, I found it!␤»
masak rindolf: dunno. 15:37
rindolf: doesn't look overly inefficient to me.
rindolf: suggest benchmarking :)
colomon: .grep does short-circuiting? I didn't know. 15:38
that's nice, then.
colomon masak: grep is lazy, and List.Bool returns true as soon as it finds the first element of the list
15:39 lue left
rindolf masak: hmmm... it's pretty slow in Perl 5 too. 15:41
masak: maybe only the Lisp version was fast.
timotimo rindolf: you may be interested in [&&] 15:43
er, i meant [||]
i think it will short-circuit, but i'm not sure. 15:44
r: say [||] 0, 0, 0, False, True, 0, 1
camelia rakudo-parrot 263aa0, rakudo-jvm 263aa0: OUTPUT«True␤»
timotimo r: say [||] 0, 0, 0, False, "aye", 0, 1
camelia rakudo-parrot 263aa0, rakudo-jvm 263aa0: OUTPUT«aye␤»
rurban1 rindolf: do have a euler lisp version to test?
rindolf rurban1: I do.
rurban1 found one on github 15:45
rindolf rurban1: bitbucket.org/shlomif/project-eule...at=default - here.
It's in Common Lisp. 15:46
timotimo r: say [||] gather loop { my $res = (False, 0, "", $(), True).pick; say $res; $res };
rindolf But requires the memoize module.
15:46 berekuk left
rurban1 it'2 hashing the intermediate result and rcurry is pretty fast 15:46
timotimo hm, that infiniloops? :(
rurban1 github.com/emef/euler/blob/master/23/p23.lisp
camelia rakudo-jvm 263aa0: OUTPUT«(timeout)␤False␤0␤0␤␤␤True␤False␤␤␤␤0␤0␤True␤␤True␤False␤True␤␤False␤True␤␤0␤␤␤0␤False␤␤␤␤␤0␤True␤False␤0␤0␤False␤0␤0␤False␤0␤␤True␤0␤␤␤␤␤␤␤True␤␤␤0␤…»
..rakudo-parrot 263aa0: OUTPUT«(timeout)False␤␤0␤True␤␤True␤False␤␤True␤␤0␤␤False␤0␤True␤␤␤␤True␤␤0␤True␤0␤True␤␤␤␤␤0␤False␤␤␤True␤␤0␤False␤␤False␤0␤␤0␤True␤0␤0␤True␤␤True␤0␤0␤True␤␤0…»
timotimo is not happy about that
but yeah, first should do the trick. 15:47
rurban1 clisp crashes with a stack overflow in this one :) 15:48
masak colomon: ooh 15:49
timotimo clisps rurban1
15:49 berekuk joined
masak p: if (1 .. 100_000).grep({ $_ %% 10}) { say "found!" } 15:49
rurban1 but sbcl is pretty fast indeed, 2.5s time sbcl --script p23.lisp --quit
camelia rakudo-parrot 263aa0: OUTPUT«found!␤»
masak colomon: that's nice! :D 15:50
colomon++
arnsholt timotimo: There's no take in your gather
That probably makes a difference =)
rurban1 the lisp version with a typed array has the same speed as the hash or memoized version. 2.5s 15:52
15:54 lue joined
arnsholt Huh, apparently it loops with the take as well... 15:55
colomon rindolf, masak: seems like just is_abundant is very slow? I'm trying to just calculate the abundant numbers from 1 to 28,123, and it's taking a distressingly long time. 15:56
timotimo arnsholt: oops! :D 15:57
r: say [||] gather loop { my $res = (False, 0, "", $(), True).pick; say $res; take $res };
hm.
camelia rakudo-jvm 263aa0: OUTPUT«(timeout)0␤True␤␤␤0␤0␤True␤␤False␤False␤True␤␤False␤False␤␤0␤␤0␤␤True␤␤False␤True␤False␤␤␤␤0␤␤␤␤␤0␤True␤␤␤␤0␤␤True␤␤0␤␤0␤0␤False␤True␤True␤␤False␤␤False␤…» 15:58
..rakudo-parrot 263aa0: OUTPUT«(timeout)True␤True␤False␤False␤True␤␤True␤False␤0␤True␤True␤␤0␤True␤False␤True␤True␤␤False␤␤0␤False␤␤True␤False␤True␤True␤0␤␤␤␤False␤␤␤␤␤␤␤0␤␤␤␤False␤␤False␤␤␤0…»
arnsholt Looks like [||] might not short circuit properly
15:58 kivutar left, Psyche^_ joined
timotimo [...] may not know about the short-circuiting nature of whatever you plug in 16:00
arnsholt I think it's specced to do the right thing, but Rakudo might not implement it yet 16:01
timotimo yup
rindolf colomon: bitbucket.org/shlomif/project-eule...at=default - optimised.
timotimo it would surprise me greatly if it *weren't* specced to DTRT
this is a very straight forward case of DTRT at first glance :P
rindolf I did the divisors_sum in a less braindead manner. 16:03
16:03 Psyche^ left 16:04 berekuk left 16:05 berekuk joined
masak arnsholt, timotimo: nope. 16:05
S03:
"Similarly, list-associative operators that have the thunk-izing characteristics of
macros (such as short-circuit operators) lose those macro-like characteristics.
You can say
[||] a(), b(), c(), d()
to return the first true result, but the evaluation of the list is controlled
by the semantics of the list, not the semantics of C<||>."
arnsholt Oh! 16:08
In that case, I recant my previous heresy =) 16:11
timotimo d'aaw 16:12
well, we have so grep 16:13
colomon rindolf: I'm still looking at the p6 version. just calculating the adbundant numbers in that range is INCREDIBLY slow.
rindolf colomon: the Perl 6 version leaves a lot to be desired. 16:16
colomon rindolf: I am working on it. ;) 16:17
rindolf colomon: you can do it better.
colomon: ah, OK.
colomon rindolf: that I don't know
I'm playing with ideas right now.
16:17 araujo left 16:18 araujo joined, araujo left 16:19 araujo joined, berekuk left
colomon calculating is-abundant for just 20000..20025 takes 42 seconds in rakudo-jvm 16:19
16:20 araujo left 16:24 berekuk joined 16:25 araujo joined
rindolf bitbucket.org/shlomif/project-eule...at=default - this takes under 3s. :-) 16:25
rindolf is away - shower. 16:29
colomon is trying to figure out how to quickly find all the divisors of a number in p6 16:31
16:31 atroxaper joined
rurban1 under 3s is comparable to common lisp (2.5s) good 16:32
colomon doubts he'll get p6 there today
rurban1 rindolf: this needs no external deps: github.com/emef/euler/blob/master/23/p23.lisp 16:34
this neither: github.com/howeyc/cl-euler/blob/master/023.lisp (array version)
grondilu I wonder why is lisp so fast. I mean, if we make a straightfoward translation of a lisp code into perl, why wouldn't be the translated code as fast? 16:42
rurban1 because lisp has a better compiler, data structures and optimizer 16:43
clisp not so, but sbcl and better lisps for sure 16:44
clisp is more the perl of the lisps, fast io, numbers but bad data structures and optimizer. and no native code compiler 16:45
and no threads!
16:46 Piers joined
grondilu couldn't perl steal lisp's data structures and compiling methods? 16:46
geekosaur not easily 16:47
arnsholt We could, but then it'd be a Lisp rather than Perl =)
japhb Plus which, Rakudo's performance problem is not lack of skill and knowledge amongst the implementors. It's lack of *tuits* from same. 16:50
That is happily progressing, but it takes time.
16:50 FROGGS[mobile] left 16:51 FROGGS[mobile] joined
colomon just wrote [*] @factors Z** @bwd; which makes him very happy 16:51
16:53 pjcj left
geekosaur yes. the likes of SBCL has had years to go from "works" to "fast" 16:54
colomon r: say 28123/2
camelia rakudo-parrot 263aa0, rakudo-jvm 263aa0: OUTPUT«14061.5␤»
grondilu do we still hope that Perl 6 will be lightning fast one day?
colomon r: say 28123/2/60 16:55
camelia rakudo-parrot 263aa0, rakudo-jvm 263aa0: OUTPUT«234.358333␤»
masak grondilu: I know I do.
geekosaur (well, SBCL has always had a reputation for speed, but that's because the reference implementations were also much slower back then :)
japhb grondilu: My hope is that it A) makes effective use of concurrency in most of the places the spec allows/suggests it, B) starts quickly enough to be useful for implementing quickie one-shot tools, and C) with proper use of type annotations and possibly other hints, can be fast enough to fill the long-lived process roles that Perl 5, Python, and Ruby do now. 16:58
colomon r: say 28123/7/60
camelia rakudo-parrot 263aa0, rakudo-jvm 263aa0: OUTPUT«66.959524␤»
rindolf What's the best way to implement a vector of bits in Perl 6/Rakudo? Something like vec($buffer, $offset, 1) in Perl 5. 16:59
japhb I do not expect Perl 6 to be as fast as, say, asm.js, but you never know. Perhaps for particular tasks?
rurban1 grondilu: yes. see p2
17:00 zakharyas joined
grondilu what worries me though is that Perl 6 is slow even for simple stuff. I mean, just counting up to 1000 is slow. I don't understand what slows such a program: .say for ^1000 17:00
japhb rindolf: In fully-implemented Perl6, 'my bit @array', as I recall. But that's not implemented in Rakudo.
rindolf japhb: ah.
17:01 berekuk left
japhb grondilu: I don't think that's intrinsic. I think it's "unexplored parts of optimization space, where currently we are using pessimized-but-easier-to-reason-about" 17:02
17:03 ajr joined
japhb grondilu: Try using loop or while instead of for-range, and see how much faster it is. 17:03
17:03 beastd left, ajr is now known as Guest43709
grondilu I just tried loop (my int $i = 0; $i < 1000; $i = $i + 1) { say $i } 17:03
japhb Unfortunately, the idiomatic version happens to be the least optimized.
grondilu it's still much slower than Perl 5
arnsholt There are a lot of things going on behind the scenes 17:04
japhb grondilu: Well yeah, that's not a fair comparison.
arnsholt Like laziness
17:05 zakharyas left
japhb I should clarify: Expecting Rakudo to be as fast as perl5 *right now* isn't really fair -- perl5 has had a LOT of optimization, and has simpler semantics to boot. Expecting it to *one day* be as fast -- that's fair. 17:05
17:06 pecastro left 17:08 pecastro joined
rurban1 actually perl5 has not much optimizations. rakudo already has better ones 17:10
rindolf OK, that's it. I've tried to search for a long time for how to write Perl 5-like loop labels (like "last MYLOOP;" or "next MYLOOP;") in Perl 6 and could not find anything. perlcabal.org/syn/Differences.html - perhaps it should be added to this.
japhb r: my $t1 = now; my $i = 0; for ^1000 { $i++ }; my $t2 = now; loop (my $j = 0; $j < 1000; $j++) {}; my $t3 = now; my $k = 0; while $k < 1000 { $k++ }; my $t4 = now; say $i, $j, $k; say $t2 - $t1, $t3 - $t2, $t4 - $t1; 17:11
camelia rakudo-jvm 263aa0: OUTPUT«100010001000␤0.0380.0290.84␤»
..rakudo-parrot 263aa0: OUTPUT«100010001000␤0.108054280.03896200.1893130␤»
japhb r: my $t1 = now; my $i = 0; for ^1000 { $i++ }; my $t2 = now; loop (my $j = 0; $j < 1000; $j++) {}; my $t3 = now; my $k = 0; while $k < 1000 { $k++ }; my $t4 = now; say $i, $j, $k; ($t2 - $t1, $t3 - $t2, $t4 - $t1).join(', ').say; 17:12
camelia rakudo-jvm 263aa0: OUTPUT«100010001000␤0.032, 0.027, 0.086␤»
..rakudo-parrot 263aa0: OUTPUT«100010001000␤0.112052, 0.0353488, 0.195029␤»
japhb The while loop is slow on jvm ... wat?
Actually, it's slow on both. Double wat.
OH! 17:13
Duh, typo
r: my $t1 = now; my $i = 0; for ^1000 { $i++ }; my $t2 = now; loop (my $j = 0; $j < 1000; $j++) {}; my $t3 = now; my $k = 0; while $k < 1000 { $k++ }; my $t4 = now; say $i, $j, $k; ($t2 - $t1, $t3 - $t2, $t4 - $t3).join(', ').say;
camelia rakudo-jvm 263aa0: OUTPUT«100010001000␤0.03, 0.028, 0.029␤»
..rakudo-parrot 263aa0: OUTPUT«100010001000␤0.1108109, 0.0411369, 0.0422413␤»
japhb *phew*
rindolf: top of S04 talks about labels. 17:15
rindolf japhb: OK.
japhb r: my $max = 10_000; my $t1 = now; my $i = 0; for ^$max { $i++ }; my $t2 = now; loop (my $j = 0; $j < $max; $j++) {}; my $t3 = now; my $k = 0; while $k < $max { $k++ }; my $t4 = now; say $i, $j, $k; ($t2 - $t1, $t3 - $t2, $t4 - $t3).join(', ').say; 17:16
camelia rakudo-jvm 263aa0: OUTPUT«100001000010000␤1.011, 0.168, 0.132␤»
..rakudo-parrot 263aa0: OUTPUT«100001000010000␤0.2568166, 0.2904760, 0.26705334␤»
japhb r: my $max = 100_000; my $t1 = now; my $i = 0; for ^$max { $i++ }; my $t2 = now; loop (my $j = 0; $j < $max; $j++) {}; my $t3 = now; my $k = 0; while $k < $max { $k++ }; my $t4 = now; say $i, $j, $k; ($t2 - $t1, $t3 - $t2, $t4 - $t3).join(', ').say;
camelia rakudo-jvm 263aa0: OUTPUT«100000100000100000␤0.504, 0.498, 0.498␤»
..rakudo-parrot 263aa0: OUTPUT«100000100000100000␤1.96252715, 2.8407922, 2.8942043␤»
rindolf japhb: feather.perl6.nl/syn/S04.html - there doesn't seems to be a meaningful/usable example. 17:17
Or maybe they are elided?
japhb rindolf: Line 347 and following.
rindolf japhb: what is Line 347? In the source? 17:18
japhb: feather.perl6.nl/syn/S04.html - I'm talking about this.
arnsholt Rakudo doesn't implement loop labels yet, though, does it?
japhb It basically says next LABEL is sugar for LABEL.next
synopsebot: S04:347
synopsebot japhb: Link: perlcabal.org/syn/S04.html#line_347
japhb arnsholt: I don't recall -- I thought someone discussed it a month or two ago, but I dunno if they actually did anything. 17:19
rindolf japhb: OK, I seem to have done it.
FROGGS I implemented labels for nqp in a branch 17:20
rindolf japhb: pastie.org/8624071 - that's my code.
japhb FROGGS++ # mergeable? 17:21
17:21 Guest43709 is now known as ajr_
FROGGS japhb: reviewable by jnthn :o) 17:21
japhb Ah, heh. :-)
rindolf And I'm getting errors: «Undeclared name: INNER used at line 59»
I can try wrapping it in a closure and using return. 17:22
FROGGS++
japhb BTW, I find it interesting that between 10_000 and 100_000 in that loop test above, the performance profiles of r-j and r-m completely changed. r-j equalized the performance of all of them, and r-p just made for-range relatively more efficient each time $max increased. 17:24
r: my $max = 1_000_000; my $t1 = now; my $i = 0; for ^$max { $i++ }; my $t2 = now; loop (my $j = 0; $j < $max; $j++) {}; my $t3 = now; my $k = 0; while $k < $max { $k++ }; my $t4 = now; say $i, $j, $k; ($t2 - $t1, $t3 - $t2, $t4 - $t3).join(', ').say; 17:25
grondilu as if parrot had to warm up or something? :)
rindolf japhb: so what should I do now?
camelia rakudo-parrot 263aa0, rakudo-jvm 263aa0: OUTPUT«(timeout)»
japhb r: my $max = 200_000; my $t1 = now; my $i = 0; for ^$max { $i++ }; my $t2 = now; loop (my $j = 0; $j < $max; $j++) {}; my $t3 = now; my $k = 0; while $k < $max { $k++ }; my $t4 = now; say $i, $j, $k; ($t2 - $t1, $t3 - $t2, $t4 - $t3).join(', ').say; 17:26
rindolf japhb: should I wrap it in a closure and use "return;"?
camelia rakudo-jvm 263aa0: OUTPUT«200000200000200000␤0.669, 0.901, 1.094␤»
..rakudo-parrot 263aa0: OUTPUT«(timeout)»
japhb wonders what the JVM has surmised about for-range 17:27
17:28 nebuchadnezzar left, nebuchadnezzar joined
japhb rindolf: That's definitely a possibility, though IIRC you take a perf hit from the semantics of return there. 17:28
rindolf japhb: ah. 17:29
japhb But my big question is: Why are you fighting for performance on this?
Just an intellectual exercise?
rindolf japhb: I'm not, it's just that I *must* terminate the loop prematurely or I'll keep track of bigger numbers that will skew the results.
japhb OIC. Yeah, return from a closure then. 17:30
17:30 raiph joined
rindolf japhb: OK. 17:30
timotimo if we could prove that the loop in for $start..$end will be sunk, we could transform it into a loop instead 17:31
at optimize-time 17:32
is that enough analysis?
17:32 raiph left
timotimo because i think void context is already something we track in the optimizer anyway 17:33
17:33 raiph2 joined, raiph joined
arnsholt I'd think so, yeah 17:34
Modulo shenanigans with pointy blocks, optional arguments and such, possibly 17:35
timotimo things like next/last and FIRST/NEXT/UNDO should Just Work after the transformation, right?
17:35 slavik left
rindolf r: [ sub { 5+6 }.() ]; 17:35
camelia rakudo-jvm 263aa0: OUTPUT«===SORRY!=== Error while compiling /tmp/DYK50yrMy3␤Two terms in a row␤at /tmp/DYK50yrMy3:1␤------> [ sub { 5+6 }⏏.() ];␤ expecting any of:␤ postfix␤ statement end␤ statement modifi…»
..rakudo-parrot 263aa0: OUTPUT«===SORRY!=== Error while compiling /tmp/5z3dTC6LIp␤Two terms in a row␤at /tmp/5z3dTC6LIp:1␤------> [ sub { 5+6 }⏏.() ];␤ expecting any of:␤ postfix␤ statement end␤ statement mod…»
rindolf r: [ (sub { 5+6 }).() ]; 17:36
camelia ( no output )
rindolf Hmmm....
timotimo finding i think there's a ticket about that somewhere actually
17:36 kaare_ joined
timotimo std: [ sub { 5 + 6 }.() ]; 17:36
camelia std 09dda5b: OUTPUT«ok 00:01 127m␤»
timotimo rakudo is in the wrong here.
rindolf std: [ sub { 5 + 6 }() ] 17:37
camelia std 09dda5b: OUTPUT«ok 00:01 127m␤»
17:38 treehug88 joined
japhb rindolf: Looking at pastie.org/8624071 again, why are you trying to use loop labels? The place you want to early exit out of isn't multiply-nested in loops. You should just be able to 'last;' there. 17:48
17:49 slavik joined
timotimo indeed 17:49
japhb Erm, to be clearer, you aren't trying to last out of multiple levels of loops.
rindolf japhb: yes, but I always like labels for good measure - perl-begin.org/tutorials/bad-elemen...out-labels ( also see Perl Best Practices ).
17:49 jeffreykegler joined
timotimo then use the special syntax for loop labels that is already implemented in rakudo 17:49
#| INNER: 17:50
japhb Heh
timotimo for ^10 { last; #= INNER\n }
rindolf Well, I'll wait. 17:52
Can I (= shlomif on GitHub) get a commit bit for github.com/perl6/perl6-examples ? 17:53
I don't seem to have one.
17:55 denis_boyun joined
colomon rindolf: I don't seem to have the power to grant one. :\ 17:57
rindolf colomon: OK. 18:01
TimToady I think I added you 18:02
try it
18:02 kaare_ left
timotimo TimToady: what's your insight on transforming a for $start..$end into a c-style loop if it's in void context? 18:03
TimToady have to worry about scoping the loop var 18:04
18:04 FROGGS[mobile] left, FROGGS[mobile] joined
timotimo putting it into the loop(^here^) won't do it properly? 18:04
TimToady nope
timotimo good to know; would have to make a new lexical scope around it i suppose?
i think that is equal to making a QAST::Block at the QAST level 18:05
18:05 ssutch left
TimToady you'd probably need to add an OUTER to any existing OUTER's as well 18:05
well, maybe not
timotimo don't think so, the for itself would do that, too 18:06
TimToady well, maybe
timotimo except of course if it's a postfix-for
TimToady if you ref $OUTER::OUTER::foo inside the loop, you probably have to add an OUTER 18:07
18:07 treehug88 left, ssutch joined
TimToady unless we have a way of add invisible outer levels 18:07
timotimo oh, because the loop has *another* { } around the loop body
TimToady *adding 18:08
timotimo is something like CALLER::OUTER:: allowed?
TimToady which is more or less what P5 does, but then P5 doesn't have OUTER
afk for a bit 18:09
18:13 hummeleBop1 joined, pecastro left 18:14 hummeleBop left
hoelzro ahoy #perl6 18:19
r: my %int-hash{Int}; %int-hash{5}:delete 18:20
camelia rakudo-parrot 263aa0: OUTPUT«Nominal type check failed for parameter 'key'; expected Int but got Str instead␤ in method at_key at gen/parrot/CORE.setting:9101␤ in method delete_key at gen/parrot/CORE.setting:8949␤ in method delete_key at gen/parrot/CORE.setting:8946␤ in …»
..rakudo-jvm 263aa0: OUTPUT«Nominal type check failed for parameter 'key'␤ in method delete_key at gen/jvm/CORE.setting:8924␤ in block at gen/jvm/CORE.setting:1885␤␤»
hoelzro bug?
18:20 pecastro joined
rindolf TimToady: thanks! I was added - github.com/organizations/perl6/teams/14366 18:24
TimToady++
dalek pan style="color: #395be5">perl6-examples: 2460f31 | (Shlomi Fish)++ | euler/prob023-shlomif.pl:
[Euler] Add solution to No. 23.

Slow on rakudo-jvm but it works.
timotimo r: my %foo 18:27
camelia ( no output )
timotimo er
r: my %foo[Int]; say %foo{5}:exists;
camelia rakudo-jvm 263aa0: OUTPUT«===SORRY!=== Error while compiling /tmp/y0zEyaq_gl␤Shaped variable declarations not yet implemented. Sorry. ␤at /tmp/y0zEyaq_gl:1␤------> my %foo[Int]⏏; say %foo{5}:exists;␤»
..rakudo-parrot 263aa0: OUTPUT«===SORRY!=== Error while compiling /tmp/FpSv33HIvY␤Shaped variable declarations not yet implemented. Sorry. ␤at /tmp/FpSv33HIvY:1␤------> my %foo[Int]⏏; say %foo{5}:exists;␤»
TimToady delete_key has an 'as Str', which is an obvious bug 18:28
it should only coerce to Str on an unshaped array 18:29
lizmat: ^^
18:37 atroxaper left
rindolf real 2m55.630s ; user 3m14.125s - wow! Ouch. :-( 18:41
Let me try it with last.
Last with no label .
It still consumes 14.4% of my 8 GB RAM. :-( 18:43
18:44 thou joined
rindolf real 3m10.957s ; user 3m32.662s ==> didn't help. 18:46
timotimo sorry to hear that :( 18:50
i'm also sad about rakudo's performance quite often
18:52 darutoko left 18:58 thou left
japhb Well, at least there's lots of room for optimization. Which is to say, it's not like it has reparse-on-every-iteration semantics that would guarantee it slow. 18:59
dalek p: fdc0be3 | (Tobias Leich)++ | src/vm/moar/QAST/QASTRegexCompilerMAST.nqp:
look up block when rule is <:InSomething>
19:05
19:08 hummeleBop1 left 19:11 thou joined
masak there's some excellent prior art on optimizing language implementations with the same kind of late-binding characteristics as Perl 6. Strongtalk comes to mind. 19:18
the biggest reason Rakudo isn't more optimized is "haven't gotten there yet". 19:19
arnsholt Common Lisp as well 19:26
The commercial compilers optimise very well when you tell them enough about the types 19:27
timotimo masak: the main reason seems to be "timo doesn't know how to optimize things" :P 19:28
FROGGS hehe
timotimo jnthn said he wanted to completely redo the structure of the optimizer before adding more things 19:29
i understand why he'd want to do that
but it means i can't add more optimizations :P
hoelzro so what exactly is the difference between sub my-sub(Str $param) and sub my-sub($param as Str)? 19:33
19:33 hoverboard joined
timotimo i wish i would have known long ago that local vars are not almost directly equivalent to registers. then i wouldn't have tossed my "turn lexicals into locals" optimizations 19:34
hoelzro I'm guessing the latter accepts Any, but coerces to Str?
timotimo that's it, yeah
hoelzro cool
19:35 hoverboard left, hoverboard joined, hoverboard left, hoverboard joined, psch left, psch joined
dalek pan style="color: #395be5">perl6-examples: ec42eb2 | (Shlomi Fish)++ | euler/prob023-shlomif.pl:
Add "use v6;" for good measure.

Make it recognise that it's a Perl 6 program.
19:36
hoelzro hmm 19:38
I can't find an example of '$param as Type' in roast
19:38 SamuraiJack left
hoelzro oh, ack is being lazy 19:38
hmm 19:39
still no finds
19:40 denis_boyun_ joined
hoelzro is trying to find where that as thing is specc'd 19:40
hoelzro .oO( Speck'd )
TimToady it's de-spec'd in favor of Str(Any) 19:41
19:41 denis_boyun left
TimToady but if you can't differentiate the type of object hashes from string hashes nominally, neither 'as' nor 'Str(Any)' is going to help 19:41
19:42 aindilis joined
hoelzro yeah, I thought this might be a bug I could actually fix 19:43
it's starting to look harder =/
TimToady you'd have to use a conditional inside, not a sig match
but isn't object hashhood mixed in?
you oughta be able to differentiate in the siggie
hoelzro I think I have to study the hash source more 19:44
it's still fairly Greek to me
19:44 hoverboard left, hoverboard joined, hoverboard left, hoverboard joined
hoelzro hmm 19:45
19:45 FROGGS[mobile] left
hoelzro I suppose 19:45
19:46 FROGGS[mobile] joined
hoelzro that I could remove the coercion from delete_key 19:46
and enforce it in at_key?
hmm
but
then I don't think keys would be properly coerced to strings for non-typed hashes.
[Coke] moar is going to break 95% today! 19:47
hoelzro whoa 19:48
\o/
that's incredible
that's 95% JVM tests, right?
19:48 raiph2 left, raiph left
colomon !!!!! 19:49
[Coke] www.reddit.com/r/perl6/comments/1uq...ap_search/ 19:51
aye.
er, hoelzro: aye
hoelzro sweet
19:54 treehug88 joined, denis_boyun_ left 19:57 denisboyun joined
grondilu better yet would be a parser for ABNF grammar, wouldn't it? 19:57
19:57 FROGGS[mobile] left 19:58 FROGGS[mobile] joined
grondilu (though I'm not sure it's possible) 19:58
19:59 hoverboard left, hoverboard joined 20:00 hoverboard is now known as Guest73665 20:01 Guest73665 left, Guest73665 joined, Guest73665 is now known as hoverboard 20:02 hoverboard left, treehug88 left 20:03 hoverboard joined, hoverboard left, hoverboard joined 20:05 moistcherry joined 20:06 Diu joined 20:09 treehug88 joined 20:11 treehug88 left 20:18 moistcherry left, moistcherry joined, FROGGS[mobile] left, FROGGS[mobile] joined, moistcherry is now known as Guest19701
hoelzro if I *do* end up fixing this bug (spec tests will be running while I'm at a movie), should I add a regression test to the repo? 20:19
20:29 Diu left, Guest19701 left
hoelzro hmm 20:30
also, would it be a bad idea to add a deprecation warning for '$param as TYPE'?
that's probably something else I could do 20:31
TimToady that'd be cool, even if we don't have coercive types yet 20:35
and yes, tests are good :)
hoelzro under Rakudo's repo, or roast's? 20:36
20:36 raiph2 joined, raiph joined
TimToady they're really the same, so doesn't matter 20:36
hoelzro so Str(Any) doesn't work yet, but $param as Str does?
TimToady but roast is the direct one
yes, but 'as' is going away
hoelzro ok
good to know
so under roast/integration, or the typed hash tests? 20:37
TimToady we can still use 'as', presuming it'll get translated to Str() when that's implemented
hoelzro mkay
TimToady typed hash, I'd think
hoelzro ok
TimToady but maybe we don't wanna use 'as' if it's deprecated, or vice versa 20:38
can always use an explicit conversion inside, but then it's harder to spot where a coercive type is wanted
hoelzro I thought that, but maybe the deprecation warning can wait until Str(Any) is impl'd 20:39
then it's easy to convert
TimToady is also fine
hoelzro sweet, my patch compiles 20:41
and it passes t! 20:42
20:42 zakharyas joined 20:46 smls joined
smls This may be a stupid question, but why do we need a colon between a method name and its arguments, to call it without parenthesis? 20:48
Perl 6: my @numbers = [1, 2, 3].map: { 10 + $_ }; 20:49
Ruby: numbers = [1, 2, 3].map { |x| 10 + x };
^^ other languages get away without it
TimToady by not being extensible 20:51
and by not being self-clocking
but mainly, we need to know whether method call wants arguments 20:52
how do you parse $obj.meth + 1 if you don't know whether the + 1 is an argument to .meth? 20:53
hoelzro regarding Hash.pm: what's the difference between bind_key and STORE_AT_KEY? I take it the former has something to do with containers? 20:54
smls TimToday: But why is this only a problem with methods and not subs?
FROGGS smls: otherwise we would need to force writing $obj.meth() + 1 when you don't want to pass arguments 20:55
rindolf Good night, everybody - thanks for everything.
hoelzro movie &
japhb o/ rindolf
And hoelzro, apparently. 20:56
20:56 rindolf left
japhb r: multi sub infix:<*=>(Int $a is rw, Int $b) { say "Snort!"; $a = $a * $b }; my $foo = 5; say $foo *= 6; 20:58
camelia rakudo-parrot 263aa0, rakudo-jvm 263aa0: OUTPUT«Snort!␤30␤»
TimToady smls: listops don't generally pretend to be variables, but object attributes do that with great frequency 20:59
afk &
21:04 takesako left 21:05 clsn_ left 21:09 jeffreykegler left 21:13 raiph2 left, raiph left, hoverboard left 21:19 hoverboard joined, hoverboard left 21:20 hoverboard joined, hoverboard left, takesako joined 21:28 rurban1 left
psch i've definitely been missing something for the last few hours 21:31
as i wrote a few days back, i have a find_symbol that find's Exception and subtypes 21:32
i can even call .new on those
but when i try to hand arguments to .new i get a nominal type check failure for '$got', which doesn't appear anywhere near where i'm doing things
this is all still the optimizer stuff, which i'm developing a similar sentiment as hoelzro developed to coercive types 21:33
*sentiment towards
gist.github.com/peschwa/8377306 # if i leave out |%opts in line 48, the exception happens and is thrown 21:40
(i'm aware that it probably shouldn't be thrown there, but i'm still inching towards "make it work at all" - although maybe that's part of the problem..?) 21:41
masak psch++ # persistence
FROGGS psch: what if you $*W.p6ize_recursive the %opts when passing it along? 21:42
psch FROGGS: i'll try that 21:43
21:43 treehug88 joined
FROGGS ummm 21:44
psch the $.got in X::ArgumentMismatch?
FROGGS no, the lines 25 to 36 do that I think
psch oh
yeah i added the $.got afterwards thinking "maybe..."
and it's still there but doesn't help 21:45
anyway, i'm building with another call to p6ize_recursive, for confirmation
FROGGS btw, it always complains about a variable called $got when you pass an argument to a sub or method that is Mu 21:48
p: sub test($a) { }; a(Mu)
camelia rakudo-parrot 263aa0: OUTPUT«===SORRY!=== Error while compiling /tmp/PvOL5kXh_F␤Undeclared routine:␤ a used at line 1␤␤»
FROGGS p: sub test($a) { }; test(Mu)
camelia rakudo-parrot 263aa0: OUTPUT«Nominal type check failed for parameter '$a'; expected Any but got Mu instead␤ in sub test at /tmp/SVh7oXQyLf:1␤ in block at /tmp/SVh7oXQyLf:1␤␤»
FROGGS ohh, hmmm
maybe the $got only shows up in settings or so 21:49
so you can comment more elements of you %opts hash, to see which element is not p6y enough
psch okay, thanks 21:52
21:52 ssutch left 21:53 mtk joined 21:55 ajr_ left 21:56 wooden left 22:05 berekuk joined 22:06 wooden joined 22:09 treehug88 left 22:11 smls left
FROGGS v5 spectest && sleep ===> gnight & 22:11
22:18 telex left
psch alright, it was $protoguilt 22:18
thanks and good night FROGGS 22:19
22:19 berekuk left, berekuk joined 22:20 telex joined 22:29 PacoAir left 22:41 zakharyas left 22:42 treehug88 joined 23:01 grondilu left 23:03 kaare_ joined 23:09 Piers left 23:11 Piers joined 23:21 treehug88 left 23:26 dmol left 23:43 Rotwang left
masak the notion of intentionally confusing scalars and one-element containers can be found in category theory. 23:47
23:48 araujo left
masak it's called being "monoidal". 23:48
in fact, monoidal categories could more generally be seen as a kind of list flattening. 23:49
so ((x, y), z) and (x, (y, z)) end up being equivalent.
this has been your daily category theory. good night, #perl6. 23:53
psch night masak