»ö« 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.
timotimo maybe we should have asked rindolf to run the script with -Msnapper, that might've been interesting 00:00
jnthn I think on that Rakudo version, snapper didn't exit :) 00:01
*exist
timotimo oh, huh 00:02
committable6: releases use snapper
committable6 timotimo, gist.github.com/23a6d87442c8b03477...ad0ec50c11
timotimo amusing how "releases use snapper" sounds like "give me the releases that use snapper"
ah, one entry for each release because of different paths 00:03
2017.11 was the first one to have it
oh what
rindolf said "rakudobrew latest" ... perhaps that was the exact time we went from master to nom? 00:04
other way around*
AlexDaniel yes, possibly
timotimo maybe it's time to turn nom into a branch that has a Configure.pl that is basically just "note 'the `nom` branch is no longer being used for rakudo. please switch over to `master` instead; exit 1" 00:06
Xliff_ timotimo: Probably. 00:57
comborico1611_ Which module is the most beginner-friendly for someone to read some simple programs? 01:37
(and not math intensive) 01:38
timotimo JSON::Tiny is rather simple, i think? 01:43
comborico1611 timotimo, thank you! 01:47
timotimo that could totally be a tag we put on distributions on the ecosystem 01:48
comborico1611 I don't yet know what JSON is but i am close to, in my learning it JavaScript.
I don't know what you are talking about, but I'm glad I could help.
comborico1611 timotimo, it would be cool if there was a module specifically for beginners. 01:49
comborico1611 And the community could simply dump they're simple programs into it, hopefully with adequate documentation. 01:50
Their*
APic k
timotimo well, we do have the examples page: examples.perl6.org/ 01:55
comborico1611_ timotimo: thanks! 02:00
Off to bed. Goodnight, guys. 02:06
skids wonders what could be done to make bits of Perl6 as effifcient as nqp so we could have less nqp:: things in src/core 02:10
APic yay
Took both Clones.
perlawhirl bisectable6: say [^5+5] 05:05
bisectable6 perlawhirl, On both starting points (old=2015.12 new=c2d0d3a) the exit code is 0 and the output is identical as well
perlawhirl, Output on both points: «[5 6 7 8 9]␤»
perlawhirl seems that parses a bit odd. is there a reason for it?
found out because i was doing something like `@a[^$n+1]` and didn't get what I expected 05:06
need to disambiguate with `@a[^($n+1)]`
perlawhirl but I wonder the reason for the current result? 05:06
AlexDaniel m: say (0..4) + 5 05:07
camelia 5..9
AlexDaniel m: say (0..4) * 2
camelia 0..8
AlexDaniel perlawhirl: ↑ that's the reason 05:08
(you can scale and shift ranges with math ops)
but even without that feature it wouldn't work anyway because of the precedence 05:09
c: 2014.01 say ^5+5
committable6 AlexDaniel, ¦2014.01: «10␤»
AlexDaniel ↑ that's a different way to do it
I mean compared to doing the range shift 05:10
perlawhirl ahh I see, i'm adding to a Range not an Int... fair enough
Anding Hello - I hope I might ask a question or two 08:57
Anding loop (my $n = 0; $n < limit; $n++) { $s += $n} # Is $n visible to the code outside of this loop and {} 08:58
lizmat m: loop (my $n = 0; $n < limit; $n++) { $s += $n} ; $n 08:59
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$s' is not declared
at <tmp>:1
------> 3loop (my $n = 0; $n < limit; $n++) { 7⏏5$s += $n} ; $n
lizmat m: my $s; loop (my $n = 0; $n < limit; $n++) { $s += $n} ; $n 08:59
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
limit used at line 1. Did you mean 'emit', 'list'?
lizmat m: my $s; loop (my $n = 0; $n < 10; $n++) { $s += $n} ; $n 09:00
camelia WARNINGS for <tmp>:
Useless use of $n in sink context (line 1)
Anding $s was already declared. It's just a question about scope 09:00
lizmat m: my $s; loop (my $n = 0; $n < 10; $n++) { $s += $n} ; say $n
camelia 10
lizmat apparently it is :-)
Anding That's what I got - but that's quite counter-intuitive. loop( ) { } looks like a signature with {}, so I was expecting similar behaviour 09:01
lizmat "The initializer is executed once and any variable declaration will spill into the surrounding block." 09:02
on docs.perl6.org/syntax/loop
if you want visibility inside the block only:
Anding In C for(int i = 0 ; i < index ; ++i), i has no external visibility 09:03
lizmat for ^limit -> $n { }
Anding Fair enough... 09:04
lizmat that is also better optimnized :-)
pmurias what should NEXT {next} do? 09:57
Ulti evaluate {next} and jump to the label of the string interp and then increment that loop counter and reenter? 10:17
at least thats what I would guess as an idiot glaring at code
possibly entering at the label rather than the start of the surrounding loop... though thats a bit jumpy
Ulti next feels more like it should only apply to loops though Id be surprised if it was also a goto 10:19
or is next a phaser for on next
which is sort of weird
lizmat NEXT is the name of the phaser 10:28
m: for ^10 { NEXT .say }
camelia 0
1
2
3
4
5
6
7
8
9
lizmat m: for ^10 { NEXT .say; next }
camelia 0
1
2
3
4
5
6
7
8
9
jnthn It hinges on whether the call to the NEXT phaser is considered to be within the dynamic scope of the `next` control exception handler or not 10:29
And also what that even means
Neither is terribly good 10:30
pmurias m: for ^5 {say $_; NEXT {say("next 1");next}} 10:37
camelia 0
next 1
next 1
1
next 1
next 1
2
next 1
next 1
3
next 1
next 1
4
next 1
next 1
pmurias Ulti: I was concerned about NEXT {next} inside a loop, but it seems to be behaving rather weird 10:38
wbiker hi all 10:59
I am not able to install rakudo star 2018.1 on Fedora 27 fresh installation. 11:00
perl Configure.pl --backend=moar --gen-moar --prefix=/opt/perl6 works
as well as make
make install failes with: 11:01
== Installing modules for MoarVM cd modules/zef && sh -c "PATH=/opt/perl6/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/wolfgangbanaston/.local/bin:/home/wolfgangbanaston/bin /opt/perl6/bin/perl6-m -Ilib bin/zef install ." ===> Testing: zef:ver<0.2.0>:auth<github:ugexe> ===> Testing [FAIL]: zef:ver<0.2.0>:auth<github:ugexe> Aborting due to test failure: zef:ver<0.2.0>:auth<github:ugexe> (use --force-test to override)
if I start all tests in /t they passes all. But not if the sh -c commadn is used. Any idea where the problem could be?
jnthn No, though I think if you run that command and give zef the --verbose flag or some such it will at least give a bit more info 11:03
rindolf hi all! moritz : [Coke] : with the latest rakudo/moar master mem consumption is acceptable. It runs slowly however 11:09
wbiker jnthn That might help, thx 11:18
wbiker unfortunately, there is no --verbose flag. I could not find such flag in the help as well 11:23
El_Che wbiker: does your user has access to /opt/perl6 11:24
wbiker El_Che: thanks for helping. But of course. I tried both: installation with root in /opt and with user in ~/perl6. Both show the problem 11:26
El_Che wbiker: Weird. I build fedora 27 packages without trouble. I compile moarvm and nqp separedly though 11:27
wbiker 2018.1 is out quite a while and just I have this troubles? Probably something is wrong with my box. But what could that be? 11:30
El_Che The rpm (github.com/nxadm/rakudo-pkg/releases) is built with this p5 sub: github.com/nxadm/rakudo-pkg/blob/m...udo.pl#L98
wbiker OK, I found the verbosity flag and started zef with --debug. That is what I got: 11:34
Seems too long string 11:35
SKIP: No Build.pm for zef:ver<0.2.0>:auth<github:ugexe> ===> Testing: zef:ver<0.2.0>:auth<github:ugexe> Testing with plugin: Zef::Service::Shell::Test+{<anon|51996944>} ===> Testing [FAIL]: zef:ver<0.2.0>:auth<github:ugexe> Aborting due to test failure: zef:ver<0.2.0>:auth<github:ugexe>
dogbert2 rindolf: that sounds like a step in the right direction at least :-) 11:40
rindolf dogbert2: yes 11:42
dogbert2 does it take ~10 minutes for you as well? 11:45
rindolf dogbert2: 13m 11:58
dogbert2: the p5 version and py3 take about 20s 11:59
dogbert2: pypy3 runs it under a second
dogbert2: so the performance of p6 is abysmal here 12:00
dogbert2 rindolf: sound as if there is room for some further optimizations in p6 :-)
I believe that one of the biggest culprits is array accesses, if memory serves timotimo has said that they are far from optimal 12:01
rindolf dogbert2: yes, but how long do we have to wait?
moritz rindolf: until it's done 12:02
rindolf: you know how volunteer-driven projects work, don't you?
dogbert2 do you know if numbers in p5 and python are 32-bit, 64-bit or larger? 12:03
moritz 64 bit, afaict 12:05
dogbert2 moritz: thx 12:06
moritz though python seems to have big ints too
dogbert2 are they used by default?
moritz 2**7000 gives a non-floating-point result
so it seems yes
dogbert2 cool
Ulti feels tangibly faster to me in the shell if you sprinkle int64 on every variable in the code 12:27
I CBA to bench that though
dogbert2 m: say "abcde" ~~ / ab <![e]> cde | ab.. / 12:32
camelia 「abcd」
dogbert2 is this correct, there's an old RT claiming that it's not. What does moritz say. 12:33
moritz the <![e]> c should terminate LTM 12:36
so I think abcd is correct
let me reread S05
"So LTM completely ignores negative lookaheads, and continues to look for pure patterns in whatever follows the negative lookahead" 12:38
then it's wrong, and the ticket is right, and the match should be the whole string 12:39
dogbert2 moritz: thx, it's an oldie RT #122951 13:37
synopsebot RT#122951 [open]: rt.perl.org/Ticket/Display.html?id=122951 [BUG] negative lookahead doesn't LTM properly
moritz dogbert2: yes, still valid 13:39
and pmichaud is generally to be trusted with such issues :-)
(I learned much of my regex knowledge from him, jnthn++ and TimToady++) 13:40
moritz and Jeffrey Friedl's book, and "perlregex", and perlmonks 13:42
dogbert2 moritz: interesting, I have an old edition of Friedl and a new Perl 6 Regex book by some noname author :-) 13:46
timotimo rindolf: if i want to reduce the workload so i can profile changes more quickly, can i just change the "2.. 24" near the bottom to a shorter range? 13:54
rindolf timotimo: yes 13:56
Xliff_ Hi. Is there a perl6 equivalent option to perl5's -n"
Which is "assume program runs within a while <> {}" loop 13:57
scimon There's -n
-n run program once for each line of input
El_Che :) 13:58
[Coke] docs.perl6.org/language/5to6-nutsh...line_flags
El_Che I would have expected something more esoteric: perl6 -☔ 13:59
Xliff_ scimon++ # LOL -- missed that. 14:03
scimon :D 14:12
See the one I'd like is -E being a synonym for -e so when I flip between perl5 and perl6 on the commandline I get less confused.
timotimo we seem to spend rather a lot of time inside infix:<%> 14:13
moritz does it coerce anything?
timotimo m: say 14:16
camelia 5===SORRY!5===
Argument to "say" seems to be malformed
at <tmp>:1
------> 3say7⏏5<EOL>
Other potential difficulties:
Unsupported use of bare "say"; in Perl 6 please use .say if you meant to call it as a method on $_, or use an …
timotimo oops
m: say 1000000000.msb 14:17
camelia 29
timotimo the result values should fit into native ints, but the in-between values probably don't
the amount of time we spend in malloc and free is surprising 14:19
timotimo we spend a lot of time in mp_mul_2d, which we use for left shifts and creating big integer values from ints or nums 14:22
[Coke] timotimo: digging into rindolf's slow code? 14:32
dogbert2 [Coke]: yep 14:33
pmurias jnthn: we do have tests for NEXT {last} which seems useful 14:47
jnthn: the way NEXT {next} behaves seems just weird and accidental 14:48
jnthn: do you think just implementing NEXT {last} and throwing an exception on NEXT {next} seems sane 14:49
?
I'm not sure if we want NEXT {redo} 14:50
timotimo there was an easy win in the code from replacing @blah[1..*] with @blah.skip(1), but i didn't manage to improve much more 15:05
jnthn .tell pmurias Exception is at lesat better than undefiend behavior. I suspect the oddness is becasue we're outside of the region covered by the next control handler of the loop in question, and so some other loop in the internals, which is in dynamic scope, catches it. 15:59
yoleaux jnthn: I'll pass your message to pmurias.
Xliff Is there a way to format DateTime objects into arbitrary strings after initialization? 16:05
I don't have the luxury of specifying a formatter since I may not be the one instantiating the objects. 16:06
jkramer You could just use the sub/callable that you'd use as formatter directly? 16:11
raschipi Xliff: Copy the data into another object and specify the formatter? 16:12
Xliff Or DateTime::Format?
jkramer m: DateTime.now.clone(:formatter(-> $_ { sprintf('custom formatter %04d', .year) })).print 16:16
camelia custom formatter 2018
Xliff jkramer++ 16:23
Seems wasteful, though.
That and I need something better than what DateTime can do. For example: Properly formatted git dates, which need text DOW and MOY
DateTime only allows for index numbers.
At least as far as I can determine from the docs. 16:24
jkramer DateTime::Format has strftime github.com/supernovus/perl6-datetime-format 16:26
daxim rakudo: use v6; class Foo { sub bar() { return 3 }}; say Foo::bar 16:28
camelia Could not find symbol '&bar'
in block <unit> at <tmp> line 1
daxim how to namespace? 16:29
jkramer m: class Foo { method bar { return 3 }}; say Foo.bar 16:30
camelia 3
jnthn daxim: Subs are my-scoped by default, stick an our on it to make it package-visible 16:32
daxim great, that does the trick 16:33
Xliff What's the best way to send this command using perl6? 16:47
pastebin.com/bt7cupGw
I'm using qq:x, but that's causing problems.
jkramer run 'git', 'filter-branch', '--env-filter', 'if [ ....' ? 16:48
jkramer With :out, :err if you want to capture the output 16:50
pmurias jnthn: re better than undefined behavior, do we have any useful/sensible behavior for that? 17:13
yoleaux 15:59Z <jnthn> pmurias: Exception is at lesat better than undefiend behavior. I suspect the oddness is becasue we're outside of the region covered by the next control handler of the loop in question, and so some other loop in the internals, which is in dynamic scope, catches it.
jnthn pmurias: I guess maybe "get me out of this NEXT phaser" or some such could work :) 17:31
pmurias jnthn: that would make sense but OTOH it might be better to just not allow something that's non-obvious and super rarely useful 17:51
jnthn pmurias: True 17:53
rindolf timotimo: hi 19:16
timotimo: any news?
timotimo rindolf: nothing really good 20:25
rindolf timotimo: ah. 20:26
Xliff rindolf: Just out of morbid curiosity, have you tried this in PHP?
timotimo rindolf: it gets faster if you replace @foo[1..*] with @foo.skip(1), for example
rindolf timotimo: well, good luck
timotimo: ah
timotimo rindolf: the numbers in the calculation before the % $BASE reach outside of 64 bit, don't they?
rindolf timotimo: no they dont 20:27
timotimo oh!
well, that changes everything
rindolf Xliff: not yet
Xliff: and doing numeric in php is evil
Xliff Yes. I did mention "morbid", didn't I? :)
rindolf Xliff: i did it in py2/3 perl5 and perl6 20:28
Xliff: yes
Xliff Yeah, I did read that.
Xliff laments he still hasn't bought moritz++ book yet. 20:29
rindolf timotimo: i think it exceeds 32-bit though 20:34
lancew_ Quick question, I am writing some tests that are time dependant. How do I set a fixed time for my tests? I.e. so something like "Date.new(DateTime.now);" can be set to a known good point so I can test date logic? 21:54
(can you guess that I have some tests that have broken as I look back at dates over 4 months and now my this year and last year dates don't work as I wrote the test in late 2017 when all was in "This year", now some is in "Last Year") 21:55
moritz can't you just use relative dates when doing the comparison? 22:01
lancew__ moritz, I am doing totals for this year and last year. But my test adds data with relative dates (i.e. this today, today -1 month, today -2 months, today -3 months, today - 13 months. Then has hard coded "expected" values for "this year" and "last year". Lazy I guess.... 22:04
lancew__ goes off to re-write
moritz lancew__: the other thing you could is to give the code an optional parameter for what to consider "today" 22:06
and default to Date.today()
but in the tests, you can pass in a hard-coded date