»ö« 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.
comborico1611 Pong 01:59
wander m: use MONKEY-SEE-NO-EVAL;say EVAL("=begin pod\n=item 42\n=end pod\n\$=pod"); 02:18
camelia [Pod::Block::Named{:name("pod")}
Pod::Item{:level("1")}
Pod::Block::Para
42
]
wander m: use MONKEY-SEE-NO-EVAL;say EVAL("=begin pod\n=head 42\n=end pod\n\$=pod");
camelia [Pod::Block::Named{:name("pod")}
Pod::Block::Named{:name("head")}
Pod::Block::Para
42
]
wander m: use MONKEY-SEE-NO-EVAL;say EVAL("=begin pod\n=head1 42\n=end pod\n\$=pod"); 02:19
camelia [Pod::Block::Named{:name("pod")}
Pod::Heading{:level("1")}
Pod::Block::Para
42
]
wander m: use MONKEY-SEE-NO-EVAL;say EVAL("=begin pod\n=code 42\n=end pod\n\$=pod");
camelia [Pod::Block::Named{:name("pod")}
Pod::Block::Code
42


]
wander why some of these guys' contents are 'Pod::Block::Para'?
wander when using `=headn` or `=item`, i want a one line head/item 02:21
wander especially, we provide classes `Pod::Heading` and `Pod::Item` for them 02:22
wander however, we treat their contents as `Pod::Block::Para` 02:22
github.com/perl6/Pod-To-HTML/blob/...#L214-L239 02:26
that is why we have to use `:$inside-heading` to check if a Para is inside a Heading
too tricky
SmokeMachine is there a way to a macro create a dynamic var? 02:48
comborico1611 I'm sorry, I'm a beginner. 02:51
wander well, to recursively deal with pod-code, it's good to pack them into a Pod::Block::Sth 02:59
comborico1611 Goodnight, guys! 03:22
ZzZombo Explain, please: 04:43
m: say (1,2).any > 0
camelia any(True, True)
ZzZombo m: say (1,2).any != 0
camelia True
wander someone have talked about it 04:52
ZzZombo: (1,2).any != 0
equals
!((1,2).any == 0) 04:53
m: say !((1,2).any == 0)
camelia True
wander that's the problem
! is a metaop here
wander m: [1,2,3,4,5,6].map(*.say) 04:54
camelia 1
2
3
4
5
6
wander timotimo: can i assume when `map` applies on an *Array*, it applies from left to right? 04:55
that is, by how Array iterates
AlexDaniel wander: yes, if you're convinced that it is an array 05:28
AlexDaniel wander: if there's a chance that it might be a HyperSeq then you can't assume that 05:29
m: sub foo($a) { say WHAT $a }; foo <a b c>.hyper
camelia (HyperSeq)
wander thank you
dominix hi 06:21
may someone gime me a hint on "were and how does perl6 compile bytecode to ?" i didn't catch on rakudo.org. 06:23
dominix perl5 compile source code to ast and then directly execute it. 06:24
went does perl6 compile ? every time ? or just one time ? were in the bytecode ? 06:25
wander how to test if an object has a special method? 08:29
A.new.has-method("method-name")
something like ^^
wander dd c[0].^find_method("config"); works(?) 08:31
moritz m: say Int.^can('sqrt') 08:32
camelia (sqrt sqrt)
moritz m: say so Int.^can('sqrt')
camelia True
moritz m: say so Int.^can('fasel')
camelia False
wander gotcha 08:36
wander BTW, how `--doc=...` works? if i directly invoke `render`, render runs once; but by `--doc=...`, it runs some times. 08:39
kekko bn giorno
!list
ZzZombo m: say 'asd'.((^100).pick >= 50 ?? "succ" !! "pred")() 09:13
camelia No such method 'CALL-ME' for invocant of type 'Str'
in block <unit> at <tmp> line 1
ZzZombo ??
parv ZzZombo, don't you have to define "succ|pred" method to be able to call? Or, am i missing something? 09:18
ZzZombo They are already defined. 09:18
parv ok
ZzZombo m: 'asd'.pred.say
camelia asc
wander ZzZombo: 09:31
m: say 'asd'."$_"() given ((^100).pick >= 50 ?? "succ" !! "pred")
camelia asc
ZzZombo great, thanks! Clever :) 09:32
wander anyway, it's not macro expanding, but parsing
s/anyway/after all/ 09:33
Anthony_ Hey folks, I tried to port a simple K (APL derivative) one-liner (`primes:{1+&2=+/~(1+!x)!\:/:1+!x}`) to Perl 6 and my P6 solution is much much slower (and more verbose). Do you know how I could fix any of this issues? `sub primes($n){grep {2 == [+] $_ <<%%<< (1..$n)}, 1..$n}` 10:29
moritz m: sub primes($n) { (2..$n).grep(*.is-prime) }; say primes(50) 10:30
camelia (2 3 5 7 11 13 17 19 23 29 31 37 41 43 47)
Anthony_ moritz. Yeah that would of course work with a very high probability 10:31
but I'm trying to transcribe the algorithm
there are waaaay better ways to calc primes
so it's really the procedure that matters for me
moritz I don't see anything obviously wrong with your Perl 6 translation 10:32
Anthony_ okay
I can understand why Perl6's performance is worse in this case
it is obviously not tuned for that style
but I thought there might be some fundamental issue with this
moritz and if you are chasing characters, you can replace << with « 10:33
Anthony_ the only real-world language with heavy use of unicode :)
I love it :D
moritz :-)
Anthony_ thank you :) 10:34
Do you know the X hyperop?
because I tried using it, but it always flats the result 10:35
m: (1..10) X+ (1..10)
camelia Potential difficulties:
Useless use of X+ in sink context
at <tmp>:1
------> 3(1..10) 7⏏5X+ (1..10)
Anthony_ ups
moritz m: say it, but it always flats the result
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routines:
always used at line 1
but used at line 1. Did you mean 'put'?
flats used at line 1. Did you mean 'flat', 'last'?
it used at line 1
result used at line …
moritz ups :-)
Anthony_ :D
moritz m: dd (1..10) X+ (1..10)
camelia (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 9, 10…
Anthony_ yeah 10:36
is there a way to get a list of lists out of that?
moritz m: dd (1..10) X, (1..10)
camelia ((1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (2, 7), (2, 8), (2, 9), (2, 10), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6), (3, 7), (3, 8), (3, 9), (3, 10), (4, 1),…
Anthony_ m: dd (1..10) X (1..10)
camelia ((1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (2, 7), (2, 8), (2, 9), (2, 10), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6), (3, 7), (3, 8), (3, 9), (3, 10), (4, 1),…
Anthony_ cool
moritz m: dd (1..10).map({ $_ X+ 1..10})
camelia ((2, 3, 4, 5, 6, 7, 8, 9, 10, 11).Seq, (3, 4, 5, 6, 7, 8, 9, 10, 11, 12).Seq, (4, 5, 6, 7, 8, 9, 10, 11, 12, 13).Seq, (5, 6, 7, 8, 9, 10, 11, 12, 13, 14).Seq, (6, 7, 8, 9, 10, 11, 12, 13, 14, 15).Seq, (7, 8, 9, 10, 11, 12, 13, 14, 15, 16).Seq, (8, 9, …
Anthony_ that's nice 10:37
moritz that's a way to get it non-flat
Anthony_ thanks
Anthony_ honestly, I think Perl 6 brings TIMTOWTDI to a whole new level... 10:39
HoboWithAShotgun stackoverflow.com/questions/472483...-a-grammar good|bad|incomplete advice? 13:21
HoboWithAShotgun gets naked and roams around the channel, as nobody is looking anyway 13:54
moritz added an answer with a slightly different perspective 14:02
MasterDuke moritz: the syntax highlighting in your answer got messed up 14:07
moritz seems somebody fixed it already 14:09
piojo sorry :) 14:11
moritz no reason to apologize 14:12
piojo++
piojo moritz: And thanks for the thorough answer. I could have told how to access the data in that method, but I couldn't have eloquently explained why the approach was wrong.
masak moritz++ # eloquent 14:15
moritz piojo: you're welcome 14:17
btw, last week I attened a three-day workshop on software architecture from Neal Ford (one of the technical leaders at ThoughtWorks) 14:18
it was quite good, I can really recommend that course 14:19
sddconf.com/software_architecture_fundamentals/
piojo Is the <name>++ thing a competition of who helps the most people? 14:51
moritz not a competition, more a show of appreciation 14:55
we used to track "karma" from the ++ mentions too, but the bot died long ago 14:56
piojo moritz: I see, then it's a slang from an old tradition 15:08
rather, a slang that is an old tradition
moritz annoyed by Apress 16:33
for example, I present two expressions to demonstrate the usage :g
moritz m: say '1 2 3'.subst(:g, /\s+/) 16:34
camelia Cannot resolve caller subst(Str: Regex, :g); none of these signatures match:
(Str:D $: Str:D $original, Str:D $final, *%options)
(Str:D $: $matcher, $replacement, *%options)
in block <unit> at <tmp> line 1
moritz m: say '1 2 3'.subst(:g, /\s+/, '') 16:34
camelia 123
moritz m: say '1 2 3'.subst( /\s+/, '')
camelia 12 3
moritz and they simply remove the whitespace from the second example output
and they screw up the vertical alignment of curly braces in some of the examples 16:35
moritz and earlier, I briefly mention the difference between "doit(1, 2, 3)" and "doit (1, 2, 3)", except that they also remove the blank before the parenthesis list in the second example 16:36
rendering the whole sentence meaningless
I'll self-publish my next book, should there be one. I prefer correct & medicore typesetting over wrong & beautiful typesetting 16:37
AlexDaniel \o/ 16:39
jdv79 AlexDaniel: how long does it take for repro for you? 16:52
i ran it for 10mins with no issues
AlexDaniel jdv79: about 10 seconds 16:53
you sure the output is still changing after 10 minutes?
jdv79: fwiw it wasn't just one commit that addressed the issue, there were many changes done by lizmat++
the situation improved *a lot*
but it is still not fully resolved 16:54
jdv79 yeah, it was changing. i was running it next to a heavy conc app for load.
weird. my original real world code that indirectly spawned that ticket is resolved... 16:55
probably cause they aren't the same. I thought the golf used for gh1202 wasn't the same as my issue
ok, i got it to break by running more load 17:02
Geth doc: ea1a64a6ab | (Will "Coke" Coleda)++ | doc/Language/regexes.pod6
nbsp
17:07
doc: 5dae820a29 | (Will "Coke" Coleda)++ | type-graph.txt
remove class that requires "use"
synopsebot Link: doc.perl6.org/language/regexes
Geth doc/master: 5 commits pushed by (Will "Coke" Coleda)++ 17:51
AlexDaniel is there any way to .round a FatRat without getting a Num back? I'm trying to keep FatRats reasonably fast 19:50
HoboWithAShotgun i don't think so. but maybe ask in #math? 19:59
moritz should be possible with simple arithmetic and coercing to Int 20:03
if you want to round to 1e-9, you have to do FatRat.new(($number * 1_000_000_000).Int, 1_000_000_000) 20:04