»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend! Set by moritz on 22 December 2015. |
|||
00:00
lizmat joined
00:02
Actualeyes joined
00:03
rindolf left
00:07
kurahaupo joined
00:10
lizmat left
00:17
rindolf joined
00:18
mr-foobar left
00:22
mr-foobar joined
00:33
AlexDaniel left
|
|||
tbrowder | .tell dwarring Font::AFM, version 1.24.1 works great now! | 00:33 | |
yoleaux | tbrowder: I'll pass your message to dwarring. | ||
00:37
kst`` is now known as kst
00:38
Cabanossi left
00:39
Cabanossi joined
00:58
BenGoldberg joined
01:01
raschipi joined
01:06
Cabanossi left
01:08
Cabanossi joined
01:12
amerlyq left
01:19
mr-foobar left
01:22
mr-foobar joined
01:25
PerlJam joined
|
|||
BenGoldberg | m: use NativeCall; my \compar_t = Callable but role :: { method sub_signature { :(Pointer,Pointer --> int) } }; | 01:31 | |
yoleaux | 06:22 EDT <Zoffix> BenGoldberg: `===SORRY!===QAST::Block with cuid 1 has not appeared` is a bug and users should never see errors about QAST stuff. In this case, it looks a lot like the error you get when you try to use whatevercode in chained ops, like `5 < *.abs <7` Do you got any of that in your module? | ||
camelia | X::Method::NotFound exception produced no message in block <unit> at <tmp> line 1 |
||
BenGoldberg | m: gist.github.com/BenGoldberg1/d0764...549f4bc359 | 01:35 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> An exception occurred while evaluating a constant at <tmp>:22 Exception details: Could not find symbol '&Callback' in block at <tmp> line 22 |
||
01:37
Actualeyes left
|
|||
BenGoldberg | m: gist.github.com/BenGoldberg1/d0764...549f4bc359 | 01:39 | |
camelia | ===SORRY!=== QAST::Block with cuid 9 has not appeared |
||
01:40
cdg joined
|
|||
BenGoldberg | .tell Zoffix There is no whatever-anything in the code: gist.github.com/BenGoldberg1/d0764...549f4bc359 | 01:40 | |
yoleaux | BenGoldberg: I'll pass your message to Zoffix. | ||
MasterDuke | BenGoldberg: fyi, the message you should have gotten from your first attempt was `No such method 'mixin' for invocant of type 'Perl6::Metamodel::ParametricRoleGroupHOW'` | ||
01:46
ilbot3 left
01:47
ilbot3 joined,
ChanServ sets mode: +v ilbot3
01:48
mr-foobar left
|
|||
BenGoldberg | Clearly my code is tickling a lot of bugs. | 01:50 | |
Should I rakudobug camelia producing that '...produced no message...' error? | 01:51 | ||
01:51
mr-foobar joined
|
|||
BenGoldberg | m: my \foo = Callable but role :: { }; | 01:53 | |
camelia | X::Method::NotFound exception produced no message in block <unit> at <tmp> line 1 |
||
01:54
cioran89 joined
01:57
Zapwai\lettuce left
|
|||
BenGoldberg | Ok, another rakudobug sent. | 01:58 | |
02:04
rindolf left
|
|||
MasterDuke | bisectable6: my \foo = Callable but role :: { }; | 02:16 | |
bisectable6 | MasterDuke, Bisecting by output (old=2015.12 new=aa36842) because on both starting points the exit code is 1 | ||
MasterDuke, bisect log: gist.github.com/c4326d71b14fe555e3...3c79f18b26 | |||
MasterDuke, (2016-09-27) github.com/rakudo/rakudo/commit/22...0f14b9c05c | |||
MasterDuke | bisectable6: old=2016.10 my \foo = Callable but role :: { }; | ||
bisectable6 | MasterDuke, Bisecting by output (old=2016.10 new=aa36842) because on both starting points the exit code is 1 | ||
MasterDuke, bisect log: gist.github.com/8e0c9ae50773c16451...bb30500c68 | 02:17 | ||
MasterDuke, (2017-06-01) github.com/rakudo/rakudo/commit/c8...3cb5fd2068 | |||
02:24
MasterDuke left
02:25
MasterDuke joined,
cdg left
02:28
aborazmeh joined,
aborazmeh left,
aborazmeh joined
02:34
titsuki_ left
02:48
noganex_ joined
02:50
curt_ left
02:51
aborazmeh left,
noganex left
02:59
Ben_Goldberg joined,
BenGoldberg left,
Ben_Goldberg is now known as BenGoldberg
03:00
aborazmeh joined,
aborazmeh left,
aborazmeh joined
03:04
Cabanossi left
03:07
Cabanossi joined
|
|||
BenGoldberg | bisectable6, gist.github.com/BenGoldberg1/d0764...549f4bc359 | 03:11 | |
bisectable6: gist.github.com/BenGoldberg1/d0764...549f4bc359 | 03:12 | ||
bisectable6 | BenGoldberg, It looks like a URL, but mime type is ‘text/html; charset=utf-8’ while I was expecting something with ‘text/plain’ or ‘perl’ in it. I can only understand raw links, sorry. | ||
BenGoldberg | bisectable6: gist.githubusercontent.com/BenGold...ck-fail.pl | ||
bisectable6 | BenGoldberg, Successfully fetched the code from the provided URL. | ||
BenGoldberg, Bisecting by output (old=2015.12 new=61ecfd5) because on both starting points the exit code is 1 | |||
BenGoldberg, bisect log: gist.github.com/5b6fa52548a25ae0cd...31f58f77eb | 03:13 | ||
BenGoldberg, (2015-12-25) github.com/rakudo/rakudo/commit/07...dc61f84053 | |||
BenGoldberg, The result looks a bit unrealistic, doesn't it? Most probably the output is different on every commit (e.g. 「bisect: say rand」) | |||
BenGoldberg | Silly bot, it's different on every commit because memory is being corrupted somehow. Probably. | 03:18 | |
j: say 'alive'; | 03:19 | ||
camelia | alive | ||
BenGoldberg | j: gist.github.com/BenGoldberg1/d0764...549f4bc359 | ||
camelia | ( no output ) | ||
BenGoldberg | java.nio.file.NoSuchFileException: blib/Perl6/BOOTSTRAP.jar in <anon> (gen/jvm/ModuleLoader.nqp:88) in load_module (gen/jvm/ModuleLoader.nqp:75) in <anon> (gen/jvm/CORE.setting) in <anon> (gen/jvm/ModuleLoader.nqp:253) in load_setting … |
03:20 | |
j: gist.github.com/BenGoldberg1/d0764...549f4bc359 | 03:21 | ||
camelia | java.nio.file.NoSuchFileException: blib/Perl6/BOOTSTRAP.jar in <anon> (gen/jvm/ModuleLoader.nqp:88) in load_module (gen/jvm/ModuleLoader.nqp:75) in <anon> (gen/jvm/CORE.setting) in <anon> (gen/jvm/ModuleLoader.nqp:253) in load_setting … |
||
zengargo1le | BenGoldberg: do the bots understand the gist url that isn't pointing to the raw blob? | 03:33 | |
03:36
Cabanossi left
03:37
Cabanossi joined
|
|||
raschipi | zengargo1le: No, they complain it isn't raw text. | 03:44 | |
03:45
khw left
|
|||
Geth | ecosystem: e110a287cf | (Zoffix Znet)++ (committed using GitHub Web editor) | META.list Add Proc::Q to ecosystem "Queue up and run a herd of Procs": github.com/zoffixznet/perl6-Proc-Q |
03:49 | |
03:50
troys_ is now known as troys
04:06
klapperl_ joined
04:07
klapperl left
04:10
aborazmeh left
|
|||
pilne | as someone who used to heal in world of warcraft.. herding procs made me think of herding cats, lol. | 04:18 | |
04:19
mr-foobar left
|
|||
BenGoldberg | You can get procs to all move in the same direction, or at least work on the same task. Cats, not so much. | 04:19 | |
pilne | believe me... if i had a nickle for every time i communicated "get your fucking ass out of the fucking fire" in one way or another on that game... i'd be rich enough to be unknown | 04:20 | |
04:20
mr-foobar joined
|
|||
raschipi | The usual problem with procs is the exact opposite: they do EXACTLY what you told them to do. | 04:23 | |
pilne | yeah, computers are funny like that | 04:24 | |
raschipi | Most of the time, it's the wrong thing. We call it a bug. | ||
pilne | unless you are treading into "undefined behavior" territory | ||
raschipi | There's not 'undefined behavior' for CPU, everything comes down to that at some point. | 04:25 | |
geekosaur | ob F0 0F C7 C8 | ||
(CPUs have bugs too. also ancient CPUs often didn't control what unassigned opcodes did at all...) | 04:26 | ||
pilne | yeup | 04:27 | |
ahhhhh the good old days | |||
raschipi | Well, those are defined... by the silicon. The docs and specs might not mention it, but the silicon will do something deterministic. | ||
Well, interrupts aren't deterministic. And the interaction in the bus too. | 04:28 | ||
geekosaur | "deterministic" but often based on the exact stepping. and you couldn't even query that (no such thing as CPUID back then) | ||
raschipi | "Which core get's to the varible first" isn't deterministic. | ||
BenGoldberg | Also, there are such things as hardware random number generators. What numbers such a generator will produce, are generally the opposite of deterministic. | 04:29 | |
geekosaur | (also at some point this just turne into trolling...) | 04:30 | |
*turns | |||
zengargo1le has wondered why hardware RNG aren't common in everything. if a dongle can do it why not have it already built in? | |||
pilne | paranoia | 04:31 | |
raschipi | Well, almost every IO device will act as a RNG. When there's no dedicated RNG, Linux uses almost all IO it can measure to generate entropy, for example. | ||
zengargo1le: Every TPM module comes with one. You can also turn the sound card into one if you have no other use for it. | |||
zengargo1le | i'm thinking of those things that catch cosmic particles hitting one side or the other of some sort of detector type of thing. does TPM use that sort of thing? | 04:33 | |
zengargo1le just notices my nick got whacked at some point. | 04:35 | ||
04:35
zengargo1le is now known as zengargoyle,
Cabanossi left
04:37
Cabanossi joined
|
|||
raschipi | zengargoyle: They use a quantum source of entropy: the noise at the base of a reverse biased transistor. It fluctuates randomly because electrons will tunnel through the gap. | 04:38 | |
zengargoyle | ah, cool. | 04:42 | |
may have to read up on that. guess it's still a slow stream of entropy or we would no longer have PRNG at all? | 04:45 | ||
04:48
BenGoldberg left
04:50
mr-foobar left
04:52
mr-foobar joined
|
|||
raschipi | If you need more, just use more transistors. Transistors are what chips have in abundance. | 05:01 | |
TEttinger | zengargoyle: intel has a hardware RNG on many of their processors but several linux and/or BSD distros have stopped using it out of concern that it may be intentionally flawed | 05:05 | |
fatguy | how can i get package and method name from caller ? let say i call method print-it("bla"). from my origin class i need to know where the caller is | ||
TEttinger | en.wikipedia.org/wiki/RdRand | 05:06 | |
05:17
fatguy left
05:20
Cabanossi left,
mr-foobar left
|
|||
zengargoyle | TEttinger++ | 05:20 | |
Geth | doc: 4f2611be57 | (Samantha McVey)++ | doc/Type/Str.pod6 .subst: give examples on how to use captures Hopefully this will help others out, as it is somewhat counterintuitive. |
05:22 | |
samcv | ok. i finally got fed up and added this to the docs XD | ||
zengargoyle | rand came up a few days ago and my grep led me to believe that it boils down to libtommath (a bunch of math routines for primes and such) which uses arc4something() or rand() depending on availability. | ||
samcv | because i always forgot it | ||
05:22
Cabanossi joined,
mr-foobar joined
|
|||
samcv | yeah something like that zengargoyle | 05:22 | |
zengargoyle | it all seems to still be a good entropy seed to some crypto generator (re-seeded at intervals by some logic) vs some actual true endless fast fount of random bits. :) | 05:25 | |
samcv | so good then? | 05:26 | |
05:26
pilne left
|
|||
zengargoyle | good enough for my Lotto number picks. | 05:27 | |
samcv | you may know more about the intricacies of random number generating than i do | ||
TEttinger | man, that's what I've been up to lately | 05:28 | |
I have a pretty fast 64-bit one now with what seems to be decent quality but a lousy period for its amount of state (128 bits) | 05:29 | ||
2 to the 65 period probably, no lower than 2 to the 64 | |||
well, pretty fast for software as in "twice as fast as an LCG, at least with the JVM's weird optimization properties" | 05:30 | ||
zengargoyle | TEttinger: you may know more about the intricacies of random number generating than i do :P | 05:32 | |
TEttinger | this stuff is fun for me. I have a system set up to repeatedly generate random 24-bit numbers and use them as colors, like here i.imgur.com/fpn0Wrq.png | 05:36 | |
if there's a flaw, it's pretty easy to pick up, also in black/white i.imgur.com/4biF98x.png | |||
this series tested various intentionally flawed RNGs i.imgur.com/4H5VXcP.jpg | 05:38 | ||
samcv | i still don't know why .grep(:v ) is the same as default | ||
v | |||
Only return the matched elements (same as not specifying any named parameter at all). | |||
where all greps always have grep -v is reversed | 05:39 | ||
only return non-matching | |||
so i guess you need :!v ? | |||
zengargoyle | worst magic-eye ever. | ||
samcv | still odd | ||
TEttinger | hehe | ||
hobbs | :!v is definitely a face | 05:41 | |
with a pencil up its nose, possibly | |||
zengargoyle | pencil balanced on pursed lips about to fall. | 05:43 | |
05:46
Actualeyes joined
05:49
mr-foobar left
05:51
mr-foobar joined
05:52
wamba joined
05:58
troys is now known as troys_
05:59
araraloren_ joined
06:03
araraloren left
06:05
webart left
06:07
grondilu joined
06:09
grondilu_ left,
atta left,
atta joined
|
|||
zengargoyle | is there a better list of bots/commands than found on perl6.org/community/irc? | 06:14 | |
samcv | see all the users that have voice | 06:15 | |
those are bots | |||
so i have `my (%hash, @array) = myfunction; sub myfunction { return %hash, @array } | 06:16 | ||
i get Odd number of elements found where hash initializer expected: | |||
it works fine when i only have it return a hash | |||
so i guess those are somehow coming together.. ack reminds me of perl 5 horrors i've experienced | |||
i think actually it's `return %hash, @array.sort.unique` so it's likely returning a sequence. that could be what's causing this | 06:18 | ||
though using .list doesn't improve the situation | |||
zengargoyle | i'd try .Array but it's just a guess. | 06:19 | |
samcv | that's not a method :P | ||
err. wait it is | |||
heh. let me try it | |||
zengargoyle | m: (1,2,3).Array | ||
camelia | ( no output ) | ||
zengargoyle | m: (1,2,3).Array.say | 06:20 | |
camelia | [1 2 3] | ||
samcv | ok now something really weird happened | ||
eek. well i'll be back in like 20 mins or so | |||
06:20
nadim joined
|
|||
zengargoyle tends to slap on a .Array whenever some error pops up (esp. Seq errors). gah, i think i haven't wrapped my head around Seq yet. | 06:22 | ||
raschipi | zengargoyle: That's almost the appropriate way of doing it, but there's an specific method to do it: .cache (docs.perl6.org/routine/cache) | 06:28 | |
zengargoyle | heh | 06:30 | |
method cache(--> TODO) | |||
06:32
webart joined
|
|||
zengargoyle | guess this is more relevant: method cache(PositionalBindFailover:D: --> List:D) | 06:32 | |
raschipi | The lower section explains what it does: turns an iterator into a list. Just don't call it on infinite or ver long lazy lists. It will eat all of your memory. P6 doesn't do it automatically because it can't know which lists will grow to much and turn out impossible to fit into memory. | 06:33 | |
Even if you got infinite memory, it will take infinite time to fill it up. | |||
zengargoyle | yeah, favorite recent bug-fix was along the lines of "no longer segfaults, will consume all available memory instead" :) | 06:34 | |
just like you told it to. | 06:35 | ||
06:36
Cabanossi left
06:37
Cabanossi joined
|
|||
raschipi | Seqs are annoying sometimes, but they are very useful. The GC can reap the part that was already dealt with and allow much bigger problems to fit into memory. | 06:39 | |
Easier than having to do it by hand. | |||
zengargoyle | other than the almost always "X is Y% faster when Z" | ||
nine | m: sub func { my %h = a => 1, b => 2; my @a = 1, 2, 3; return %h, @a}; my (%h, @a) := func; say %h; say @a; | 06:40 | |
camelia | {a => 1, b => 2} [1 2 3] |
||
nine | samcv: ^^^ | ||
zengargoyle | true, i'm just not used to lazy stuff. | ||
and it tends to bite me in the a** all the time. | 06:41 | ||
TEttinger | abs | 06:42 | |
muscular abdominal muscles | |||
zengargoyle | nine: is it the bind? | ||
m: sub func { my %h = a => 1, b => 2; my @a = 1, 2, 3; return %h, @a}; my (%h, @a) = unc; say %h; say @a; | 06:43 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Undeclared routine: unc used at line 1. Did you mean 'uc', 'func'? |
||
zengargoyle | m: sub func { my %h = a => 1, b => 2; my @a = 1, 2, 3; return %h, @a}; my (%h, @a) = func; say %h; say @a; | ||
camelia | Odd number of elements found where hash initializer expected: Found 5 (implicit) elements: Last element seen: $[1, 2, 3] in block <unit> at <tmp> line 1 |
||
zengargoyle | guess so. bind is another thing that i haven't quite internalized yet. | 06:45 | |
zengargoyle expected the = to work | 06:46 | ||
nine | zengargoyle: yes | 06:50 | |
Collections like hashes and arrays are slurpy on assignment. That's why the hash tries to gobble the array and complains. | 06:51 | ||
zengargoyle | m: sub func { my %h = a => 1, b => 2; my @a = 1, 2, 3, 4; return %h, @a}; my (%h, @a) = func; say %h; say @a; | 06:52 | |
camelia | Odd number of elements found where hash initializer expected: Found 5 (implicit) elements: Last element seen: $[1, 2, 3, 4] in block <unit> at <tmp> line 1 |
||
zengargoyle | m: sub func { my %h = a => 1, b => 2; my @a = 1, 2, 3, 4; return %h, @a}; my (%h) = func; say %h; | 06:53 | |
camelia | Odd number of elements found where hash initializer expected: Found 5 (implicit) elements: Last element seen: $[1, 2, 3, 4] in block <unit> at <tmp> line 1 |
||
raschipi | m: my @a = 1, 2, 3, 4; my %h = @a; say %h; | ||
camelia | {1 => 2, 3 => 4} | ||
raschipi | m: my @a = 1, 2, 3, 4, 5; my %h = @a; say %h; | ||
camelia | Odd number of elements found where hash initializer expected: Found 5 (implicit) elements: Last element seen: 5 in block <unit> at <tmp> line 1 |
||
06:53
wamba left
|
|||
nine | Itemized array coming from the "return" vs. plain array. | 06:54 | |
zengargoyle | i was guessing the pairs prime the return to expect pairs and the array mucked things up | 06:55 | |
but guess not. | |||
nine | The error message actually tells it quite clearly: Last element seen: $[1, 2, 3, 4] | 06:56 | |
zengargoyle | ah | 06:57 | |
m: my %h = 1 => 2, 3, 4; say %h | |||
camelia | {1 => 2, 3 => 4} | ||
zengargoyle | m: my %h = 1 => 2, [3, 4]; say %h | ||
camelia | Odd number of elements found where hash initializer expected: Found 3 (implicit) elements: Last element seen: $[3, 4] in block <unit> at <tmp> line 1 |
||
raschipi | m: my %h := 1 => 2, [3, 4]; say %h | ||
camelia | Type check failed in binding; expected Associative but got List ($(1 => 2, [3, 4])) in block <unit> at <tmp> line 1 |
||
raschipi | This last one is a type check failure, which means we're violating a promise we made to the compiler. | 06:59 | |
zengargoyle | why is the hash not also itemized? | ||
07:00
darutoko- joined
|
|||
zengargoyle | why is %h not { a => 1, b => 2 } => [ 1, 2, 3 ] | 07:01 | |
raschipi | P6 doesn't mangle structures like that, it keeps everything tidy. | 07:05 | |
Lists don't end um mixed or flatened. | 07:06 | ||
zengargoyle | then it seems (%h,@a) = (%x,@y) should work. | 07:07 | |
raschipi | Asignement calls a method on the object in the righ hand side, and hash doesn't know what to do with a odd-numbered list. | 07:08 | |
On the left hand, even. | |||
zengargoyle | m: my ($h, @a) = ( { a => 'b' }, 1 ); say $h; say @a; | 07:10 | |
camelia | {a => b} [1] |
||
nine | zengargoyle: the sad truth is that hashes are flattened more easily than lists. Feels like a bit of an oversight during the GLR. | ||
zengargoyle | m: my ($h, @a) = ( { a => 'b' }, [1,2,3] ); say $h; say @a; | 07:11 | |
camelia | {a => b} [[1 2 3]] |
||
zengargoyle | nine: gotcha | ||
raschipi | Is 6.d the opportunity to fix that? | 07:14 | |
zengargoyle | hopefully only if they can keep 6.c vs 6.d semantics about the same way p5 only changes if asking for the new stuff. | 07:16 | |
zengargoyle still miffed that { use 6.c; ...old-code...} didn't fix my IO breakage. | |||
raschipi | I think the idea is to keep everything that asks for 6.c at the top working. | 07:17 | |
zengargoyle | but not that miffed. | ||
nine | The idea is good but object orientation puts a severe limit on that | ||
zengargoyle | yeah, best effort is fine by me no matter my complaining. :) | 07:18 | |
raschipi | Use 6.c inside a block could help with syntax changes, but the objects have global state. | ||
nine | It's downright trivial to have the compiler bind to the right await sub depending on the language version. But methods are late bound. It doesn't at all depend on the caller of which method is found but on the object the method is called on. | 07:19 | |
raschipi | Their dispatch tables are global. | ||
07:19
lizmat joined
|
|||
zengargoyle | yeah,IO is a thing unto itself. | 07:20 | |
raschipi | zengargoyle: Doesn't have anything to do with IO, :) . It would be the same for any object. | 07:21 | |
zengargoyle | just breaks my ask for 6.c get 6.c expectations and maybe future compatibility. p5 did the same thing around 5.10 or so bringing about all of the 'experimental' and 'feature' stuff. | 07:23 | |
how much legacy do you want to support with minimal tweak of asking for the old behavior? | 07:24 | ||
raschipi | You have to keep in mind that these versions are for the language, for the syntax, but that the breaking changes were made in a library. | ||
The way to fix that would be to create objects with multiple interfaces. | 07:25 | ||
Adding a :old-model adverb to IO or something. But then, standard handles already start instantiated. | 07:26 | ||
zengargoyle | eh, my breakage was simple IO. but point taken, the boundry is fuzzy. | ||
raschipi | It's like the difference between GCC and LibC. | 07:28 | |
nine | Would be all doable. But what the heck should happen if 6.d code passes an IO::Path object to 6.c code? | ||
zengargoyle | and it was really just like one line of testing code. | ||
raschipi | nine: croak | 07:29 | |
zengargoyle | hehe, you can wrap a Python interpreter's object in a p6 object. nothing is impossible! (just not worth it) | 07:30 | |
and i'd rather the effort be spent elsewhere ATM anyway. | |||
zengargoyle just musing on how awesome it would be if it actually did do that thing. | 07:31 | ||
nine | Actually it should even be possible for a method to ask for its caller's language version. This is Perl 6 after all ;) It just would be quite bad for performance and for maintainability of the code... | 07:34 | |
raschipi | nine: I see where the problem is now, the 6.c and 6.d code are from different authors. | 07:35 | |
And these methods are intermingled in with the operating system and represent things people just expect to be there. It wouldn't be so hard if people had to set up their IO instead of just using it. | 07:36 | ||
zengargoyle | yeah, i give wide berth when you hit IO or some other systemy thing vs just high-level syntax. | 07:37 | |
i hope things settle down by 6.e or 6.f where it becomes "if it worked it still does" (most likely). | 07:42 | ||
raschipi | The good news is that the same companies that are paying for P6 development are the ones paying for P5 development, so they will want the same guarantees eventually. | 07:44 | |
nine | Well IO was an area that lagged behind the rest of the setting when we released 6.c. There was bound to be some changes. | 07:45 | |
07:50
Cabanossi left
07:52
Cabanossi joined
08:02
zengargoyle is now known as zengargoyle_
08:14
araraloren_ is now known as araraloren
08:19
mr-foobar left
08:22
mr-foobar joined
08:28
setty1 joined
08:31
parv joined
|
|||
El_Che | for Spanish speakers, the Madrid Perl Workshop has live streaming: www.youtube.com/watch?v=JDOykNlrJ5...e=youtu.be (There seems to be 1 on englis hat 15h CET: madrid.pm.org/workshop/page/talks/k....html#top) | 08:47 | |
08:47
raschipi left
08:49
mr-foobar left
08:51
mr-foobar joined
08:59
TEttinger left
09:11
pminten joined
09:12
rindolf joined
|
|||
pminten | hi, is it possible to define a custom character class? | 09:13 | |
<:L + :N + :P + :S - :Z - [(),=:.~?"%]> | |||
I want to reuse that | |||
because I have a regex / <$that - :Lu> $that * / | 09:14 | ||
rightfold | You can define a custom regex and then use that regex within another regex | ||
Oh I'm not sure you can do that | 09:15 | ||
pminten | yeah, the regex including doesn't work inside char classes so I can't use the set operations | 09:16 | |
09:17
TimToady left
09:19
TimToady joined
09:20
mr-foobar left
09:21
mr-foobar joined
09:22
AlexDaniel joined
09:36
setty1 left
09:39
setty1 joined
09:40
kyan left
09:44
vimal2012 joined
|
|||
samcv | is this supposed to work? a.uguu.se/kYCTenCQkEMF_Screenshot_...024931.png | 09:51 | |
and if so why. cause it does work. returning itself on initialization | |||
hobbs | don't see why it wouldn't | 09:53 | |
09:53
lizmat left
|
|||
samcv | m: my $a = foo; sub foo { $a = 100; return $a }; say $a; | 09:53 | |
camelia | 100 | ||
hobbs | it's unnecessary (either the function should have its own lexical, or if it's going to assign to an outer one, it doesn't have to also return it) | 09:54 | |
but it's the same effect as my %pnamecode; make-name-alias-hash(...); %pnamecode = %pnamecode; | |||
samcv | i never declare it inside the sub though | ||
so it must use the outer one | 09:55 | ||
hobbs | yes | ||
samcv | m: my $a = foo; sub foo { $a = 100; return 10 }; say $a | 09:57 | |
camelia | 10 | ||
samcv | though this also works too | ||
hobbs | which is in-scope, it hasn't been assigned to yet (because make-name-alias-hash hasn't returned yet ;) but it's still usable as a container, same as if it didn't have an initialization at all. | ||
I don't know if it's guaranteed, but it's the behavior I'd expect | 09:58 | ||
samcv | anyway thanks for helping me underertasd it | ||
hobbs | then when the assignment part of the initialization does complete, it effectively does nothing | ||
10:04
avalenn_ left
|
|||
hobbs | the equivalent code in perl 5 would behave the same, FWIW, so my expectations are already set ;) | 10:06 | |
10:06
pminten left
10:09
robertle left
10:20
lizmat joined
|
|||
nine | The declaration of $a happens at compile time, so during compilation of sub foo, it's already known. So indeed foo refers to the container named '$a'. When _running_ the assignment, first sub foo is called, which already assigns to $a and then returns a value which again gets assigned to $a | 10:28 | |
10:43
dogbert17_ joined
10:45
dogbert11 left
10:47
parv left
10:49
mr-foobar left
10:53
mr-foobar joined
10:57
vimal2012 left,
vimal2012 joined
|
|||
vimal2012 | What is the practical use of sigilless variable? Why would one want to use sigilless variable over sigilled one? | 10:59 | |
llfourn | vimal2012: I think sometimes it's a decent way to indicate that you don't want to have a variable with a container | 11:06 | |
or more simply is read only | |||
m: my \foo = "foo"; foo = "bar"; | |||
camelia | Cannot modify an immutable Str (foo) in block <unit> at <tmp> line 1 |
||
llfourn | so it tells the reader that you aren't going to modify the variable after declaration | 11:07 | |
unless there's a particular reason you want to point that I wouldn't use them | 11:08 | ||
jnthn | They're also useful in the cases where you don't want to enforce any kind of context | 11:13 | |
my \matching = $fh.lines.grep(&condition).map(&operation); for matching { } # Will iterate the lazy pipeline, discarding values, so using little memory on a large file | 11:15 | ||
my $matching = $fh.lines.grep(&condition).map(&operation); for $matching { } # Only does one iteration, because $ means item | |||
my @matching = $fh.lines.grep(&condition).map(&operation); for @matching { } # assignment is mostly eager, so will store all the matching lines in @matching before doing the iteration | 11:16 | ||
This means if you're constructing lazy processing pipelines they are also a pretty good choice. | |||
11:19
curt_ joined
11:20
Cabanossi left,
mr-foobar left
11:22
Cabanossi joined
11:23
MARTIMM joined
|
|||
MARTIMM | m:sub s (Str :$str) {say $str.WHAT};s('1') | 11:25 | |
evalable6 | (exit code 1) Too many positionals passed; expected 0 arguments but got 1 in sub s at /tmp/GVw_XG8kbF line 1 in block <unit> at /tmp/GVw_XG8kbF line 1 |
||
11:25
mr-foobar joined
|
|||
MARTIMM | m: sub s (Str :$str) {say $str.WHAT}; s('1'); | 11:27 | |
camelia | Too many positionals passed; expected 0 arguments but got 1 in sub s at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
jnthn | :$str is a named argument | 11:28 | |
araraloren | m:sub s (Str :$str) {say $str.WHAT};s(a => '1') | 11:29 | |
evalable6 | (exit code 1) Unexpected named argument 'a' passed in sub s at /tmp/EuwaLPG4p_ line 1 in block <unit> at /tmp/EuwaLPG4p_ line 1 |
||
MARTIMM | m: sub s (Str :$str) {say $str.WHAT}; s(:str<1>); | ||
camelia | (IntStr) | ||
araraloren | m:sub s (Str :$str) {say $str.WHAT};s(str => '1') | ||
evalable6 | (Str) | ||
11:29
TeamBlast left
|
|||
MARTIMM | @jnthn: thanks, why is it IntStr and not Str | 11:30 | |
araraloren | m: sub s (Str :$str) {say $str.WHAT};s(str => 1) | ||
camelia | Type check failed in binding to parameter '$str'; expected Str but got Int (1) in sub s at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
araraloren | m: say <1>.WHAT | ||
camelia | (IntStr) | ||
jnthn | Because <...> applies val(...) to each of the things it parses | ||
araraloren | m: say '1'.WHAT | 11:31 | |
camelia | (Str) | ||
araraloren | It's different things | ||
11:31
TeamBlast joined
|
|||
MARTIMM | @jnthn: looked up val sub and is undertandable that the result of val is IntStr. But I still don't get it when it assigns to Str that the type of tha variable is changed from Str into IntStr. It should coerce | 11:35 | |
araraloren | m: say <1> ~~ Str; | ||
camelia | True | ||
araraloren | IntStr is a Str | 11:36 | |
jnthn | MARTIMM: Types in Perl 6 are constraints, not coercions. | ||
MARTIMM | m: IntStr ~~ Str | ||
camelia | ( no output ) | ||
jnthn | m: say IntStr.^mro | ||
camelia | ((IntStr) (Int) (Str) (Cool) (Any) (Mu)) | ||
MARTIMM | m: say IntStr ~~ Str | ||
camelia | True | ||
MARTIMM | m: say Str ~~ IntStr | ||
camelia | False | ||
jnthn | IntStr inherits from both Int and Str. The point of this is it can be passed to code that wants a Str or wants an Int | 11:37 | |
11:39
curt_ left
|
|||
araraloren | m: sub f(IntStr :$is) { say $is.WHAT; }; try { f(is => "1"); CATCH { say ":("; }; }; f(is => IntStr.new(10, "1")); | 11:40 | |
camelia | :( Type check failed in binding to parameter '$is'; expected IntStr but got Str ("1") in sub f at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
araraloren | m: sub f(IntStr :$is) { say $is.WHAT; }; f(is => IntStr.new(10, "1")); | ||
camelia | (IntStr) | ||
araraloren | Oh, It's a error not a exception . | ||
jnthn | lunch; bbl | 11:41 | |
11:42
ctilmes joined,
vimal2012 left
|
|||
Geth | doc: 62137859de | (Jan-Olof Hendig)++ | doc/Language/traps.pod6 Changed incorrect mention of nextsame to callsame. jnthn++ |
11:43 | |
11:50
mr-foobar left
11:51
Cabanossi left
11:52
Cabanossi joined
11:54
mr-foobar joined
|
|||
rightfold | The syntax highlighting for Perl 6 makes Vim extremely slow. | 12:09 | |
Am I using an old version? I am using the version that ships with Vim. | 12:10 | ||
What should I upgrade to? | |||
El_Che | github.com/vim-perl/vim-perl | 12:13 | |
rightfold | Should I install github.com/vim-perl/vim-perl6? | ||
El_Che | that the latest version | ||
not slow at all on Ubuntu 16.04 and 17.04 | 12:14 | ||
rightfold | I find this repository confusing. | ||
"Support for Perl 5 and Perl 6 in Vim" | |||
"This is the aggregation of all the various Perl-related syntax and helper files for Perl 5. For Perl 6 files, please see vim-perl6." | |||
El_Che | rightfold: this are the notes of my vim setup: nxadm.wordpress.com/2016/08/21/vim...-6-editor/ | 12:15 | |
rightfold | So I do not have to "see vim-perl6"? | 12:16 | |
El_Che | I haven't had time to work on synastic-perl6, but it works as is | ||
rightfold: no | |||
rightfold | OK | ||
Thanks | |||
El_Che | just clone it and you're good to go | ||
rightfold: on a kind-of-related not, atom is nowaways pretty good for perl6 | 12:17 | ||
12:17
Actualeyes left
|
|||
rightfold | I don't want to use Atom. | 12:18 | |
El_Che | sure, just fyi | 12:19 | |
rightfold | Thanks :P | 12:20 | |
12:21
aborazmeh joined,
aborazmeh left,
aborazmeh joined
|
|||
rightfold | Oh I should probably install Perl 6 too lol | 12:26 | |
Gonna be difficult testing my code otherwise | |||
araraloren | I prefer emacs :) | 12:35 | |
rightfold | m: '-'.IO.spurt('karate') | 12:36 | |
camelia | karate | ||
12:36
Cabanossi left
|
|||
rightfold | m: '-'.IO.slurp | 12:36 | |
camelia | No such method 'decode' for invocant of type 'Str'. Did you mean 'encode'? in block <unit> at <tmp> line 1 |
||
rightfold | Is '-' only stdout, not stdin? | ||
12:37
Cabanossi joined
12:41
CacoS joined
|
|||
timotimo | rightfold: i've experienced problems when there were comments and it'd make vim hang basically indefinitely m( | 12:41 | |
zengargoyle_ | rightfold: have you ever checked out nvim? i switched way back when because it was faster at syntax highlighting and checking than vim (around the 7.0 era). | 12:42 | |
rightfold | oh '-'.IO.lines works, but '-'.IO.slurp doesn't | 12:44 | |
zengargoyle_ | it was the whole async thing that i think maybe vim 8 does now, highlighting, make/perltidy/perlcritic on write, etc. are threads so no delays. | ||
rightfold | I don't use any code analysis or building features in Vim | 12:45 | |
My setup is a tiling window manager where one of the terminals houses a file watcher that does the analysis and building | |||
It is less distracting than constantly moving frames and squiggly lines and popups | |||
zengargoyle_ | gotcha, nvim still seemed to do highlighting faster or at least in a way that didn't interfere with typing. depends on whether your issue is with slowness or with flakey highlighting as a whole. | 12:49 | |
12:49
geekosaur left
|
|||
zengargoyle_ | i do the notify test thing too, but floating stacked windows rule. :P | 12:50 | |
zengargoyle_ needs to check out vim 8 again but hasn't had any problem and only smoother experience from nvim. | 12:51 | ||
12:52
geekosaur joined,
kaare_ left
12:57
khw joined
|
|||
zengargoyle_ wonders if Damien Conway has a set of perl6 vim doodads. some of his p5 vim doodads are freakin' awesome. | 12:59 | ||
El_Che | rightfold: I have pkgs available if you run Ubuntu, Debian, Centos or Fedora: github.com/nxadm/rakudo-pkg/releases/ | 13:02 | |
zengargoyle_ | El_Che: does atom have vim bindings? i have really been meaning to actually try it for various reasons. | 13:03 | |
El_Che | zengargoyle_: there are some plugins | 13:07 | |
zengargoyle_ | heh, El_Che i recognize your blog styling... so i've probably read a few of your posts here and there. :) | 13:10 | |
Geth | doc: b72d7cbcd1 | (Zoffix Znet)++ | doc/Language/operators.pod6 Improve `orelse` docs - More details on what happens to the last arg - More details on the expected Callables - Add tip this is a useful Failure handler - Add code examples |
13:12 | |
doc: 7c2d4a5b34 | (Zoffix Znet)++ | doc/Language/operators.pod6 Improve `andthen` docs - Add more info on what happens to the last arg - Add info on the expected Callable - Add a tip that this op is handy for handling Failures |
13:17 | ||
rightfold | With vim-perl it's still slow | 13:19 | |
13:20
mr-foobar left
13:23
mr-foobar joined
13:24
rindolf left,
titsuki joined
13:26
domidumont joined
13:35
Cabanossi left
13:36
mst left,
mst joined
13:37
Cabanossi joined,
mcmillhj joined
|
|||
Geth | doc: 945ae9b4a7 | (Zoffix Znet)++ | doc/Language/operators.pod6 Link to &defined from andthen docs To make it clearer what it checks for |
13:47 | |
13:49
aborazmeh left
13:51
domidumont left
|
|||
MasterDuke | c: all '-'.IO.slurp | 13:55 | |
13:57
committable6 left
14:00
committable6 joined,
ChanServ sets mode: +v committable6
|
|||
Voldenet | MasterDuke: $*IN.slurp would probably work too | 14:01 | |
14:02
sergot joined
|
|||
MasterDuke | yeah, that works. but '-'.IO.slurp has changed over time | 14:03 | |
14:04
pilne joined
14:05
setty1 left
14:06
jameslenz left
14:07
jameslenz joined
14:11
aborazmeh joined,
aborazmeh left,
aborazmeh joined
14:12
bisectable6 left,
bisectable6 joined,
ChanServ sets mode: +v bisectable6
14:15
grondilu left
|
|||
rightfold | I have multi MAIN(IO(Cool) $in = '/dev/stdin', IO(Cool) :$out = '/dev/stdout') now :) | 14:15 | |
14:15
grondilu joined
|
|||
rightfold | Instead of '-' | 14:15 | |
MasterDuke | rightfold: it used to work. i pinged a coupe people in #perl6-dev about it | 14:20 | |
rightfold | ok :) | ||
MasterDuke | c: 2017.03,2017.04.3 say '-'.IO.slurp | ||
committable6 | MasterDuke, gist.github.com/3fe6aa0ced80a9a57c...0cc63b324d | ||
rightfold | Does this bot use random emoji for stdin? | 14:21 | |
MasterDuke | it just has a selection of letters, numbers, unicode chars, etc | ||
rightfold | ok :) | 14:22 | |
MasterDuke | github.com/perl6/whateverable/blob/master/stdin | 14:23 | |
rightfold | ah static | ||
Voldenet | Eh, i hate to maintain my own, local git repo with opinionated patches, because of situations when the patches collide with my opinionated changes :< | ||
s/patches/official patches/ | 14:24 | ||
MARTIMM | Back again, I'm a slow learner, I understand what jnthn have said before about following | ||
MasterDuke | rightfold: looks like there aren't any tests in roast for reading from '-' as stdin. you could add some... | 14:25 | |
MARTIMM | <1>.WHATm: | ||
rightfold | oy vey, I'll take a look | ||
MARTIMM | m: say <1>.WHAT | ||
camelia | (IntStr) | ||
rightfold | I also couldn't find docs about '-'.IO | ||
MARTIMM | m: say '1'.WHAT | ||
camelia | (Str) | ||
rightfold | stdin nor stdout | ||
Voldenet | rightfold: well, - is just a file in unix | 14:26 | |
that's stdin | |||
> ls | cat - | |||
rightfold | TIL | ||
MasterDuke | rightfold: heh, could also add docs... | ||
rightfold | I thought programs just special-cased it | ||
"stat -" works :v | |||
araraloren | MARTIMM++ :) | 14:27 | |
rightfold | unix.stackexchange.com/a/16364/5130 | ||
Voldenet: ^ | |||
MasterDuke is now afk to turn over a garden. yay | 14:28 | ||
Voldenet | rightfold: oh wow, so it's only special-cased almost everywhere :D | ||
14:28
Khisanth left
|
|||
Voldenet | (in fact I've never had any problems with using that as stdin, so I assumed it's a kernel thingie) | 14:28 | |
MARTIMM | analoren: thing is that I don't understand the following | 14:29 | |
my Str $s = <1> | |||
say $s.WHAT | |||
evalable6 | (exit code 1) 04===SORRY!04=== Error while compiling /tmp/VoC3HkhBcR Variable '$s' is not declared at /tmp/VoC3HkhBcR:1 ------> 03say 08⏏04$s.WHAT |
||
Voldenet | I'd still use $*IN.slurp though, easier to reason about | ||
MARTIMM | my Str $s = <1>; $s.WHAT | ||
my Str $s = <1>; say $s.WHAT | 14:30 | ||
m: my Str $s = <1>; say $s.WHAT | |||
camelia | (IntStr) | ||
rightfold | Voldenet: the '-' is user input | ||
moritz | m: say $*IN.IO === $*IN | ||
camelia | False | ||
rightfold | m: $*IN.IO.perl.say | ||
camelia | IO::Special.new(what => "<STDIN>") | ||
14:30
crocodileG joined
|
|||
MARTIMM | ok, took me awhile, but there it is; $s became IntStr and not Str | 14:30 | |
araraloren | MARTIMM, it's like parameter constraint | 14:31 | |
MARTIMM | I'll have to look that one up. can you give a pointer? | 14:32 | |
araraloren | Because `<1>` is IntStr, you just make a container hold `<1>` | ||
Str is a type constraint | |||
m: my $s = <1>; say $s.WHAT; | 14:33 | ||
camelia | (IntStr) | ||
araraloren | m: my Int $s = <1>; say $s.WHAT; | ||
camelia | (IntStr) | ||
araraloren | m: my Mu $s = <1>; say $s.WHAT; | ||
camelia | (IntStr) | ||
MARTIMM | So a type does not have a meaning here in this case I suppose | 14:34 | |
araraloren | MARTIMM, have you read this : docs.perl6.org/language/containers ? | ||
m: my Hash $s = <1>; say $s.WHAT; | |||
camelia | Type check failed in assignment to $s; expected Hash but got IntStr (IntStr.new(1, "1")) in block <unit> at <tmp> line 1 |
||
araraloren | It has mean | 14:35 | |
MARTIMM | I have to reread that section, thanks for the pointer | ||
14:35
Cabanossi left
14:37
Cabanossi joined
14:42
Khisanth joined
14:46
crocodileG left
14:53
MARTIMM left
15:01
rindolf joined
15:06
johnd_perl6 joined
|
|||
johnd_perl6 | p6: say foobar | 15:07 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Undeclared routine: foobar used at line 1 |
||
johnd_perl6 | p6:say "foobar"; | ||
p6: say 3; | |||
camelia | 3 | ||
johnd_perl6 | p6: say 'foobar'; | 15:08 | |
camelia | foobar | ||
Voldenet | p6: say '/etc/passwd'.IO.slurp | 15:09 | |
camelia | bin:x:1:1:bin:/bin:/bin/bash daemon:x:2:2:Daemon:/sbin:/bin/bash ftp:x:40:49:FTP account:/srv/ftp:/bin/bash games:x:12:100:Games account:/var/games:/bin/bash lp:x:4:7:Printing daemon:/var/spool/lpd:/bin/bash mail:x:8:12:Mailer daemon:/var/spool… |
||
Voldenet | ┐(´~`;)┌ | ||
johnd_perl6 | p6:my @fibonnaci = 1, 1, {^$a + ^$b} ... *; | 15:10 | |
Geth | doc: a2d1733296 | (Zoffix Znet)++ | doc/Language/operators.pod6 Use C<> for code in text |
||
johnd_perl6 | p6: say @fibonacci[6]; | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '@fibonacci' is not declared at <tmp>:1 ------> 3say 7⏏5@fibonacci[6]; |
||
Geth | doc: 5ff8befec3 | (Zoffix Znet)++ | doc/Language/operators.pod6 Document notandthen I refuse to play your Chinese Food mind games! |
||
Voldenet | p6: my @fib = 1, 1, * + * ... Inf; say @fib[6]; | 15:11 | |
camelia | 13 | ||
Voldenet | but actually | ||
p6: my @fib = 0, 1, * + * ... Inf; say @fib[6]; | |||
camelia | 8 | ||
johnd_perl6 | p6: my @fib = 1, 1, {^$a + ^$b} ... *; say @fib[6] | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '$a' is not declared at <tmp>:1 ------> 3my @fib = 1, 1, {^7⏏5$a + ^$b} ... *; say @fib[6] |
||
15:12
kaare_ joined
|
|||
johnd_perl6 | p6: my @fib = 1, 1, {$^a + $^b} ... *; say @fib[6]; | 15:12 | |
camelia | 13 | ||
johnd_perl6 | p6: my @fib = 1, 1, {$^a + $^b} ... *; say @fib[16]; | 15:13 | |
camelia | 1597 | ||
johnd_perl6 | p6: my @fib = 1, 1, {$^a + $^b} ... *; say @fib[600]; | ||
camelia | 178684461669052552311410692812805706249615844217278044703496837914086683543763273909969771627106004287604844670397177991379601 | ||
Voldenet | ;D | ||
unexpectably fast | |||
johnd_perl6 | p6: my @fib = 1, 1, {$^a + $^b} ... *; say @fib[6000]; | 15:15 | |
camelia | 61002008991510192252609003226598130375096219309442191900486835682890258650986409694193881623806381048629260422531750253466153164177574080996385252429749849585194794556451960621753647848629512663287296069734572044312365909202383479412709492273520813220543… | ||
johnd_perl6 | say 'woah'; | 15:16 | |
evalable6 | woah | ||
15:16
troys_ is now known as troys
15:18
AlexDani` joined
15:20
mr-foobar left
15:21
johnd_perl6 left,
AlexDaniel left
|
|||
rightfold | El_Che: I have to actually use vim-perl6 | 15:22 | |
vim-perl does not include Perl 6 | |||
15:22
mr-foobar joined
|
|||
Geth | doc: 56367baa91 | (Jan-Olof Hendig)++ | doc/Language/regexes.pod6 Fixed a slightly broken code example. timotimo++ |
15:25 | |
15:27
wamba joined
15:29
aborazmeh left
15:31
ccntrq left
15:34
ccntrq joined
|
|||
mst | rightfold: different programming languages tend to have different plugins, yes. | 15:36 | |
vim-python also does not include perl6 :) | |||
15:37
BenGoldberg joined,
zacts left
|
|||
rightfold | Voldenet: the typical slowness in fib examples is due to recomputation | 15:50 | |
Just adding numbers, even if they are big, is not slow | |||
15:51
robertle joined
15:55
fatguy joined
15:58
zacts joined
|
|||
rightfold | m: sub fib($n) { $n < 2 ?? 1 !! fib($n - 1) + fib($n - 2) }; say fib(20) | 15:59 | |
camelia | 10946 | ||
rightfold | m: sub fib($n) { $n < 2 ?? 1 !! fib($n - 1) + fib($n - 2) }; say fib(600) | ||
camelia | (timeout) | ||
rightfold | m: sub fib($n) { state %ns; unless %ns{$n} { %ns{$n} = $n < 2 ?? 1 !! fib($n - 1) + fib($n - 2) }; %ns{$n} }; say fib(600) | 16:02 | |
camelia | 178684461669052552311410692812805706249615844217278044703496837914086683543763273909969771627106004287604844670397177991379601 | ||
rightfold | 🤓 | 16:03 | |
BenGoldberg | m: sub fib($n) is cached { $n < 2 ?? 1 !! fib($n - 1) + fib($n - 2) }; say fib(600) | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Use of the 'is cached' trait is experimental; please 'use experimental :cached' at <tmp>:1 |
||
BenGoldberg | m: use experimental :cached; sub fib($n) is cached { $n < 2 ?? 1 !! fib($n - 1) + fib($n - 2) }; say fib(600) | 16:04 | |
camelia | 178684461669052552311410692812805706249615844217278044703496837914086683543763273909969771627106004287604844670397177991379601 | ||
araraloren | m: constant f = sub fib($n) { state %ns; unless %ns{$n} { %ns{$n} = $n < 2 ?? 1 !! fib($n - 1) + fib($n - 2) }; %ns{$n} }(600); say f; | ||
camelia | 178684461669052552311410692812805706249615844217278044703496837914086683543763273909969771627106004287604844670397177991379601 | ||
araraloren | m: constant f = sub fib($n) { $n < 2 ?? 1 !! fib($n - 1) + fib($n - 2) }(600); say f; | 16:05 | |
:( | |||
camelia | (timeout) | ||
BenGoldberg | m: sub fib($n) { (state %){$n} //= $n < 2 ?? 1 !! fib($n - 1) + fib($n - 2) }; say fib(600) | ||
camelia | 178684461669052552311410692812805706249615844217278044703496837914086683543763273909969771627106004287604844670397177991379601 | ||
rightfold | Dat syntax | 16:07 | |
BenGoldberg | m: sub fib($n) { (state @ := 1, 1, *+* ...^ *)[$n] }; say fib(600) | ||
camelia | Cannot resolve caller postcircumfix:<[ ]>(Mu, Int); none of these signatures match: (\SELF, Any:U $type, |c is raw) (\SELF, int $pos) (\SELF, int $pos, Mu \assignee) (\SELF, int $pos, Mu :$BIND! is raw) (\SELF, int $pos, :$d… |
||
rightfold | m: my $; | ||
camelia | ( no output ) | ||
rightfold | m: my $ = 42; | ||
camelia | ( no output ) | ||
rightfold | m: my $ = 42; say $; | ||
camelia | (Any) | ||
rightfold | Lol | ||
m: say @; | |||
TimToady | that's two different anonymous vars | ||
camelia | [] | ||
BenGoldberg | Each anonymous variable is distinct. | ||
rightfold | Ah ok | 16:08 | |
Cooliosis | |||
araraloren | m: constant f = (1, 1, * + * ... *)[600]; say f | ||
camelia | 178684461669052552311410692812805706249615844217278044703496837914086683543763273909969771627106004287604844670397177991379601 | ||
TimToady | m: say $++, $-- for 1..10 | ||
camelia | 00 1-1 2-2 3-3 4-4 5-5 6-6 7-7 8-8 9-9 |
||
TimToady | m: say (1,1,&[+]...*)[600] | 16:09 | |
camelia | 178684461669052552311410692812805706249615844217278044703496837914086683543763273909969771627106004287604844670397177991379601 | ||
araraloren | Even they are in same scope ? | ||
BenGoldberg | Yes. | ||
araraloren | m: say $++; say $++; | ||
camelia | 0 0 |
||
TimToady | each $ is like (state $) | ||
m: say (state $)++, (state $)-- for 1..10 | 16:10 | ||
camelia | 00 1-1 2-2 3-3 4-4 5-5 6-6 7-7 8-8 9-9 |
||
araraloren | oh | ||
TimToady | that was construed to be much more useful than anonymous 'my' vars :) | ||
rightfold | m: say (my $)++ for 1..10; | ||
camelia | 0 1 2 3 4 5 6 7 8 9 |
||
Geth | ecosystem: 0294679ce9 | (Gabor Szabo)++ | META.list Bailador use 'main' as it's release branch |
16:11 | |
TimToady | m: sub foo () { say $++ }; foo() for 1..10 | ||
camelia | 0 1 2 3 4 5 6 7 8 9 |
||
TimToady | m: sub foo () { say (my $)++ }; foo() for 1..10 | ||
camelia | 0 0 0 0 0 0 0 0 0 0 |
||
TimToady | there's the difference | ||
araraloren | Oh, I see | 16:12 | |
16:12
Herby_ left
16:21
mr-foobar left
16:22
mr-foobar joined
16:27
kaare__ joined
16:28
kaare_ left
|
|||
rightfold | Is the my hoisted to the top of the function? | 16:31 | |
m: for ^10 { say $++ } | 16:32 | ||
camelia | 0 1 2 3 4 5 6 7 8 9 |
||
rightfold | m: for ^10 { say (my $)++ } | ||
camelia | 0 0 0 0 0 0 0 0 0 0 |
||
16:32
kaare__ is now known as kaare_
|
|||
rightfold | m: say (my $)++ for ^10; | 16:32 | |
camelia | 0 1 2 3 4 5 6 7 8 9 |
||
rightfold | m: my $x = $_ for ^10; say $x | 16:33 | |
camelia | 9 | ||
rightfold | extremely interesting | ||
moritz | does anybody know the publication dates of "Perl 6 at a Glance" and "Migrating to Perl 6"? (Andrew's books) | ||
rightfold: scopes are delimited by curly braces. No curlies means it's visible in the whole compunit (here file) | 16:34 | ||
ah, migrating to perl 6 is only available for preorder right now | 16:35 | ||
rightfold | moritz: ok | 16:43 | |
16:43
CacoS left
|
|||
rightfold | m: my $x = $_ for ^0; say $x | 16:43 | |
camelia | (Any) | ||
16:48
pmurias joined
16:50
mr-foobar left
16:53
mr-foobar joined
16:54
zakharyas joined
17:05
Cabanossi left
17:07
Cabanossi joined
17:15
domidumont joined
17:27
fatguy left
|
|||
Geth | doc: 5ff9a68825 | (Zoffix Znet)++ | 3 files Make xtest pass |
17:29 | |
doc: 9bf4e37b02 | (Zoffix Znet)++ | xt/code.pws Remove from wordlist accidentally added incorrect word |
|||
rightfold | What was the syntax to set the type smiley of the receiver? I can't find it. | 17:32 | |
oh, method foo(T:D: ...) | 17:33 | ||
17:34
AlexDani` is now known as AlexDaniel
17:39
zakharyas left
17:41
troys is now known as troys_
17:42
LeCamarade left
|
|||
Voldenet | rightfold: I know, It's possible to implement it somehow saner | 17:52 | |
sub fib($i) { my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v[$i%3] = @v[($i+1)%3] + @v[($i+2)%3] }; @v[0] }; say fib(100); | |||
m: sub fib($i) { my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v[$i%3] = @v[($i+1)%3] + @v[($i+2)%3] }; @v[0] }; say fib(100); | |||
camelia | Cannot resolve caller postfix:<-->(Int); the following candidates match the type but require mutable arguments: (Mu:D $a is rw) (Int:D $a is rw) The following do not match for other reasons: (Bool:D $a is rw) (Bool:U $a is … |
||
Voldenet | wut | ||
m: sub fib { my ($i) = @_; my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v[$i%3] = @v[($i+1)%3] + @v[($i+2)%3] }; @v[0] }; say fib(100); | 17:54 | ||
camelia | 354224848179261915075 | ||
17:54
mcmillhj left
|
|||
Voldenet | the good point is C implementability | 17:55 | |
17:57
TEttinger joined
|
|||
Voldenet | ...and better performance compared to list ;P | 17:58 | |
m: sub x($i){ .say while $i-- }; x(5); | 18:07 | ||
camelia | Cannot resolve caller postfix:<-->(Int); the following candidates match the type but require mutable arguments: (Mu:D $a is rw) (Int:D $a is rw) The following do not match for other reasons: (Bool:D $a is rw) (Bool:U $a is … |
||
Voldenet | hmm, don't you think it's kind of insane you can't do this? | ||
m: sub x($i is copy){ .say while $i-- }; x(5); | 18:08 | ||
camelia | (Any) (Any) (Any) (Any) (Any) |
||
moritz | not really | 18:12 | |
Voldenet | I wouldn't mind if some types were copied by default, but I guess I understand the logic | 18:15 | |
18:15
pmurias left
|
|||
moritz | m: sub x($i is copy){ say $i while $i-- }; x(5); | 18:16 | |
camelia | 4 3 2 1 0 |
||
Voldenet | oh, I didn't mean the say | ||
i meant the /is copy/ for Int | |||
18:17
pmurias joined
|
|||
moritz | I find the "is copy" to be good documentation that $i isn't constant within the sub | 18:18 | |
(given that paramaters are usually constant) | |||
Voldenet | hm, unless they're instance of a class, they're mutable then :) | ||
moritz | most everything is an instance of a class in Perl 6 | 18:19 | |
18:20
espadrine_ joined
18:21
mr-foobar left,
araraloren_ joined
18:22
mr-foobar joined
18:23
araralonre__ joined
18:24
araraloren left
18:26
araraloren_ left
18:34
kaare__ joined,
kaare_ left
18:36
Cabanossi left
18:37
Cabanossi joined
18:40
jameslenz left
18:48
holyghost joined
|
|||
timotimo | classes are instances of a class, too | 18:52 | |
18:57
kaare__ is now known as kaare_
19:05
kaare__ joined
19:06
kaare_ left
|
|||
pmurias | Voldenet: it's not the Int that's being copied it's the variable | 19:10 | |
Voldenet | well, apparently it's the box | 19:11 | |
in which case it makes sense | |||
19:13
rindolf left
19:28
domidumont left
19:36
CacoS joined
|
|||
Voldenet | ouch, I just compared p6's fib implementation I just pasted to C implementation | 19:37 | |
timotimo | and it's faster? no way :P | 19:38 | |
Voldenet | it's .02s vs 1.4s-faster | 19:39 | |
sure, I'd expect some overhead, but that's scary | |||
timotimo | how does the sequence operator compare? | ||
Voldenet | ~2s-ish | ||
timotimo | m: say (1, 1, *+* ... *)[100] | ||
camelia | 573147844013817084101 | ||
timotimo | how man | ||
how many-th number? | |||
i bet doing it without an array would make it a bunch faster | 19:40 | ||
Voldenet | 1e5 | ||
timotimo | m: say (1, 1, *+* ... *)[1e5].msb | ||
camelia | 69423 | ||
timotimo | how do you do it in C? | ||
Voldenet | ix.io/we6 | ||
timotimo | ah, the gmp one | 19:41 | |
bench: compare HEAD sub fib { my ($i) = @_; my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v[$i%3] = @v[($i+1)%3] + @v[($i+2)%3] }; @v[0] }; say fib(1000); ||| m: sub fib { my ($i) = @_; my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v.ASSIGN-POS($i%3, @v.AT-POS(($i+1)%3) + @v.AT-POS(($i+2)%3) }; @v[0] }; say fib(100); | 19:42 | ||
benchable6 | timotimo, starting to benchmark the 1 given commit | ||
19:42
raschipi joined
|
|||
benchable6 | timotimo, ¦HEAD: «04===SORRY!04=== Error while compiling -eUnable to parse expression in argument list; couldn't find final ')' at -e:1------> 03.AT-POS(($i+1)%3) + @v.AT-POS(($i+2)%3) 08⏏04}; @v[0] }; say fib(100); } ; my $b = Be» | 19:42 | |
timotimo | whoops | 19:43 | |
MasterDuke | timotimo: also, you need the give the subs different names | ||
timotimo | bench: compare HEAD sub fib { my ($i) = @_; my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v[$i%3] = @v[($i+1)%3] + @v[($i+2)%3] }; @v[0] }; say fib(1000); ||| m: sub fib { my ($i) = @_; my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v.ASSIGN-POS($i%3, @v.AT-POS(($i+1)%3) + @v.AT-POS(($i+2)%3)) }; @v[0] }; say fib(100); | ||
benchable6 | timotimo, starting to benchmark the 1 given commit | ||
timotimo, gist.github.com/bf49f3d01f0d955770...d6a2396f3d | |||
19:43
darutoko- left
|
|||
MasterDuke | huh, at least i thought you did | 19:44 | |
timotimo | bench: compare HEAD sub fib { my ($i) = @_; my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v[$i%3] = @v[($i+1)%3] + @v[($i+2)%3] }; @v[0] }; say fib(1000); ||| m: sub fib { my ($i) = @_; my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v.ASSIGN-POS($i%3, @v.AT-POS(($i+1)%3) + @v.AT-POS(($i+2)%3)) }; @v[0] }; say fib(1000); | ||
benchable6 | timotimo, starting to benchmark the 1 given commit | ||
timotimo, gist.github.com/bcd2007a19bec85532...9a90446536 | |||
timotimo | interesting, hardly any difference | ||
Voldenet | oh wow | ||
timotimo | the benchmark difference above was comparing 100 vs 1000 | ||
Voldenet | actually printing this to console takes +.300ms | ||
timotimo | a third of a milisecond? | 19:45 | |
Voldenet | so i guess building a Str | ||
erm | |||
+.300s | |||
I guess building a string representation out of a bigint isn't the fastest operation | 19:46 | ||
timotimo | bench: compare HEAD sub fib { my ($i) = @_; my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v[$i%3] = @v[($i+1)%3] + @v[($i+2)%3] }; @v[0] }; say fib(1000); ||| sub fib { my ($i) = @_; my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v[$i%3] = @v[($i+1)%3] + @v[($i+2)%3] }; @v[0] }; fib(1000); | ||
benchable6 | timotimo, starting to benchmark the 1 given commit | ||
timotimo, gist.github.com/3fc5343428c1eefc0b...e7d4e724f4 | |||
timotimo | only a quarter of time to print it for the 1000th number | ||
with 1e5 the value is very similar | 19:48 | ||
oh, heh | |||
19:49
zapwai joined
|
|||
timotimo | when you use 1e5 instead of 1e5.Int, you'll be turning 1e5 into an Int every single step of the way | 19:49 | |
i.e. 1e5 times | |||
Voldenet | Oh, wow. | 19:50 | |
timotimo | that change alone gets me from 2.5 to 2.0 seconds | 19:51 | |
Voldenet | > sub fib { my ($i) = @_; my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v[$i%3] = @v[($i+1)%3] + @v[($i+2)%3] }; @v[0] }; say fib(1e5); | ||
real 0m1.421s | |||
> sub fib { my int ($i) = @_; my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v[$i%3] = @v[($i+1)%3] + @v[($i+2)%3] }; @v[0] }; say fib(1e5.Int); | 19:52 | ||
real 0m0.825s | |||
that's amazing | |||
timotimo | yeah, a native int for $i makes it a whole bunch faster, too | 19:53 | |
0.8s by leaving out the "say" as well | |||
19:53
cyphase left
|
|||
Voldenet | well, so the 'deadly slow' points are pretty much obvious by now | 19:54 | |
timotimo | impressively, 20% of time spent in GC now | ||
Voldenet | hmm, I guess it allocates 10k+3 Int objects | 19:55 | |
timotimo | i don't understand why, but the four most expensive frames all don't get jitted | ||
aha | 19:57 | ||
hmpf. bails on one of the param ops | 19:58 | ||
19:59
cyphase joined
|
|||
timotimo | hm. we really do spend 43% of time in a bigint add function | 20:00 | |
like, MVM_bigint_add | |||
and in mp_add and s_mp_add of course | |||
eew, mp_grow takes up 17% of time. i wonder if we're doing something silly to start with very small bigints even though we know we're adding two very large ones? | 20:01 | ||
15% in mp_clear, too | |||
that's potentially the big time loss inside GC | 20:02 | ||
so yeah, as long as we can't figure out that we could allocate these int objects on the stack (which is very hard to prove here, i bet) we'll be spending around this amount of time to do this calculation | 20:03 | ||
might be able to halve it, but not /10 or /100 | 20:04 | ||
5% of time spent in the interpreter itself, so not very much to gain from jitting either | 20:05 | ||
20:08
cdg joined
|
|||
Voldenet | I wonder if there would be any difference if I implemented it differently | 20:09 | |
20:10
cdg left,
kaare__ is now known as kaare_
|
|||
Voldenet | bench: compare HEAD sub fib { my int ($t) = @_; my ($a, $b) = (0, 1); while $t-- { ($a, $b) = ($b, $a + $b) }; $a }; say fib(1e4.Int); ||| sub fib { my int ($i) = @_; my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v[$i%3] = @v[($i+1)%3] + @v[($i+2)%3] }; @v[0] }; say fib(1e4.Int); | 20:10 | |
benchable6 | Voldenet, starting to benchmark the 1 given commit | ||
20:10
cdg joined
|
|||
benchable6 | Voldenet, gist.github.com/f3949ef696df311893...f220bfcbf8 | 20:10 | |
20:11
zakharyas joined
|
|||
rightfold | m: sub f(--> Str:D) { } | 20:11 | |
camelia | ( no output ) | ||
Voldenet | not the direction I wanted to take | ||
rightfold | m: sub f(--> Str:D) { }; f() | ||
camelia | ( no output ) | ||
timotimo | hm, i think assignment like that is extremely slow right now | 20:12 | |
rightfold | Why is this not an error? | ||
timotimo | ($a, $b) = (...) | ||
rightfold: Nil goes through all returns, because it's Failure | |||
rightfold | oh ok | ||
20:17
araraloren_ joined
|
|||
Voldenet | hmm, using ugly temp variable made it a lot faster, but not comparably to array implementation | 20:18 | |
timotimo | oh? the array one was still faster? | ||
Voldenet | bench: compare HEAD sub fib { my int ($t) = @_; my ($a, $b, $tmp) = (0, 1); while $t-- { $tmp = $a; $a = $b; $b = $tmp + $b }; $a }; say fib(1e4.Int); ||| sub fib { my int ($i) = @_; my @v = [1,1,1]; @v[$i%3] = 0; while $i-- { @v[$i%3] = @v[($i+1)%3] + @v[($i+2)%3] }; @v[0] }; say fib(1e4.Int); | 20:19 | |
benchable6 | Voldenet, starting to benchmark the 1 given commit | ||
Voldenet, gist.github.com/0045622a45648304a8...6d665292b5 | |||
timotimo | huh, it's twice as fast | 20:20 | |
20:20
araralonre__ left
20:21
mr-foobar left
|
|||
Voldenet | ah, right, I forgot to use "say" | 20:21 | |
magic word that makes it a lot slower | |||
timotimo | i see output in both, though? | 20:22 | |
Voldenet | (the array version is actually slower) | ||
timotimo | ah, you had the say only in the temp-var-one | ||
20:25
mr-foobar joined
20:32
zacts left
20:35
Cabanossi left
20:37
Cabanossi joined
20:38
zacts joined
20:39
Cabanossi left,
Ben_Goldberg joined,
BenGoldberg left,
Ben_Goldberg is now known as BenGoldberg,
Cabanossi joined
20:40
lizmat left,
jameslenz joined,
zakharyas left
20:41
Cabanossi left,
Cabanossi joined
20:45
jameslenz left
20:47
jameslenz joined
|
|||
Geth | ecosystem: 9b6ea9d0d1 | (Zoffix Znet)++ (committed using GitHub Web editor) | META.list Add WhereList to ecosystem "Simpler `where` constraints for items of lists": github.com/zoffixznet/perl6-WhereList |
20:50 | |
20:50
lizmat joined
20:55
lizmat left
20:58
zapwai left
20:59
yqt joined
21:00
cdg_ joined
21:02
cdg left
21:05
Some-body_ joined,
DarthGandalf left,
Cabanossi left,
vcv left
21:06
Some-body_ is now known as DarthGandalf
21:07
Cabanossi joined
|
|||
pilne | have i not dug deep enough into perl6 yet, or does it not do the "context" based things like perl5 (i.e. my $a = @array setting $a to the length of @array)? | 21:09 | |
timotimo | that is correct | 21:10 | |
you have to +@array or @array.elems | |||
mst | the removal of wantarray() from perl6 makes me very happy. | ||
pilne | i will miss it somewhat, but not enough to feel remorse. | 21:11 | |
(the $a=@array) | |||
timotimo | you can now put arrays into $foo vars without \-ing them | ||
pilne | yeup! | ||
much more useful than saving a few keystrokes | 21:12 | ||
that's one thing i've noticed, i type a bit more "per thing" in perl6, but i type a lot less overall | |||
and, unless i'm trying to golf, the code is almost not needing comments | |||
(i still comment my stuff, because it's the right way to do things in my book, but it is nice regardless). | 21:13 | ||
timotimo | yeah, no comments needed for [>>+>>] at all :D | ||
pilne | the [] idea is fantastic though | ||
i'll have to put "shaking larry wall's hand" on my bucket list. | |||
Xliff | [>>+>>] _ O_o | 21:16 | |
<sarcasm>No. We don need no steeking comments!</sarcasm> | |||
timotimo | damn commies :) | 21:17 | |
Xliff | timotimo: Will you explain what that piece of line noise is? | ||
pilne | [>>+>>][<<+<<] | ||
timotimo | well, if you have [>>+>>] @a, @b, @c, it'll pretend you wrote @a >>+>> @b >>+>> @c | 21:18 | |
Xliff pulls what's left of his hair. | |||
Yeah. [] is good. | |||
But that operator is unfamiliar. | |||
pilne | and... just because i haven't seen it, what is >>+>> | ||
Xliff | ^^ SEE! | ||
pilne | something to do with hyper? | ||
timotimo | yeah | ||
Xliff | Oh got please no... | ||
Wah! | 21:19 | ||
So »+» is a thing, too? | |||
timotimo | yup | ||
raschipi | m: say (1, 2, 3, 4) »~» <a b>; | ||
camelia | (1a 2b 3a 4b) | ||
Xliff | So. Hyper addition, then? | ||
pilne | hyper and race are neat, i never thought it would be something to have the choice of keeping or not keeping order when doing something in parallel. | ||
timotimo | you put >> or << on either side of an infix operator and it'll distribute; you hold the pointy end against things you want to allow to grow, you hold the blunt end against things you require to only be run over once | ||
raschipi | m: say (1, 2, 3, 4) »~» (5, 6); | 21:20 | |
camelia | (15 26 35 46) | ||
pilne | see, that would be a decent chunk of code otherwise.... | ||
raschipi | m: say (1, 2, 3, 4) »+» (5, 6); | ||
camelia | (6 8 8 10) | ||
Xliff | \o/ | 21:21 | |
Wait. | |||
\O/ | |||
raschipi | That's (1+5, 2+6, 3+5, 4+6) | ||
Xliff | One of those was made famous by Mccauley Caulkin | ||
pilne | lol | 21:22 | |
i think i'm going to find a useful way to make \O/ an operator | |||
Xliff | kk. So 'tis a new fangled thang that I had not caught in the change logs. | ||
pilne: I. DARE. YOU!!! | |||
pilne | it might take a few revision cycles! | ||
Xliff | ];-> | ||
raschipi | This example from the docs is fun: | 21:23 | |
m: my $neighbors = ((-1, 0), (0, -1), (0, 1), (1, 0)); my $p = (2, 3); say $neighbors »>>+<<» ($p, *); | |||
camelia | ((1 3) (2 2) (2 4) (3 3)) | ||
raschipi | Try that without comments. | 21:24 | |
Xliff faints. | |||
Geth | doc: 5dfae24189 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/operators.pod6 Swap .&fail to fail $_ At least ATM, the former doesn't actually throw CX::Return exception |
||
pilne | so basically >><< is the "distribution" operator. | ||
21:26
yqt left
|
|||
raschipi | m: say (1, 2, 3, 4) «+» (5, 6); | 21:26 | |
camelia | (6 8 8 10) | ||
raschipi | m: say (1, 2, 3, 4) «+« (5, 6); | 21:27 | |
camelia | (6 8) | ||
raschipi | m: say (1..*) «+« (5, 6); | ||
camelia | (6 8) | ||
raschipi | m: say (1..*) «+« (5, 6, 7); | ||
camelia | (6 8 10) | ||
21:33
cdg_ left
21:34
Herby_ joined
|
|||
Herby_ | o/ | 21:34 | |
raschipi | m: say (1..*) »+« (5, 6); | ||
camelia | List on left side of hyperop of infix:<+> is known to be infinite in block <unit> at <tmp> line 1 |
||
raschipi | Why doesn't that return an infinite list? | 21:35 | |
timotimo | because infinite lists have to be lazy | ||
and lazy is literally the opposite of hyper | |||
also, it'd have to complain that Inf != 2 | |||
BenGoldberg | m: say (1, 2, 3, 4) »+« (5, 6); | ||
camelia | Lists on either side of non-dwimmy hyperop of infix:<+> are not of the same length left: 4 elements, right: 2 elements in block <unit> at <tmp> line 1 |
||
raschipi | Thanks timotimo++ | 21:36 | |
BenGoldberg | Like that ^ but "Inf" instead of "4". | ||
timotimo | m: say (1..*) Z+ (|(5, 6) xx *) | ||
camelia | (...) | ||
timotimo | m: say ((1..*) Z+ (|(5, 6) xx *))[^20] | ||
camelia | (6 8 8 10 10 12 12 14 14 16 16 18 18 20 20 22 22 24 24 26) | ||
BenGoldberg | m: say ((1..*) Z~ (|(<a b>) xx *))[^20] | 21:37 | |
camelia | (1a 2b 3a 4b 5a 6b 7a 8b 9a 10b 11a 12b 13a 14b 15a 16b 17a 18b 19a 20b) | ||
timotimo | Z is able to give you a lazy list | ||
raschipi | That solves it. | 21:38 | |
timotimo | but there's no control on it for "how do you handle one list being shorter than the other?" it'll just always stop when one list is expended | ||
raschipi | That's why you make both infinite. | ||
timotimo | yup | 21:39 | |
it's easy to forget, though, and can lead to data loss | |||
we used to not run all test files when we had harness6 with multiple test_jobs, because it was creating batches with Z or something | |||
21:43
CacoS left
21:48
espadrine_ left
21:50
lizmat joined
|
|||
Herby_ | I just discovered the p6 module File::Find | 22:00 | |
github.com/tadzik/File-Find | |||
I'm trying to utilize the second example, to lazily return retuls | 22:01 | ||
results | |||
so I have: my $list = find(dir => 'foo') | |||
timotimo | that was example code from before the GLR i'd say | ||
Herby_ | hmm | ||
timotimo | m: my @foo = 1..*; say @foo[^100] | ||
camelia | (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 8… | ||
timotimo | that used to lose you lazyness | 22:02 | |
List assignment is eager in Perl 6, so if you assign find() result to an array, the elements will be copied and the laziness will be spoiled. For a proper lazy list, assign a result to a scalar value (see SYNOPSIS). | |||
^- that's from the "caveats" section at the bottom and it's no longer true | |||
22:02
nadim left
|
|||
Herby_ | ok. as someone who doesn't have a great understanding of lazy/eager, how should I utilize File::Find if I want to do it lazily? | 22:03 | |
timotimo | i wonder if the module needs any adjustments for GLR stuff | 22:04 | |
Herby_ | the lib/File description on that link I posted says: Update to post-GLR semantics | ||
not sure if that means its needs updating, or was updated | |||
timotimo | ah, nice | ||
that's the commit description (well, the title at least) of the last commit that touched the file in question | 22:05 | ||
if you click the title it gives you the whole commit including the rest of the description and what exact changes there were | |||
Herby_ | ahh ok | ||
22:06
Cabanossi left
22:07
Cabanossi joined
|
|||
Herby_ | if I do follow that lazy example, how do I print each item on it's own line? | 22:08 | |
my $list = find(dir => 'foo'); | |||
for $list -> $file { say $file } | |||
that just prints it as one blob | |||
so i'm guessing i'm missing something | |||
timotimo | yup, that's because "for $something" will only ever give you a single iteration | 22:09 | |
you'll want "for @$list" or have the find stuff in a @ variable to begin with | |||
Herby_ | ah ok | ||
thanks | |||
timotimo | this is part of the "single-arg-rule semantics" we've introduced with the GLR | ||
for things that behave single-arg-ruley, you'll get iteration of the outermost thing unless it's in a scalar container | 22:10 | ||
so "for @foo" will give you each entry directly inside @foo, "for (@foo,)" will give you just @foo once | |||
Herby_ | that makes sense | ||
timotimo | m: my $foo = Slip.new(1, 2, 3); for $foo -> $thing { say "thing is $thing" } | 22:11 | |
camelia | thing is 1 thing is 2 thing is 3 |
||
timotimo | unless it's slippy, i suppose | ||
Herby_ | : say BagHash.new.categorize-list: { gather { take 'largish' if $_ >5; take .is-prime ?? 'prime' || 'non-prime'; }, ^10 | 22:13 | |
m: say BagHash.new.categorize-list: { gather { take 'largish' if $_ >5; take .is-prime ?? 'prime' || 'non-prime'; }, ^10 | |||
camelia | 5===SORRY!5=== Error while compiling <tmp> Confused: Found ?? but no !! at <tmp>:1 ------> 3take .is-prime ?? 'prime' || 'non-prime'7⏏5; }, ^10 |
||
Herby_ | m: say BagHash.new.categorize-list: { gather { take 'largish' if $_ >5; take .is-prime ?? 'prime' !! 'non-prime'; }, ^10 | 22:14 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing block at <tmp>:1 ------> 3-prime ?? 'prime' !! 'non-prime'; }, ^107⏏5<EOL> expecting any of: statement end statement modifier statement modifier loop |
||
Herby_ | m: say BagHash.new.categorize-list: { gather { take 'largish' if $_ >5; take .is-prime ?? 'prime' !! 'non-prime'; }, ^10; | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing block at <tmp>:1 ------> 3prime ?? 'prime' !! 'non-prime'; }, ^10;7⏏5<EOL> |
||
Herby_ | hm | ||
timotimo | that { } around the gather/take may be wrong here | ||
Herby_ | docs.perl6.org/routine/categorize-list | ||
trying to copy that first example | 22:15 | ||
timotimo | oooh | ||
of course | |||
Herby_ | recently discovered categorize-list and it might be perfect for what i'm trying to do | ||
timotimo | you can also use categorize instead of categorize-list | 22:16 | |
MasterDuke | Herby_: you're missing a '}' | ||
Herby_ | m: say BagHash.new.categorize-list: { gather { take 'largish' if $_ >5; take .is-prime ?? 'prime' !! 'non-prime'; } }, ^10; | 22:17 | |
camelia | BagHash.new(largish(4), non-prime(6), prime(4)) | ||
Herby_ | :) | ||
timotimo | that's better | ||
Herby_ | timotimo: i'll take a look at categorize | ||
m: say % .categorize-list: { | 22:18 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing block at <tmp>:1 ------> 3say % .categorize-list: {7⏏5<EOL> |
||
Herby_ | gather { | ||
take 'prime' if .is-prime; | |||
take 'largish' if $_ > 5; | |||
take $_ %% 2 ?? 'even' !! 'odd'; | |||
timotimo | the difference is that categorize doesn't give you the opportunity to decide what kind of object comes out | ||
Herby_ | } | ||
}, ^10; | |||
gah, i'll leave it alone | |||
gotcha | |||
timotimo | feel free to open a private chat with camelia | 22:19 | |
Herby_ | i have a list of files, and i just want to categorize them into either type A or type B | ||
will do | |||
timotimo | oh | ||
in that case you may want classify instead :) | |||
classify is for when you have a single category every single value fits into | 22:20 | ||
categorize is for when you have multiple categories that individual values might fall into | |||
i.e. you can have values that are both largish and prime | |||
Herby_ | ah ok | 22:21 | |
timotimo | so a single value may show up in both the largish list and the prime list | ||
Herby_ | ok, yeah these files are either A or B, not both. classify sounds like its what I want | ||
23:08
Exodist left
23:09
Exodist joined,
wamba left
23:13
grumble left
23:14
grumble joined,
grumble left
23:16
grumble joined
23:29
BenGoldberg left
23:31
Rawriful joined
|
|||
rightfold | m: role R { method Str() { 'hidden!' } }; my $i = 2; $i but R; say $i.Str | 23:37 | |
camelia | 2 | ||
rightfold | m: role R { method Str() { 'hidden!' } }; my $i = 2; ($i but R).WHAT.perl.say | ||
camelia | Int+{R} | ||
rightfold | Ah it creates a wrapper | 23:38 | |
Cool | |||
timotimo | "but" makes a copy | ||
well, a clone | |||
m: role R { method Str() { 'hidden!' } }; my $i = 2; say ($i but R).Str; say $i.Str | |||
camelia | hidden! 2 |
||
rightfold | Does it not reference the original object? | ||
timotimo | nope. though the clone is shallow | 23:39 | |
rightfold | Ok | 23:40 | |
Is does the same as but + reassignment? | |||
timotimo | m: class Foo { has @.array }; role Bar { method lol { say "oooh" } }; my $orig = Foo.new; $orig.array[2] = "yo"; my $clone = $orig but Bar; $clone.lol; $orig.array.say; $clone.array[1] = "woop"; $orig.array.say | ||
camelia | oooh [(Any) (Any) yo] [(Any) woop yo] |
||
timotimo | no, it mutates the original object | ||
so whatever variables refered to the object will now refer to the changed object as well | 23:41 | ||
rightfold | :( | ||
timotimo | gotta go get some sleeps | ||
have a good one! | |||
Herby_ | o/ | 23:42 | |
i've come to realize that I am absolutely terrible at naming items in my code | |||
worst namer ever | |||
rightfold | m: role R { method Str() { 'hidden!' } }; class C { has $.a }; my $x = C.new(a => 1); $x does R; say $x.WHAT | 23:43 | |
camelia | (C+{R}) | ||
Xliff | say 4.is-prime | 23:44 | |
evalable6 | False | ||
rightfold | m: role R { method Str() { 'hidden!' } }; my $x = 1; $x does R; say $x.WHAT | ||
camelia | (Int+{R}) | ||
Xliff | m: say BagHash.new.categorize-list: { gather { take 'largish' if $_ >5; take .is-prime ?? 'prime' !! 'non-prime'; } }, ^10; | ||
camelia | BagHash.new(largish(4), non-prime(6), prime(4)) | ||
Xliff | That math doesn't look right. | 23:45 | |
4 is not prime, for example. | |||
raschipi | m: (^10).grep({.is-prime}) | 23:46 | |
camelia | ( no output ) | ||
raschipi | m: say (^10).grep({.is-prime}) | ||
camelia | (2 3 5 7) | ||
raschipi | 4 primes in ^10, it's the right answer. | ||
m: say (^10).grep({$_ >5}) | 23:47 | ||
camelia | (6 7 8 9) | ||
Xliff | Ooh. I am interpreting the code incorrectly. | 23:48 | |
raschipi | m: say Hash.new.categorize-list: { gather { take 'largish' if $_ >5; take .is-prime ?? 'prime' !! 'non-prime'; } }, ^10; | 23:49 | |
camelia | {largish => [6 7 8 9], non-prime => [0 1 4 6 8 9], prime => [2 3 5 7]} | ||
rightfold | m: 42.^rebless(Str).say | 23:52 | |
camelia | X::Method::NotFound exception produced no message in block <unit> at <tmp> line 1 |
||
23:53
pmurias left
|
|||
raschipi | rightfold: Up to no good, I see... | 23:58 | |
MasterDuke | that error message will be fixed after the next NQP bump | 23:59 |