Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2017-07-15

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:23 skids joined #perl6
00:32 evalable6 joined #perl6
00:32 coverable6 joined #perl6
00:32 bloatable6 joined #perl6
00:32 greppable6 joined #perl6
00:32 committable6 joined #perl6
00:32 unicodable6 joined #perl6
00:32 bisectable6 joined #perl6
00:32 quotable6 joined #perl6
00:32 benchable6 joined #perl6
00:32 statisfiable6 joined #perl6
00:48 stan joined #perl6
00:48 AlexDaniel joined #perl6
00:50 Cabanossi joined #perl6
00:50 johnybravo joined #perl6
00:50 johnybravo left #perl6
01:09 gdonald joined #perl6
01:20 Cabanossi joined #perl6
01:33 cpage_ joined #perl6
01:39 reino4477 joined #perl6
01:39 reino4477 how can I use generics? I've not found anything in the doc-ion.
01:42 TimToady joined #perl6
01:47 MasterDuke joined #perl6
01:47 reino44771 joined #perl6
01:47 reino44771 left #perl6
01:47 reino44771 joined #perl6
01:48 ilbot3 joined #perl6
01:48 Topic for #perl6 is now »ö« Welcome to Perl 6! | https://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:,  or /msg camelia p6: ... | irclog: http://irc.perl6.org or http://colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
01:48 timotimo but you can use roles as if they were classes in something we call "punning"
01:49 timotimo m: role GenericRole[::Type, $value] { has Type $.foo; method do-the-thing { say $value; say $.foo.^name; say Type.^name } }; GenericRole[Str, "fooooo"].new(foo => "yo").do-the-thing()
01:49 camelia rakudo-moar 23ad2c: OUTPUT: «fooooo␤Str␤Str␤»
01:49 timotimo ^- no class any more
01:49 reino44771 thx
01:49 timotimo using a role like that acts the same way as if you had written class :: does TheRole[the, arguments] {}, i.e. it mixes the role into an empty class and gives you that class
02:03 tamva joined #perl6
02:05 noganex joined #perl6
02:12 cpage_ joined #perl6
02:24 BenGoldberg m: sub foo {...}; role R[$s] { method s{$s} }; constant C = R[&foo.signature]; dd C.s;
02:24 camelia rakudo-moar 23ad2c: OUTPUT: «Signature $s = :()␤»
02:25 BenGoldberg m: sub foo {...}; role R[$s] { method s{$s} }; constant C = R[:()]; dd C.s;
02:25 camelia rakudo-moar 23ad2c: OUTPUT: «===SORRY!===␤QAST::Block with cuid 7 has not appeared␤»
02:25 * BenGoldberg wonders, why 7?
02:48 Vitaliy_ joined #perl6
03:02 cpage_ joined #perl6
03:16 epony joined #perl6
03:20 Cabanossi joined #perl6
03:48 Cabanossi joined #perl6
04:04 kaare_ joined #perl6
04:14 zoll joined #perl6
04:33 Cabanossi joined #perl6
05:00 Todd__ joined #perl6
05:01 Todd__ Hi All,  I just got clipped by https://github.com/retupmoca/P6-Net-SMTP/issues/16
05:01 Todd__ # perl6 -v This is Rakudo version 2017.06 built on MoarVM version 2017.06 implementing Perl 6.c.
05:01 Todd__ Is there an newer RPM out there somewhere for Fedora?  I do I have to compile from scratch?
05:03 zoll Todd__: could you not use zef to update only Net::SMTP?
05:03 Todd__ Did not think of that.  I will try
05:03 Cabanossi joined #perl6
05:03 llfourn Todd__: didn't we establish the bug isn't in Net::SMTP?
05:04 llfourn NeuralAnomaly: status
05:04 NeuralAnomaly llfourn, [✘] Next release is today. Since last release, there are 23 new still-open tickets (0 unreviewed and 0 blockers) and 61 unreviewed commits. See http://perl6.fail/release/stats for details
05:04 Todd__ I am already at the latest version.  Timo said the issue was in Rakudo and that he had fixed it.
05:04 zoll BTW, Todd__, timo mentions a simple fix by editing the file.
05:05 Todd__ I was not smart enough to know what he meant
05:06 llfourn Todd__: The next release should be soon, someone will release new rpms after that I guess.
05:06 zoll change "$self.conn.nl-in = "\r\n";" to "$self.conn.nl-in = ("\r\n");"
05:06 setty1 joined #perl6
05:06 zoll <-- untested
05:07 llfourn $self.conn.nl-in = "\r\n",; # this actually
05:07 Todd__ I am trying to download the clone from git
05:07 zoll ah. thank you, llfourn
05:11 Todd__ Poop!  Type check failed in binding to parameter '@seps'; expected Positional but got Str ("\r\n")
05:11 Todd__ Any words of wisdom?
05:12 ugexe ["\r\n"]
05:12 ugexe otherwise probably ("\r\n",)
05:12 llfourn Todd__: did you make the change?
05:13 Todd__ llfourn.  Any idea on the time table for the next release so I can inform my customer?  (Should I add a couple of weeks just in case?)
05:13 Todd__ Do you want me to change it to  `["\r\n"]` or `("\r\n",)`
05:14 llfourn either should work
05:14 Todd__ I changed it to ("\r\n") without the comma
05:14 llfourn that won't work
05:15 Todd__ Do yo have a preference?
05:15 llfourn ("\r\n",)
05:16 llfourn ugexe++ # what I said initially was wrong too
05:16 Todd__ It looks like it worked.  I have to check something
05:17 Todd__ It worked.  Thank you!  What did I do?
05:19 zoll-tester joined #perl6
05:20 ugexe you sent a pr with the changes
05:22 ugexe but rakudo now takes a list of line separators and not a single string.
05:23 ugexe m: say "\r\n".WHAT; say ("\r\n",).WHAT
05:23 camelia rakudo-moar 23ad2c: OUTPUT: «(Str)␤(List)␤»
05:24 llfourn Todd__: btw I don't know when rpms get release after there is a release. It seems to be pretty fast.
05:25 zoll (...,).WHAT produces better output for someone who is learning perl6 than $x.WHAT (given $x = (...,))
05:27 zoll ugh, never mind. that also produces same output
05:27 zoll I used .perl instead of .WHAT
05:29 zoll-tester left #perl6
05:33 Cabanossi joined #perl6
05:34 ugexe if you need something slightly more verbose... `perl6 --target=ast -e '("\r\n",)'`
05:35 Todd__ At the risk of bing laughed off this form, I can only find perl5 examples on google.
05:36 Todd__ What am I doing wrong here. I want the result to be "ghi".  I am trying to do a "greedy" subsitution.
05:36 Todd__ perl6 -e 'my $x="abc/def/ghi"; $x ~~ s{*./}{}; say $x'
05:36 Todd__ Quantifier quantifies nothing
05:38 llfourn perl6 -e 'my $x="abc/def/ghi"; $x ~~ s:g!.*"/"!!; say $x'
05:38 zoll Why is "()" is a list but (3) is Int-but-not-list per rakudo? Yet "(,)" is a syntax error and "(3,)" is a list?
05:39 Todd__ thank you!
05:40 llfourn Todd__: you'll have to add s:g:i etc to get ignorecase etc too
05:40 Todd__ Is there a way to do it with {} brackets?
05:41 zoll llfourn: why does "/" need to be quoted?
05:41 Todd__ perl6 -e 'my $x="abc/def/ghi"; $x ~~ s/.*\///; say $x'
05:41 llfourn because Todd__ wants to match it literally
05:41 Todd__ saves the back slash and gets you out of \\\/\/\/\\\/ hell
05:42 ugexe m: say "hello " ~ (1 ?? 2 !! 3); # because parens arent just used for positional
05:42 camelia rakudo-moar 23ad2c: OUTPUT: «hello 2␤»
05:42 Todd__ s is subsitute.  g is global?  i is case insensitive?
05:42 llfourn in p6 regex non-metacharaters have to be quoted
05:42 llfourn Todd__: yep
05:42 zoll ok. "/" is a metacharacter.
05:43 llfourn you have to quote it either way
05:43 timotimo yo
05:43 llfourn I don't think "/" is used for anything
05:43 timotimo need me for something?
05:44 llfourn you can still leave alphanumeric characters as non-quoted
05:45 Todd__ If I am "greedy", is ther a reason to use 'g'?
05:46 llfourn g is for global?
05:47 Todd__ perl6 -e 'my $x="abc/afg/ahi"; $x ~~ s:g/a/r/; say $x' rbc/rfg/rhi
05:47 Todd__ seems to be global
05:47 Todd__ perl6 -e 'my $x="abc/Afg/ahi"; $x ~~ s:g:i/a/r/; say $x' rbc/rfg/rhi
05:48 timotimo m: my $a = "abc/afg/ahi"; say $a.substr($a.rindex("/"))
05:48 camelia rakudo-moar 23ad2c: OUTPUT: «/ahi␤»
05:48 timotimo m: my $a = "abc/afg/ahi"; say $a.substr($a.rindex("/") + 1)
05:48 camelia rakudo-moar 23ad2c: OUTPUT: «ahi␤»
05:48 timotimo ^- do it without regex, it'll be a few hundred times faster
05:49 timotimo alternatively you can do a match instead of a substitution and match "the other thing"
05:49 timotimo m: my $x = "abc/afg/ahi"; $x ~~ m/.* \/ <( .* /; say $/.Str
05:49 camelia rakudo-moar 23ad2c: OUTPUT: «ahi␤»
05:49 timotimo alternatively, use split
05:50 timotimo m: my $x = "abc/afg/ahi"; say $x.split("/").tail
05:50 camelia rakudo-moar 23ad2c: OUTPUT: «ahi␤»
05:50 Todd__ Are {} out in Perl6 (I use them a lot in Perl 5)
05:50 timotimo you'll want to consider what happens when there are no / in there at all, btw
05:50 greppable6 joined #perl6
05:51 timotimo m: my $x = "foobarbaz"; say $x.substr($x.rindex("/") + 1)
05:51 camelia rakudo-moar 23ad2c: OUTPUT: «Use of Nil in numeric context␤  in block <unit> at <tmp> line 1␤oobarbaz␤»
05:51 timotimo this is problematic
05:51 timotimo my example with the m/ / will also not work if there's no / in there
05:51 ufobat joined #perl6
05:51 timotimo m: my $x = "foobarbax"; say $x.split("/").tail
05:51 camelia rakudo-moar 23ad2c: OUTPUT: «foobarbax␤»
05:51 zoll-tester joined #perl6
05:52 timotimo this however works
05:52 zoll-tester left #perl6
05:54 llfourn I'm not sure if you can use {} to do something like s{foo}{bar}
05:55 llfourn If I try it tells me to use assignment syntax
05:55 zoll timotimo: can you explain why "xy".split( '' ) returns two empty strings before & after each letter?
05:55 timotimo sure
05:55 AlexDaniel m: $_ = ‘abcdefg’; s{cd} = ‘OH’; .say
05:55 camelia rakudo-moar 23ad2c: OUTPUT: «abOHefg␤»
05:55 timotimo there's an empty string at the beginning and at the end of "xy"
05:55 AlexDaniel llfourn: ↑
05:56 timotimo it's a generalization from what you get when your split characters are at the beginning and end of the string
05:56 timotimo m: "axaya".split("a").perl.say
05:56 camelia rakudo-moar 23ad2c: OUTPUT: «("", "x", "y", "").Seq␤»
05:56 timotimo if that were not the case, you wouldn't get the same thing back when you join it again
05:56 llfourn AlexDaniel: thanks
05:57 AlexDaniel llfourn: this looks so weird though :)
05:58 llfourn it is pretty weird
05:58 llfourn given that I'm not assigning anything
05:58 llfourn but trying to to string replacement
05:58 AlexDaniel hm… that's an interesting point :)
05:58 timotimo it feels a bit like an assignment to me
05:58 timotimo the weird thing about it is that it's thunky
05:59 timotimo m: $_ = "whoa dude what"; s{" ") = <! ? , . : ;>.pick; say $_
05:59 camelia rakudo-moar 23ad2c: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Couldn't find terminator }␤at <tmp>:1␤------> 3$_ = "whoa dude what"; s{" "7⏏5) = <! ? , . : ;>.pick; say $_␤    expecting any of:␤        double quotes␤        infix stopper␤»
05:59 timotimo m: $_ = "whoa dude what"; s{" "} = <! ? , . : ;>.pick; say $_
05:59 camelia rakudo-moar 23ad2c: OUTPUT: «whoa;dude what␤»
05:59 timotimo m: $_ = "whoa dude what"; s{" "} = <! ? , . : ;>.pick; say $_
05:59 camelia rakudo-moar 23ad2c: OUTPUT: «whoa:dude what␤»
05:59 timotimo m: $_ = "whoa dude what"; s{" "} = <! ? , . : ;>.pick; say $_
05:59 camelia rakudo-moar 23ad2c: OUTPUT: «whoa;dude what␤»
05:59 timotimo oh, forgot the :g
05:59 timotimo m: $_ = "whoa dude what is happening"; s:g{" "} = <! ? , . : ;>.pick; say $_
05:59 camelia rakudo-moar 23ad2c: OUTPUT: «whoa.dude,what:is?happening␤»
05:59 timotimo m: $_ = "whoa dude what is happening"; s:g{" "} = <! ? , . : ;>.pick; say $_
05:59 camelia rakudo-moar 23ad2c: OUTPUT: «whoa!dude;what,is.happening␤»
06:00 AlexDaniel I like this also:
06:00 timotimo m: $_ = "whoa dude what is happening"; s:g{" "} = $/.target; say $_
06:00 camelia rakudo-moar 23ad2c: OUTPUT: «whoawhoa dude what is happeningdudewhoa dude what is happeningwhatwhoa dude what is happeningiswhoa dude what is happeninghappening␤»
06:00 AlexDaniel m: my $x = ‘abcdefg’; $x ~~ s「cd」 = ‘OH’; $x.say
06:00 camelia rakudo-moar 23ad2c: OUTPUT: «abOHefg␤»
06:00 llfourn ohh
06:01 llfourn so you can actually use it without $_ being set
06:01 timotimo yeah because ~~ sets $_ for you
06:01 llfourn ^ I don't always find the above to be the case
06:01 AlexDaniel well, I guess so… it just felt like it should work, and turns out it does :)
06:02 llfourn m: my $a = "foo"; say $a ~~ .uc
06:02 camelia rakudo-moar 23ad2c: OUTPUT: «False␤»
06:02 llfourn m: my $a = "foo"; say $a.uc ~~ .uc
06:02 camelia rakudo-moar 23ad2c: OUTPUT: «True␤»
06:02 llfourn nvm I guess I got confused somewhere
06:03 timotimo i'm not sure we're actually helping Todd__ at all :)
06:03 Cabanossi joined #perl6
06:04 llfourn Todd__: in conclusion you can do. my $x = "foo"; $x ~~ s{foo} = "bar".  Which is like s/foo/bar.
06:04 AlexDaniel looking at it again, I think the assignment syntax is much clearer
06:05 llfourn I like it now that I know you can do it on stuff other than $_
06:06 llfourn (well know I know that ~~ actually sets $_ consistently)
06:09 Todd__ I understand.  Thank you!
06:15 andrzejku joined #perl6
06:29 Todd__ bye bye
06:41 konsolebox joined #perl6
06:44 mcmillhj joined #perl6
06:54 nadim joined #perl6
07:06 espadrine joined #perl6
07:24 wamba joined #perl6
07:35 darutoko joined #perl6
07:48 Cabanossi joined #perl6
08:00 kurahaupo joined #perl6
08:03 itaipu joined #perl6
08:06 mr-foobar joined #perl6
08:07 ufobat joined #perl6
08:23 nadim Good morning, what's the role of the 'provides' section in META6.json ?
08:23 rindolf joined #perl6
08:32 stmuk_ I see the go people are arguing about their language naming on twitter
08:32 zoll Go got nothing on Perl 6, I say.
08:32 zoll stmuk_: got a link?
08:33 tyil[m] zoll: they got popularity
08:33 tyil[m] and speed :'3
08:33 zoll my point was about the name.
08:34 stmuk_ zoll: see rob poke's thread
08:34 stmuk_ errr rob pike even
08:49 Cabanossi joined #perl6
08:52 zoll left #perl6
08:58 Gothmog_ joined #perl6
09:08 nadim m: my $s = 1 ; my $s2 = 2 ; $s := $s2 if $s2.defined ; say $s
09:08 camelia rakudo-moar 23ad2c: OUTPUT: «2␤»
09:08 nadim m: my $s = 1 ; my $s2 = 2 ; $s = $s2 if $s2.defined ; say $s
09:08 camelia rakudo-moar 23ad2c: OUTPUT: «2␤»
09:08 nadim m: my $s = 1 ; my $s2 = 2 ; $s [R//]= $s2 ; say $s
09:08 camelia rakudo-moar 23ad2c: OUTPUT: «2␤»
09:09 nadim m: my $s = 1 ; my $s2 = 2 ; $s [R//]:= $s2 ; say $s
09:09 camelia rakudo-moar 23ad2c: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Preceding context expects a term, but found infix := instead␤at <tmp>:1␤------> 3my $s = 1 ; my $s2 = 2 ; $s [R//]:=7⏏5 $s2 ; say $s␤»
09:09 nadim isn't it possible to use [R//] with := ?
09:17 parv joined #perl6
09:55 wowee joined #perl6
10:04 Cabanossi joined #perl6
10:17 Ven joined #perl6
10:20 eliasr joined #perl6
10:30 Cabanossi joined #perl6
10:37 Geth ¦ doc: 1b8b5bc028 | (Elizabeth Mattijsen)++ | doc/Language/setbagmix.pod6
10:37 Geth ¦ doc: Fix 2 typos
10:37 Geth ¦ doc: review: https://github.com/perl6/doc/commit/1b8b5bc028
10:38 lizmat looking at the documentation in https://docs.perl6.org/language/setbagmix , I would want to write a lot there, but this would need more community feedback
10:38 lizmat that we won't be able to get before the R* release
10:38 lizmat so afaiac , I won't be touching doc anymore until after the R* release
10:39 lizmat afk&
10:48 notbenh joined #perl6
11:27 rindolf joined #perl6
11:38 robertle joined #perl6
11:40 Ven joined #perl6
11:42 titsuki joined #perl6
11:48 TimToady joined #perl6
11:51 BenGoldberg joined #perl6
12:03 szabgab joined #perl6
12:48 Cabanossi joined #perl6
12:53 cpage_ joined #perl6
13:00 * geekosaur wonders if there's somewhere in the documentation to put the description of how process groups work; it's not strictly perl 6 and it's unix specific but I think this is the second time someone's been confused by it
13:02 geekosaur also it's amazing how many people don't get the idea that a multitasking system has more than one process running at the same time
13:03 |oLa| joined #perl6
13:12 zakame joined #perl6
13:15 lizmat joined #perl6
13:15 lucasb joined #perl6
13:16 zakame joined #perl6
13:16 zakame joined #perl6
13:18 BenGoldberg geekosaur, Multitasking is just an illusion.
13:27 geekosaur that's exactly what people think...
13:27 geekosaur your computer would never work at all if it worked the way everyone thinks it does
13:28 geekosaur (there was also a time when that was literally true, but computers have had multiple CPU cores for how long now?)
13:29 zakame joined #perl6
13:31 zakame joined #perl6
13:32 geekosaur and even when it was true because the computer only had one CPU, what process was current on the CPU changed by the millisecond. trust me, humans do not track what process is current by the millisecond
13:33 geekosaur most of them would insist the other processes are not current even though they're on the cpu; the "current process" is whatever they are interacting with on the terminal and somehow that process knows to keep all the others running or stop them if it receives a signal or etc.
13:33 geekosaur if computers actually worked that way, *every* programmer would get it wrong.
13:36 timotimo so, if we open our source files and set \n=finish\n as separator, we could totally accept perl6 source files that end in a binary blob
13:36 geekosaur it's the return of __END__!
13:42 zakame joined #perl6
13:42 pmurias joined #perl6
13:51 zakame joined #perl6
14:00 timotimo the END is back
14:08 zakame joined #perl6
14:09 araraloren joined #perl6
14:10 araraloren evening
14:11 araraloren I know use grammar we can define a recursive regex, is there any other way can do this?
14:12 araraloren Such like my regex A { 1 | <&A> };
14:12 araraloren Oh I know
14:13 araraloren my regex A { 1 <&A>? }; can do this, sorry
14:15 Ven joined #perl6
14:16 zakame joined #perl6
14:18 Cabanossi joined #perl6
14:19 zakame joined #perl6
14:19 zakame joined #perl6
14:20 zakame joined #perl6
14:21 zakame joined #perl6
14:21 nhywyll joined #perl6
14:22 timotimo does somebody want to make "my ($a, $b, $c);" faster? :)
14:23 zakame joined #perl6
14:28 ufobat joined #perl6
14:29 zakame joined #perl6
14:31 zakame joined #perl6
14:39 zakame joined #perl6
14:40 kaare_ joined #perl6
14:43 khw joined #perl6
14:46 kaare_ joined #perl6
14:47 zakharyas joined #perl6
14:49 Cabanossi joined #perl6
14:52 gdonald joined #perl6
15:00 kerframil joined #perl6
15:03 espadrine joined #perl6
15:04 kaare_ joined #perl6
15:10 domidumont joined #perl6
15:15 ggoebel joined #perl6
15:16 domidumont joined #perl6
15:17 spreadLink joined #perl6
15:17 leont_ joined #perl6
15:20 Ven joined #perl6
15:26 nadim Hi, I am going to make a change to my favorite module (Data::Dump::Tree) as it has now three different environments, Termina, terminal with NCurses and HTML, of course they don't handle color the same way which forces me to stop dealing with Str but have some ColorStr type. i wonder if by, a very unlikely chance someon has seen such a class somewhere. Not difficult to write but I rather no re-invent.
15:30 araraloren Terminal color ?
15:31 araraloren Do you mean Terminal::ANSIColor ?
15:32 nadim No, I mean a Str class that also caaries color attributes with it
15:33 lizmat role HasColor { has $.color }; my $a = "foo" but HasColor ?
15:34 nadim a bunch of them and they shall concatenate while keeping the color, and, let's dream, can render itself in multiple environments
15:34 nadim but that was a good idea for a single string.
15:35 lizmat m: role Color[$color] { method color { $color } }; my $a = "foo" but Color["red"]; dd $a.color   # using parameterized roles
15:35 camelia rakudo-moar 23ad2c: OUTPUT: «Str $color = "red"␤»
15:35 nadim I guess I should also have an operator to create them, ColorStr.new: :color(...), :str<...> ; is going to be tiresome very quickly
15:36 nadim lizmat: I like the approach
15:41 Morfent joined #perl6
15:42 colomon Is there a Windows MSI out there for a recent Rakudo?  All I’ve found so far are Rakudo Stars from April or earlier.
15:42 * colomon is building a new Windows 10 VM beause his old one blew up :\
15:46 colomon aha!  http://rakudo.org/downloads/rakudo/
15:46 colomon oh, wait, those aren’t MSIs
15:47 colomon perl6.org
15:48 * colomon grumpily gives up and installs R* 2017.04
15:50 Morfent can you compile rakudo on windows?
15:50 colomon I don’t know that I can — especially with most of my development tools not installed yet — but somebody can, obviously.
15:51 colomon jnthn still develops on Windows as far as I know.
15:51 Morfent ah
15:54 Morfent compiling it takes hardly any time to do, so if you can't find the msis it's not a problem after getting the dependencies installed
15:55 araraloren Yeah, you can I make a MyStr has a terminal width
15:56 araraloren nadim, you can inherit from Str
16:05 domidumont joined #perl6
16:06 cpage_ joined #perl6
16:14 Ven joined #perl6
16:33 MasterDuke colomon: the next R* is going to be based on 2017.07, which should be released today, so there should be a new R* sometime after
16:34 colomon ooooo
16:35 MasterDuke i think stmuk_ usually waits a week or so
16:40 zakharyas joined #perl6
16:46 kaare_ joined #perl6
16:48 Cabanossi joined #perl6
16:51 mr-fooba_ joined #perl6
17:03 zakharyas joined #perl6
17:04 ugexe i use rakudobrew on windows, but yeah you need a compiler and perl installed
17:05 zengargoyle joined #perl6
17:06 Voldenet Is it a good idea to subtype "Stringy:D" for its every use case and then move constraint checking into a type?
17:06 Voldenet I'm sure it's very elegant and tidy, but wouldn't it kill performance to re-check this a lot?
17:07 Ven_ joined #perl6
17:09 Voldenet m: subset S of Stringy:D where { .chars > 0 }; Str $t = "some text"; (sub (S $a) { $a.say })($a);
17:09 camelia rakudo-moar 23ad2c: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3S of Stringy:D where { .chars > 0 }; Str7⏏5 $t = "some text"; (sub (S $a) { $a.say ␤    expecting any of:␤        infix␤        infix stopper␤      …»
17:09 Voldenet m: subset S of Stringy:D where { .chars > 0 }; my Str $t = "some text"; (sub (S $a) { $a.say })($a);
17:09 camelia rakudo-moar 23ad2c: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Variable '$a' is not declared␤at <tmp>:1␤------> 3 = "some text"; (sub (S $a) { $a.say })(7⏏5$a);␤»
17:09 Voldenet m: subset S of Stringy:D where { .chars > 0 }; my Str $t = "some text"; (sub (S $a) { $a.say })($t);
17:09 camelia rakudo-moar 23ad2c: OUTPUT: «some text␤»
17:09 Voldenet m: subset S of Stringy:D where { .chars > 0 }; my Str $t = ""; (sub (S $a) { $a.say })($t);
17:09 camelia rakudo-moar 23ad2c: OUTPUT: «Constraint type check failed in binding to parameter '$a'; expected S but got Str ("")␤  in sub  at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
17:10 ugexe where *.chars
17:12 ugexe still flawed though
17:12 ugexe m: my $buf = "x".encode; say $buf ~~ Stringy; say $buf.chars
17:12 camelia rakudo-moar 23ad2c: OUTPUT: «True␤Cannot use a Buf as a string, but you called the chars method on it␤  in block <unit> at <tmp> line 1␤␤»
17:12 ugexe m: my $buf = "x".encode; say $buf ~~ Stringy; say $buf.?chars # I feel like this *should* work but it doesnt
17:12 camelia rakudo-moar 23ad2c: OUTPUT: «True␤Cannot use a Buf as a string, but you called the chars method on it␤  in block <unit> at <tmp> line 1␤␤»
17:14 Voldenet m: subset S of Stringy:D where *.chars; my Str $a = "a"; sub b(S $a) { $a }; for ^10000 { b($a) }; (now - BEGIN now).say
17:14 camelia rakudo-moar 23ad2c: OUTPUT: «0.0762509␤»
17:14 Voldenet m: subset S of Stringy:D where *.chars; my S $a = "a"; sub b(S $a) { $a }; for ^10000 { b($a) }; (now - BEGIN now).say
17:14 camelia rakudo-moar 23ad2c: OUTPUT: «0.07377091␤»
17:14 Voldenet doesn't look like a smashing difference
17:16 ugexe m: my $buf = "x".encode; say $buf ~~ Stringy; say $buf.Stringy; # cause this doesn't really make sense
17:16 camelia rakudo-moar 23ad2c: OUTPUT: «True␤x␤»
17:16 ugexe er that wasnt what i thought it was gonna say
17:17 ugexe yes it did
17:18 Cabanossi joined #perl6
17:18 Voldenet m: "".encode.Stringy.chars.say
17:18 camelia rakudo-moar 23ad2c: OUTPUT: «0␤»
17:19 Voldenet m: "ó".encode.Stringy.chars.say
17:19 camelia rakudo-moar 23ad2c: OUTPUT: «1␤»
17:19 BenGoldberg joined #perl6
17:21 ugexe m: my $buf = "x".encode; my $buf2 = Buf.new($buf); say $buf.perl; say $buf2.perl; say $buf ~~ Stringy; say $buf2 ~~ Stringy; say $buf.Stringy; say $buf2.Stringy
17:21 camelia rakudo-moar 23ad2c: OUTPUT: «utf8.new(120)␤Buf.new(120)␤True␤True␤x␤Cannot use a Buf as a string, but you called the Stringy method on it␤  in block <unit> at <tmp> line 1␤␤»
17:22 ugexe that doesn't make sense though
17:24 Voldenet Huh... that's quite magical
17:24 ugexe well i guess it sort of does since the former you *know* its utf8 but the later is just known to be a Buf
17:25 Voldenet m: say "x".encode.WHAT
17:25 camelia rakudo-moar 23ad2c: OUTPUT: «(utf8)␤»
17:25 Voldenet m: say Buf.new("x".encode).WHAT
17:25 camelia rakudo-moar 23ad2c: OUTPUT: «(Buf)␤»
17:25 geekosaur yes, utf8 is a Buf[uint8] with extra abilities
17:25 Voldenet Well, it makes sense now. Not all "Buf" objects can be used as a string
17:26 Voldenet m: say Buf.new("x".encode).Stringy
17:26 camelia rakudo-moar 23ad2c: OUTPUT: «Cannot use a Buf as a string, but you called the Stringy method on it␤  in block <unit> at <tmp> line 1␤␤»
17:26 Voldenet m: say Buf.new("x".encode).decode.Stringy
17:26 camelia rakudo-moar 23ad2c: OUTPUT: «x␤»
17:26 ugexe seems like Buf.Stringy should be calling something like { self."{::T}"::Stringy }
17:39 Mrofnet joined #perl6
17:41 Moronnt joined #perl6
17:46 al2o3-cr joined #perl6
17:47 al2o3-cr p6: say "hello perl";
17:47 camelia rakudo-moar 23ad2c: OUTPUT: «hello perl␤»
17:48 nine colomon: jnthn usually develops on Linux, too these days.
17:49 nine AFAIK we don't have anyone doing development on Windows regularily.
18:01 al2o3-cr left #perl6
18:03 Cabanossi joined #perl6
18:04 karlsson joined #perl6
18:05 karlsson p6: $_ = '① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳';  s:nth(4,8,12...*)/(.)/$0,/;  .say
18:05 camelia rakudo-moar 23ad2c: OUTPUT: «① ② ,③ ④ ,⑤ ⑥ ,⑦ ⑧ ,⑨ ⑩ ,⑪ ⑫ ,⑬ ⑭ ,⑮ ⑯ ,⑰ ⑱ ,⑲ ⑳␤»
18:07 karlsson Is this error?
18:10 lucasb m: $_ = '(1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) (15) (16) (17) (18) (19) (20)';  s:nth(4,8,12...*)/(.)/$0,/;  .say
18:10 camelia rakudo-moar 23ad2c: OUTPUT: «(1) ,(2) ,(3) ,(4) ,(5) ,(6) ,(7) ,(8) ,(9) ,(10), (11,) (1,2) (,13) ,(14), (15,) (1,6) (,17) ,(18), (19,) (2,0)␤»
18:10 lucasb idk why the output changed between evaluations
18:11 lucasb oh, sorry. I copy and pasted in the terminal...
18:12 lucasb didn't know those were unicodey
18:31 zengargoyle joined #perl6
18:34 zakharyas joined #perl6
18:48 Cabanossi joined #perl6
19:00 domidumont joined #perl6
19:05 nadim joined #perl6
19:15 Ven joined #perl6
19:24 gdonald joined #perl6
19:26 epony joined #perl6
19:32 MilkmanDan joined #perl6
19:36 TEttinger joined #perl6
20:20 Ven joined #perl6
20:24 mr-foobar joined #perl6
20:35 NeuralAnomaly joined #perl6
20:36 NeuralAnomaly joined #perl6
20:38 NeuralAnomaly joined #perl6
20:55 epony joined #perl6
20:55 karlsson joined #perl6
20:56 mr-foobar joined #perl6
21:13 ufobat joined #perl6
21:18 Cabanossi joined #perl6
21:23 ctilmes joined #perl6
21:27 NeuralAnomaly joined #perl6
21:28 NeuralAnomaly joined #perl6
21:29 mr-foobar joined #perl6
21:30 NeuralAnomaly joined #perl6
21:41 NeuralAnomaly joined #perl6
21:44 Manifest0 joined #perl6
21:58 mr-foobar joined #perl6
22:01 ptolemarch joined #perl6
22:03 Cabanossi joined #perl6
22:27 geekosaur joined #perl6
22:28 mr-foobar joined #perl6
22:41 Morfent joined #perl6
22:43 Ven joined #perl6
22:57 Morfent joined #perl6
22:59 mr-foobar joined #perl6
22:59 Mrofnet joined #perl6
23:07 Morfent joined #perl6
23:09 vadz joined #perl6
23:21 samcv how do i create a channel using stdin
23:30 zengargoyle echo -e "foo\nbar\n" | perl6 -e '$*IN.Supply.tap(*.say)'
23:30 zengargoyle ^^ seems to do something.. :)
23:35 atta joined #perl6
23:36 zengargoyle m: $*IN.lines.map: *.say;
23:36 camelia rakudo-moar d37be2: OUTPUT: «»Wann treffen wir drei wieder zusamm?«␤   »Um die siebente Stund‘, am Brückendamm.«␤     »Am Mittelpfeiler.«␤         »Ich lösche die Flamm.«␤ »Ich mit«␤␤         »Ich komme vom Norden her.«␤        »Und ich vom Süden.«…»
23:37 zengargoyle m: $*IN.lines.Supply.tap: *.uc.say;
23:37 camelia rakudo-moar d37be2: OUTPUT: «»WANN TREFFEN WIR DREI WIEDER ZUSAMM?«␤   »UM DIE SIEBENTE STUND‘, AM BRÜCKENDAMM.«␤     »AM MITTELPFEILER.«␤         »ICH LÖSCHE DIE FLAMM.«␤ »ICH MIT«␤␤         »ICH KOMME VOM NORDEN HER.«␤        »UND ICH VOM SÜDEN.«…»
23:37 zengargoyle m: $*IN.lines.Supply.Channel
23:37 camelia rakudo-moar d37be2: ( no output )
23:37 zengargoyle m: $*IN.lines.Supply.Channel.perl.say
23:37 camelia rakudo-moar d37be2: OUTPUT: «Channel.new␤»
23:46 samcv hm
23:55 timotimo m: my $chan = Channel.new; start { $chan.send($_) for $*IN.lines }; react { whenever $chan { say "received $_" } }
23:55 timotimo m: my $chan = Channel.new; start { $chan.send($_) for $*IN.lines; $chan.close() }; react { whenever $chan { say "received $_" } }
23:55 camelia rakudo-moar d37be2: OUTPUT: «(timeout)received »Wann treffen wir drei wieder zusamm?«␤received    »Um die siebente Stund‘, am Brückendamm.«␤received      »Am Mittelpfeiler.«␤received          »Ich lösche die Flamm.«␤received  »Ich mit«␤received ␤received   …»
23:55 camelia rakudo-moar d37be2: OUTPUT: «received »Wann treffen wir drei wieder zusamm?«␤received    »Um die siebente Stund‘, am Brückendamm.«␤received      »Am Mittelpfeiler.«␤received          »Ich lösche die Flamm.«␤received  »Ich mit«␤received ␤received          »…»
23:57 mr-foobar joined #perl6

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo