»ö« 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 Zoffix on 25 May 2018. |
|||
00:10
mcmillhj joined
00:14
mcmillhj left
00:27
mcmillhj joined,
nnunley joined
00:32
mcmillhj left
00:37
dct left
00:42
raschipi joined
00:51
pmmmm joined
00:55
kurahaupo_ joined,
kurahaupo_ left
00:56
kurahaupo_ joined,
kurahaupo left
00:57
kurahaupo_ is now known as kurahaupo,
markoong left,
mcmillhj joined
00:58
nnunley left
01:03
mcmillhj left
|
|||
pmmmm | Quick question. How do I create an empty sequence? I am trying to flatmap every element in a directory where every element maps to sequence of many element or one element or zero element. | 01:12 | |
MasterDuke | pmmmm: Seq.new doesn't work? | 01:14 | |
raschipi | m: .say for Seq.new | 01:20 | |
camelia | Too few positionals passed; expected 2 arguments but got 1 in block <unit> at <tmp> line 1 |
||
raschipi | MasterDuke: No | 01:23 | |
01:33
japhb left
|
|||
timotimo | why not ().Seq? | 01:41 | |
or "lol" xx 0 | |||
m: say ("lol" xx 0).^name | |||
camelia | Seq | ||
timotimo | m: say ().Seq.^name | 01:42 | |
camelia | Seq | ||
01:43
mcmillhj joined
01:46
Kaiepi joined
|
|||
pmmmm | timotimo: Thanks. That indeed works. | 01:47 | |
01:48
mcmillhj left
|
|||
timotimo | put some very intricate and complicated expression in front of the xx to make it extra funny when the reader gets the joke | 01:49 | |
01:51
molaf left
|
|||
timotimo | 'night | 01:56 | |
pmmmm | timotimo: goodnight and thanks again. | ||
01:59
nnunley joined
02:04
molaf joined
02:06
comborico1611 left
02:13
mcmillhj joined
02:18
mcmillhj left
02:32
Kaiepi left
02:33
Kaiepi joined
02:48
raschipi left
02:52
kurahaupo left
02:57
mcmillhj joined,
Tison left
02:59
lizmat left
03:02
mcmillhj left
03:12
mcmillhj joined
03:16
mcmillhj left
03:19
kurahaupo joined
03:41
mcmillhj joined
03:46
mcmillhj left
04:11
psychoslave joined,
Xliff joined
|
|||
Xliff | \o | 04:11 | |
Anyone read -> www.wired.com/story/microsoft-gith...oderation/ | 04:13 | ||
04:14
psychoslave left,
psychoslave joined
|
|||
Xliff | That bothers me, greatly. | 04:15 | |
04:22
mahafyi joined
04:23
espadrine left,
Xliff left
04:31
mcmillhj joined
04:36
mcmillhj left
04:57
mcmillhj joined
05:02
mcmillhj left
05:03
uzl joined
|
|||
uzl | .tell hythm_ class A { has $.letter }; class B { has A @.objs }; my %h; %h<vowels>.push(A.new(letter => $_)) for <a e i o u>; my $b = B.new(objs => |%h<vowels>); | 05:08 | |
yoleaux | uzl: I'll pass your message to hythm_. | ||
05:08
mcmillhj joined
05:09
sauvin joined
|
|||
uzl | p6: class A { has $.letter }; class B { has A @.objs }; my %h; %h<vowels>.push(A.new(letter => $_)) for <a e i o u>; my $b = B.new(objs => |%h<vowels>); | 05:10 | |
camelia | ( no output ) | ||
uzl | p6: class A { has $.letter }; class B { has A @.objs }; my %h; %h<vowels>.push(A.new(letter => $_)) for <a e i o u>; my $b = B.new(objs => |%h<vowels>); say $b; | ||
camelia | B.new(objs => Array[A].new(A.new(letter => "a"), A.new(letter => "e"), A.new(letter => "i"), A.new(letter => "o"), A.new(letter => "u"))) | ||
05:11
uzl left
05:13
mcmillhj left
05:27
u-ou joined
05:29
xtreak joined
05:34
mcmillhj joined
05:37
Sgeo_ joined
05:39
Sgeo left,
mcmillhj left
06:00
Geth left
06:01
dalek joined,
ChanServ sets mode: +v dalek,
Geth joined,
ChanServ sets mode: +v Geth,
p6lert joined,
synopsebot_ joined,
ChanServ sets mode: +v synopsebot_
06:04
mcmillhj joined
06:09
mcmillhj left
06:21
espadrine joined
06:37
obfusk joined
06:39
mahafyi left
06:41
mcmillhj joined
06:45
mcmillhj left
06:53
mcmillhj joined
06:58
mcmillhj left
07:06
lizmat joined
07:11
darutoko joined
07:13
musca` left
07:14
skids left
07:15
mcmillhj joined
07:17
jmerelo joined
07:20
mcmillhj left
07:21
kurahaupo left,
sena_kun joined
07:45
musca joined
07:46
xtreak left
07:48
xtreak joined
07:50
xtreak left
07:51
xtreak joined
07:55
xtreak left
07:59
mcmillhj joined
08:04
mcmillhj left
08:18
robertle joined
08:28
wamba joined
08:29
mcmillhj joined
08:33
mcmillhj left
08:36
rindolf joined
08:37
xtreak joined
08:45
mcmillhj joined
08:52
mcmillhj left
08:59
robertle left
09:00
kurahaupo joined
09:08
psychoslave left
|
|||
buggable | New CPAN upload: Inline-Perl5-0.34.tar.gz by NINE modules.perl6.org/dist/Inline::Perl5:cpan:NINE | 09:14 | |
jmerelo | Role and traits are conceptually the same thing; however, they have different keywords and work differently in Perl 6. Would it be correct to say that traits are added at compile time, roles at runtime? | 09:40 | |
09:40
lizmat left
|
|||
moritz | NO | 09:41 | |
El_Che | are they the same thing? | ||
moritz | sorry, capslock, didn't meant to shout :-) | ||
roles are an OO feature | |||
traits are a language modification hooks | |||
traits often use roles as mixins to modify behavior, but that doesn't need to be the case | 09:42 | ||
jmerelo | traits are language modification hooks... because they work at runtime. | ||
sorry, compile time. | |||
moritz | yes, but roles are also often used at compile time | 09:43 | |
class Rat does Rational[int64, Int] { ... } # role used at compile time | |||
jmerelo | Roles _can_ be used at compile time, but traits are _always_ used at compile time. | ||
moritz | you can also call traits at run time | 09:44 | |
jmerelo | Hum. | ||
Example? | |||
moritz | m: class A { }; class B { }; trait_mod:<is>(B, A); # not sure if that works | 09:45 | |
camelia | Parents cannot be added to class 'B'after it has been composed in block <unit> at <tmp> line 1 |
||
moritz | m: my $f = sub () { 42 }; trait_mod:<returns>($f, Int) | ||
camelia | ( no output ) | ||
moritz | I've post-declared the return type of $f with a run-time call to the "returns" trait | 09:46 | |
jmerelo | hum. | ||
moritz | and if you write something framework-like, it's not that uncommon | 09:47 | |
jmerelo | OK. Let's see this: Roles access the `self` variable, while traits can access only the public API of the object they are mixed in. | 09:48 | |
moritz | why are you trying to list differences that don't capture the essence? | ||
roles are a way to structure classes and objects | 09:49 | ||
traits are hooks that the compiler calls for you | |||
09:49
lizmat joined
|
|||
jmerelo | I'm trying go put the essence into an easy-to-understand single sentence. | 09:49 | |
moritz | (note that some other programming languages use the word "traits" for our roles; that's a potential source of confusion) | ||
jmerelo | our roles _are_ traits conceptually. And traits are also traits. | 09:50 | |
Or both are mixins. | |||
moritz | if you phrase it that way, you're confusing everybody :-) | 09:51 | |
jmerelo | I don't want to phrase it that way. | ||
"Perl 6 roles are traits that are structurally part of classes (and objects), while Perl 6 traits are hooks that the compiler calls for you" | 09:52 | ||
"Perl 6 roles are traits that are structurally part of classes (and objects), while Perl 6 traits are hooks that the compiler calls for you. However, they are conceptually mixins, also called traits in other languages" | 09:53 | ||
moritz | Perl 6 roles are a mechanism for code reuse, and thus for structuring classes and objects. Some other languages call them "traits". | ||
Perl 6 traits, however, are hooks that the compiler calls for you. | 09:54 | ||
jmerelo | traits can also be used for code reuse. | 09:55 | |
moritz | well, if you try, you can make things more confusing | ||
traits are mostly useful for defining concise APIs | |||
and sure, that has some implications for code reuse | |||
jmerelo | The problem is mixing in one single adversative sentence use (on one hand) and concept (in the other hand) | 09:56 | |
Roles are used for this, while traits are that. | |||
moritz | why do you even try to describe both in a single sentence? | 09:57 | |
jmerelo | Roles are structure, while traits are... Hum. | ||
moritz: well, to avoid confusion, and make clear when one should use one or the other. Make a precise use case for any of them. | |||
Roles can't change internal representation, while traits can. | 09:58 | ||
Roles can access self, while traits in principle only receive the public interface of the object. | 09:59 | ||
That would be two sentences, but I believe both are true. Two sentences is less awesome than a single one, but build up to a good use case. | 10:00 | ||
Also, "is" applies a trait to an object in compile time, while "does" can be used at compile or runtime. | 10:02 | ||
Three sentences. | |||
moritz | jmerelo: but who confuses roles and traits in the first place? | ||
jmerelo | moritz: Mr Newt B. Ye | 10:03 | |
moritz: It's for the (all new) traits page in the documentation. | 10:04 | ||
moritz | jmerelo: be careful, there's an infix:<does> operator and a "does" trait | 10:05 | |
the operator runs at runtime, the trait at compile time | |||
jmerelo | moritz: OK, let's start all over again. | 10:06 | |
moritz: looking at this stackoverflow.com/questions/925609...vs-traits, would you say that roles are mixins, and traits are, unsurprisingly, traits? | 10:07 | ||
moritz | jmerelo: I'd say that Perl 6 roles have aspects of traits (explicit conflict resolution, flattened), but unlike traditional CS traits, the can contain state | 10:11 | |
I don't see any relation between a Perl 6 trait and a CS trait | |||
jmerelo | moritz: So roles are mixins and (from some point of view) traits, and traits are... what? | 10:12 | |
moritz | jmerelo: trait are compiler hooks | ||
... as I've been saying for the last half hour | |||
jmerelo | moritz: OK. Thanks for your patience. | 10:13 | |
moritz: I was trying to reconcile the fact that they are called "traits" seeing how that concept applied to them. And also to roles... | 10:14 | ||
moritz | jmerelo: afaict, the naming of p6 traits comes more from natural language than from CS | 10:15 | |
you define some properties (aka traits) of an object that way, for example the return type of a function, the parents of a class etc | 10:16 | ||
jmerelo | moritz: it would have been less confusing to call it properties or features. But one has to work with what's already there... | 10:17 | |
moritz | many programmers associated "properties" with our "attributes" | 10:20 | |
naming is not easy :( | |||
10:21
jeromelanteri joined
|
|||
jmerelo | moritz: we should have invented a new word. "trooks" | 10:21 | |
"wraits", as in "hook" and "traits" | |||
moritz | don't give TimToady any ideas :) | ||
jmerelo | I'll change it everywhere in Rakudo and make a pull request. | ||
moritz | (and the people who write trooks will be called trookers, right?) | 10:22 | |
jmerelo | moritz: anyway, it's been really helpful. I'll put the conversation, as is, in the documentation :-) | ||
moritz: I mean, _you_ have been really helpful. | |||
moritz: I would so *love* that :-) | 10:23 | ||
And then we'll sing the song "Minnie the trooker" www.youtube.com/watch?v=8mq4UT4VnbE | |||
moritz | :) | 10:24 | |
10:36
damaxi joined
|
|||
damaxi | araraloren: Hi!:) | 10:37 | |
araraloren | hi | 10:39 | |
10:41
dogbert2 left
|
|||
araraloren | what's going on damaxi | 10:43 | |
El_Che | discussions about roles and traints: pbs.twimg.com/media/DfPbUBOXUAA-YOl.jpg | 10:49 | |
10:50
dogbert2 joined
|
|||
jeromelanteri | someone use spacemacs for dev perl6 codes ? | 10:50 | |
(hello) | 10:51 | ||
El_Che | a merelo anagram? | 10:53 | |
moritz | neearly, missing an e :-) | ||
jeromelanteri: not me; I use down-to-earth vim :D | |||
El_Che | jinetea merelo | 10:54 | |
jeromelanteri: there are some emacs users here. Stick around | |||
jmerelo | El_Che: that would be me... | ||
jeromelanteri | moritz, i use vim to usually, but i'm trying to start to use emacs and specificaly spacemacs. layer for perl6 seems to failed, maybe there is something good for perl6 to use with spacemacs ? | 10:55 | |
jmerelo | I mean, I use plain old emacs | ||
El_Che | space emacs is like emacs on drugs? | ||
how is that different? | |||
jeromelanteri | bah i'm an emacs beginner... but i can see that spacemacs embed directly most of packages i need (and more)... for example vim keys bindings with evil | 10:56 | |
spacemacs should be a kind of emacs for newbie with special leader key and facilities... | |||
the idea is to not loose to much time to learn emacs also. | 10:57 | ||
El_Che | it probably has the same perl6 setup as regular emacs, I presume | 10:58 | |
jmerelo | if it's basically emacs there's a perl6 mode you can use. | ||
10:59
markoong joined
|
|||
jeromelanteri | yes, i see perl6-mode and also perl6 layer... perl6 layer test failed for spacemacs (so i presume maybe also for just emacs) | 10:59 | |
jmerelo | El_Che: jmerelo is unanagrammable | ||
moritz: I'm realizing there's then a confusion throughout all the documentation. | |||
(maybe more, but at least this one) | 11:00 | ||
El_Che | m: say 'jemerelo'.split('').permutations | 11:02 | |
camelia | (( j e m e r e l o ) ( j e m e r e l o) ( j e m e r e o l ) ( j e m e r e o l) ( j e m e r e l o) ( j e m e r e o l) ( j e m e r l e o ) ( j e m e r l e o) ( j e m e r l o e ) ( j e m e r l o e) ( j e m e r l e o) ( j e m e r l o e) ( j e m e … | ||
El_Che | I like jemereól | ||
jmerelo | m: say 'jmerelo'.split('').permutations | 11:03 | |
camelia | (( j m e r e l o ) ( j m e r e l o) ( j m e r e o l ) ( j m e r e o l) ( j m e r e l o) ( j m e r e o l) ( j m e r l e o ) ( j m e r l e o) ( j m e r l o e ) ( j m e r l o e) ( j m e r l e o) ( j m e r l o e) ( j m e r o e l ) ( j m e r o e l… | ||
jmerelo | It's badly unagrammable, then. | 11:04 | |
moritz | m: say 'jmerelo'.split('').perl | 11:05 | |
camelia | ("", "j", "m", "e", "r", "e", "l", "o", "").Seq | ||
moritz | if you use .comb instead, you get fewer bogus/redundant permutations | ||
El_Che | m: say 'jemerelo'.split('').comb | ||
camelia | ( j e m e r e l o ) | ||
moritz | m: say 'jmerelo.comb.permutations.map(*.join) | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Unable to parse expression in single quotes; couldn't find final "'" (corresponding starter was at line 1) at <tmp>:1 ------> 3y 'jmerelo.comb.permutations.map(*.join)7⏏5<EOL> expecting … |
||
moritz | m: say 'jmerelo'.comb.permutations.map(*.join) | ||
camelia | (jmerelo jmereol jmerleo jmerloe jmeroel jmerole jmeerlo jmeerol jmeelro jmeelor jmeeorl jmeeolr jmelreo jmelroe jmelero jmeleor jmelore jmeloer jmeorel jmeorle jmeoerl jmeoelr jmeolre jmeoler jmreelo jmreeol jmreleo jmreloe jmreoel jmreole jmreelo jm… | ||
El_Che | nice! | 11:06 | |
jmerelo | jmeleor could be a Lord of the Rings character | 11:07 | |
Anyway | |||
moritz: most documentation is wrong, I was saying, regarding traits. | |||
The talk about the "is rw" trait, or things like that | 11:08 | ||
but the trait is actually "is", "does" or "will". | |||
"is rw" is an instantiation of the trait. | |||
right? | |||
in general, only "is" is referred to as "trait". "does", "will" ... are just stuff. | 11:09 | ||
moritz | not 100% sure on this nor | ||
nor about how much value this extra precision actually gives us | 11:10 | ||
jmerelo | moritz: not sure about how it's reflected in the documentation or not sure about what should be properly called a trait? | ||
For instance "does" is a trait, but documentation directs us to the definition of "roles". "does" has only one multi, which does what it does (no pun intended), but it can do so much more... | 11:11 | ||
If you define a proto, I guess you can define as many roles as you want. I mean, differentiating between traits and trait instances gives us some insigh on actual use cases. | 11:12 | ||
Besides, it gives us a hint on how traits should be best used. You can define trait_mod:<is> any way you want on new types, but we should give some advice or best practice on how best to use it. | 11:13 | ||
When to use "does" instead of "is", for instance. | |||
11:14
wamba left,
wamba joined
|
|||
perlawhi1l | hi perlers | 11:18 | |
jmerelo | hi | 11:19 | |
araraloren | hi | ||
perlawhi1l | i think i got a bug here | ||
my %hash = :zero(0), :one(1); say so %hash<zero>:exists; say 'zero' ∈ %hash; | |||
evalable6 | True False |
||
perlawhi1l | looks like it's booling the value, which is 0, resulting in False | ||
for ∈ | |||
jmerelo | m: my %hash = :zero(0), :one(1); say so %hash<zero>:exists; say 'zero' ∈ %hash.keys; | ||
camelia | True True |
||
araraloren | my %hash = :zero(2), :one(1); say so %hash<zero>:exists; say 'zero' ∈ %hash; | ||
evalable6 | True True |
||
jmerelo | m: my %hash = :zero(0), :one(1); say so %hash<zero>:exists; say 'zero' ∈ %hash.kv; | 11:20 | |
camelia | True True |
||
jmerelo | m: my %hash = :zero(0), :one(1); say so %hash<zero>:exists; say 'zero' ∈ %hash.values; | ||
camelia | True False |
||
jmerelo | There you go | ||
m: my %hash = :zero(0), :one(1); say set(%hash); say so %hash<zero>:exists; say 'zero' ∈ %hash.values; | |||
camelia | set(one => 1 zero => 0) True False |
||
jmerelo | m: my %hash = :zero(0), :one(1); say set(%hash); say so %hash<zero>:exists; say 'zero' ∈ set(%hash); | ||
camelia | set(one => 1 zero => 0) True False |
||
jmerelo | ∈ is coercing a hash to a set, and that's the result. | 11:21 | |
m: my %hash = :zero(0), :one(1); say set(%hash).perl; say so %hash<zero>:exists; say 'zero' ∈ set(%hash); | |||
camelia | (:one(1),:zero(0)).Set True False |
||
jmerelo | m: my %hash = :zero(1), :one(1); say set(%hash).perl; say so %hash<zero>:exists; say 'zero' ∈ set(%hash); | 11:22 | |
camelia | (:one(1),:zero(1)).Set True False |
||
jmerelo | m: my %hash = :zero(1), :one(1); say set(%hash).perl.elems; say so %hash<zero>:exists; say 'zero' ∈ set(%hash); | ||
camelia | 1 True False |
||
jmerelo | Hum, it's a junction. | 11:23 | |
perlawhi1l | bisectable6: my %hash = :zero(0), :one(1); say 'zero' ∈ %hash; | ||
bisectable6 | perlawhi1l, On both starting points (old=2015.12 new=c940a0e) the exit code is 0 and the output is identical as well | ||
perlawhi1l, Output on both points: «False» | |||
perlawhi1l | ok | 11:24 | |
tobs | fwiw, that behaviour makes more sense if you think of Set as a special type of Bag :-) | 11:25 | |
perlawhi1l | yeah... just seems odd that 'one' ∈ %hash is true, but 'zero' ∈ is false | ||
i guess the rule is, don't use setops to test hash membership :D | 11:26 | ||
that's what :exists is for | |||
jmerelo | perlawhi1l: looks fair | ||
perlawhi1l | the "hash coerces to set" doesn't hold water if you try 'one' ∈ set(%hash), which is fault, because that creates a set of pairs | 11:30 | |
instead i presume it's doing %hash.Set | |||
my %hash = :zero(0), :one(1); say %hash.Set | |||
evalable6 | set(one) | ||
perlawhi1l | which makes that set... hence 'one' ∈ %hash is true | ||
jmerelo | perlawhi1l: that's what I call coercing to Set. | ||
perlawhi1l | yes :D | 11:31 | |
I agree | |||
I am tired... i meant... based on your notes above... it's not creating a set from the hash (ie. set(%hash)), but instead coercing. | 11:32 | ||
ok, all is understood now | |||
jmerelo | perlawhi1l: :-) | ||
11:32
jeromelanteri left
11:34
SourceBaby joined,
ChanServ sets mode: +v SourceBaby
11:39
Zoffix joined
|
|||
Zoffix | More accurately, `zero` doesn't make it to the created Set, because it's false. So you end up with a Set that only has `one` and you're then trying to test if it has `zero` in it. | 11:40 | |
You could test membership of keys instead: | 11:41 | ||
m: my %hash = :zero(0), :one(1); dd say 'zero' ∈ keys %hash | |||
camelia | True Bool::True |
||
perlawhi1l | yeah, figured that... i just incorrectly assumed ∈ on a hash would check the keys... but a hash with numeric values does not a QuantHash make | 11:43 | |
jmerelo | perlawhi1l: in fact, that behavior is documented: docs.perl6.org/type/Set#Creating_Set_objects | 11:53 | |
Geth | doc: 39fe1e46e6 | (JJ Merelo)++ | doc/Language/traits.pod6 Restructures the traits page With a better definition given by @moritz Also restructures. Refs #1957 |
11:56 | |
synopsebot_ | Link: doc.perl6.org/language/traits | ||
Geth | doc: 02669a0be4 | (JJ Merelo)++ | doc/Type/List.pod6 Documents list → on the list side, closes #1245 |
||
synopsebot_ | Link: doc.perl6.org/type/List | ||
12:13
Zoffix left
12:15
jmerelo left,
mahafyi joined
12:16
Util joined
12:18
xtreak left
12:22
zakharyas joined
12:26
psychoslave joined
12:33
robertle joined
|
|||
moritz | jnthn: re your last blog post, any reason not to use (|) as the signature in discard-and-nil? I thought that was faster than (*@, *%) | 12:36 | |
jnthn | moritz: It's NQP code, and NQP doesn't have |. | 12:39 | |
moritz | jnthn: ah, but it's less costly as the Perl 6 slurpy | ||
no objections then :-) | |||
jnthn | Yeah, NQP also doesn't wrap the two up in a higher level object, or have any concept of flattening, so its *@foo is more like Perl 6 **@foo except lower level :) | 12:40 | |
12:40
zakharyas left
12:45
araraloren left
12:46
araraloren joined
|
|||
moritz | also, from reading the blog post, it looks like a pretty cool mechanism | 12:46 | |
considering that those spesh plugins are just a few lines each | |||
12:53
domidumont joined
13:00
domidumont left
13:01
domidumont joined
|
|||
Juerd | jnthn: It's interesting that Bool.pick is faster than rand > .5 :) | 13:03 | |
jdv79 | is there a web irc log alternative? that's one of the only ways i know what's going on:( | 13:04 | |
moritz | jdv79: there's a link in the topic | 13:05 | |
13:06
domidumont left
|
|||
jnthn | Juerd: It probably avoids that coercion that I mentioned :) It's also prettier. Should probably have used that :) | 13:07 | |
Juerd | jnthn: Nah, this is a better comparison to the other rand call, for which I don't think a prettier option is available | 13:08 | |
Maybe Bag.pick, though | |||
Why does rand not return a Rat anyway? :D | 13:10 | ||
13:20
xiaomiao joined
13:24
espadrine left
13:25
xiaomiao left
13:30
xiaomiao joined
|
|||
damaxi | araraloren: fine | 13:40 | |
araraloren | okay :) | ||
14:09
MasterDuke left,
MasterDuke joined
|
|||
mahafyi | good day all! I asked a question here : stackoverflow.com/questions/507751...n-in-perl6 | 14:11 | |
timotimo | mahafyi: the problem is that you can't combine prefix-for and postfix-for in one line like that | 14:12 | |
it's either something like | |||
m: say "hi $_" for <a b c d> | |||
camelia | hi a hi b hi c hi d |
||
timotimo | or something like | ||
m: for <a b c d> { last when "c"; say "hi $_" } | |||
camelia | hi a hi b |
||
timotimo | does that help? | 14:13 | |
mahafyi | timiotimo: oh ok thanks. There isn't any problem really, just wanted to see if it can be done like that... | ||
yes it is fine | |||
timotimo | the $i thing can be done "for you", too, with the .kv method | 14:14 | |
m: for <a b c d>.kv -> $k, $v { say "k is $k, v is $v. yay!" } | |||
camelia | k is 0, v is a. yay! k is 1, v is b. yay! k is 2, v is c. yay! k is 3, v is d. yay! |
||
mahafyi | last unless $_ is needed else it goes into an infinite loop | 14:15 | |
timotimo | you're getting input from a user? if so, they will have to ctrl-d for the .lines() iterator to exit | 14:16 | |
mahafyi | i posted on stackoverflow, per jmerelo idea yday, that questions there can offer some SEO and help others down the line maybe | ||
timotimo : no it is input from another program. I use it to capture default system variables passed by asterisk pbx daemon to an AGI script. | 14:17 | ||
timotimo | hm, i wouldn't expect an infinite loop under that condition | 14:22 | |
mahafyi | i followed the perl5 asterisk adi module. I was not getting an <<RX in the asterisk log at all if i use slurp or if i do not use the -> last when "" condition , plus the telephony channels does not execute the next statement which means the program never exited. I see it running in output of 'ps -ef ' also. | 14:25 | |
in fact, i am thinking of tring to make a change to use whenever and then log the stdin string to text. as of now i can only look for any output in asterisk log / debug. | 14:28 | ||
log to a file i meant | |||
14:30
espadrine joined
14:35
mcmillhj joined
14:42
mcmillhj left
14:44
AlexDani` joined,
mahafyi_ joined
14:45
AlexDaniel left
14:48
mcmillhj joined
14:49
mahafyi left,
mahafyi_ is now known as mahafyi,
AlexDani` is now known as AlexDaniel
14:53
mcmillhj left
15:06
mahafyi left
15:23
skids joined
15:24
mcmillhj joined
15:29
mcmillhj left
15:32
wamba left
15:39
domidumont joined
15:44
mcmillhj joined
15:47
Tison joined
|
|||
Tison | \o | 15:47 | |
timotimo | o/ | 15:48 | |
15:48
mcmillhj left
15:55
Tison left
15:57
psychoslave left
16:03
[particle] left
16:04
dakkar joined,
[particle] joined
16:08
labster left
16:17
mcmillhj joined
16:22
mcmillhj left
16:26
raschipi joined
16:31
mcmillhj joined
16:40
zakharyas joined
16:45
mcmillhj left
16:46
mcmillhj joined
16:48
jmerelo joined
16:51
mcmillhj left
16:56
Khisanth left
16:58
zakharyas left
16:59
zakharyas joined
17:09
musca left
17:11
Khisanth joined
17:12
mcmillhj joined
17:16
mcmillhj left
|
|||
Geth | doc: 2cd9fd07d9 | (JJ Merelo)++ | doc/Language/traits.pod6 Reorganizes and adds info on «is» for classes. Refs #1957 |
17:17 | |
synopsebot_ | Link: doc.perl6.org/language/traits | ||
17:23
imcsk8 left,
musca joined
17:25
mcmillhj joined
17:30
mcmillhj left,
imcsk8 joined
17:48
atweiden-air joined
17:54
jmerelo left
18:01
mcmillhj joined
18:02
diego_k joined,
bartolin_ joined,
Guest556371 joined,
jsimonet1 joined
18:04
espadrine left,
Guest49045 left,
espadrine joined,
camelia joined,
mst__ joined,
mst__ is now known as mst,
avalenn joined,
mst left,
mst joined
18:05
mcmillhj left,
ChanServ sets mode: +v camelia
18:06
giraffe joined,
kurahaupo left,
giraffe is now known as Guest75834
18:07
Guest556371 left
18:16
mcmillhj joined
18:21
mcmillhj left
18:31
mcmillhj joined
18:35
zakharyas left,
skids left
18:36
mcmillhj left
18:37
zakharyas joined
18:38
zakharyas left
18:40
zakharyas joined
18:54
mcmillhj joined
18:58
mcmillhj left
19:02
wamba joined
19:05
mcmillhj joined
19:09
mcmillhj left
19:10
zakharyas left,
zakharyas1 joined
19:12
zakharyas joined
19:14
zakharyas2 joined,
zakharyas1 left
19:17
zakharyas left
19:19
domidumont left
19:20
dct joined
19:23
zakharyas2 left
19:27
lizmat left
19:32
zakharyas joined,
darutoko left
19:34
mcmillhj joined
19:37
zakharyas left
19:38
zakharyas joined,
mcmillhj left
19:45
mcmillhj joined
19:49
lizmat joined
19:50
mcmillhj left
20:14
atweiden-air left
20:17
mcmillhj joined
20:22
mcmillhj left
20:29
mirlur[m] joined,
dakkar left
20:30
Kaiepi left,
Kaiepi joined
20:39
mcmillhj joined
20:41
raschipi left
20:44
mcmillhj left,
hythm_ joined
|
|||
hythm_ | p6: class C { has $!a; has $!b; submethod BUILD(:$!a = qx<hostname>, :$!b = False,) { } }; my $c = C.new; say $c; C.new | 20:45 | |
yoleaux | 05:08Z <uzl> hythm_: class A { has $.letter }; class B { has A @.objs }; my %h; %h<vowels>.push(A.new(letter => $_)) for <a e i o u>; my $b = B.new(objs => |%h<vowels>); | ||
camelia | qx, qqx is disallowed in restricted setting in sub restricted at src/RESTRICTED.setting line 1 in sub QX at src/RESTRICTED.setting line 11 in submethod BUILD at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
MasterDuke | e: class C { has $!a; has $!b; submethod BUILD(:$!a = qx<hostname>, :$!b = False,) { } }; my $c = C.new; say $c; C.new | 20:46 | |
evalable6 | C.new | ||
hythm_ | the above code works fine, but if added "chomp" on front of qx<hostname> it gives misleading error,.. | ||
# class C { has $!a; has $!b; submethod BUILD(:$!a = chomp qx<hostname>, :$!b = False,) { } }; my $c = C.new; say $c; # this errors out | |||
e: class C { has $!a; has $!b; submethod BUILD(:$!a = chomp qx<hostname>, :$!b = False,) { } }; my $c = C.new; say $c; | 20:47 | ||
evalable6 | (exit code 1) Cannot modify an immutable Pair (b => (Any)) in submethod BUILD at /tmp/C4TuNnFHsH line 1 in block <unit> at /tmp/C4TuNnFHsH line 1 |
||
MasterDuke | hythm_: can you use TWEAK instead of BUILD? does that change anything? | 20:50 | |
b2gills | e: class C { has $!a; has $!b; submethod BUILD(:$!a, :$!b = False,) { $!a //= chomp qx<hostname> } }; my $c = C.new; say $c; | ||
evalable6 | C.new | ||
hythm_ | MasterDuke TWEAK gives same error | 20:51 | |
b2gills | I don't know why you are using private attributes. | 20:53 | |
e: class C { has $.a = chomp qx<hostname>; has $.b = False; }; my $c = C.new; say $c; | |||
evalable6 | C.new(a => "superserver", b => Bool::False) | ||
20:54
damaxi left
|
|||
b2gills | e: class C { has $!a; has $!b; submethod BUILD(:$!a = chomp(qx<hostname>), :$!b = False,) { } }; my $c = C.new; say $c; | 20:56 | |
evalable6 | C.new | ||
b2gills | hythm_: The problem you were facing is that all of `qx<hostname>, :$!b = False,` were arguments to chomp | 20:57 | |
hythm_ | ah, makes sense now. Thanks b2gills. | 20:58 | |
21:13
comborico1611 joined
21:18
sena_kun left
21:19
rindolf left,
CIAvash[m] joined,
AlexDaniel`` joined,
unclechu joined,
lance_w[m] joined,
wictory[m] joined,
ilmari[m] joined,
Matthew[m] joined,
Garland_g[m] joined,
mienaikage joined
21:21
dct left
21:23
dct joined
21:28
Kaiepi left,
Kaiepi joined,
mcmillhj joined
21:30
Some-body_ joined
21:31
Some-body_ is now known as DarthGandalf
21:33
mcmillhj left
|
|||
masak | maybe it's time to reach outside of the echo chamber about Perl 6 no longer running on the Parrot VM: news.ycombinator.com/item?id=17275038 | 21:44 | |
(apologies to anyone who still runs Perl 6 on Parrot on a daily basis.) | |||
El_Che | in production | ||
21:48
mcmillhj joined
21:53
mcmillhj left
21:58
kurahaupo joined
22:01
mcmillhj joined
22:04
zakharyas left
22:05
mcmillhj left
22:09
dct left
22:19
|oLa| left
|
|||
AlexDaniel | c: 2014.01 say 42 | 22:23 | |
committable6 | AlexDaniel, ¦2014.01: «42» | 22:24 | |
AlexDaniel | fwiw that's the first working rakudo on moar ↑ | ||
I was able to build it fairly recently, but I think it no longer works on systems where perl5 is too new | 22:30 | ||
22:31
mcmillhj joined
22:36
mcmillhj left
22:54
hythm_ left
23:02
mcmillhj joined
23:03
obarb joined,
obarb is now known as mrmeseeks,
mrmeseeks left
23:06
mcmillhj left
23:09
molaf left
23:17
mcmillhj joined
23:21
markoong left
23:22
markoong joined,
mcmillhj left
23:25
molaf joined
23:44
mcmillhj joined
23:46
robertle left
23:49
mcmillhj left
23:52
pecastro joined
23:57
mcmillhj joined
|