»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg p6eval perl6: ... | irclog: irc.perl6.org/ | UTF-8 is our friend! Set by sorear on 4 February 2011. |
|||
timotimo | wouldn't a zen-slice[] copy a list? | 00:00 | |
i must be misunderstanding coroutines :| | 00:05 | ||
or maybe binding or lazyness or something entirely different. | 00:06 | ||
00:07
bot48 joined
00:15
bot48 left
|
|||
timotimo | hm, i would have liked to gist this and feed it to p6eval, but could as well just sprunge it | 00:16 | |
sprunge.us/AOFJ | |||
the only surprise i can't get rid of is that each of the combinations is apparently a parcel with a list as second argument, but i can't really turn it into a single parcel, because that just flattens the outermost list into utter unhelpfulnes | 00:17 | ||
also it's very interesting how the number of elements you take out of the outermost lazy list causes the first element to be longer, that seems kind of unnatural :D | |||
00:18
bot48 joined
|
|||
timotimo | sprunge.us/DbKJ - sample output for [^30], sample output for [^10]: sprunge.us/NIbe | 00:19 | |
00:25
rurban1 left
00:26
MayDaniel left
|
|||
timotimo | and i can't run the perl6-debugger because it's saying "Missing or wrong version of dependency 'src/gen/Metamodel.pm'" and i can't install it via panda because github is down :| | 00:27 | |
00:44
slayer101_ joined
00:53
ServerSage joined
01:21
rurban joined
01:22
slayer101_ left
01:23
bowtie left
01:29
pmurias left
01:31
rurban left
01:33
rummik left,
rummik joined
01:38
Celelibi joined
01:40
PacoAir left
01:44
cognominal joined
02:00
mj41 joined
02:07
thou_ joined
02:09
slayer101_ joined
|
|||
diakopter | urp. github still down. | 02:11 | |
scheduled or unscheduled? | |||
sorear | diakopter: failures during scheduled maintance, Chernobyl style | 02:12 | |
diakopter: status.github.com/messages | |||
diakopter | if only this were distributed.. oh wait. | 02:13 | |
02:15
rurban joined
02:22
skids joined
02:28
mj41 left
02:34
MikeFair_ left
02:36
rurban left
|
|||
cognominal | unlike chernobyl, the fallout reaches France. | 02:38 | |
02:49
mj41 joined
02:54
mj41 left,
FROGGS_ joined
02:58
FROGGS left
|
|||
[Coke] | No such method 'length' for invocant of type 'Str' | 03:00 | |
03:03
Chillance left
|
|||
diakopter | No such method 'resurrect' for invocant of type 'github' | 03:22 | |
sorear | [Coke]: length is gone, sorry. did you mean "chars"? | 03:23 | |
03:26
cognominal left,
mj41 joined,
cognominal joined
03:31
mj41 left
03:46
mj41 joined
04:09
slayer101_ left
04:14
cognominal left,
raiph left
04:19
cognominal joined
04:23
slayer101_ joined
04:25
cognominal_ joined
04:26
cognominal left,
snarkyboojum_ is now known as snarkyboojum
04:30
cognominal_ left
04:34
slayer101_ left
04:35
hash_table left
04:36
slayer101_ joined
04:39
chubbyLady joined
04:40
chubbyLady left
05:11
telex left
05:18
telex joined
05:21
aindilis joined
05:29
lolage left
05:31
telex left
05:37
telex joined
05:40
slayer101_ left
05:42
mj41 left
05:58
mj41 joined
06:06
rurban joined
06:10
rurban left
06:27
noggle left
06:28
noggle joined
06:37
rurban joined
06:39
cognominal joined
06:42
rurban left
06:53
cognominal left
07:01
cognominal joined
07:05
noggle left
07:06
mj41 left
07:09
rurban joined
07:11
noggle joined
07:16
rurban left
07:21
mj41 joined
07:28
mj41 left
07:34
cognominal left
07:35
cognominal joined
07:37
FROGGS_ left
|
|||
moritz | timotimo: yes, perl-6.de is lots out of date | 07:43 | |
07:44
mj41 joined
|
|||
moritz | I guess I should update it, but so far I have too many other things on Perl 6 TODO heap | 07:48 | |
I'm putting the source code on github.com/moritz/perl-6.de | 07:58 | ||
if anybody wants to help, just ask for a commit bit | |||
08:07
cognominal left,
cognominal joined
08:10
rurban joined
08:11
SamuraiJack joined
08:15
cognominal left
08:16
gaussblurinc joined,
cognominal joined
08:18
rurban left
08:23
cognominal left
|
|||
moritz | timotimo: are you still looking for stuff to hack on? | 08:24 | |
timotimo: rakudo's substr-rw doesn't understand *-1 | |||
n: my $a = '1234'; say substr($a, 1, 1, '42) | 08:25 | ||
p6eval | niecza v24-12-g8e50362: OUTPUT«===SORRY!===Unable to parse argument list at /tmp/EBV219gS1w line 1:------> my $a = '1234'; say substr(⏏$a, 1, 1, '42)Couldn't find final ')'; gave up at /tmp/EBV219gS1w line 1:------> my $a = '1234'; say subs… | ||
08:25
cognominal joined
|
|||
moritz | n: my $a = '1234'; say substr($a, 1, 1, '42') | 08:25 | |
p6eval | niecza v24-12-g8e50362: OUTPUT«4» | ||
moritz | erm, what? | ||
r: my $a = '1234'; say substr($a, 1, 1, '42') | 08:26 | ||
p6eval | rakudo c8de2e: OUTPUT«Too many positional parameters passed; got 4 but expected between 2 and 3 in sub substr at src/gen/CORE.setting:2339 in block at /tmp/eT3nbR6ttb:1» | ||
08:27
donghongbo joined
08:30
cognominal left
08:34
cognominal joined
08:39
xinming left,
kaare_ joined
08:41
cognominal left,
GlitchMr joined
08:43
xinming joined
08:44
cognominal joined
08:45
rurban joined
08:54
popl joined,
rurban left
08:55
spider-mario joined
08:56
mj41 left
09:01
mj41 joined
|
|||
moritz | timotimo: I've updated perl-6.de a bit; still needs lots of updating | 09:03 | |
09:07
cognominal left,
mj41 left
|
|||
moritz | n: say do for ^4 { $_ ** 2 } | 09:09 | |
p6eval | niecza v24-12-g8e50362: OUTPUT«Nil» | ||
moritz | n: say Date.today | 09:10 | |
p6eval | niecza v24-12-g8e50362: OUTPUT«===SORRY!===Undeclared name: 'Date' used at line 1Unhandled exception: Check failed at /home/p6eval/niecza/boot/lib/CORE.setting line 1443 (die @ 5)  at /home/p6eval/niecza/src/STD.pm6 line 1147 (P6.comp_unit @ 37)  at /home/p… | ||
09:11
cognominal joined
09:16
cognominal_ joined
|
|||
GlitchMr | I've lately moved to Arch. I like how repositories have Rakudo Star 2012.11. | 09:16 | |
popl | I considered moving to Arch Linux. | ||
09:16
cognominal left
|
|||
popl | my laptop is on the way out anyways, though. | 09:17 | |
So I have Slackware and a broken Parrot | |||
and no Perl6 | |||
oh well | |||
OH, that was not the topic of conversation. My apologies. | 09:18 | ||
moritz reminds masak++ to publish a p6advent post today | 09:19 | ||
09:21
FROGGS_ joined
|
|||
FROGGS_ | morning | 09:23 | |
moritz | \o FROGGS_ | ||
FROGGS_ | moritz: is github/rakudo an org now? | 09:24 | |
09:25
popl left
|
|||
FROGGS_ | I'm asking because of the commit bit I'd like to have | 09:25 | |
bbkr | wordpress on advent calendar destroys code thinking it's HTML :( I've posted comment under masak IPv4 post about usefulnes of <?{}> | 09:26 | |
rakudo: $_ = "Go 127.666.0.1, I said! He went to 173.194.32.32."; say .Str for m:g/ ( (\d ** 1..3) <?{ 0 < $0 < 255 }> ) ** 4 % "." /; | |||
p6eval | rakudo c8de2e: OUTPUT«173.194.32.32» | ||
moritz | FROGGS_: it is, but I still can't hand them out on a whim | ||
FROGGS_ | moritz: k | 09:27 | |
moritz | FROGGS_: you need to have submitted a CLA, and the majority of the developers need to agree, and none object | ||
FROGGS_ | I sent the CLA right before 2012.11 release | 09:28 | |
moritz: what can I do to get the devs feedback? making a gist so that they can reply there? or send a mail to some address? | 09:31 | ||
09:40
tcpr1347 left
09:41
Psyche^ joined
09:42
Patterner left,
Psyche^ is now known as Patterner
09:45
mj41 joined,
rurban joined
09:52
rurban left
09:57
cognominal_ left
10:02
cognominal_ joined
10:04
rindolf joined
|
|||
moritz | FROGGS_: talk to jnthn and pmichaud | 10:06 | |
FROGGS_: you have my +1 | 10:07 | ||
10:07
ivan`` joined
10:15
ps joined,
ps is now known as Guest90247
|
|||
FROGGS_ | moritz: thanks, and thanks, will do :o) | 10:15 | |
10:16
cognominal_ left
|
|||
GlitchMr | I wanted to put problem 1 solution | 10:16 | |
It looked like this: | |||
say [+] grep * %% (3|5), ^1000; | |||
The problem is that somebody already has done that... | 10:17 | ||
Exactly like that | |||
moritz | GlitchMr: what are you talking about? | ||
GlitchMr | github.com/perl6/perl6-examples/bl...rondilu.pl | ||
moritz | so, what's the problem? | 10:18 | |
GlitchMr | But well, the problem is probably so simple that it's hard to think of other Perl6ish solution. | ||
rindolf | What is %%? | ||
Is it numeric reminder? | 10:19 | ||
GlitchMr | Divides by operator | ||
rindolf | remainder sorry. | ||
Ah. | |||
Why not a simple "%"? | |||
GlitchMr | Because % is modulo | ||
3 % 2 == 1, but 3 %% 2 == False. | |||
rindolf | Ah, hah. | ||
GlitchMr | But opposite of modulo would work too | ||
!($a % $b) is just like ($a %% $b) | 10:20 | ||
moritz | rindolf: you can look up operators on doc.perl6.org/language/operators | ||
GlitchMr | %% is actually useful operator :-). | ||
The $a % $b == 0 I often see in other programming languages annoys me. | 10:21 | ||
rindolf | doc.perl6.org/language/operators#infix+%25%25 - this link does not work in Firefox with JS blacklisted. | ||
GlitchMr | !($a % $b) is even more annoying. | ||
10:21
cognominal_ joined
|
|||
moritz | rindolf: I know there's some trouble with the anchor links | 10:22 | |
the browsers don't quite agree on what needs escaping and what not | |||
and I haven't figured it out yet | |||
rindolf | moritz: OK. | ||
I tend to avoid doing that and use custom id="..." | 10:23 | ||
GlitchMr | print(sum(i for i in range(1000) if i % 3 == 0 or i % 5 == 0)) | 10:25 | |
I believe it would look like this in Python | |||
Now for Rubyish way | 10:30 | ||
puts (1..999).select {|i| i % 3 == 0 or i % 5 == 0 }.inject(:+) | |||
You can write really short programs in Perl 6. | |||
Of course, you can write Ruby in Perl 6 | 10:33 | ||
say (1..999).grep(-> $i { $i % 3 == 0 or $i % 5 == 0 }).reduce(&[+]) | |||
Close enough | |||
10:39
jokar left
10:42
Guest90247 left
10:44
cognominal_ left
10:46
rurban joined
10:49
cognominal joined
10:51
cognominal left
10:53
pmurias joined
10:55
PacoAir joined
10:57
rurban left
11:00
Kharec joined
11:03
PacoAir left,
PacoAir joined
|
|||
masak | hola, #perl6 | 11:17 | |
sorry I haven't prepared a slot 23 post yet. | |||
I completely forgot... | |||
if you have the patience for it, I'll have one ready in a couple hours. | |||
moritz | what would be the alternative? you prepare it for tomorrow, and somebody else does a post fo today? | 11:19 | |
masak | I guess. | ||
up to you folks and bots. | 11:20 | ||
GlitchMr | Illegally post-declared types | 11:23 | |
Forward goto is disallowed in Niecza? | 11:24 | ||
rn: gist.github.com/4363016 | 11:32 | ||
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Two terms in a rowat /tmp/BFHqh1Q8Y1:13------> zero⏏: expecting any of: argument list postfix infix or meta-infix infix stopper statement end statement modifier… | ||
..niecza v24-12-g8e50362: OUTPUT«===SORRY!===Illegally post-declared types: 'no' used at line 34 'yes' used at line 23Unhandled exception: Check failed at /home/p6eval/niecza/boot/lib/CORE.setting line 1443 (die @ 5)  at /home/p6eval/niecza/src/STD.pm6 line 11… | |||
GlitchMr | std: gist.github.com/4363016 | ||
felher | masak: I think we can wait a couple of hours :) | ||
p6eval | std a8bc48f: OUTPUT«===SORRY!===Illegally post-declared types: 'no' used at line 34 'yes' used at line 23Check failedFAILED 00:00 43m» | ||
GlitchMr | So, I cannot have forward labels? | ||
"must enclose the label in quotes" | 11:33 | ||
oh, ok | |||
11:34
rummik left
11:35
rummik joined
|
|||
moritz | masak: I agree with felher | 11:36 | |
11:38
donghongbo left
|
|||
FROGGS_ | IMO quality is much more important than beeing on time | 11:39 | |
masak: (and your posts tend to be good) | 11:40 | ||
jnthn | morning o/ | 11:43 | |
phenny | jnthn: 21 Dec 21:51Z <FROGGS> tell jnthn I have a patch that allows one to import multis from two different modules (like the trait_mod:<is>), but one thing remains open: the dump of the list of dispatchers is incomplete, even if all dispatchers work | ||
jnthn: 21 Dec 22:05Z <moritz> tell jnthn YOU MAKED BRANCH outer-bound BUT I MERGED IT KXTHXBY | |||
jnthn | kthx by...whom? :P | ||
jnthn will be about for a little bit :) | |||
FROGGS_: What does "list of discpatchers" mean? Maybe it's easiest if I can see a patch... | 11:44 | ||
moritz | by CEILING CAT | ||
jnthn: I think FROGGS_ talks about the list of signatures in the error message | |||
FROGGS_ | moritz: correct | ||
jnthn | ah, those'd be dispatch*ee*s :P | ||
11:45
Kharec left
|
|||
jnthn | Anyway, I can probably spot any issues by looking at the patch | 11:45 | |
FROGGS_ | jnthn: I can't show you right now | ||
jnthn | ok | ||
I'm gonna be fairly tied up with family stuff, but may find the odd moment in the next few days | |||
FROGGS_ | currently I'm traveling | ||
pmurias | jnthn: what do uninitialised lexicals contain in nqp? NQPMu? | 11:46 | |
jnthn | Best bet is to gist it and phenny me it. | ||
pmurias: For scalars, yes | |||
FROGGS_ | jnthn: I will be too, no hurry | ||
jnthn | @ and % are automatically initialized with an empty array/hash | ||
FROGGS_ | jnthn: k | ||
11:46
rurban joined
|
|||
moritz | now I wanted to remove the sink ROADMAP item, and found that we had none :-) | 11:46 | |
jnthn | moritz: aww! | 11:47 | |
moritz: Noticed it got merged. Yay. \o/ | |||
moritz++ | |||
FROGGS_ | cool | ||
how much is the parse time now? | |||
moritz | not much changed | 11:48 | |
FROGGS_ | k | ||
moritz | still between 1 and 4 minutes, depending on the machine I run it on | ||
FROGGS_ | one minute? wow | ||
moritz | jnthn: any idea for medium-sized rakudo hacking projects? | 11:49 | |
FROGGS_: I've got a new workstation at $work | |||
it managed the parsing stage in 62s or so | |||
FROGGS_ | had 80s right before the slow-down patch, now got 240s | ||
moritz | erm, what? | ||
the slow-down part of the patch has been reverted | 11:50 | ||
FROGGS_ | the patch that added set operators | ||
moritz | FROGGS_: are you on up-to-date nom branch? | ||
jnthn has just kicked off a build | |||
FROGGS_ | ohh, then I should pull :o) | ||
no | |||
moritz | yes, you should :-) | ||
FROGGS_ | ya | ||
jnthn | moritz: Hm, lemme glance the ROADMAP for things :) | 11:51 | |
11:51
pmurias left
|
|||
moritz | one that sounds like fun ins NFG strings... but I think it's way too much work | 11:51 | |
jnthn | moritz: Where did the logical cascades work get to? | ||
moritz | jnthn: it mostly works, but there were some trouble setting $_ and/or $! in the thunks | 11:53 | |
jnthn | ah, ok | ||
orelse too? | |||
There could be some things in regexes | |||
11:53
pmurias joined
|
|||
moritz | yes, orelese too | 11:54 | |
though I'm not sure of the corner cases there | |||
jnthn | The array variable interpolation is...difficult. | ||
moritz | hm, might still be a TODO | ||
jnthn | But OTOH not a huge amount of code to write. | ||
11:55
rurban left
|
|||
jnthn | The problem is that it involves some fairly dynamic NFA stuff | 11:55 | |
Doing ~~ inside regexes may well be more accessible. | 11:56 | ||
moritz | what's the "missing bits of enums" in the Language Features section? | ||
jnthn | I'm not sure | ||
Do non-numeric enums work? | |||
I'm sure I saw a comment the other day in Actions that suggested not. | |||
moritz | r: my enum A a => 'b', c => 'd'; say c | ||
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Malformed myat /tmp/Y3RWkIw78A:1------> my enum A ⏏a => 'b', c => 'd'; say c expecting any of: scoped declarator» | ||
moritz | r: enum A (a => 'b', c => 'd'); say c | 11:57 | |
p6eval | rakudo c8de2e: OUTPUT«c» | ||
jnthn | The sigspace changes are also an option. | ||
pmurias | jnthn: are there any specific method names I should use for conversions to nqp numbers,ints and strings? (I currently use to_n,to_i,to_s) | ||
jnthn | .Num, .Int, .Str :) | ||
moritz | r: enum A (a => 'b', c => 1); say c | ||
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Type error in enum. Got 'Int' Expected: 'Str'at /tmp/1khutqr76M:1------> enum A (a => 'b', c => 1)⏏; say c expecting any of: postfix infix or meta-infix infix stopper statement … | ||
moritz | are those supposed to work? | ||
jnthn | r: enum A (a => 'b', 'c'); say c | 11:58 | |
p6eval | rakudo c8de2e: OUTPUT«c» | ||
moritz | well, maybe I'm doing the rest of p6cc first :-) | ||
jnthn | r: enum A (a => 'b', 'c'); say c.perl | ||
p6eval | rakudo c8de2e: OUTPUT«A::c» | ||
jnthn | r: enum A (a => 'b', 'c'); say c.value | ||
p6eval | rakudo c8de2e: OUTPUT«c» | ||
jnthn | Hm, seems they do work | ||
moritz | r: enum A (a => 'x', 'c'); say c.value | ||
pmurias | jnthn: isn't Int a bigint rather then something the op add_i wants? | ||
p6eval | rakudo c8de2e: OUTPUT«y» | ||
jnthn | Maybe consider the spectest | ||
moritz | ok | ||
jnthn | pmurias: In Perl 6, but NQP doesn't use bigints natively | ||
pmurias: In reality, all the numeric ops in NQP are floating point. | 11:59 | ||
The only way to get an int is with the native types stuff. | |||
Well, plus literals I guess | |||
This is to avoid having to multi-dispatch all the operators. | 12:00 | ||
moritz: I think STD has got a decent solution on the sigspace things. | |||
pmurias | and nqp::add_i? | ||
jnthn | pmurias: Yes, if you do that it's integer addition of course | ||
pmurias: I meant what + does | |||
It always (in Actions) spits out nqp::add_n | 12:01 | ||
12:01
gattschardo joined
|
|||
jnthn | My plan was to change it to add_i in the optimizer when both sides are integers. | 12:01 | |
moritz: Don't take the :D/:U/:T task as I've plans for that (which will involve some notable changes) | 12:02 | ||
pmurias | that would acutally hurt performance in js | ||
as javascript has no integers | |||
jnthn | moritz: If you want to do something REALLY evil...masak's macro grant doesn't cover textual macros, and now that I did that refactor that puts the target/orig off in a struct that all cursors share throughout the parse, they're actually kinda doable ;) | 12:03 | |
pmurias: Optimizer doesn't have to do the same thing for all backends ;) | 12:04 | ||
moritz: Another small task that may be fun and isn't a huge amount of work: look up $*LAST_NIBBLE in STD, and port the related bits to Rakudo. | 12:05 | ||
moritz: It does runaway string detection. | |||
It's a nice error improvement for a probably quite modest amount of work. :) | 12:06 | ||
Other possibility there: implement suppose. I didn't get around to it yet, and we could use it in a few places. | |||
12:06
fgomez joined
|
|||
jnthn | (today we get bogus TTIAR errors sometimes, when the next thing actually isn't a term...) | 12:07 | |
moritz: Hope that lot provides some ideas ;) | |||
12:08
gaussblurinc left
|
|||
moritz | jnthn: it does, takk | 12:08 | |
jnthn | var saa god :) | 12:09 | |
gattschardo | is there a simple way to load (or reload) a .pl file in rakudo when using it as a shell? | 12:13 | |
12:13
LlamaRider left,
LlamaRider joined
|
|||
FROGGS_ | slurp and eval? | 12:14 | |
jnthn | Heh, could do that. | 12:15 | |
"use" won't look for it. | |||
r: evalfile | |||
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Undeclared routine: evalfile used at line 1» | ||
jnthn | hm, probably misremembering...I thought there was a builtin that did slurp/eval for you | ||
but yeah, eval slurp 'file.pl' | 12:16 | ||
gattschardo | well, slurp/eval works, thanks | ||
12:16
am0c joined
|
|||
gattschardo | just thought there might be something built in | 12:16 | |
jnthn | And if you repeat it, it'll slurp it afresh | ||
jnthn realizes that this is probably a cute debugger prompt idiom too... | |||
Since eval slurp 'foo.pl' at the debugger prompt would let you debug foo.pl :) | 12:17 | ||
GlitchMr | In Perl 5, do is enough | 12:18 | |
do 'foo.pl' | |||
But not like eval slurped files is good idea | 12:19 | ||
12:23
MayDaniel joined
12:25
rindolf left
12:26
rindolf joined
12:27
noggle left
12:28
noggle joined
12:35
GlitchMr left
12:37
GlitchMr joined
12:38
LlamaRider left
12:40
GlitchMr_ joined
12:42
GlitchMr left,
GlitchMr_ left
12:44
mj41 left
12:47
mj41 joined,
rurban joined,
jokar joined
12:50
GlitchMr joined
12:51
rurban left
12:52
pmurias left,
pmurias joined,
mj41 left
12:55
GlitchMr left
13:04
FROGGS_ left
13:05
FROGGS_ joined
|
|||
jnthn | OK, enough for today :) o/ | 13:14 | |
moritz | bye | 13:15 | |
13:17
GlitchMr joined
13:20
mj41 joined
13:24
donghongbo joined
13:27
isBEKaml joined
13:30
GlitchMr left
|
|||
isBEKaml | hola, #perl6! | 13:33 | |
13:35
SamuraiJack left
13:37
Chillance joined
13:40
not_gerd joined
|
|||
not_gerd | hello, #perl6 | 13:40 | |
isBEKaml | rn: sub froo($xx, $yy?) { say "x is $xx" ~ $yy.defined ?? " with yy as $yy." !! ""; }; froo(24); | 13:41 | |
p6eval | rakudo c8de2e: OUTPUT«use of uninitialized value of type Any in string context in sub froo at /tmp/y0LWn_zjkK:1 with yy as .» | ||
..niecza v24-12-g8e50362: OUTPUT«Use of uninitialized value in string context at /home/p6eval/niecza/lib/CORE.setting line 1287 (warn @ 5)  at /home/p6eval/niecza/lib/CORE.setting line 266 (Mu.Str @ 15)  at <unknown> line 0 (ExitRunloop @ 0)  at /tmp/uZzmxBKJTo line 1 (froo @ 4) … | |||
not_gerd | moritz: one way to make html ids from arbitrary strings: gist.github.com/4363369 | 13:42 | |
horribly slow on Rakudo, though :( | |||
isBEKaml | rn: sub froo($xx, $yy?) { say "x is $xx" ~ $yy.defined ?? " with yy as $yy." !! ""; }; froo(24); froo(24, 42) | ||
p6eval | niecza v24-12-g8e50362: OUTPUT«Use of uninitialized value in string context at /home/p6eval/niecza/lib/CORE.setting line 1287 (warn @ 5)  at /home/p6eval/niecza/lib/CORE.setting line 266 (Mu.Str @ 15)  at <unknown> line 0 (ExitRunloop @ 0)  at /tmp/PKLdLjr8FA line 1 (froo @ 4) … | ||
..rakudo c8de2e: OUTPUT«use of uninitialized value of type Any in string context in sub froo at /tmp/UjkC3z7vvW:1 with yy as . with yy as 42.» | |||
isBEKaml | is that correct? This was out of p6book. :) | 13:43 | |
rn: sub froo($xx, $yy?) { say "x is $xx" ~ ($yy.defined ?? " with yy as $yy." !! ""); }; froo(24); froo(24, 42) | 13:45 | ||
p6eval | rakudo c8de2e, niecza v24-12-g8e50362: OUTPUT«x is 24x is 24 with yy as 42.» | ||
isBEKaml | oh, parens. how I love you. :| | ||
13:46
SamuraiJack joined
13:47
rurban joined
|
|||
pmurias | jnthn: why do we have BUILDPLAN? | 13:50 | |
jnthn: why do we construct and execute the plan instead of just doing the work? | |||
moritz | because doing the work takes time | 13:51 | |
pmurias | so it's supposed to avoid doing the traversal every time? | 13:52 | |
moritz | yes | ||
pmurias | would be nice to have that mentioned in comments | 13:54 | |
not_gerd | rn: constant @x = []; constant @y = @x; say @x =:= @y; my @u = []; my @v = @u; say @u =:= @v | ||
p6eval | rakudo c8de2e, niecza v24-12-g8e50362: OUTPUT«TrueFalse» | ||
not_gerd | doesn't that violate least surprise? | ||
(assuming it's not a bug, of course) | 13:55 | ||
moritz | IMHO it's a bug | ||
assigning to a constant | |||
13:55
rurban left
|
|||
isBEKaml | OOC, what does =:= mean? | 13:56 | |
equality both by type and values? | |||
13:57
SamuraiJack left
|
|||
not_gerd | isBEKaml: container identity, ie both variables are bound to the same thing | 13:57 | |
isBEKaml | not_gerd: ah, thanks. | 13:58 | |
13:58
mikemol joined
|
|||
not_gerd just got a 10x speedup by replacing constant with my | 14:00 | ||
isBEKaml | not_gerd: the difference is 0.5 sec on my machine (between constant and my) | 14:02 | |
"my" being the faster one. It took 5 secs to just go through encoding and decoding two strings. | 14:03 | ||
14:03
donghongbo left
|
|||
not_gerd | isBEKaml: my @foo = 0..5, 10..20 creates a new array, whereas constant @foo = ... just binds the right-hand side | 14:04 | |
==> fast iteration in case of my, slow iteration in case of constant | |||
14:04
lolage joined
|
|||
moritz | you can work around it by slapping .list on the RHS | 14:04 | |
but it's really a bug in rakudo | 14:05 | ||
it should do proper list assingment | |||
14:05
FROGGS_ left
|
|||
isBEKaml | not_gerd: I can see that. Also, s/:=/=/g gives me 2.5 sec running time. :) | 14:06 | |
14:06
SamuraiJack joined
|
|||
moritz | nr: my @a = 1..5; say @a.WHAT | 14:08 | |
p6eval | rakudo c8de2e, niecza v24-12-g8e50362: OUTPUT«Array()» | ||
isBEKaml | moritz: do we know if variable bindings are slow on rakudo? | 14:09 | |
14:09
am0c left
|
|||
isBEKaml | moritz: that is, $var := $another-var or $var := literal-stuff | 14:09 | |
moritz | isBEKaml: they aren't slow | 14:12 | |
isBEKaml: they are only slow if they lead to multiple evaluations in later code | |||
14:14
bowtie joined
14:15
GlitchMr joined
14:22
rurban joined
|
|||
isBEKaml | moritz: sorry if I sound a bit confused - do "multiple evaluations" also include lookups? The way I see it, they shouldn't (ideally) slow things down, right? | 14:22 | |
moritz | isBEKaml: I'm talking about multiple evaluations of lazy lists and stuff like that | 14:23 | |
isBEKaml: not lookups | |||
not_gerd | rn: my $n = 42; /a ** $n/ | 14:25 | |
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Quantifier quantifies nothingat /tmp/4yt24UZp5x:1------> my $n = 42; /a ** ⏏$n/ expecting any of: postfix infix or meta-infix infix stopper statement end statement modif… | ||
..niecza v24-12-g8e50362: OUTPUT«Potential difficulties: Unsupported use of atom ** $n as separator; nowadays please use atom+ % $n at /tmp/lhcsayHHjd line 1:------> my $n = 42; /a ** $n⏏/» | |||
isBEKaml | moritz: wheww... okay. :) | ||
14:27
rurban left,
FROGGS joined
|
|||
isBEKaml | moritz: where can I find the full index of all functions documented in doc.perl6.org? | 14:29 | |
moritz: or is that what we have right on the first page? | |||
moritz | doc.perl6.org/#Routines | 14:30 | |
though that doesn't list the operators from language/operators | |||
isBEKaml | moritz: okay, I guess I'll start with some string functions. .subst, .trans and stuff like that. :) | ||
14:35
cibs joined
14:40
spider-mario left
14:48
FROGGS left
14:55
cibs left
14:57
rurban joined
14:58
rurban left
15:00
mikemol left
|
|||
masak | ok, starting to write the macros advent post now. | 15:01 | |
15:03
cibs joined
|
|||
felher | masak: btw: here is my Perl6 and Haskell solution. The Haskell solution is quite long and not very efficient. But since I have little to no experience with Haskell and am quite busy, I was happy to get it working at all and then left it there :) | 15:05 | |
masak: gist.github.com/4363849 | 15:06 | ||
15:07
isBEKaml left
|
|||
masak looks | 15:07 | ||
felher: nice. | 15:08 | ||
your solution is more... composable than mine. | |||
felher: looks like you can get rid of 'list' almost anywhere. | |||
felher: because of currying, when the left side and right side end in the same terms, you can just remove them, like in an equation. | 15:09 | ||
felher | masak: oh, right. Point free ftw :) | ||
masak | felher: your Perl 6 solution looks like what I wanted to write all along. | ||
kudos. | |||
filterWith, nice. | 15:10 | ||
felher | masak: thanks. I updated the gist to make the haskell version more point-free :) | 15:12 | |
masak | \o/ | 15:13 | |
masak .oO( resistance is point-free ) | |||
felher | :D | ||
masak: btw. Your haskell version is much shorter and much more efficient I guess. I just was too lazy to look up Set and MultiSet :) | 15:15 | ||
masak | I got #haskell to help me with those. | 15:17 | |
my Haskell port is a straight port of my Perl 6, which was a straight port of the Python. | 15:18 | ||
I essentially innovated nothing along the way. | |||
felher | masak: nothing wrong with that as long as it gives you a nice solution :) | 15:21 | |
15:23
mikemol joined
15:24
SamuraiJack left
|
|||
masak | r: macro checkpoint { state $n = 0; my $i = ++$n; quasi { say "CHECKPOINT $i" } }; checkpoint; say "foo"; checkpoint; say "bar"; checkpoint | 15:26 | |
p6eval | rakudo c8de2e: OUTPUT«CHECKPOINT 1fooCHECKPOINT 2barCHECKPOINT 3» | ||
masak | \o/ | ||
15:29
donghongbo joined
|
|||
not_gerd | bye, #perl6 | 15:31 | |
15:31
not_gerd left,
donghongbo left
15:32
rummik left
|
|||
masak | what's the biggest difference between C's textual macros and Perl 5's source filters? | 15:32 | |
15:32
lorn left
|
|||
felher | r: macro checkpoint { state $n = 0; quasi { say "CHECKPOINT {++$n}" } }; checkpoint for ^3; say "foo"; checkpoint; say "bar"; checkpoint | 15:32 | |
p6eval | rakudo c8de2e: OUTPUT«CHECKPOINT 1CHECKPOINT 2CHECKPOINT 3fooCHECKPOINT 4barCHECKPOINT 5» | ||
15:32
rummik joined
|
|||
felher | r: macro checkpoint { state $n = 0; ++$n; quasi { say "CHECKPOINT {$n}" } }; checkpoint for ^3; say "foo"; checkpoint; say "bar"; checkpoint | 15:33 | |
p6eval | rakudo c8de2e: OUTPUT«CHECKPOINT 3CHECKPOINT 3CHECKPOINT 3fooCHECKPOINT 3barCHECKPOINT 3» | ||
15:33
lorn joined
|
|||
felher | Ah, i think i got why there is a $n and a $i :) | 15:34 | |
masak | closure semantics. | ||
felher | yep :) sweet :) | ||
masak | r: macro checkpoint { my $i = ++(state $n); quasi { say "CHECKPOINT $i" } }; checkpoint; say "foo"; checkpoint; say "bar"; checkpoint | 15:35 | |
p6eval | rakudo c8de2e: OUTPUT«CHECKPOINT 1fooCHECKPOINT 2barCHECKPOINT 3» | ||
diakopter | masak: lol point-free | 15:36 | |
masak | felher: it's sweet, yes. it's like the code you're dealing with is alive, and smiling at you. it's not just text, it's *behavior*. :) | ||
felher | masak: indeed :) | ||
masak | felher: the more I program, the more I realize that we're all Dr Frankenstein. we're putting behavior into dead matter. and we're slowly getting increasingly good at it. | ||
the future, barring some major cataclysm, will be awesome. | 15:37 | ||
felher | yeah :) | 15:38 | |
masak is on a roll with this advent post | 15:44 | ||
15:51
isBEKaml joined
15:59
hash_table joined
|
|||
masak | r; macro checkpoint { my $i = ++(state $n); quasi { say "CHECKPOINT $i" } }; checkpoint; for ^5 { checkpoint }; checkpoint | 16:00 | |
r: macro checkpoint { my $i = ++(state $n); quasi { say "CHECKPOINT $i" } }; checkpoint; for ^5 { checkpoint }; checkpoint | 16:01 | ||
p6eval | rakudo c8de2e: OUTPUT«CHECKPOINT 1CHECKPOINT 2CHECKPOINT 2CHECKPOINT 2CHECKPOINT 2CHECKPOINT 2CHECKPOINT 3» | ||
masak | this nicely illustrates a difference between macros and subs. | ||
16:02
GlitchMr left
16:04
erkan joined,
erkan left,
erkan joined
|
|||
timotimo | is there a problem regarding the 23rd advent post? | 16:07 | |
masak | working on it. | 16:08 | |
(I meant to write it yesterday, but forgot) | |||
timotimo | that's fine :) | 16:11 | |
16:12
birdwindupbird joined
16:17
GlitchMr joined
16:26
Vlavv left
16:33
Vlavv_ joined
16:42
david joined
16:44
david left
|
|||
isBEKaml | rn: my $foo = "boo"; say $foo.subst(rx:m/boo/, "far", :mm); #NYI? | 16:44 | |
p6eval | niecza v24-12-g8e50362: OUTPUT«===SORRY!===Unrecognized adverb :m(1) at /tmp/IYfl8z2IpH line 1:------> my $foo = "boo"; say $foo.subst(rx⏏:m/boo/, "far", :mm); #NYI?Regex modifier m not valid on regex literal at /tmp/IYfl8z2IpH line 1:------> … | ||
..rakudo c8de2e: OUTPUT«===SORRY!===Adverb m not allowed on rxat /tmp/MuMFtXSjoB:1------> y $foo = "boo"; say $foo.subst(rx:m/boo/⏏, "far", :mm); #NYI?» | |||
masak | I don't think rx takes adverbs at all. | 16:45 | |
by spec, I mean. | |||
isBEKaml | masak: well then, the spec needs change. :) | ||
S05 | |||
GlitchMr | unlink Perl6 || true | ||
aur.archlinux.org/packages/ra/rakudo/PKGBUILD | |||
Interesting use of || true | |||
16:55
mj41 left
16:58
birdwindupbird left
17:01
mj41 joined
|
|||
masak | advent post published: perl6advent.wordpress.com/2012/12/2...23-macros/ | 17:07 | |
tadzik | yay | ||
masak++ | |||
17:10
mj41 left,
isBEKaml left
|
|||
felher | <3 "A Song of Ice and Fire" reference | 17:15 | |
masak | "A textual macro is a sword without a hilt. There's no safe way to grasp it." | 17:18 | |
:) | |||
felher | masak++ # nice blog post about macros that makes you wish the end of the next year is already here :) | 17:25 | |
masak | I don't promise all of those things will be in place by the end of next year. ;) | 17:27 | |
two of the points are within the current grant. | |||
17:34
SamuraiJack joined
17:45
azawawi joined
|
|||
felher | masak: oh, there is a solution on Wikipedia for python. Is that the one you translated to Perl 6 and then to Haskell? | 17:52 | |
masak | felher: it is. | 17:58 | |
I renamed all the variables and eliminated some of the Python boilerplate that Perl 6 doesn't need. (such as checking whether a hash entry exists before incrementing it) | |||
felher | masak: I see :) | 18:01 | |
azawawi | hi | 18:04 | |
phenny | azawawi: 02 Dec 18:44Z <japhb> ask azawawi Would you mind using a different pastebin than the one at paste.debian.net (or configuring it to keep the pastes for longer), because they are expiring quite quickly (sometimes faster than I can backlog if I've been AFK for a couple days)? | ||
azawawi: 03 Dec 04:53Z <japhb> tell azawawi your 1 == any(range) benchmark is now in perl6-bench, with two range limits to show scaling; but note that sorear says it may be somewhat problematic against smart implementations (but at least it notices the difference between smart and not) | |||
18:07
Abcxyz joined,
tcpr1347 joined
|
|||
azawawi | feather.perl6.nl:3030/ # Farabi (with a Perl backend / JS Frontend), Web-based REPL, Run, Open file autocomplete... simple Perl 6 syntax highlighting... etc... etc :) | 18:08 | |
18:09
spider-mario joined
|
|||
azawawi nap & | 18:11 | ||
18:11
azawawi left
|
|||
GlitchMr | What macros are useful for? | 18:26 | |
Making gotos? | 18:27 | ||
diakopter | r: macro foo { quasi { {{{ macro boo { 1 } }}} } }; foo | 18:28 | |
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Error while compiling block : Error while compiling op call: Error while compiling block : Error while compiling block : Unknown QAST node type NQPMu» | ||
18:28
mj41 joined
|
|||
diakopter | r: macro foo { quasi { say {{{ macro boo { quasi { {{{ 3 }}} } } }}} } }; foo | 18:30 | |
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Method 'flat' not found for invocant of class 'NQPMu'» | ||
18:36
mtk left
18:38
mtk joined
18:40
xilo_ joined
18:50
Kharec joined
|
|||
hoelzro | hooray, heredoc hilighting! \o/ | 18:56 | |
GlitchMr | :-) | ||
timotimo | masak: that was a good post :) | 19:02 | |
19:04
aindilis left
19:05
aindilis joined
|
|||
masak | timotimo: thanks. it did feel like it had something going for it. :) | 19:12 | |
GlitchMr | I've done Niecza Arch module. I guess I can upload it now? | 19:13 | |
It looks like this: github.com/GlitchMr/arch-niecza | 19:14 | ||
masak | GlitchMr: what are macros useful for? I like the quote in the latest advent post as an answer to that question. | 19:18 | |
GlitchMr: I don't think you need anyone's permission to upload a Niecza Arch module. even if you do, forgiveness > permission. | 19:19 | ||
GlitchMr | well, ok | 19:20 | |
aur.archlinux.org/packages/niecza/ | |||
Arch already had nice Rakudo Perl package, so why not Niecza? | 19:28 | ||
masak | GlitchMr++ | 19:34 | |
Abcxyz | (1..5 ==> reverse) ==> [\+] | 19:35 | |
r: (1..5 ==> reverse) ==> [\+] | |||
p6eval | rakudo c8de2e: ( no output ) | ||
GlitchMr | "bash" as dependency is there just for fun (it's meaningless). | ||
Abcxyz | r: say (1..5 ==> reverse) ==> [\+] | ||
p6eval | rakudo c8de2e: OUTPUT«5 4 3 2 1» | ||
GlitchMr | (but it's used in /usr/bin/niecza) | ||
Abcxyz | r: say 1..5 ==> reverse ==> [\+] | 19:36 | |
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Preceding context expects a term, but found infix ==> insteadat /tmp/quldCkupyL:1------> say 1..5 ==> reverse ==>⏏ [\+]» | ||
sorear | good * #perl6 | 19:38 | |
Abcxyz | I think the parenthesis should be redundant in this, right? | ||
GlitchMr | They aren't because of bug | ||
PerlJam | Greetings | ||
GlitchMr | std: say 1..5 ==> reverse ==> [\+] | ||
p6eval | std a8bc48f: OUTPUT«===SORRY!===Preceding context expects a term, but found infix ==> instead at /tmp/CPBOrQQm3a line 1:------> say 1..5 ==> reverse ⏏==> [\+]Parse failedFAILED 00:00 42m» | ||
tadzik | in case you missed it: an open-source geeky board game:github.com/TableTopSecurity/d0x3d-the-game | 19:39 | |
Abcxyz | Is operator: ==> right associative or left associative? | ||
Where can I find these detailed information? | |||
GlitchMr | doc.perl6.org/language/operators says it's neither | 19:40 | |
masak | it's a statement terminator. | ||
hoelzro | masak++ # GoT reference | ||
Abcxyz | OK... @_@ | 19:41 | |
tadzik | heh, masak puts GoT references in his blogposts | ||
you could say that... | |||
( •_•)>⌐■-■ | |||
it is known | 19:42 | ||
(⌐■_■) | |||
YEEEEEAH | |||
masak | ;) | 19:45 | |
Abcxyz | What is GoT reference? | 19:47 | |
tadzik | GoT is Game of Thrones, a book | 19:48 | |
the beginning to a long series of books :) | |||
hoelzro | a very good series of books if you've got the time =) | 19:49 | |
tadzik | yeah, you need plenty of time. And winder is coming | ||
hoelzro | indeed | ||
Abcxyz | I see... | 19:52 | |
I have some for Perl6 some bug reports and lots of new ideas. | |||
Is this the right place to discuss these? | 19:53 | ||
tadzik | sure | ||
19:53
FROGGS joined
|
|||
Abcxyz | 1. | 19:54 | |
r: print$_ | |||
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Two terms in a rowat /tmp/1nZf4GbVMG:1------> print⏏$_ expecting any of: argument list postfix infix or meta-infix infix stopper statement end statement modifier… | ||
Abcxyz | :r say 3x$_ | 19:55 | |
FROGGS | r: say 3x$_ | ||
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Confusedat /tmp/EXdrOZgj7K:1------> say 3⏏x$_ expecting any of: whitespace» | ||
FROGGS | hi Abcxyz | 19:56 | |
flussence | that one seems self-explanatory | ||
Abcxyz | Yes | ||
Are all the white spaces mandatory in Perl6 now? | |||
In Perl5 all these work fine. | |||
FROGGS | I think so, yes | ||
tadzik | not all of them, surely | ||
but some of them, yes | 19:57 | ||
FROGGS | std: print$_ | ||
p6eval | std a8bc48f: OUTPUT«===SORRY!===Unsupported use of bare 'print'; in Perl 6 please use .print if you meant $_, or use an explicit invocant or argument at /tmp/VZePAZqOpi line 1:------> print⏏$_Two terms in a row (listop with args requires whitespac… | ||
flussence | the ones between [<alnum>|<punct>] ** 2 usually are | ||
Abcxyz | Will this improve in the future? Since most of them are so obvious according to context: there is no ambiguity at all. | ||
19:59
hash_table left
|
|||
FROGGS | if withspaces around x arn't mandatory, you don't know if x in 3x$_ is suffix, infix or prefix | 19:59 | |
Abcxyz | I see. | 20:00 | |
That's why Perl5 accepts them, but Perl6 rejects. | |||
Since Perl5 doesn't have to distinguish these? | |||
FROGGS | Perl 5 only has infixes, right? | 20:01 | |
Abcxyz | I guess so. | ||
FROGGS | except [] and () and stuff | ||
huf | and + | ||
FROGGS | but these can't appear as infix | ||
right | |||
huf | and a ton of others :) | ||
Abcxyz | Yes. | ||
FROGGS | I'm not a language pro, just a "user" | ||
Abcxyz | Fine. | 20:02 | |
Usually I include whtespace in my one liner character countings. | |||
That's why I checked these... | |||
masak | FROGGS: it's "whitespace", singular, as a mass noun. | 20:03 | |
Abcxyz | Yes. | ||
FROGGS | ahh, see, everyday I learn something ;o) | ||
masak | Abcxyz: even where there is no ambiguity, someone could define new operators and there would be ambiguity. | ||
Abcxyz | Right. | 20:04 | |
That is what is different in Perl6 from Perl5 now. | |||
So many possibilities of new operators. | |||
doy | where are the rules for where whitespace is required documented? | ||
Abcxyz | I don't think it is fully documented. | 20:05 | |
But Perl5 uses heuristics to parse. | |||
So usually it understands you and does the right thing. | |||
Just like when you talk to a people face to face, you don't have to be grammatically correct, but they understand you. | |||
That's human language, right? | 20:06 | ||
And a lot of time Perl5 is parsing in that way. | |||
doy | perl 5 only uses heuristics in very specific places, and i can't think of any that involve whitespace (except for a few annoying things that are newline-sensitive) | ||
Abcxyz | I guess I would define it this way: | 20:08 | |
When there is ambiguity, one of them makes the most possible sense, then interpret it this way. | |||
For example | 20:09 | ||
The defined-or operator: // | |||
and the regexp matching operator: // | |||
If there is ambiguity, Perl5 interprets it as defined-or | 20:10 | ||
doy | "one of them makes the most sense" is only usually true | ||
Abcxyz | Since you can always write the other in the form: m// | ||
masak | doy: if you count STD.pm6 as documentation, it's all in there. | ||
huf | Abcxyz: can you even have defined-or in a position to confuse it with //? | ||
masak | doy: otherwise, the rule is quite simple: the operator after a term is infix if there's whitespace in-between or post(circum)fix if not. | 20:11 | |
Abcxyz | Maybe not, but the parser is not smart enough to distinguish that. | ||
Yet. | |||
So it uses heuristics directly in this case. | |||
doy | masak: thanks, that was what i was curious about | ||
huf: yes, you can | 20:12 | ||
Abcxyz | And another case, but we almost don't realize: | ||
1..10 | |||
masak | Abcxyz: in Perl 6, an empty match // is disallowed. | ||
Abcxyz | 1. . 0 | ||
This is ambiguity. | |||
But we almost always mean 1 .. 10 | |||
masak | Abcxyz: and in the case of 1..10, Perl 6 disallows '1.' as a number :) | ||
you see, we put great thought into this. :) | 20:13 | ||
Abcxyz | So the parse treats it that way, the most possible one, being understanding. | ||
masak | ...whereas in Perl 6, we try to make the underlying parsing sane rather than DWIMmy. | ||
will probably scale better to derived dialects of Perl 6. | |||
Abcxyz | What does it mean by: disallowing '1.' as a number? | ||
masak | std: 1. | ||
p6eval | std a8bc48f: OUTPUT«===SORRY!===Decimal point must be followed by digit at /tmp/rEFlzRG2zo line 1:------> 1.⏏<EOL>Unsupported use of . to concatenate strings; in Perl 6 please use ~ at /tmp/rEFlzRG2zo line 1 (EOF):------> 1.⏏<EOL>… | ||
masak | means it's not allowed. | 20:14 | |
Abcxyz | ... | ||
That sounds scary to me. | |||
masak | boo! | ||
20:14
pmurias left
|
|||
Abcxyz | Since it means if I am Copy and Pasting the numerical results from other program's output into my perl script, I have to modify these every time? | 20:15 | |
Before, perl is always the most flexible and versatile language in these kind of things... | |||
timotimo | quote it and parse it with a simple regex? | 20:16 | |
doy | if you're copying and pasting numbers that use , as a decimal point, you have to modify them every time too | ||
there are all kinds of number formats, it's a bit unreasonable to expect perl to parse all of them | |||
Abcxyz | I don't have to. | ||
masak | also, it's *output*. when was the last time you saw "1." or similar in output? | ||
Abcxyz | use pdl [ STRING ] | ||
if there is comma: , | |||
use qw{ STRING } if there is whitespace | 20:17 | ||
So easy. | |||
Many language does this: in C: double d = 1.; | 20:18 | ||
Although you don't have to. | 20:19 | ||
masak | r: say "1. 2. 3.".subst(/<?after \d> \./, "", :g) | ||
p6eval | rakudo c8de2e: OUTPUT«1 2 3» | ||
Abcxyz | But some language enforces the decimal point. | ||
masak | so easy. | ||
you have a *programming language* at your fingertips. | |||
slightly wrongly formatted output shouldn't hinder you. | |||
r: say "1. 2.0 3".subst(/<?after \d> \. <!before \d>/, "", :g) | 20:20 | ||
p6eval | rakudo c8de2e: OUTPUT«1 2.0 3» | ||
Abcxyz | I know, there can always be work arounds. | ||
masak | this isn't even that. | ||
it's just adapting output before you paste it as code. :) | |||
Abcxyz | :r say 1 | 20:21 | |
:r say 1.0 | |||
masak | r: say 1.0 | ||
p6eval | rakudo c8de2e: OUTPUT«1» | ||
Abcxyz | :r say 1. | ||
:r say 0.1 | |||
:r say .1 | |||
masak | r: say 1. | ||
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Confusedat /tmp/TfkY83FcTT:1------> say 1.⏏<EOL> expecting any of: dotty method or postfix» | ||
20:21
pmurias joined
|
|||
masak | r: say .1 | 20:21 | |
p6eval | rakudo c8de2e: OUTPUT«0.1» | ||
Abcxyz | In all these forms, only "1." is rejected. | 20:22 | |
masak | aye. | ||
that's the form that is causing trouble with things like infix:<..> and method dot. | 20:23 | ||
Abcxyz | Just make the regexp greedy then... | ||
timotimo | r: sub postfix:<.>($i) { $i }; say 1.; | ||
p6eval | rakudo c8de2e: OUTPUT«1» | ||
timotimo | i win. | ||
masak | timotimo: :) | ||
Abcxyz | As in 1..10, we always mean 1 .. 10 without even notice there is such underlying ambiguity. | ||
FROGGS | masak: how do you make multiline commit messages in git with a subject? do you add \n's to -m="" ? | 20:24 | |
masak | Abcxyz: yes, but the parser is already in the 'number' rule, parsing the term. | ||
Abcxyz: it's won't back out if it already saw '1.', and then it won't understand '.10' | |||
Abcxyz: "Just make the regexp greedy" is more like the problem, not the solution. | |||
FROGGS: I tend to write them in $EDITOR... | 20:25 | ||
FROGGS: but in a Unix environment, you can just hit Enter until you terminate the quote. | |||
FROGGS: (in Windows, not so much) | |||
FROGGS | okay, thanks | ||
Abcxyz | Yes, I agree it is a implementation difficulty. | 20:26 | |
timotimo | i believe you can type \ before hitting enter in DOS. | ||
Abcxyz | I just mean that in real life the meaning is almost certain, as my previous definition for heuristics, the most possible interpretation is clearly there. | ||
masak | Abcxyz: indeed. | 20:27 | |
doy | r: sub postfix:<.> (Int $a) { $a }; say 1. | ||
masak | Abcxyz: and Perl 5 takes that road. | ||
p6eval | rakudo c8de2e: OUTPUT«1» | ||
Abcxyz | Right. | ||
masak | Abcxyz: Perl 6 doesn't. it lets every rule do its thing. | ||
which leads naturally to '1.' being disallowed. | 20:28 | ||
doy | r: sub postfix:<.> (Int $a) { $a }; say 1. + 2. | ||
p6eval | rakudo c8de2e: OUTPUT«3» | ||
Abcxyz | I can imagine it is because the practical way we implements it. | ||
masak | r: sub postfix:<.> (Int $a) { $a }; say 1..10 | ||
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Two terms in a rowat /tmp/_qp7pQyZa0:1------> sub postfix:<.> (Int $a) { $a }; say 1..⏏10 expecting any of: postfix infix or meta-infix infix stopper statement end state… | ||
masak | Abcxyz: no, it's because it's *consistent*. | ||
Abcxyz: I explained the reasons to you. did you understand them when I did? | 20:29 | ||
Abcxyz | I guess partly. | ||
20:29
SamuraiJack left
|
|||
masak | I agree that it is a fair bit different from how Perl 5 does it. | 20:29 | |
Abcxyz | Yes. | ||
masak | that's because the guy who wrote the Perl 5 parser is involved in this project too, and he chose what he percieves to be a better way this time. | 20:30 | |
Abcxyz | He has changed. :) | ||
masak | his code sure has :) | ||
20:30
stevan_ left
|
|||
timotimo | it would be a real shame if perl6 were just perl5 reheated | 20:31 | |
20:31
stevan_ joined
|
|||
Abcxyz | It is not impossible to solve it in the grammar - rule system. But probably that will bring in a lot extra complexity to the grammar just to solve this one small problem, and it might be simpler just to make the rules easier to the computer. | 20:32 | |
lue | hello world o/ | ||
timotimo | not using the knowledge you gained from the previous version to create not only a "new" version , but also an "improved version" ... that would be sad | ||
doy | masak: why doesn't ltm fix that? | 20:34 | |
shouldn't .. be a priority over .? | |||
Abcxyz | It is not easy. | 20:35 | |
It takes a lot of work. | |||
And it only solve a small problem, so it probably won't be a priority when there are other things to improve now. | 20:36 | ||
Unless for perfectionism | |||
FROGGS | phenny: tell jnthn that this is my questionable patch: github.com/FROGGS/rakudo/commit/eb...213da2b43d | 20:37 | |
phenny | FROGGS: I'll pass that on when jnthn is around. | ||
masak | doy: because LTM decides which alternation wins. if the parser is already inside a term, parsing it, the decision between a decimal dot and the '..' isn't up to LTM, the decimal dot automatically wins as being part of the term. | 20:39 | |
Abcxyz: if you're building a language that's meant to be extended, it makes a whole lot of sense to keep exceptions to a minimum. | |||
lue! \o/ | |||
doy | so effectively, it's just because .. is infix and . is postfix? | 20:40 | |
lue | .oO(If C<1.> was allowed, what would happen in C<1...10> ?) |
||
masak | doy: oh! in your case with the postfix, it's because there's no whitespace. | 20:41 | |
as I said above, that's how infix is distinguished from post(circum)fix. | |||
20:41
stevan_ left
|
|||
masak | lue: also a good point. | 20:41 | |
doy | masak: hmmm | 20:42 | |
lue also personally never liked how "1." looked visually. | |||
doy | so infix operators are only disambiguated by whitespace then | ||
it's only relevant if there's an ambiguity? | |||
postfix operators just always win if there is no whitespace, but postfix operators fail to even be considered if there is intervening whitespace | 20:43 | ||
is that it? | |||
masak | if there's no whitespace, and both a postfix operator and an infix operator (not necessaarily of the same length) can match, the postfix wins. | 20:44 | |
if there's whitespace, only infix operators are considered. | |||
doy | okay | 20:46 | |
that makes sense | |||
20:47
slayer101_ joined
|
|||
masak | what's more, it keeps making sense as new terms and operators are added in derived Perl 6 dialects. :) | 20:48 | |
doy | yeah | ||
perl 6's whitespace rules have just always been something that seemed a bit odd and confusing to me | 20:49 | ||
but i feel like that's probably because i just don't know what they are | |||
in perl 5, you can get by almost entirely with just "word boundaries are equivalent to whitespace", or something along those lines, perl 6 does things a bit differently | 20:50 | ||
20:51
hash_table joined
|
|||
moritz | masak++ # macro advent post | 20:52 | |
doy | i think some amount of documentation/spec that explains exactly what those rules are would be helpful | ||
20:52
sid_ joined
|
|||
masak | doy: I agree. | 20:53 | |
it's information that just sits in STD.pm6, the compilers, and the brains of old regulars like me :P | |||
should be documented somewhere. | 20:54 | ||
Abcxyz | Is it possible to define an operator "...^*" other than "...^" ? | ||
moritz calls for a braindump | |||
Abcxyz: yes, if I understood the question correctly | |||
the longest operator wins, in case of doubt | 20:55 | ||
timotimo | r: sub infix:<...^*>($a, $b) { say "i have $a and $b"; $a...^$b }; say 5...^*10; | ||
p6eval | rakudo c8de2e: OUTPUT«i have 5 and 105 6 7 8 9» | ||
timotimo | easiest to just try | ||
20:55
cognominal joined
|
|||
Abcxyz | So after I've defined that, will this work without whitespace? "1, *+1, ...^*>10" | 20:56 | |
Sorry, "1,*+1...^*>10" | |||
moritz | Abcxyz: why don't you just try it? | ||
Abcxyz | :r 1,*+1...^*>10 | 20:57 | |
masak | it's 'r' and then ':' | ||
Abcxyz | r: 1,*+1...^*>10 | ||
p6eval | rakudo c8de2e: ( no output ) | ||
masak | and you need to 'say' your output. | ||
Abcxyz | r: say 1,*+1...^*>10 | ||
p6eval | rakudo c8de2e: OUTPUT«1 2 3 4 5 6 7 8 9 10» | ||
20:58
sid_ left
|
|||
Abcxyz | r: sub infix:<< ...^*> >>($a, $b){}; say 1,*+1...^*>10 | 20:59 | |
p6eval | rakudo c8de2e: OUTPUT«1WhateverCode.new()» | ||
20:59
stevan_ joined
|
|||
masak | WhateverCode.new is what '*+1' comes out looking like. | 20:59 | |
Abcxyz | r: say 1,*+1...^*>10 | ||
p6eval | rakudo c8de2e: OUTPUT«1 2 3 4 5 6 7 8 9 10» | ||
masak | er, '*+(1...^*>10)', I mean. | 21:00 | |
Abcxyz | Interesting. | ||
masak | actually, I'm not 100% sure where the '>' ends up in the AST. | 21:01 | |
Abcxyz | So it interprets it as: ( 1, ( * + ( 1 infix:<< ...^*> >> 10 ) ) ) | 21:02 | |
21:02
GlitchMr left
21:05
hash_table left
|
|||
Abcxyz | :r 1, * + Nil | 21:05 | |
masak | 'r', then ':' | ||
Abcxyz | ... | ||
masak | it's short for 'rakudo:' | 21:06 | |
moritz | :wq! | ||
hugme hugs moritz, good vi(m) user! | |||
Abcxyz | r: 1, * + Nil | ||
p6eval | rakudo c8de2e: ( no output ) | ||
LoRe | do not use :wq, use :x instead | ||
masak hugs moritz, too, even though he probably did it intentionally ;) | |||
LoRe: nono, use ZZ :) | |||
21:06
FROGGS left
|
|||
timotimo | no, pull the plug and do everything with swap files | 21:06 | |
Abcxyz | r: say 1, * + Nil | ||
p6eval | rakudo c8de2e: OUTPUT«1WhateverCode.new()» | ||
LoRe | or that, but :wq is harmful | 21:07 | |
diakopter | rn: :wq | ||
Abcxyz | I fogot the 'say' again | ||
p6eval | rakudo c8de2e, niecza v24-12-g8e50362: ( no output ) | ||
Abcxyz | r: say 1, * + Nil | ||
p6eval | rakudo c8de2e: OUTPUT«1WhateverCode.new()» | ||
Abcxyz | r: sub infix:<< ...^*> >>($a, $b){}; say 1,*+1...^*>10 | 21:08 | |
p6eval | rakudo c8de2e: OUTPUT«1WhateverCode.new()» | ||
Abcxyz | It's the same thing. | 21:09 | |
tadzik | LoRe: how is wq harmful? | ||
LoRe | tadzik: it always writes the file, even if it is unchanged, :x only writes if modified | ||
21:09
FROGGS_ joined
|
|||
moritz | r: sub infix:<< ...^*> >>($a, $b){ 'blubb'}; say 1,*+1...^*>10 | 21:10 | |
p6eval | rakudo c8de2e: OUTPUT«1WhateverCode.new()» | ||
moritz | r: sub infix:«...^*>»($a, $b){ 'blubb'}; say 1,*+1...^*>10 | ||
p6eval | rakudo c8de2e: OUTPUT«1WhateverCode.new()» | ||
LoRe | ok, it's not that harmful, but changes timestamps | ||
timotimo | you need to call it | ||
Abcxyz | r: say 1, * + 'blubb' | ||
p6eval | rakudo c8de2e: OUTPUT«1WhateverCode.new()» | ||
timotimo | the * + is doing the conversion | ||
tadzik | yeah, :x seems saner | ||
Abcxyz | That' how it reads | ||
moritz | r: sub infix:«...^*>»($a, $b){ 'blubb'}; say 1,+1...^*>10 | ||
p6eval | rakudo c8de2e: OUTPUT«1blubb» | ||
moritz | timotimo++ | ||
21:11
bruges joined
|
|||
masak | nice. paulgraham.com/fix.html # via @sheeshee++ | 21:14 | |
moritz | I disagree with some of the details, but in general, yes, nice | 21:15 | |
masak | there's certainly room for disagreement. | 21:16 | |
diakopter | Perl 6: No other language has enough of anything | ||
moritz | (including insanity) | 21:17 | |
masak | or "Perl 6: Perl 5 is a kludge." | 21:18 | |
guess that one's almost too obvious to state. | |||
Abcxyz | So even the Perl group consider this as true? | ||
diakopter | Perl 6: Where else will you find the kitchen sink? | ||
masak | Abcxyz: everyone is entitled to their own opinions. everyone isn't entitled to their own facts. ;) | ||
timotimo | everyone is unentitled? | 21:19 | |
masak | Perl 5 *is* a kludge. one that makes bazillions out in the industry each day, but still a kludge. | ||
Abcxyz | I think Perl5 is really nice, except for so many historical vestiges that cannot be thrown away for compatibility sake. | 21:20 | |
masak | Perl 6 is very much sitting down and saying "there are *good* things in there. let's put them on a sane foundation and see what language we get." | ||
lue | .oO(Perl 6: There's too big a leap required to get to P7) |
||
Abcxyz | The regexp is a big surprise to me, since before I was using C++ to treat streams... | ||
masak | (this was what my 24th slot post was gonna be about, btw) :) | ||
lue | masak: what specifically? | 21:21 | |
masak | lue: "You should think of Perl 6 more as Perl 16" :) | ||
lue: nothing specifically. the whole *language* is a rewrite according to that kind of thinking. | |||
diakopter | Perl 6: No ho-hum. Just tra-la-la. | 21:23 | |
lue | (I'll assume you didn't mean P16 < P6) | ||
diakopter | Perl 6: 100 years ahead, but 12 years behind, so 88 years ahead. | 21:24 | |
masak | diakopter: *lol* | ||
flussence | 88MPH?!? | 21:25 | |
something I was thinking about recently, a generic HTTP test suite would be useful to have. Trying to figure out how it'd be automated is pretty hard though... | 21:30 | ||
masak | mocks. | ||
if you can mock time, surely you can mock HTTP ;) | |||
lue | perl6: "because I" ==> (say so $_); | ||
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Sorry, do not know how to handle this case of a feed operator yet.at /tmp/ETZ8Sg20EY:1------> "because I" ==> (say so $_)⏏; expecting any of: postfix infix or meta-infix infix stopper»… | ||
..niecza v24-12-g8e50362: OUTPUT«Unhandled exception: Feed ops NYI at /home/p6eval/niecza/lib/CORE.setting line 1435 (die @ 5)  at /home/p6eval/niecza/lib/CORE.setting line 3353 (infix:<==>> @ 4)  at /tmp/xQb4gHHohG line 1 (mainline @ 3)  at /home/p6eval/niecza/lib/CORE.setting li… | |||
masak | flussence: en.wikipedia.org/wiki/Mock_object | ||
flussence: github.com/jnthn/test-mock | 21:31 | ||
flussence | ooh, pre-existing stuff | ||
masak | :) | 21:32 | |
21:32
stevan_ left
|
|||
diakopter | Perl 6: Because no one blithely loves recursive Death Marches enough | 21:33 | |
cognominal | that's perl 6..* the developpers have almost finished their first take to reify the sequence beginning to gather the first version number. | 21:34 | |
flussence | masak: I have a sort-of plan for doing it already, it'd be a runtime-agnostic list of instructions for what requests and responses are supposed to happen, then I write a bailador app (or whatever) to implement those. It wouldn't necessarily have to be perl6-specific either :) | ||
cognominal | I suppose that 6..** with hyperwhatever is infinity and beyond | 21:35 | |
diakopter | Perl 6: Because no one had taken Second System Syndrome far enough yet | 21:36 | |
masak | diakopter: note that's pg's original one's weren't overly bitter. | 21:37 | |
ones* | |||
lue | Perl 6: No-one had yet created their language with -Ofun | ||
masak | I'm pretty sure that's not strictly true :) | ||
diakopter | masak: truly one can state those entirely non-bitterly; blithely even | 21:38 | |
some people love death marches | |||
timotimo | well, if laughs are equivalent to fun, LOLCODE would certainly be a contestant. | ||
diakopter | masak: embrace the fail; it loves you anyway | 21:40 | |
masak | I... guess. | ||
diakopter | I mean, one could talk about redefining success.. | 21:41 | |
or just leaving it uselessly ambiguous | 21:42 | ||
Abcxyz | r: say sub infix:«...^*>»($a, $b) is looser(&infix:<+>){ 'blubb' } | 21:46 | |
p6eval | rakudo c8de2e: OUTPUT«sub+{precedence} infix:<...^*>>($a, $b) { ... }» | ||
Abcxyz | r: say 1,*+1...^*>10 | ||
p6eval | rakudo c8de2e: OUTPUT«1 2 3 4 5 6 7 8 9 10» | ||
timotimo | that .perling is misleading | 21:47 | |
Abcxyz | r: sub infix:«...^*>»($a, $b) is looser(&infix:<+>){ 'blubb' }; say 1,*+1...^*>10 | ||
p6eval | rakudo c8de2e: OUTPUT«1WhateverCode.new()» | ||
Abcxyz | r: sub infix:«...^*>»($a, $b) is looser(&infix:<+>){ 'blubb' }; say 1,+1...^*>10 | ||
p6eval | rakudo c8de2e: OUTPUT«1blubb» | ||
21:49
mj41 left
21:57
slayer101_ left
21:59
pmurias left
22:01
pmurias joined,
kaare_ left
22:02
Kharec left
|
|||
Abcxyz | r: say given 9 { 0 when $_ %% 3; 1 } | 22:03 | |
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Two terms in a rowat /tmp/bsaYNIOHpY:1------> say given 9 ⏏{ 0 when $_ %% 3; 1 } expecting any of: postfix infix or meta-infix infix stopper» | ||
Abcxyz | r: sub s () { given 9 { 0 when $_ %% 3; 1 } }; say s; | 22:04 | |
p6eval | rakudo c8de2e: OUTPUT«1» | ||
Abcxyz | Why this does not return 0 ? | ||
masak | Abcxyz: because statement-mod 'when' doesn't leave the contextualizer block. | 22:06 | |
the ordinary 'when' does. | |||
Abcxyz | so $_ is Nil? | 22:09 | |
I am translating my previous Perl5 ProjectEuler code into Perl6. | 22:10 | ||
So all these are working code in Perl5. | |||
It's good way to find bugs also. | 22:11 | ||
masak | in Perl 5, statement-mod 'when' does leave the contextualizer block. | ||
but that's a bug in Perl 5, not in the Perl 6 implementations ;) | |||
(IMNSHO) | |||
Abcxyz | What does it mean by leaving the contextulizer block? How does that effect $_? | ||
masak | r: sub s () { given 9 { when $_ %% 3 { 0 }; 1 } }; say s; | 22:12 | |
p6eval | rakudo c8de2e: OUTPUT«0» | ||
masak | does that answer your question? | ||
Abcxyz | Yes, | ||
but what is the meaning of your previous sentence? | |||
Is there a link I can read on this? | 22:13 | ||
22:14
mj41 joined
|
|||
masak | S04, I guess. | 22:15 | |
22:21
stevan_ joined
|
|||
doy | r: sub s () { given 9 { return 0 when $_ %% 3; 1 } }; say s | 22:22 | |
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Null regex not allowedat /tmp/L1ou2HrobS:1------> 9 { return 0 when $_ %% 3; 1 } }; say s⏏<EOL> expecting any of: argument list prefix or term prefix or meta-prefix» | ||
doy | r: sub s () { given 9 { return 0 when $_ %% 3; 1 } }; say s; | ||
p6eval | rakudo c8de2e: OUTPUT«0» | ||
masak | that first one is arguably a bug. | 22:24 | |
r: sub s {}; say s | |||
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Null regex not allowedat /tmp/LJm1RVH5Du:1------> sub s {}; say s⏏<EOL> expecting any of: argument list prefix or term prefix or meta-prefix» | ||
masak submits rakudobug | 22:25 | ||
std: sub s {}; say s | 22:26 | ||
p6eval | std a8bc48f: OUTPUT«===SORRY!===No delimiter found at /tmp/0ivzQQ5JQE line 1 (EOF):------> sub s {}; say s⏏<EOL>Parse failedFAILED 00:00 42m» | ||
masak | std: sub s {}; say s; | ||
p6eval | std a8bc48f: OUTPUT«===SORRY!===Regex not terminated at /tmp/kOLlJYIE3C line 1 (EOF):------> sub s {}; say s;⏏<EOL>Parse failedFAILED 00:00 43m» | ||
masak | right. | ||
it's the 's;' case that is wrongly parsed. | |||
'night, #perl6 | 22:28 | ||
22:31
mcglk joined
|
|||
pmurias | jnthn: ping | 22:35 | |
masak: 'night | 22:36 | ||
Abcxyz | night | ||
gattschardo | std: sub s {}; say s(); | 22:38 | |
p6eval | std a8bc48f: OUTPUT«ok 00:00 42m» | ||
22:41
sftp joined
22:43
cognominal left
|
|||
Abcxyz | std: sub s {}; say s(); | 22:50 | |
p6eval | std a8bc48f: OUTPUT«ok 00:00 42m» | ||
Abcxyz | std: sub s {}; say s() | ||
p6eval | std a8bc48f: OUTPUT«ok 00:00 43m» | ||
Abcxyz | std: sub s {}; say s | ||
p6eval | std a8bc48f: OUTPUT«===SORRY!===No delimiter found at /tmp/WZYxiQM5mo line 1 (EOF):------> sub s {}; say s⏏<EOL>Parse failedFAILED 00:00 42m» | ||
Abcxyz | std: sub s {}; say s; | ||
p6eval | std a8bc48f: OUTPUT«===SORRY!===Regex not terminated at /tmp/xKF_rk8RnY line 1 (EOF):------> sub s {}; say s;⏏<EOL>Parse failedFAILED 00:00 43m» | ||
Abcxyz | It seems that Perl6 does not understand bareword functions well. | 22:51 | |
diakopter | r: sub s { 55 }; say s; | 22:52 | |
p6eval | rakudo c8de2e: OUTPUT«55» | ||
diakopter | r: sub s { say 55 }; s | ||
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Null regex not allowedat /tmp/fATj0WLr68:1------> sub s { say 55 }; s⏏<EOL> expecting any of: postfix infix or meta-infix infix stopper statement end statement modifier… | ||
diakopter | r: sub s { say 55 }; s; | ||
p6eval | rakudo c8de2e: OUTPUT«55» | ||
diakopter | r: sub s { say 55 }; s | ||
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Null regex not allowedat /tmp/O5CgWGj9zh:2------> <BOL>⏏<EOL> expecting any of: postfix infix or meta-infix infix stopper statement end statement modifier statem… | ||
Abcxyz | In: "for lines() { ... }", the parenthesis cannot be omitted neither. | 22:53 | |
I guess this should be a bug for now. | |||
diakopter | rn: for (lines) { .say } | ||
p6eval | rakudo c8de2e: OUTPUT«Land der Berge, Land am Strome,Land der Äcker, Land der Dome,Land der Hämmer, zukunftsreich!Heimat bist du großer Söhne,Volk, begnadet für das Schöne,vielgerühmtes Österreich,vielgerühmtes Österreich!Heiß umfehdet, wild umstrittenliegst dem Erdteil du inmi… | ||
..niecza v24-12-g8e50362: OUTPUT«Land der Berge, Land am Strome,Land der Äcker, Land der Dome,Land der Hämmer, zukunftsreich!Heimat bist du großer Söhne,Volk, begnadet für das Schöne,vielgerühmtes Österreich,vielgerühmtes Österreich!Heiß umfehdet, wild umstrittenliegst dem Erdtei… | |||
Abcxyz | What happens if you remove the "()" | 22:54 | |
diakopter | rn: for lines { .say } | ||
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Missing blockat /tmp/DDJpTN5vRR:1------> for lines { .say }⏏<EOL> expecting any of: method arguments postfix infix or meta-infix infix stopper statement end stat… | ||
..niecza v24-12-g8e50362: OUTPUT«===SORRY!===Missing block at /tmp/5Ve7vISWzO line 1 (EOF):------> for lines { .say }⏏<EOL>Parse failed» | |||
Abcxyz | r: for lines { .say } | 22:55 | |
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Missing blockat /tmp/cf3jsPDorE:1------> for lines { .say }⏏<EOL> expecting any of: method arguments postfix infix or meta-infix infix stopper statement end stat… | ||
Abcxyz | r: for (lines) { .say } | ||
p6eval | rakudo c8de2e: OUTPUT«Land der Berge, Land am Strome,Land der Äcker, Land der Dome,Land der Hämmer, zukunftsreich!Heimat bist du großer Söhne,Volk, begnadet für das Schöne,vielgerühmtes Österreich,vielgerühmtes Österreich!Heiß umfehdet, wild umstrittenliegst dem Erdteil du inmi… | ||
Abcxyz | 123 | ||
r: for lines() { .say } | |||
p6eval | rakudo c8de2e: OUTPUT«Land der Berge, Land am Strome,Land der Äcker, Land der Dome,Land der Hämmer, zukunftsreich!Heimat bist du großer Söhne,Volk, begnadet für das Schöne,vielgerühmtes Österreich,vielgerühmtes Österreich!Heiß umfehdet, wild umstrittenliegst dem Erdteil du inmi… | ||
timotimo | r: say glob | ||
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Undeclared routine: glob used at line 1» | ||
timotimo | r: say qp/./.^methods | 22:56 | |
p6eval | rakudo c8de2e: OUTPUT«===SORRY!===Confusedat /tmp/piWNoX8QHs:1------> say qp/.⏏/.^methods expecting any of: dotty method or postfix» | ||
22:57
REPLeffect left,
mj41 left,
REPLeffect joined
23:00
spider-mario left
23:06
xenoterracide joined
23:09
cognominal joined
23:17
REPLeffect left,
REPLeffect joined
23:25
PacoAir left
23:28
Tim-Tom joined
|
|||
Abcxyz | How do you express this idea? | 23:33 | |
my @list = 5..10; say 0 ...^ * -> $idx { @list[$idx] > 8 } | |||
23:35
rindolf left,
pmurias left
|
|||
Tim-Tom | Abcxyz: I'm not sure what you're attempting. Do you want to report all elements of list that are greater than 8, create a list of true false values for items greater than 8? | 23:35 | |
23:37
mj41 joined
|
|||
Tim-Tom | Abcxyz: As it is, what you've written would report false until it gets to the 4th element, then report true for 3 elements, then false for all eternity (perhaps with warnings about undef). Which is probably not what you intended | 23:39 | |
Abcxyz | I wanted to get all the index for @list that contains the elems le 8 | 23:40 | |
my @list = 5..10; say @list[ 0 ...^ * -> $idx { @list[$idx] > 8 } ] | |||
With this I hope to print: 5 6 7 8 | |||
23:42
xinming left
|
|||
Abcxyz | Because: "my @list = 5..10; say @list[ 0 ...^ @list[*] > 8 ]" Definite does not do what I want, the * in @list[*] is used as @list.elems instead. | 23:42 | |
Tim-Tom | Well if your end result is supposed to be 5,6,7,8, you probably want "my @list = 5..10; say @list.grep: * <= 8" | 23:43 | |
23:44
xinming joined
|
|||
Abcxyz | Yeah, maybe I should do that. | 23:44 | |
I just wanted to make the * really functional. | |||
In a sense that they may be more interesting sequences that it can express directly. | 23:45 | ||
But I can't foresee that yet. | |||
Tim-Tom | But if you want to go via indexes, you really want 0 ..^ @list | ||
or the equivalent just ^@list | |||
Abcxyz | I want to make the "* > 8" in "0, *+1 ...^ * > 8" a more powerful function. | 23:48 | |
Tim-Tom | Sorry, that should apparently be ^+@list | ||
Abcxyz | I know. | ||
I wanted to know how to express something beyond the * > 8. | |||
Like @list[*] > 8 | 23:49 | ||
Or rank(*) > 8 | 23:50 | ||
Tim-Tom | Ah. The simple answer is to just use the subroutine form. so 0, *+1 ...^ { @list[$^a] <= 8 } | ||
Or -> $a { @list[$a] <= 8} if you don't like the automatic parameters | 23:51 | ||
Abcxyz | Yes! | ||
This is exactly what I want! | |||
Thanks! | |||
Tim-Tom | Sure, glad I could help :) | ||
Abcxyz | r: my @list = 5..10; 0, *+1 ...^ -> $a { @list[$a] > 8 } | 23:52 | |
p6eval | rakudo c8de2e: ( no output ) | ||
Abcxyz | r: my @list = 5..10; say 0, *+1 ...^ -> $a { @list[$a] > 8 } | ||
p6eval | rakudo c8de2e: OUTPUT«0 1 2 3» | ||
Abcxyz | r: my @list = 5..10; say @list[ 0, *+1 ...^ -> $a { @list[$a] > 8 } ] | ||
p6eval | rakudo c8de2e: OUTPUT«5 6 7 8» | ||
Abcxyz | Thanks | 23:54 |