»ö« 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 Quiet night. 00:49
wander .tell moritz I'm reading your post on perl6advent by Chrome, where code blocks display not so well, the worst thing is `grammar` looks like `arammar` 01:48
yoleaux wander: I'll pass your message to moritz.
wander .tell moritz it looks like style on <code>, padding is too large 01:52
yoleaux wander: I'll pass your message to moritz.
wander go to lesson&
lookatme m: my method f($name) { f."$name"(); }; f(1, "say"); 02:27
camelia Too few positionals passed; expected 2 arguments but got 0
in method f at <tmp> line 1
in method f at <tmp> line 1
in block <unit> at <tmp> line 1
lookatme m: my method f($name) { self."$name"(); }; f(1, "say");
camelia 1
lookatme m: my method f(|c) { say c; }; f(1, "say"); 02:31
camelia \("say")
piojo @timotimo Is there any way I can define how a class should be serialized by JSON::Fast? 04:20
Or a way for me to make its attributes serialized as attribute-name/value so it becomes a JSON hash? 04:21
I can do it by hand if it's just one instance, but that solution won't work in nested structures. 04:22
lookatme piojo, I think JSON::Fast not support object serialized. Maybe you can pay attention to JSON::Class 05:14
piojo lookatme: thanks, that looks like exactly what I need 06:17
piojo Though it seems to not work very well with top-level builtin types like list/hash 06:31
It's too much risk to use this library... if I ever need to deserialize an array/dictionary, JSON::Class is trouble 06:33
I guess that's why it's called "JSON::Class"--only for classes
thou I'm trying to get `unit class X::Y::Z;` and `sub MAIN()` to work together; it works with a "top-level" class (`unit class X;`), but gives «Could not find symbol '&Z'» with the "multi-level" class name. Test case: pastebin.com/9JkxqSMc 07:38
I presume there's some scoping thing I don't know about. BTW the reason I want this is that `perl6 --doc=Foo lib/Pod/To/Foo.pm` fails with «P6M Merging GLOBAL symbols failed: duplicate definition of symbol Foo» 07:40
Anyone have an idea on how to fix pastebin.com/9JkxqSMc? 07:41
AlexDaniel eval: pastebin.com/raw/9JkxqSMc 07:42
evalable6 AlexDaniel, Successfully fetched the code from the provided URL.
(exit code 1) Could not find symbol '&Z'
in sub MAIN at /tmp/jZcaLMbBz6 line 1
in block <unit> at /tmp/jZcaLMbBz6 line 5
lookatme That code is in one file ? 07:43
thou ::('X::Y::Z').wut(); 07:45
^ That works
lookatme no idea 07:46
thou eval: gist.github.com/softmoth/87fc37887...25d2559597 07:47
evalable6 thou, It looks like a URL, but mime type is ‘text/html; charset=utf-8’ while I was expecting something with ‘text/plain’ or ‘perl’ in it. I can only understand raw links, sorry. 07:48
thou eval: gist.githubusercontent.com/softmot...e1/main.p6
evalable6 thou, Successfully fetched the code from the provided URL.
hi
thou thanks for looking! 07:53
moritz \o 07:54
yoleaux 01:48Z <wander> moritz: I'm reading your post on perl6advent by Chrome, where code blocks display not so well, the worst thing is `grammar` looks like `arammar`
01:52Z <wander> moritz: it looks like style on <code>, padding is too large
moritz wander: thanks, I've changed <pre><code>...</code></pre> to just <pre>...</pre>. Hope it's better now!
anop most used MVC web framework in perl6 ? 08:51
moritz Dancer, I think 08:53
anop in perl6 ?
moritz erm, Bailador, sorry
El_Che he :)
anop but Bailador is not a MVC 08:54
moritz language confusion
anop but Bailador is not a MVC web framework
moritz modules.perl6.org/search/?q=mvc seems you don't have too many choices :-) 08:55
if you really want MVC
jast in my experience most MVC web applications do MVC wrong anyway :} 08:56
lookatme rgc 08:59
sorry
moritz jast: I don't know if I've ever seen MVC done right :-) 09:01
wander moritz: so it is. ("[15:55] <moritz> wander: ...I've changed <pre><code>...</code></pre> to just <pre>...</pre>...") 09:16
dogbert2 hmm, is there a problem with irclog.perlgeek.de ? 09:46
dogbert2 moritz: ^^^ 09:51
lizmat moritz: fwiw, seems to be unresponsive for me as well 09:57
moritz it had a few of these hangups in the past months :( 10:00
lizmat moritz: after several minutes I got an internal server error 10:06
jast wouldn't happen to be an AMD-based server, would it? 10:08
moritz jast: yes 10:13
moritz lizmat: it's back now 10:14
jast I've had that same issue for years, for me it's a hiccup in the AHCI chipset/driver (SB600 chipset, possibly others)
lizmat moritz: indeed :-)
jast the sata link occasionally freezes (complete with sata/ahci diagnostics message in kernel log)
moritz jast: it's not the server, just the webserver 10:15
and it's fine after a restart
jast oh well
I have that, too :) worked around it by running a responsiveness check in cron that automatically cycles the webserver 10:16
moritz I wouldn't want to do that without any protection against constant restarts 10:17
dogbert2 moritz++ 10:18
El_Che moritz: you could use a variation of the silent-cron in your book :)
moritz El_Che: that could work, yes :-) 10:20
Geth ecosystem: 0175dc7928 | (Alexey Melezhik)++ (committed using GitHub Web editor) | META.list
Sparky distrubution via CPAN
10:57
araraloren Hi 11:10
Some exception thrown by rakudo when I use `trace` : ideone.com/dQEV95 11:11
eval: ideone.com/dQEV95 11:15
evalable6 araraloren, It looks like a URL, but mime type is ‘text/html; charset=UTF-8’ while I was expecting something with ‘text/plain’ or ‘perl’ in it. I can only understand raw links, sorry.
wander %()
araraloren
also `;` after define %field-table 11:16
araraloren: gist.github.com/W4anD0eR96/44f7e64...27f87d1a54 11:17
araraloren eval: gist.githubusercontent.com/araralo...tfile1.txt
evalable6 araraloren, Successfully fetched the code from the provided URL.
(exit code 1) 2 (/tmp/7lGFGule4I line 6)
my %field-table = %{
'标题' …
araraloren, Full output: gist.github.com/8f32c59ed5afbd5e31...53d3dbfdf1
araraloren wander, %{} also works
wander . 11:18
araraloren eval: gist.githubusercontent.com/araralo...tfile1.txt
evalable6 araraloren, Successfully fetched the code from the provided URL.
2 (/tmp/0vGEgNzcx5 line 6)
my %field-table = %(
'标题' => …
araraloren, Full output: gist.github.com/d34b3d72519ce7b9b2...bdb0d2736c
wander not to me
araraloren m: my %h = %{'a' => 2, 'b' => 3 }; say %h 11:19
camelia {a => 2, b => 3}
araraloren see, it works ok
m: my %h = %('a' => 2, 'b' => 3 ); say %h
camelia {a => 2, b => 3}
wander weird, it also works to me, without `use trace` 11:20
araraloren without `use trace`, everything will be ok, yeah
That's what I want show u 11:21
buggable New CPAN upload: Sparky-0.0.22.tar.gz by MELEZHIK cpan.metacpan.org/authors/id/M/ME/....22.tar.gz 12:13
Phlogistique Hi 12:15
(1,2,3)[0...*-0] == (1,2,3)[0..*-2]
I don't understand why the difference between .. and ... is 2 and not 1 in this example
what keyword should I look for in the docs to understand?
(i.e. what's the name of "..", and what's the name of "*-0"?) 12:16
hahainternet range and whatever star, iirc 12:16
moritz Phlogistique: .. is the range operator
DrForr .. is the range operator, and '*' of '*-0' is Whatever.
moritz and... right
wander m: say 0...*-0 12:17
camelia (0 1)
Phlogistique Ok, so what I was looking for is (1,2,3)[0..^*] 12:18
moritz m: say (1, 2, 3).head(*-1) 12:19
camelia (1 2)
moritz more readable, IMHO
Phlogistique ok, so "*-1" is just "whatever minus one" 12:20
moritz right
Phlogistique and the only difference between .. and ... is laziness?
moritz and in the case of lists, "whatever" usually means the number of elements
no, you can use the ... operator for all kinds of fancy stuff
m: say 1, 2, 4, 8 ... 1024
camelia (1 2 4 8 16 32 64 128 256 512 1024)
moritz m: say (1, 1, *+* ... *).head(20) 12:21
camelia (1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765)
moritz it's called the series operator
wander Phlogistique: .. produces Range while ... produces Seq
Phlogistique ok
wander moritz: say 0, 1, 2...*-1
moritz: say 0, 1, 2...*-0
m: say 0, 1, 2...*-0 12:22
camelia (0 1)
wander m: say 0, 1, 2...*-1
camelia (0)
wander moritz: looks no normal
though the code itself is weird
Phlogistique ok, and the precedence of .. is not the same as ...
so (1,2,4,8..1024) produces a list which 4th element is 8..1024 12:23
moritz wander: looks fine to me, as soon as you understand that series stops if the right-hand side evaluates to a true value
Phlogistique: right
wander what is rhs in this case? 12:24
moritz righ-hand side
erm, sorry 12:25
*-1
or *-0
moritz a bit distracted
docs.perl6.org/language/operators#infix_...
the docs search is a bit broken 12:26
Phlogistique is a variable set by the perl6 repl for the last result?
moritz I'd expect it to come up with that link when I enter ... in the search field
Phlogistique (similar to ruby "_")
moritz Phlogistique: I don't think so
Phlogistique thanks
ok, sorry for abusing your patience, one more question: what does that mean when the REPL prints "( ... )" 12:27
wander moritz: thanks, so the right-hand side is a guard :) 12:28
hahainternet Phlogistique: you're probably printing a lazy sequence 12:29
Phlogistique hahainternet: thanks
ok, and I can slice it to see the contents 12:30
thanks :)
hahainternet Phlogistique: before then, the contents didn't exist, so you're actually generating them
moritz Phlogistique: no need to apologize. This channel is the right place to ask such question. 12:31
Phlogistique thanks all for your help
hahainternet hf :)
jast some nice posts on the advent calendar so far 12:33
hahainternet it's annoying that europeans have a v hard time getting on the leaderboard
wander +1
hahainternet have to be up at like 4-5am 12:34
DrForr What leaderboard?...
hahainternet oh sorry, i misread, the advent of code one :)
there are some nice perl6 posts there too
El_Che hahainternet: we have nou trouble with leatherhosen, though
jast lederhosen! 12:35
El_Che jawuhl, give me 5 sec
Phlogistique :) I'm taking the advent of code as an opportunity to learn Perl6
hahainternet i used it last year to experiment with some features, but i didn't have the time to keep it up 12:36
this year i'm intent on doing so
Phlogistique (No Perl5 background so the doc is a little hard to follow for me)
(But it's good that there is a "Perl6 from Ruby" document)
jast I've written a tiny thing in Perl 6 but don't really have enough time to get cracking on a "small" project :) 12:37
hahainternet jast: AoC perfect then, as it's just a pair of challenges per day that people complete in literal minutes 12:39
Phlogistique well, yesterday's challenge took me rather long 12:40
hahainternet part 1 in it was quite easy, you could solve it just on paper, but part 2 was a bit tricky
took me nearly an hour to do #2, embarrassingly
jast I prefer learning on things with practical applications 12:41
wander what's the difference between `let` and `temp`? 13:33
docs.perl6.org/routine/temp
docs.perl6.org/routine/let
moritz let restores the old value if the scop was left unsuceessfully 13:34
wander m: my $a = 42; { let $a = 60 }; say $a 13:36
camelia 60
wander m: my $a = 42; { temp $a = 60 }; say $a
camelia 42
wander m: my $a = 42; { my $a = 60 }; say $a
camelia 42
moritz m: my $a = 42; sub f() { let $a = 60; fail("foo") }; my $dummy = f(); say $a
camelia 42
moritz m: my $a = 42; sub f() { temp $a = 60; fail("foo") }; my $dummy = f(); say $a 13:37
camelia 42
wander m: my $a = 42; { temp $a; say $a }; say $a
camelia 42
42
wander m: my $a = 42; { let $a; say $a }; say $a 13:38
camelia 42
42
moritz kinda surprised by the outcomes of his own examples
perlpilot what's the surprising part? 13:39
perlpilot m: my $a = 42; try { let $a = 60; say $a; }; say $a 13:41
camelia 60
60
perlpilot m: my $a = 42; try { let $a = 60; say $a; fail; }; say $a
camelia 60
42
perlpilot moritz: btw, the sentence in your advent post and in the book "If instead you give in to the temptation of writing down a whole grammar from top to bottom, you can spend many hours debugging why some seemingly simple thing such as an extra space makes the parse fail." probably bears repeating or highlighting or emphasis of some kind. It still happens to me occasionally where I think "oh, this is a simple grammar, I'll just write the whole thing" and 13:51
it takes a strongish act of will to NOT do that because it invariably leads to pain and suffering.
jast or... you could simply never make any mistakes ;) 13:52
jast I'm still working on that bit 13:52
perlpilot jast: It is a worthy goal to not make mistakes, but a better strategy involves planning for the mistakes you are likely to make and learning how to recover from mistakes in general. :-) 13:54
moritz perlpilot: I'm glad it resonated with you :-) 13:55
I'm a afraid it's a bit too late to add highlighting to the book, because it's being printed right now :-) 13:56
perlpilot second edition then :)
in fact, I'd say parsing or not parsing whitespace is probably the biggest source of consternation when making a grammar. 13:57
(or any ubiquitous but invisible characters) 13:58
moritz I don't have enough data to claim that myself, but it's certainly in the top 3
moritz it certainly felt as if I could have made the book twice as thick 14:01
though that would have taken another year 14:02
perlpilot so ... second edition? ;)
moritz *and* I would have liked to fix :dba(...) in rakudo, and implemented :: and/or ::: in regexes, *and* high-water mark built in to rakudo, and ... 14:03
perlpilot: I won't commit to anything right now ;)
timotimo moritz: "if you parse a mathematical expression, an operator can be an arbitrary expression inside a pair of parentheses" - operator sounds strange here 14:12
moritz timotimo: fixed. Should be "a term can be an ..." 14:13
I fixed it for the book, but forgot to check it back into my source repo
timotimo the next sentence also sounds strange; "this is a ... structure, or more precisely a ... parser" 14:15
bbl
moritz meh, I should've open-sourced the whole book, waited for three months of proof-reading, and then sent it for publishing :-) 14:16
lizmat
.oO( a book is a bit like a programming language )
14:17
moritz it's full of bugs? :-)
lizmat and never finished :-)
moritz and a PITA to write
... and doesn't pay off financially 14:18
the list could go on :-)
lizmat see? see? :-) 14:21
pmurias why do we even have <:ascii>? 15:00
jast moritz: I think proofreading only ever reaches maximum efficiency after printing has started :) 15:02
pmurias it doesn't seem to be an unicode property name :/
buggable New CPAN upload: Sparrowdo-0.0.36.tar.gz by MELEZHIK cpan.metacpan.org/authors/id/M/ME/....36.tar.gz 15:03
pmurias ahh, ascii is just matching the ASCII block 15:12
timotimo easier to remember than <[\0..\127]> 15:25
srandon111_ guys is perl6 used by some companies nowadays ? 15:33
also is it fast compared to other high level languages such as python/ruby ? 15:34
moritz srandon111_: I know it's used in some internal tooling in some companies
nothing public facing that I'm aware of yet
mspo it's fast for some stuff in some cases ;)
moritz mostly it's not so fast yet :(
timotimo it's slower than ruby or python, but at unlike those two it can run stuff with multiple threads properly 15:38
jast if you're using ruby or python clearly you don't care about speed in the first place ;o)
[Coke] . 15:40
tadzik well, some things aren't fast, but are Fast Enough :) 15:42
tadzik and for some intents and purposes, Perl 6 will be one of these things 15:43
but as much as we like to dodge that topic, it's still quite a bit slower than python/ruby in general, in my experience :/
jast yeah, that's pretty much what I wanted to hint at
Voldenet Is there any good way to make the $_ in map mutable? 15:44
jast I'm testing on an ARMv7 system to maximize the experience
Voldenet m: say map { my ($x, $y) = ("", $_); repeat { $x = ($y % 2 ?? "1" !! "0") ~ $x } while ($y div= 2) > 0; $x }, 1..10 15:45
camelia (1 10 11 100 101 110 111 1000 1001 1010)
Voldenet I wish $_ was mutable in this case, would make things more readable
Voldenet srandon111_: perl6 is used in some companies, they don't even know it, but I'm taking care of it ;) 15:49
srandon111_ Voldenet: sorry ? 15:49
what do you mean
?
jast m: say (1..10)>>.base(2)
camelia (1 10 11 100 101 110 111 1000 1001 1010)
Pilu does anybody use perl6 for something serious? I mean what are its advantages over other esoteric languages such as lisp, haskell, prolog (excepting its infamous regex)?
Voldenet ninja scripting
jast that's more readable, I think ;) 15:49
mspo Pilu: I think perl6 is Larry Wall's vision after too much haskell 15:50
[Coke] I regularly use p6 here at $DAYJOB for the concurrency support.
jast by definition none of those are esoteric languages
they're just... less popular :)
Voldenet jast: I know, but I wanted a non-immutable "map" for this 15:51
mspo jast: prolog is probably getting there
Voldenet srandon111_: basically, you can use perl6 whenever you need to write some processing tool - one would write it in python or something that company uses for such tools, but I find it a lot easier to write a lot of them in perl6 15:52
jast to me personally, the nice thing about Perl 6 is that it takes the spirit of previous Perls (making easy things easy and hard things possible) and takes it much, much further
Voldenet the thing I like about perl6 is brevity, for example all the *f* operators family 15:54
lizmat jast: wish there were more of you
srandon111_ Voldenet: what are *f* operators ?
Voldenet all the flipflops
lizmat a lot of people entrenched in Perl 5 do not take that view :-)
jast I haven't quite wrapped my head around the flipflop operators yet. I mean, I know their definition, but that doesn't translate into reading or writing them easily yet. :) 15:55
pmurias Pilu: lisp/haskell/prolog are all vastly different and have different strengths and weaknesses
Voldenet for example lisp's strength is pretending to not have a syntax at all 15:56
pmurias lizmat: isn't most of the Perl 5 opposition to the implementation/effect on Perl 5 rather than the language itself
Voldenet: it's also it's biggest weakness ;)
jast lizmat: well, there are plenty of annoying limitations in Perl 5. personally I'm a fan of the "batteries included" mindset. I don't appreciate combining modules in a project and suddenly having three different implementations of object orientiation in my list of dependencies...
that doesn't mean there shouldn't be plenty of options to customize behaviour, of course. Perl 6 checks both boxes, it doesn't get better than that 15:57
srandon111_ jast: well it comes down to personal preference at some point
jast of course
Voldenet I'm sure though, that perl6 code is bound to be a lot shorter than perl5 code 15:58
since perl 5 doesn't really do much in terms of threading, error handling, oop and even some simple array/hash operations, one is condemned to write everything from scratch 16:01
Pilu pmurias: so it's all about regex, isn't it? 16:02
jast regex is Perl 5 standard fare
timotimo m: my @a = 1..10; @a.map({ $_ = 9 }); say @a
camelia [9 9 9 9 9 9 9 9 9 9]
timotimo Voldenet: it's mutable, but only if what you're mapping over has containers
jast in Perl 6 you have grammars, the likes of which very few languages have built in
timotimo mapping over 1..10 gives you a list, which is immutable. and container-less by default 16:02
Voldenet smacks his head 16:03
of course, thanks
timotimo YW :)
m: my @a = 1..10; for @a <-> $_ { $_ = 9 }; say @a
camelia [9 9 9 9 9 9 9 9 9 9]
timotimo m: my @a = 1..10; for @a { $_ = 9 }; say @a
camelia [9 9 9 9 9 9 9 9 9 9]
timotimo ^ also works
Voldenet m: say map { $_ *= 2 }, (1..10).Array 16:04
camelia (2 4 6 8 10 12 14 16 18 20)
lizmat m: say map -> $_ is copy { $_ *= 2 }, 1..10 # Voldenet: yet another way 16:06
camelia (2 4 6 8 10 12 14 16 18 20)
lizmat on large ranges this is probably easier on memory as it won't need to create the array 16:07
Pilu what is the best programming book you've ever read? do you have any recommendation? My one is still SICP ... I still think lisps have something special
Voldenet hm, I wouldn't really use map over large ranges though, for seems like a better choice 16:08
timotimo if you map over a range you can consume the result lazily in the next step 16:09
m: say (map -> $_ is copy { say "processing $_"; $_ * 2 }, 1..10000)[^10];
camelia processing 1
processing 2
processing 3
processing 4
processing 5
processing 6
processing 7
processing 8
processing 9
processing 10
(2 4 6 8 10 12 14 16 18 20)
Voldenet I guess they all have their uses, the last way would be more suitable to db-like approach, for example where you need to operate on large sorted sets 16:11
srandon111_ Voldenet: also will perl6 fix some of the problems of perl5 ? 16:13
Voldenet srandon111_: It already have fixed threading
srandon111_ Voldenet: nice... the fact is that perl5 is nice but lacks modules for data science/machine learning/statistics/big data 16:14
PDL is not comparable to numpy for example
scovit srandon111_: I think that numpy is not comparable with matlab 16:30
Voldenet scovit: matlab is extremely unreadable 16:32
scovit nah, is just a language like the others. It is not the syntax his strength 16:33
Voldenet I believe "nargin" to be extremely unreadable, and it's _basics_ 16:34
also, things like `size(M, 2)` 16:35
scovit Voldenet may I just agree with you that it sucks but still think that it is much better than numpy for the specific purpose? 16:37
Voldenet Uh, some its features are great, but not the language itself. 16:38
scovit ye
pmurias Voldenet: isn't familiarity a huge part of readability? 17:12
Voldenet it is, that's why most programming languages just use english
"arguments.length" in js still feels hacky, but it's easy to remember 17:13
Voldenet and I doubt familiarity is a huge part of readability, it has a fair share of it, but even without using python much I can say it's made for readability 17:23
Voldenet while some languages (haskell, I'm looking at you) did have elegance in mind, without minding the readability at all 17:23
mspo which haskell? :) 17:24
Voldenet (;
mspo the sugary version?
Voldenet a regular GHC version, not sure which one is it 17:26
timotimo i find the "readability" of python doesn't hold up; being so wordy can make things super difficult to understand, because you drown in a thousand words 17:27
pmurias Voldenet: readability by people who don't know the language and those who do are two different things 17:30
timotimo i was using python for like 6 years at the point i got annoyed 17:31
moritz python has this weird mixture of a powerful and concise slice syntax, and then very verbose syntax for other stuff 17:35
like ternary operator
Voldenet I didn't know python had ternary operator 17:36
moritz x = "foo" if condition else "bar" 17:36
moritz x = (condition and "foo") or "bar 17:37
(doens't work for false "foo")
Voldenet huh, I thought it'd have something that looks like an actual ternary operator 17:38
also, I'm not sure how readability by people who don't and do know the language differs, it's not a switch, it looks more fluid 17:43
from "I've never seen anything like it" to "I've programmed in the language that looked exactly like it for 5 years" ;P
Voldenet so for the people that programmed in C-like languages functional languages might seem odd and vice versa 17:48
Voldenet I have no idea, but I'm interested in researches on the topic, I'll better hide before people smack me for being ignorant... 17:50
Phlogistique did the "user-defined array indexing" described here design.perl6.org/S09.html#User-def...y_indexing actually land? 17:55
p6: my int @ints{-1...1} 17:57
camelia 5===SORRY!5=== Error while compiling <tmp>
The {} shape syntax with the @ sigil is reserved
at <tmp>:1
------> 3my int @ints{-1...17⏏5}
expecting any of:
statement end
statement modifier
statement mo…
Phlogistique what is the idiom for element-wise addition in Perl6? 18:08
ilmari m: say (1,2,3) Z+ (4,5,6) 18:09
camelia (5 7 9)
ilmari that's the Z metoperator applied to +
it can be applied to any infix operator
Phlogistique thanks ilmari
ilmari docs.perl6.org/routine/Z 18:10
timotimo heyo Phlogistique 18:20
are you the one i know from the lojban community?
[Coke] crap, my initial thought for an advent article isn't panning out; good thing i have a few weeks left. :)
Phlogistique timotimo: yes :)
timotimo: nice to see you there!
will you be at CCC?
timotimo potentially 18:21
Phlogistique nice! We should catch up there
Phlogistique Is there a broadcasting equivalent to Z ? 18:25
timotimo what si broadcast?
Phlogistique [1,2,3,4] BROADCASTING-Z [foo,bar] would be [[1 foo][2 bar][3 foo][4 bar]]
it's called "broadcasting" in the context of numeric computing 18:26
timotimo oh, yeah, the hyperoperators do tthat
m: say [1, 2, 3, 4] >>,>> [<foo bar>];
camelia [(1 foo) (2 bar) (3 foo) (4 bar)]
timotimo you point them at the side that you'd like to expand
if you point both sides inwards to the operator it'll complain if the arrays aren't the same size 18:27
Phlogistique ok!
Phlogistique so the Matlab "broadcasting" + would be "<<+>>" 18:29
hankache hello #perl6
Phlogistique which looks nice, and I can choose when I want broadcasting
timotimo <<+>> will repeat the shorter list until the longer list is exhausted, i believe 18:31
m: say <1 2 3 4 5> <<,>> [<a b>]
camelia ((1 a) (2 b) (3 a) (4 b) (5 a))
Phlogistique hm, it's not really the same thing as multi-dimensional broadcasting
m: say [[1,2],[3,4]] <<+>> [1,2]
camelia [[2 3] [5 6]]
Phlogistique m: say [[1,2],[3,4]] <<+>> [[1],[2]]
camelia [[2 3] [5 6]]
Phlogistique alright 18:32
comborico1611 Hello, Hank 18:33
hankache hello comborico1611 18:36
Phlogistique can I specify the shape of my list arguments? 18:46
i.e sub foo(@bar[2]) {...}
moritz m: sub foo(@bar[2]) {... 18:47
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3sub foo(@bar[2]) {...7⏏5<EOL>
expecting any of:
statement end
statement modifier
statement modifier loop
Phlogistique m: sub foo(@bar[2]) { say @bar } 18:50
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '@bar' is not declared
at <tmp>:1
------> 3sub foo(@bar[2]) { say 7⏏5@bar }
[Coke] ponders refactoring the doc tests so they could be loaded as modules in a single test file that could then use rakudo concurrency to run -all- the tests instead of only in a single test. 19:00
Voldenet Phlogistique: if you only want to constrain them, then I think you can, not sure if there's an easier syntax 19:02
m: use Test; sub a (*@x where { @_.elems == 2 }) { }; my (@n2, @n3) = ([1,2], [1,2,3]); dies-ok { a(@n3); }; lives-ok { a(@n2) } 19:03
camelia ok 1 -
ok 2 -
Voldenet actually 19:03
m: use Test; sub a (@x where { .elems == 2 }) { }; my (@n2, @n3) = ([1,2], [1,2,3]); dies-ok { a(@n3); }; lives-ok { a(@n2) }
camelia ok 1 -
ok 2 -
El_Che m: sub foo(@bar where @bar.elems == 2) { say @bar }; say foo((1,2)); say foo((1,2,3)) 19:05
camelia (1 2)
Constraint type check failed in binding to parameter '@bar'; expected anonymous constraint to be met but got List ($(1, 2, 3))
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1

True
El_Che m: sub foo(@bar where @bar.elems == 2) { say @bar }; say foo((1,2))
camelia (1 2)
True
El_Che m: sub foo(@bar where @bar.elems == 2) { say @bar }; say foo((1,2,3)) 19:06
camelia Constraint type check failed in binding to parameter '@bar'; expected anonymous constraint to be met but got List ($(1, 2, 3))
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
Voldenet m: use Test; sub a (*@x where .elems == 3) { }; dies-ok { a(1, 2); }; lives-ok { a(1, 2, 3) } 19:12
camelia ok 1 -
ok 2 -
comborico1611 Does anyone know how to keep the stupid YouTube mobile app playlist to the bottom, instead of it going back to the top, requiring you to scroll all the way back to the bottom? 19:18
Phlogistique Voldenet: thanks! 19:20
Phlogistique m: my @a[1,2,3]; say @a.shape 19:22
camelia (1 2 3)
Phlogistique m: say Array.new(:shape(1,2,3)).shape 19:23
camelia (1 2 3)
Phlogistique m: my @a = Array.new(:shape(1,2,3)); say @a.shape
camelia (*)
Phlogistique Why? :(
timotimo because you're doing array assignment 19:24
that iterates over the array on the right and puts the stuff into the array on the left
what you want there is binding instead of assignment :)
Phlogistique oh. ok.
timotimo the advent blog post from yesterday explains that in nice detail
Phlogistique thanks timotimo 19:26
another why:
m: say [1], [[1]], [[1],]
camelia [1][1][[1]]
timotimo "single-argument rule"; most things iterate over things if they get passed a single thing
Phlogistique ok 19:27
timotimo m: say [<foo bar baz>] # it's how you get an array of strings with the < > syntax rather than just a list
camelia [foo bar baz]
Phlogistique thanks again :)
timotimo m: for (1, 2, 3), (4) { say "oh my, $_" }
camelia oh my, 1 2 3
oh my, 4
timotimo m: for (1, 2, 3) { say "oh my, $_" } 19:27
camelia oh my, 1
oh my, 2
oh my, 3
Phlogistique Partially dimensioned views of shaped arrays not yet implemented. Sorry. <- :(( 19:36
timotimo yes :( 19:36
perlpilot That would be an excellent grant proposal for someone: Give Perl 6 a little PDL-love 19:38
DrForr I've got a nascent OpenCV thing... 19:39
[Coke] wonders if we should consider targetting wasm 20:07
El_Che [Coke]: don't tease us :) 20:21
hahainternet is it possible to take a reference to a method? I remember this being possible in some form because dispatch is unified between them 20:47
but i can't remember the specifics
TimToady m: say Int.^lookup('abs').WHAT 20:50
camelia (Method)
TimToady m: say Int.^lookup('abs')(-42) 20:51
camelia 42
TimToady m: say Int.can('abs')[0](-42) 20:51
camelia 42
El_Che explosive
AlexDaniel hahainternet: see also: docs.perl6.org/routine/lookup (note how it mentions find_method) 20:58
hahainternet AlexDaniel: cheers :) sorry i missed your reply TimToady 20:59
teatime huggable: hug someone. 21:03
huggable hugs someone.
teatime huggable: hug someone else.
huggable hugs someone else.
DickClarke thank you :3
teatime huggable: what's on top of a house? who was the greatest baseball player ever to live?
huggable teatime, nothing found
AlexDaniel teatime: you better ask ZofBot on #perl6-dev channel :) 21:04
DickClarke teatime: babe ruth 21:17
hahainternet what's the most succinct way to grep a list for defined items? 21:20
(specifically, not Anys)
timotimo grep(*.defined) 21:21
hahainternet thought as much, cheers :)
perlpilot hahainternet: golfing? 21:23
hahainternet perlpilot: sorta 21:31
hahainternet a question in that vein, is there a nice list of when you can use funcname: args instead of funcname(args)? I expected it to work using the ==> operator, but alas it does not appear to 21:46
perlpilot hahainternet: show the code; it's probably a precedence problem. 21:51
hahainternet perlpilot: oh it's been refactored since then, i just wondered if there were some docs on it i could bookmark
or a formal name, i think i've probably asked this before :)
AlexDaniel hahainternet: I think the question was about methods? 22:46
hahainternet AlexDaniel: sorry?
AlexDaniel hahainternet: any “.method: args” will work, for subroutines you just write “sub args”
hahainternet AlexDaniel: sorry it was more when you are permitted to use the colon form 22:47
AlexDaniel hahainternet: you can use it with any method
if I got the question right
hahainternet AlexDaniel: right, i think i was using the bare grep with ==> so that'd be why
as it does the implicit passing of the subject or topic or whatever self is :p 22:48
comborico1611 Apache written in Perl6. 22:49
lizmat and another Perl 6 Weekly hits the Net: p6weekly.wordpress.com/2017/12/04/...ieventing/ 22:57
hahainternet i felt the HN response to day 1 was overly harsh 22:58
i hope to see another article posted in a week or so, mindshare is important
comborico1611 Thanks, lizmat!
hahainternet yes, gj lizmat 22:59
AlexDaniel lizmat++ 23:12
timotimo can someone build that sonnet slang from the hackernews thread? 23:50