»ö« 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. |
|||
00:07
redhands left
00:23
aborazmeh joined,
aborazmeh left,
aborazmeh joined
00:29
wamba left
00:31
Cabanossi left
00:32
Cabanossi joined
00:35
Xliff left
00:41
kybr joined
00:53
eliasr left
01:00
Cabanossi left
01:01
BenGoldberg left
01:02
cdg joined,
Cabanossi joined
01:03
darkmorph joined,
cdg left
01:04
margeas left
01:29
Cabanossi left
01:32
Cabanossi joined
01:40
redhands joined
01:55
raschipi left
02:04
wander left
02:10
colomon left
02:12
poohman joined
02:13
wander joined
02:15
apallatto left
02:18
ch3ck3r joined
02:19
colomon joined
02:21
apallatto joined
02:22
napo1eon left
02:32
cdg joined,
bitrauser_ joined
02:36
bitrauser left
02:37
cdg left
02:41
Herby_ joined
|
|||
Herby_ | o/ | 02:42 | |
02:46
ilbot3 left
02:49
cdg joined
02:55
ilbot3 joined,
ChanServ sets mode: +v ilbot3,
darkmorph left
03:00
piojo joined
|
|||
Herby_ | I'm trying a Python OO exercise, using Perl 6. I'm stuck. | 03:03 | |
gist.github.com/anonymous/2f2221c3...73dd552aaa | 03:04 | ||
How do I create the "last_id" attribute in p6? For each note created, it should get the next id available | |||
ugexe | ++$ | 03:09 | |
Herby_ | ? | ||
ugexe | or `state $last_id += 1` | ||
Herby_ | do I declare $last_id outside of the class too? | 03:10 | |
ugexe | not with `state` | ||
oh i see | 03:11 | ||
m: class Foo { my $last_id = 0; method add { $last_id++ }; method last_id { $last_id } }; Foo.new.add; Foo.new.last_id | 03:12 | ||
camelia | ( no output ) | ||
ugexe | m: class Foo { my $last_id = 0; method add { $last_id++ }; method last_id { $last_id } }; Foo.new.add; Foo.new.last_id.say | ||
camelia | 1 | ||
ugexe | m: class Foo { my $last_id = 0; method new { $last_id++; self.bless() }; method last_id { $last_id } }; Foo.new; Foo.new.last_id.say | 03:13 | |
camelia | 2 | ||
Herby_ | awesome | 03:14 | |
thanks | |||
03:15
cdg left
|
|||
wander | C<\n> matches a single, logical newline character. C<\n> is supposed to also | 03:19 | |
match a Windows CR LF codepoint pair; though it's unclear whether the magic | |||
happens at the time that external data is read, or at regex match time. | |||
unclear? | |||
is it? | |||
03:27
dominix joined
|
|||
dominix | hi guys | 03:27 | |
ugexe | i dont think its unclear, i think its just not what you might expect coming from other languages | ||
dominix | do someone knows about the project V5 ? that is perl5 implemented in rakudo. Is it dead ? stalled ? of no interest ? | 03:28 | |
03:32
noganex joined
03:33
ryn1x left
03:35
noganex_ left
|
|||
geekosaur | wander, I think which happens is not part of the spec, but part of the implementation? | 03:39 | |
03:44
poohman left
|
|||
wander | agree, spec says "\n matches logical newline" | 03:44 | |
I think the implementation is, that it happens when external data is read | 03:45 | ||
ugexe | depends, what if you read it in binary and decode it using a decoder that does not do newline translation? | 03:46 | |
geekosaur | yes, current rakudo-moar at least rewrites text mode newlines to a general newline grapheme | ||
on read | 03:47 | ||
03:53
Herby_ left
03:55
khw left,
drissel left
04:04
wander left
|
|||
piojo | Zoffix: Thank you. moritz already corrected me once about the %hash<$val> incorrect syntax. I really need to break that habit! | 04:17 | |
04:24
evalable6 left,
evalable6 joined,
ChanServ sets mode: +v evalable6
04:42
mson left
04:45
Cabanossi left
04:46
Cabanossi joined
04:53
K_ joined
|
|||
samcv | is there a way for modules to know what version they are? | 04:53 | |
like some dynamic variable that stores the version number of that installed module? | 04:54 | ||
K_ | Whatsnext? | ||
samcv | ugexe, do you know? | ||
K_ | 32 | ||
?: | 04:55 | ||
samcv | K_, do you have a question? | ||
K_ | How do i win? And get to walk away without spreading this diseez? | 04:56 | |
ugexe | samcv: github.com/rakudo/rakudo/pull/1132 needs this to do it in a reasonable way, after which point we can possibly add it to .^ver | ||
04:56
aborazmeh left
|
|||
samcv | ugexe, can we add a --version option to zef now? i always want to know what version i'm running but there's no way | 04:57 | |
and i'm guessing a lot of people may expect that to work | |||
ugexe | no, that example is shown in the PR | ||
samcv | oh you mean it adds it as an option by itself | 04:58 | |
ok thanks for link to PR | 04:59 | ||
ugexe | it makes it possible for zef to do it | ||
05:03
K_ left
05:16
cdg joined
05:20
cdg left
05:27
raiph left
05:29
Cabanossi left
05:31
Cabanossi joined
|
|||
sacomo | hi all | 05:35 | |
05:49
wamba joined
05:58
Cabanossi left
06:00
finanalyst joined,
Cabanossi joined
|
|||
finanalyst | can anyone tell me whether the specification for the META.json file in S22 has been updated? | 06:01 | |
mostly I am interested in the depends: field | |||
06:08
Mrofnet joined
06:10
Morfent joined
06:11
Merfont left
06:12
Mrofnet left
06:13
darutoko joined
|
|||
sacomo | finanalyst, now sure if the ver, author adverbs work in depends. I haven't seen any modules using them. | 06:14 | |
finanalyst | sacomo: so far I have seen some ver/author in modules, eg. Bailador. However, I remove these adverbs. My question is about the structure of depends | 06:16 | |
According to S22, there are two / three structures: a) array of string, b) array of string | hash (which contains hints), c) hash of hash of array of string | 06:17 | ||
Recently, App::Cpan6 started using the hash structure, which broke my analysis program. | 06:18 | ||
Since I originally only took into account array of string, I now want to make more generic. Just checking to see if S22 has full spec | 06:19 | ||
sacomo | yeah, I have only seen the array of strings, App::Cpan6 is the first I have seen use that structure. I think now that the cpan6 effort is underway that will become more common. | 06:23 | |
06:23
sena_kun joined
06:29
skqvheallf joined,
skqvheallf left
06:30
Cabanossi left
06:31
Cabanossi joined
06:34
dominix left
06:39
Piotr_ joined
06:41
mempko joined
06:49
parv joined
06:56
wander joined
|
|||
wander | m: uniname("一").parse-names() | 07:02 | |
camelia | Unrecognized character name [<CJK Ideograph-4E00>] in block <unit> at <tmp> line 1 |
||
wander | m: say uniname("一") | ||
camelia | <CJK Ideograph-4E00> | ||
wander | why does `uniname("一").parse-names()` not work? | 07:03 | |
I have seen rakudo #1031 but still don't know how parse-names work. especially where the dict is | 07:05 | ||
07:16
evalable6 left,
evalable6 joined
|
|||
Geth | doc: b24a42baee | (Alex Chen)++ (committed using GitHub Web editor) | doc/Language/regexes.pod6 Update regexes.pod6 |
07:17 | |
synopsebot | Link: doc.perl6.org/language/regexes | ||
apallatto | ~/2 | 07:22 | |
07:23
abraxxa joined
07:24
domidumont joined
07:28
domidumont left
07:30
domidumont joined
|
|||
Geth | doc/master: 4 commits pushed by (Jeremy Studer)++, (Jarkko Haapalainen)++ | 07:34 | |
wander | m: say 'abcdefg' ~~ /\w ** {-Inf}/; # OUTPUT: «「」» | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Bogus statement at <tmp>:2 ------> 3<BOL>7⏏5» expecting any of: prefix term |
||
wander | m: say 'abcdefg' ~~ /\w ** {-42}/; # OUTPUT: «「」» | 07:36 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Bogus statement at <tmp>:2 ------> 3<BOL>7⏏5» expecting any of: prefix term |
||
wander | m: say 'abcdefg' ~~ /\w ** {-10..-42}/; | ||
camelia | 「」 | ||
wander | m: say 'abcdefg' ~~ /\w ** {-10..-42}/; # OUTPUT: «「」» | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Bogus statement at <tmp>:2 ------> 3<BOL>7⏏5» expecting any of: prefix term |
||
wander | m: say 'abcdefg' ~~ /\w ** {-Inf}/; | ||
camelia | 「」 | ||
wander | it complain "This type (Failure) does not support positional operations in block <unit> at <unknown file> line 1" on my REPL | 07:37 | |
This is Rakudo version 2017.07 built on MoarVM version 2017.07 implementing Perl 6.c. | |||
and | 07:38 | ||
m: say 'abcdefg' ~~ /\w ** {-10..-42}/; | |||
camelia | 「」 | ||
wander | output 「abcdefg」 | ||
m: say 'abcdefg' ~~ /\w ** 1..*/; | |||
camelia | 「abcdefg」 | ||
geekosaur | yes, that was a change within the past few months | 07:39 | |
(bug fix) | 07:40 | ||
wander | ok, i'm going to get a recent release | 07:41 | |
07:41
redhands left
07:49
sena_kun left
07:57
rindolf joined
07:58
Cabanossi left
08:01
Cabanossi joined
|
|||
wander | m: (try say 'abcdefg' ~~ /\w ** {42..10}/ ) orelse say ($!.^name, $!.empty-range); | 08:06 | |
camelia | (X::Syntax::Regex::QuantifierValue True) | ||
08:07
TEttinger left
|
|||
wander | m: (try say 'abcdefg' ~~ /\w ** {42..10}/ ); say ($!.^name, $!.empty-range); | 08:07 | |
camelia | (X::Syntax::Regex::QuantifierValue True) | ||
wander | m: (try say 'abcdefg' ~~ /\w ** {42..10}/ ) // ($!.^name, $!.empty-range); | ||
camelia | ( no output ) | ||
wander | m: (try say 'abcdefg' ~~ /\w ** {42..10}/ ) // say ($!.^name, $!.empty-range); | ||
camelia | (X::Syntax::Regex::QuantifierValue True) | ||
08:08
jonas1 joined
|
|||
wander | m: (try say 'abcdefg' ~~ /\w ** {NaN..42}/ ) // say $!; | 08:08 | |
camelia | Cannot use Range with non-Numeric or NaN end points as quantifier in block <unit> at <tmp> line 1 |
||
wander | m: (try say 'abcdefg' ~~ /\w ** {NaN..42}/ ) // say $!.resume; | 08:11 | |
camelia | This exception is not resumable in block <unit> at <tmp> line 1 |
||
wander | m: (try say 'abcdefg' ~~ /\w ** {NaN..42}/ ) // say $!.Str | 08:12 | |
camelia | Cannot use Range with non-Numeric or NaN end points as quantifier | ||
08:16
cdg joined
08:17
rindolf left
08:19
zakharyas joined
08:20
cdg left
08:21
salva joined
08:26
rindolf joined
08:30
Cabanossi left
08:31
Cabanossi joined
08:36
Ven joined
08:37
Ven is now known as Guest36397
08:39
robertle left
|
|||
wander | Note that you cannot easily obtain the same behavior(regex conjunction) with a look-ahead, because a look-ahead doesn't stop looking when the quoted string stops matching. | 08:43 | |
^^ what is a look-ahead? | 08:44 | ||
moritz | it's a regex doens't consume characters | 08:45 | |
for example / \w+ <?before '='> / matches a word only if it is followed by a '=' | |||
but the regex matches only the word, not the '=' | 08:46 | ||
explained in more detail in www.amazon.com/Parsing-Perl-Regexe...1484232275 </ad type="blatant"> | |||
08:49
Mrofnet joined,
rindolf left
|
|||
wander | m: say "42=" ~~/ \w+ [<?before '='> && <.ws>]/ | 08:50 | |
camelia | 「42」 | ||
wander | emmmm...what is the note means? && works well on look-ahead it seems | 08:51 | |
btw, indeed looking forward to your new book | 08:52 | ||
08:52
Morfent left
08:59
araujo left,
rindolf joined
09:02
dj_goku_ joined
09:04
scovit joined
09:05
dj_goku left
|
|||
moritz | yes, but only because <.ws> is also a zero-width match | 09:05 | |
09:07
mempko left
09:09
eliasr joined
|
|||
moritz | m: say so 'abc' ~~ / <?before a> && . / | 09:09 | |
camelia | False | ||
moritz | m: say so 'abc' ~~ / <?before a> . / | ||
camelia | True | ||
moritz | m: say 'abc' ~~ / <?before a> .. / | ||
camelia | 「ab」 | ||
09:11
wander left
09:12
Guest36397 left
09:23
lizmat left,
lizmat joined
09:43
evalable6 left
09:44
evalable6 joined,
Cabanossi left
09:46
Cabanossi joined
10:01
robertle joined
10:12
rurban joined
10:14
Cabanossi left,
wamba left
10:16
Cabanossi joined
10:22
wander joined,
parv left
|
|||
wander | .tell moritz thanks for your patient explanation, and sorry for I'm leaving for a while | 10:23 | |
yoleaux | wander: I'll pass your message to moritz. | ||
moritz | you're welcome, and no problem | 10:25 | |
yoleaux | 10:23Z <wander> moritz: thanks for your patient explanation, and sorry for I'm leaving for a while | ||
El_Che | morning | 10:26 | |
10:27
knight__ left
|
|||
AlexDaniel | squashable6: next | 10:33 | |
squashable6 | AlexDaniel, ⚠🍕 Next SQUASHathon in 3 days and ≈23 hours (2017-11-04 UTC-12⌁UTC+14). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day | ||
jnthn | m: use nqp; say nqp::eqaddr(Int.new(5), Int.new(5)) # :) | 10:37 | |
camelia | 0 | ||
jnthn | oops | 10:38 | |
geekosaur | reallyUnsafePtrEq# :p | ||
10:47
evalable6 left,
evalable6 joined,
ChanServ sets mode: +v evalable6
10:55
nadim_ joined
|
|||
Geth | doc: dbff958f5d | (Alex Chen)++ (committed using GitHub Web editor) | doc/Language/regexes.pod6 Add and modify examples on zero or one quantifiers `?` and conjunction `&&` And rewrite example on greedy versus frugal quantifiers |
10:58 | |
synopsebot | Link: doc.perl6.org/language/regexes | ||
10:59
wamba joined
11:00
Cabanossi left
11:01
Cabanossi joined
11:02
cdg joined
11:03
sena_kun joined
|
|||
Geth | mu: 912a0d9d5b | (Tom Browder)++ (committed using GitHub Web editor) | misc/perl6advent-2017/schedule take a shot |
11:13 | |
11:17
nadim_ left
11:20
margeas joined,
cdg left
11:21
domidumont left
11:33
zakharyas left,
knight__ joined
|
|||
knight__ | Hello, I am creating a module, but what is the real purpose of 'use lib 'lib''? Load all modules symbols from path lib ? | 11:34 | |
timotimo | not all, but it'll put the lib folder first in the list of locations to look in | 11:36 | |
11:40
zakharyas joined,
domidumont joined
11:47
cgfbee joined
|
|||
knight__ | timotimo: Is there any option like python globals()/locals() it returns symbols which have been defined in scope? | 11:50 | |
timotimo | m: say ::.keys | ||
camelia | ($=pod $_ $/ !UNIT_MARKER $=finish EXPORT $! ::?PACKAGE GLOBALish $¢ $?PACKAGE) | ||
timotimo | that's how you get at the lexical scope's contents | ||
m: say OUR::.keys | |||
camelia | () | ||
timotimo | those are the package-scoped variables, i.e. everything declared "our" instead of "my" | 11:51 | |
lizmat | m: my $foo; dd ::.keys<$foo> | ||
camelia | Failure.new(exception => X::AdHoc.new(payload => "Type Seq does not support associative indexing."), backtrace => Backtrace.new) | ||
lizmat | hmmm | ||
m: my $foo; dd ::<$foo> | |||
camelia | Any $foo = Any | ||
lizmat | m: my $foo = 42; dd ::<$foo> | ||
camelia | Int $foo = 42 | ||
timotimo | imma be AFK for a bit | 11:52 | |
11:53
finanalyst left
|
|||
knight__ | timotimo: Also, is there any doc about environment bindings? I mean how interpreter makes some "execution" plan? | 11:53 | |
timotimo | i don't know what that means? | ||
knight__ | I will show, wait | 11:54 | |
timotimo | someone else will surely be able to answer while i'm gone | ||
seeya | |||
knight__ | ok | ||
:-) | |||
bye, thank you | |||
12:04
nadim_ joined
12:10
rurban left
12:14
Cabanossi left
12:16
Cabanossi joined,
araraloren joined
12:19
zakharyas left
|
|||
araraloren | Is there any convenient way update value of Hash, just like `%h<x> = %h<x> // 'foo';` | 12:21 | |
lizmat | %h<x> = "foo" ? | 12:22 | |
araraloren: not sure what you mean | |||
araraloren | sorry | ||
If there key exists, I want update it | 12:23 | ||
this | |||
oh I'm a foolish.. :P | 12:24 | ||
moritz | %h<x> = 'foo' if %h<x>:exists; | 12:28 | |
lizmat | araraloren: if they are always defined values in there, you can use 'with' | 12:29 | |
m: my %h = a => 42; $_ = 666 with %h<a>; dd %h | |||
camelia | Hash %h = {:a(666)} | ||
araraloren | oh, nice | 12:30 | |
12:30
domidumont left
|
|||
araraloren | thanks | 12:30 | |
My friend not describe the question correctly. sorry | |||
[Coke] | . | ||
12:32
mson joined
12:33
rurban joined,
aborazmeh joined,
aborazmeh left,
aborazmeh joined
12:34
rurban left
|
|||
knight__ | apropo my previous questions about execution plan. I am interested in some execution plan how interpreter interpretes data. For example when I have multiple inheritance, I would like to know how interpreter works, which method it will choose, which table of symbols will use. etc :-) I do not know how to say it english. | 12:36 | |
Some rules, how it works. | 12:37 | ||
moritz | knight__: classes have "Method Resolution Order", short MRO | ||
knight__: it tells which order the classes are searched for when looking for methods | |||
m: say Int.^mro | 12:38 | ||
camelia | ((Int) (Cool) (Any) (Mu)) | ||
moritz | m: say IntStr.^mro | ||
camelia | ((IntStr) (Int) (Str) (Cool) (Any) (Mu)) | ||
moritz | Perl 6 uses C3: en.wikipedia.org/wiki/C3_linearization | ||
knight__ | Thank you! | 12:39 | |
12:40
khw joined
12:44
Cabanossi left
12:45
bdmatatu joined
12:46
Cabanossi joined,
COMBORICO joined,
domidumont joined
12:52
perlpilot joined,
domidumont left
12:54
darkmorph joined,
domidumont joined
12:55
MasterDuke joined
12:58
COMBORICO left
12:59
cdg joined
13:00
cgfbee left
13:03
cdg left
13:12
mcmillhj joined,
cdg joined
13:13
Cabanossi left
13:16
lowin left,
Cabanossi joined
13:20
aborazmeh left,
darkmorph left
13:21
aborazmeh joined,
aborazmeh left,
aborazmeh joined
13:26
ch3ck3r left
13:32
COMBORICO joined
13:43
napo1eon joined
|
|||
wander | m: say "11" ~~ /(\d) {} :my $c = $0; ($c)/; | 13:46 | |
camelia | 「11」 0 => 「1」 1 => 「1」 |
||
COMBORICO | Question: What does the perl method do: "say '2'.perl;". I know it returns "2", but I don't understand what is going on. | ||
wander | where can I see how code like `{} :my $c = $0;` works? | 13:47 | |
13:47
ChoHag left
|
|||
wander | COMBORICO, docs.perl6.org/routine/perl | 13:48 | |
COMBORICO | Ty | ||
geekosaur | COMBORICO, it produces the perl source code needed to reproduce the expression. for a number or a string, it's just the number | ||
or string | |||
wander | briefly, returns a Perlish representation of the object | ||
COMBORICO | Ty | ||
13:49
domidumont left,
zakharyas joined
13:50
domidumont joined
13:51
Guest38 joined,
Guest38 left
|
|||
geekosaur | mhhh. think embedded code is only documented in the speculations :/ | 13:51 | |
the real docs are steering people to action objects | 13:52 | ||
COMBORICO | geekosaur, i read the link, but your explanation is clearer. Thank you. | ||
13:52
cognominal joined
|
|||
cognominal | Mon histoire d´A avec les Rita Mitsouko finit mal. RIP Fred. www.youtube.com/watch?v=tPSyz7xweVc | 13:54 | |
oops | |||
wrong channel | |||
lizmat | ah, l'erreur :-) | 13:55 | |
geekosaur | wander, so closures in regexes are apparently only documented at design.perl6.org/S05.html#Bracket_r...nalization | 13:58 | |
and ':my' is documented in the middle of design.perl6.org/S05.html#Variable_...erpolation | 14:00 | ||
I am wondering if those are going to be deprecated, since the docs point you to action objects instead | 14:01 | ||
moritz | no | 14:03 | |
14:09
Guest49 joined
|
|||
wander | geekosaur, thank you | 14:09 | |
14:10
Guest49 left,
abraxxa left
|
|||
wander | so, for `"11" ~~ /(\d) {} :my $c = $0; ($c)/`, first I match "1", then run a block, which updates $/ | 14:11 | |
following `:my $c = 0;` which is how we declare inside a regex/token/rule | |||
14:12
bwisti joined,
aborazmeh left
|
|||
wander | interesting, for we never(?) declare a variable in this form anywhere else | 14:13 | |
14:14
Cabanossi left
|
|||
geekosaur | er? it's a normal declaration preceded by a colon | 14:14 | |
14:14
lowin joined
|
|||
wander | aha :P | 14:15 | |
m: :my $x = 42; | |||
camelia | 5===SORRY!5=== Error while compiling <tmp> Two terms in a row at <tmp>:1 ------> 3:my7⏏5 $x = 42; expecting any of: infix infix stopper statement end statement modifier statement … |
||
14:16
Cabanossi joined
|
|||
geekosaur | it may help to note that, in a regex, : normally stops backtracking (and both closures and :my also have that effect) | 14:17 | |
(closures, because it's kinda hard to run arbitrary code "in reverse" if you backtrack through it) | 14:18 | ||
wander | so such form is only used inside regex, is it? | 14:19 | |
geekosaur | yes | 14:20 | |
rgeex is a separate language from perl 6 proper, although it allows limited embedding of perl 6 via closures | |||
likewise strings are a separate language | |||
perl 6 cleverly uses its own grammar facilities to allow switching languages on the fly | 14:21 | ||
14:21
ChoHag joined
|
|||
perlpilot | .oO( "my god, it's full of languages" ) |
14:21 | |
geekosaur | hypothetically, someone could implement python as a perl 6 grammar and you could then put a block of python code in the middle of your program | ||
(I think there was actually an effort to run perl 5 that way, but it stalled out back when rakudo was still using parrot?) | |||
14:22
lowin left
14:23
troys joined,
lowin joined
|
|||
wander | moritz, do we have other method to do the same thing like `/(\d) {} :my $c = $0; ($c)/`? ( We should have :-) ) | 14:24 | |
14:25
ChoHag left
14:26
nadim joined
14:27
nadim_ left
|
|||
moritz | wander: you mean /\d $0 / ? | 14:29 | |
m: say '1223' ~~ /(\d) $0 / | 14:30 | ||
camelia | 「22」 0 => 「2」 |
||
moritz | m: say '1223' ~~ /$<alias>=(\d) ($<alias>) / | ||
camelia | Nil | ||
moritz | :( | ||
wander | yes | 14:31 | |
14:32
darkmorph joined
|
|||
wander | m: say '1223' ~~ /$<alias>=(\d) $<alias> /; say $0; | 14:32 | |
camelia | 「22」 alias => 「2」 Nil |
||
14:32
esh_ joined
14:33
bartolin joined,
esh left
|
|||
moritz | how often do you actually need to capture the second bit, when you already know that it matches the same text as the first? | 14:33 | |
wander | you're right. what i care about is the match, not the capture XD | 14:35 | |
14:35
ChoHag joined
|
|||
jdv79 | can a Pair's value be Nil? | 14:35 | |
moritz | m: say (a => Nil).perl | 14:36 | |
camelia | :a(Nil) | ||
moritz | jdv79: ^^ that was easy to answer :-) | ||
jdv79 | i asked the wrong question. why can't a hash's value be Nil? | 14:37 | |
Geth | marketing: 305da3af38 | (Zoffix Znet)++ | 47 files Add some decent open fonts to repo To save time setting up when designing on new boxes... |
||
lizmat | m: my %h is default(Nil) = a => Nil; dd %h | 14:38 | |
camelia | Hash %h = {:a(Nil)} | ||
lizmat | jdv79: ^^^ | ||
jdv79 | oh, that makes sense | ||
thanks | |||
14:40
knight__ left
|
|||
geekosaur | the core issue is that, in an assignment, Nil usually means use the default value for the type. so you need the default to also be Nil | 14:40 | |
14:44
abraxxa joined
14:45
Cabanossi left
|
|||
jdv79 | i thought of that just before lizmat showed it | 14:45 | |
14:45
kyan joined
|
|||
Geth | doc: a30596e843 | (Alex Chen)++ (committed using GitHub Web editor) | doc/Language/regexes.pod6 Add example on Capture markers |
14:46 | |
synopsebot | Link: doc.perl6.org/language/regexes | ||
jdv79 | for an args hash being slipped into a constructor a default of Nil is useful | ||
14:46
Cabanossi joined
|
|||
wander | maybe test defined? | 14:48 | |
m: say defined Nil; say defined Any; | |||
camelia | False False |
||
14:49
cdg left
14:50
Piotr_ left
|
|||
jdv79 | i'm talking about - "{..., k => $v ?? $v...whatever !! Nil,... } | 14:51 | |
15:00
mempko joined
15:04
Guest78 joined
15:06
callyalater joined
15:12
Guest78 left
15:13
Cabanossi left
15:16
Cabanossi joined
|
|||
ugexe | m: sub foo(*%_) { %_ }; my %hash = %( :a([1,2,3]), :b(1) ); say foo(%hash).perl # wonder if this error message can be improved | 15:16 | |
camelia | Too many positionals passed; expected 0 arguments but got 1 in sub foo at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
ugexe | ah n/m, too early | 15:17 | |
15:18
araraloren left
15:19
Ven joined,
AlexDaniel left,
Ven is now known as Guest42207
|
|||
callyalater | m: say ""; sub postfix:<!>(Int $n) { [*] 2..$n }; say "{6!}"; | 15:23 | |
yoleaux | 28 Oct 2017 04:35Z <Zoffix> callyalater: the quote braid bug is now fixed: c: HEAD $ = ""; sub postfix:<!> { [*] ^$^f+1}; say "{ 5! }"; Sorry it took longer to fix than original promised :) | ||
camelia | 720 |
||
callyalater | Zoffix: Thank you! | 15:24 | |
15:32
kyan left
15:52
evalable6 left,
evalable6 joined
15:58
Cabanossi left
15:59
mcmillhj left
16:01
Cabanossi joined
16:05
zakharyas left
16:06
mcmillhj joined
16:11
mcmillhj left
16:21
mcmillhj joined
16:23
cdg joined
16:28
mempko left
16:34
araujo joined,
araujo left,
araujo joined
|
|||
AlexDaniel` | squashable6: next | 16:35 | |
squashable6 | AlexDaniel`, ⚠🍕 Next SQUASHathon in 3 days and ≈17 hours (2017-11-04 UTC-12⌁UTC+14). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day | ||
16:37
cognominal left,
cognominal joined
16:39
cdg_ joined
16:42
cdg left
16:44
Cabanossi left
16:45
MasterDuke left
16:46
Piotr_ joined,
Cabanossi joined
16:48
Guest42207 left
16:52
Coleoid joined
16:53
abraxxa left
16:54
Ven joined,
Ven is now known as Guest45092
16:56
Guest45092 is now known as Ven``
|
|||
lizmat | nice objective for this Saturday's Squashathon: stackoverflow.com/questions/470171...umentation | 16:58 | |
timotimo | hm, do we have a Pod::To::Markdown? :) | 17:00 | |
17:02
cdg_ left
17:03
zakharyas joined
|
|||
Coleoid | Hi, #perl6! I'm wrestling with NativeCalling a funky library. | 17:03 | |
The NativeCall docs specify that lib functions which return structs, must return them by reference, and I'm faced with a lib which does not. Do I have options beyond "rewrite those functions"? | |||
17:04
cdg joined
|
|||
timotimo | if i remember correctly, returning structs is not properly standardised between ABIs or compilers or something? | 17:04 | |
hm, though of course we should support anything libffi and dyncall can. let's see if they support that | 17:05 | ||
geekosaur | Coleoid, or write a wrapper function | 17:07 | |
Coleoid | That may be. The C folks on StackOverflow seem to believe it's defined, safe, and proper to return structs by value, and then they start listing caveats... | ||
geekosaur | passing structs and returning structs both have weirdness; C knows how to do it, but making an FFI do it is hard enough that many don't bother | ||
timotimo | looks like dyncall doesn't support it | ||
hm, does libffi support it? | 17:09 | ||
1.03 Oct-10-96 | |||
Passing struct args, and returning struct values works for | |||
all architectures/calling conventions. | |||
now how do we handle this ... a run time exception when trying to use a function with struct return type if moarvm is compiled with dyncall? | 17:10 | ||
(that would probably also immediately trigger when precompiling a module with that in it | 17:11 | ||
Coleoid | geekosaur, I was thinking wrapper functions, too, if I can't avoid writing C with this project. | 17:12 | |
timotimo, I run up to the native call, and exit immediately without any message thereafter. So it gave me much better visibility than a precompile exception. | 17:14 | ||
17:15
Cabanossi left
|
|||
timotimo | well, a precompile exception would not half-run the program if it's doomed | 17:15 | |
17:16
Cabanossi joined
|
|||
Coleoid | ...or, now I think you meant NativeCall doing its first-time precompile, and it's given helpful messages when I haven't built the signature. | 17:16 | |
timotimo | m: use NativeCall; class Foo is repr<CStruct> { has int32 $.foo }; sub foo() returns Foo is native(Str) {*} | 17:17 | |
camelia | ( no output ) | ||
timotimo | m: use NativeCall; class Foo is repr<CStruct> { has int32 $.foo }; sub foo() returns Foo is native(Str) {*}; foo() | ||
camelia | Cannot locate symbol 'foo' in native library '' in method setup at /home/camelia/rakudo-m-inst-1/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 289 in method CALL-ME at /home/camelia/rakudo-m-inst-1/share/perl6/… |
||
17:17
pmurias joined
|
|||
timotimo | huh, it allows a CStruct for "returns"? | 17:17 | |
m: use NativeCall; class Foo is repr<CStruct> { has int32 $.foo }; sub foo(--> Foo) is native(Str) {*}; foo() | |||
camelia | Cannot locate symbol 'foo' in native library '' in method setup at /home/camelia/rakudo-m-inst-1/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 289 in method CALL-ME at /home/camelia/rakudo-m-inst-1/share/perl6/… |
||
Coleoid | Yes, they just must be returned by reference. | 17:18 | |
timotimo | ah crap, of course | 17:19 | |
Coleoid | Another sad thing is this struct is three uint8s, so it would even fit into an int32 return value. Redefining the nativecall binding to do that didn't fool the runtime, though. :D | ||
timotimo | in that case i also don't know how to signal that ... "is structure-return" or similar | ||
yeah, depending on your architecture returning an integer or a struct with a sufficiently small size can still be vastly different | 17:20 | ||
17:22
setty1 joined
|
|||
geekosaur | has vs. HAS? | 17:23 | |
timotimo | you can't put has or HAS in a sub signature | ||
Coleoid | Sounds right. Well, foo. Looks like wrapper functions, then. | ||
geekosaur | I meant in the CStruct | ||
timotimo | it'd also be possible to signal it like returns FlatStruct[Foo] (name up for debate) | ||
that won't help | 17:24 | ||
17:24
COMBORICO left,
domidumont left
17:26
COMBORICO joined
|
|||
COMBORICO | Question: sub plus_three | 17:28 | |
El_Che | the travis schrodinger build: it only builds when you're not looking | ||
COMBORICO | Nevermind. | 17:30 | |
Coleoid | Hm, this library has Python and Lua bindings, so we know return-structs-by-value is solvable. I can just write my wrappers for now, though. Thanks, timotimo++ and geekasaur++. | 17:31 | |
geekosaur | python makes you write C code to bind native libs anyway | 17:32 | |
(as does perl 5) | |||
and for that matter lua | |||
Geth | doc: acea6c5f1b | (Alex Chen)++ (committed using GitHub Web editor) | doc/Language/regexes.pod6 Put section "Look-around assertions" to proper pos Seems its author directly appends this doc with it. |
17:33 | |
synopsebot | Link: doc.perl6.org/language/regexes | ||
17:33
robertle left
17:40
eugene_barsky joined
|
|||
eugene_barsky | hi | 17:41 | |
17:42
eugene_barsky left
17:44
Cabanossi left
17:46
Cabanossi joined
|
|||
[Coke] tries to decipher that commit message. | 17:51 | ||
17:52
troys is now known as troys_
|
|||
[Coke] is very excited to see a skip test -> preamble change, though. :) | 17:52 | ||
oh, I get it. moved the doc (but also did a lot of other stuff) | |||
pmurias | blogs.perl.org/users/pawel_murias/2...ittle.html # rakudo.js update | 17:53 | |
geekosaur | yes, and accuses the doc's author of adding all new content near the end before the 'postamble' sections | ||
ilmari | or, allowing for imperfect grammar, just this section | 17:55 | |
appends -> appended | 17:56 | ||
wander | how do I report a bug on RT? | ||
I've reached rt.perl.org, but got lost | 17:57 | ||
[Coke] | email [email@hidden.address] | 17:58 | |
github.com/rakudo/rakudo/wiki/rt-introduction | |||
github.com/rakudo/rakudo/issues is also open (recently) | 17:59 | ||
17:59
ChoHag left
|
|||
wander | got it | 17:59 | |
18:14
Coleoid left,
cdg left
18:16
cdg joined,
cdg left,
cdg joined
18:17
lowin left
18:18
troys_ is now known as troys,
TEttinger joined
18:26
mempko joined
18:29
Cabanossi left
18:31
Cabanossi joined
18:43
lowin joined,
darutoko left
|
|||
lizmat | pmurias++ | 18:48 | |
18:50
ChoHag joined
18:51
COMBORICO left
|
|||
ugexe | m: Grammar.new | 18:57 | |
camelia | P6opaque: no such attribute '@!list' in type Capture when trying to bind a value in block <unit> at <tmp> line 1 |
||
18:58
Cabanossi left
19:01
Cabanossi joined
19:03
mcmillhj left
19:05
mcmillhj joined
19:06
Ven`` left
19:07
zakharyas left
19:08
bdmatatu left
19:10
cpage_ left,
mcmillhj left,
Thrush joined
19:12
Thrush left
19:13
mcmillhj joined
19:14
Thrush joined
|
|||
Thrush | I'm a little confused about the difference(s) between the '..' and '...' operators. | 19:14 | |
m: 'a87' ... 'b09' | 19:15 | ||
camelia | Potential difficulties: Useless use of ... in sink context at <tmp>:1 ------> 3'a87' ...7⏏5 'b09' |
||
Thrush | m: ('a87' ... 'b09').say | ||
camelia | (a87 a88 a89 a77 a78 a79 a67 a68 a69 a57 a58 a59 a47 a48 a49 a37 a38 a39 a27 a28 a29 a17 a18 a19 a07 a08 a09 b87 b88 b89 b77 b78 b79 b67 b68 b69 b57 b58 b59 b47 b48 b49 b37 b38 b39 b27 b28 b29 b17 b18 b19 b07 b08 b09) | ||
Thrush | In the command "('a87' ... 'b09').say", why is "a77" and "a78" included? | 19:16 | |
19:17
MasterDuke joined
|
|||
geekosaur | it counts forward from a to b and backward from 8 to 0 and forward from 7 to 9 | 19:18 | |
19:18
troys is now known as troys_
19:19
espadrine joined
|
|||
Thrush | geekosaur, this is different than the behavior I'd expect, coming from a Perl5 background. Is there any way to emulate Perl5's behavior? | 19:26 | |
[Coke] | Inline::Perl5 | 19:27 | |
Not built in, as far as I know, no | 19:28 | ||
geekosaur | I thought there was amodule | ||
the problem with the perl 5 one is it doesn;t generalize | |||
it's a bundle of special cases for specific patterns and failure for anything that doesn;t fit those patterns | 19:29 | ||
19:38
ChoHag left
19:40
cdg left
19:41
cdg joined
19:45
jonas1 left
19:46
cdg left
19:47
knight__ joined
19:48
wamba left,
wamba joined
19:49
troys_ is now known as troys
19:50
ChoHag joined
19:51
Morfent joined
|
|||
Thrush | m: my @a = ['a98'] ; @a.push( @a[*-1].succ ) until @a[*-1] eq 'b09' | 19:52 | |
camelia | ( no output ) | ||
Thrush | m: my @a = ['a98'] ; @a.push( @a[*-1].succ ) until @a[*-1] eq 'b09'; @a.say | ||
camelia | [a98 a99 b00 b01 b02 b03 b04 b05 b06 b07 b08 b09] | ||
Thrush | It looks like " @a.push( @a[*-1].succ ) until @a[*-1] eq 'b09' " is one way to do it. | 19:53 | |
19:54
Mrofnet left
19:57
mr-foobar left
20:01
mr-foobar joined
20:03
Thrush left
|
|||
timotimo | that'd be much easier written as: | 20:03 | |
m: say "a98", *.succ ... "b09" | |||
camelia | (a98 a99 b00 b01 b02 b03 b04 b05 b06 b07 b08 b09) | ||
timotimo | dang, they had already left | 20:06 | |
El_Che | timotimo: it looks like travis is hammered with evening | 20:07 | |
timotimo | ? | ||
El_Che | build take a lot of time to start | 20:08 | |
and in my project it runs 1 subbuild at the time instead of the 4 or 5 it normally dies | |||
timotimo | i'm confused, why are you writing me this? | ||
El_Che | I am confused as well | 20:09 | |
wasn't meant to be specificaaly to you | |||
to much tab magic, I guess | |||
sorry | |||
timotimo | OK | 20:10 | |
geekosaur | travis free tier is limited cpu time | ||
El_Che | indeed | 20:14 | |
20:15
Rawriful joined
|
|||
El_Che | it seem they only cap when busy. Like said, normally I get several subbuilds running at the same time | 20:15 | |
20:15
mingdao joined
|
|||
geekosaur | yep. all the paid folks having a productive monday :p (and the european ones probably pushing to it at the end of the work day, or maybe delaying it thinking they can avoid the rush --- but all delaying by about the same amount. I learned better than that a couple decades ago :) | 20:16 | |
El_Che | hehe, true | ||
20:22
mingdao left,
Ven joined
20:23
Ven is now known as Guest9063
|
|||
cxreg | maybe interesting: evolvingavm.com/ | 20:25 | |
20:29
mingdao joined
20:33
COMBORICO joined
|
|||
COMBORICO | Question about immutable parameters. | 20:35 | |
sub plus-three( Int $number ) { $number += 3 } | |||
my $value = 5; | |||
say plus-three $value; #error: cannot assign to an immutable value | |||
How is "say" modifying $value? | 20:36 | ||
[Coke] | get rid of the say; it's the call to the function that's modifying $number. | ||
timotimo | it's not | ||
gfldex | m: sub plus-three( Int $number ) { $number += 3 }; my $value = 5; plus-three $value; | ||
camelia | Cannot assign to an immutable value in sub plus-three at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
gfldex | m: sub plus-three( Int $number is copy ) { $number += 3 }; my $value = 5; plus-three $value; | ||
[Coke] | you want $number is rw or $number is copy | ||
camelia | ( no output ) | ||
timotimo | plus-three is assigning to $number, which is by default read-only becaues it's a parameter | ||
callyalater | m: sub plus-three( Int $number ) { $number += 3 }; my $value = 5; say plus-three $value; | ||
camelia | Cannot assign to an immutable value in sub plus-three at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
gfldex | m: sub plus-three( Int $number is rw ) { $number += 3 }; my $value = 5; plus-three $value; | ||
camelia | ( no output ) | ||
callyalater | m: sub plus-three( Int $number is rw ) { $number += 3 }; my $value = 5; say plus-three $value; | 20:37 | |
camelia | 8 | ||
callyalater | By default, I believe all parameters are read only unless specified otherwise with `is rw`. | ||
m: sub plus-three( Int $number ) { $number += 3; return $number; }; my $value = 5; say plus-three $value; | 20:38 | ||
camelia | Cannot assign to an immutable value in sub plus-three at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
gfldex | COMBORICO: see docs.perl6.org/type/Signature#Para..._Modifiers | ||
callyalater | m: sub plus-three( Int $number ) { $number += 3 }; my $value = 5; my $v = plus-three $value; say $v; | ||
camelia | Cannot assign to an immutable value in sub plus-three at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
callyalater | m: sub plus-three( Int $number is rw) { $number += 3; return $number; }; my $value = 5; my $v = plus-three $value; say $v; | 20:39 | |
camelia | 8 | ||
COMBORICO | Okay. Thank you all for your help. | ||
20:40
ChoHag left
20:47
AlexDaniel joined
20:52
cdg joined
20:53
cdg left
20:54
cdg joined
21:07
MasterDuke left
21:10
cdg_ joined
21:13
cdg left,
mcmillhj left
21:17
ChoHag joined
21:19
raiph joined
21:23
wamba left
21:25
cono joined
|
|||
cono | m: class A::B { method hm { my class C {}; C.^name.say }; }; A::B.new.hm | 21:25 | |
camelia | A::B::C | ||
cono | how to define C, outside of A::B namespace? | 21:26 | |
COMBORICO | Does "is rw" stand for re-writable? | ||
Juerd | COMBORICO: read-write | ||
COMBORICO: ro stands for read-only. | |||
COMBORICO | Thanks! | ||
Juerd | cono: Why are you putting it there if you don't want it there? | 21:27 | |
lizmat | Juerd: I assume scoping | 21:28 | |
Juerd | COMBORICO: Please note that in many cases, changing the caller's values is considered very bad style. It should, in general, only be used as a performance optimization when you really need it (for example, to prevent copying a huge string in memory). In most situations, returning the new value and having the caller do the assignment is easier to read and maintain. | 21:29 | |
COMBORICO: So usually you'd do sub plus-three(Int $number) { return $number + 3 }; my $value = 5; $value = plus-three $value; # Or of course, my $value = plus-three 5; | 21:30 | ||
COMBORICO | Roger that. I just NEED to know what things stand-for. | ||
Juerd | COMBORICO: Now that you mention it, that should probably be explained at docs.perl6.org/type/Signature#inde..._Modifiers | 21:31 | |
COMBORICO: Would you mind opening a github issue for that? | |||
COMBORICO | I'm still meditating on thing i wrote earlier. Yup, I've been meditating on this page. | 21:32 | |
lizmat | so what do you need to go to see the actual code on code-golf.io/ ? | ||
cono | Juerd: I'm using GraphQL module, which accepts class with name: Query, but I want to pass in this class Config class and other stuff which I need. That's why I thought that I create wrapper class which clousring Config inside of Query class | ||
it doesn't work with A::B::Query | |||
it neeeds to be Query without namespaces | |||
Juerd | cono: That typically means it's assuming you'll subclass Query, or if Query is a role, implement a class that "does Query;" | 21:33 | |
cono | if I subclass from Query, the ^name will change | ||
which again breaks internal GraphQL logic | |||
Juerd | If GraphQL uses .^name for a type check, that may be a design flaw in the module :( | 21:34 | |
21:34
epony left
|
|||
cono | I understand but this is what I have :) | 21:34 | |
github.com/CurtTilmes/Perl6-GraphQ...QL.pm#L273 | |||
COMBORICO | Juerd, hahaha i don't even know what a github issue is. | ||
Juerd | COMBORICO: Do you know what github is though? :) | 21:35 | |
COMBORICO | Yes. | ||
gfldex | COMBORICO: it's a convenient way to complain :-> | ||
Juerd | COMBORICO: "Issues" is the built-in issue tracker, or bug tracker if you will, that authors can get with any Git repository hosted on Github. | 21:36 | |
COMBORICO | Juerd, were you speaking of complaining about rw? | ||
Juerd | COMBORICO: Yes | ||
At the bottom of docs.perl6.org/type/Signature there is a link "Please report any issues" | |||
COMBORICO | I see. I will do it. Now to remember my password . . . | 21:37 | |
Juerd | COMBORICO: Great, thank you! | ||
cono: I don't recognise in that line why the class would have to be named Query though | 21:38 | ||
cono | because after that we are adding this here: github.com/CurtTilmes/Perl6-GraphQ...QL.pm#L184 | 21:39 | |
Juerd | cono: I think the best work-around is to simply declare a global class instead of the lexical (my) one. | ||
cono | and when graphql request coming, it matches Query to the ^name | 21:40 | |
Juerd: and how to pass my config into this global class? | |||
Juerd | cono: Maybe a class attribute? That's a fancy name for a global variable that lives in the class, but because it has a fancy name and lives in the namespace it's not nearly as gross as a regular global variable :D | 21:41 | |
21:41
troys is now known as troys_
|
|||
Juerd | cono: class Query { our $.config; ... }; Query.config = ...; | 21:42 | |
cono | attributes of the Query class will be expoed to the API :( | ||
Juerd | Then the gross solution... our $config; class Query { ... }; $config = ...; | 21:43 | |
It really sounds like GraphQL should use .^name only as a fallback if no name is provided in another way. | |||
cono | I'm thinking about defining my custom class, and inherit top Query from my custom one.. | ||
ugexe | m: class Foo { submethod TWEAK(|) { self.HOW does role :: { method name(|) { q|Query| } }; } }; say Foo.new.^name # hehe | 21:44 | |
camelia | Query | ||
cono | Juerd: totally agree with you | ||
Juerd | ugexe: Nice hack. | ||
ugexe: I wonder how much other stuff would break :) | |||
21:45
Cabanossi left
|
|||
ugexe | if its matching on $t.^name already, I imagine it should just work since it saves the $t alongside the $t.^name | 21:46 | |
21:46
Cabanossi joined,
grumble left
|
|||
lizmat | and another Perl 6 Weekly hits the Net: p6weekly.wordpress.com/2017/10/30/...-mastered/ | 21:47 | |
ugexe | if its doing something like $t.^name.new(...) then it'd break down | ||
21:47
grumble joined
|
|||
cono | nope. no object creation at all: github.com/CurtTilmes/Perl6-GraphQ...on.pm#L468 | 21:48 | |
knight__ | hmm | ||
interesting | |||
cono | just taking package on method and invoking it | ||
21:51
aindilis left
21:56
epony joined
|
|||
raiph | .tell eugene_barsky er, hi. (better late than never...) :) In answer to your SO, aiui, almost anything that makes #perl6 a great place to experience P6 is on topic. | 21:57 | |
yoleaux | 25 Oct 2017 06:25Z <moritz> raiph: thanks, answered | ||
raiph: I'll pass your message to eugene_barsky. | |||
raiph | m: say 'hi eugene' # write m: plus perl 6 code to run it via a bot that uses a rakudo compiler on a MoarVM backend | 22:04 | |
camelia | hi eugene | ||
22:05
Guest9063 left
22:14
setty1 left
22:18
aindilis joined,
pmurias left
22:21
ggoebel left
22:23
Aaronepower left
|
|||
COMBORICO | As a new programmer in general but coming from C++, so far the steepest learning-curve has been Perl 6's default immutable parameter (compared to C++ default is mutable). | 22:24 | |
22:24
Ven joined,
Piotr_ left
22:25
Ven is now known as Guest73995
|
|||
COMBORICO | It took me an hour or more to understand what was going on! | 22:25 | |
lizmat | perhaps we need a "coming from C++ traps" doc | 22:26 | |
I mean, we have for Haskell: docs.perl6.org/language/haskell-to-p6 | 22:27 | ||
Python: docs.perl6.org/language/py-nutshell | 22:28 | ||
Ruby: docs.perl6.org/language/rb-nutshell | |||
and several aspects when coming from Perl 5 | |||
22:29
Cabanossi left
22:31
Cabanossi joined
|
|||
COMBORICO | I have no programming experience so I'm not a good judge if yea or nay for that. | 22:31 | |
I just could not understand (still don't) why a person would want to have the parameter to be defaulted to const. | 22:32 | ||
So that kept me thinking that i was understanding what i was reading incorrectly. | 22:33 | ||
Juerd | COMBORICO: Because it's considered bad style to mutate the arguments. It's possible because sometimes it's needed or the easy way out, but generally it's a bad idea. | ||
lizmat | COMBORICO: perhaps what you're looking for is "is copy" ? | 22:34 | |
COMBORICO | But isn't C++ default to mutate parameters? | ||
lizmat | or do you really want your changes to be visible in the caller as well ? | ||
22:34
ggoebel joined
|
|||
COMBORICO | I understood what was going on from this link: | 22:35 | |
www.reddit.com/r/ProgrammingLangua...ers_being/ | |||
perlawhirl | I have a question about Range.sum() it does a 'self.int-bounds || nextsame;'... the nextsame jumps to Any.sum()... which iterates the invocant and sums each iteration | 22:36 | |
which means trying to sum an infinite range doesn't terminate... i'm trying to think... | |||
22:36
Thrush joined
|
|||
perlawhirl | besides infinte ranges, what other ranges will fail int-bounds... and is there any reason why Range.sum() shouldn't just check for is-lazy() and fail if True? | 22:36 | |
Juerd | COMBORICO: It looks like C++ defaults to "is copy": juerd.nl/i/e252132fe377471bb3400aa9ff64a423.png | 22:37 | |
Thrush | How do I concatenate two arrays in Perl 6? I'm looking for something like: my @c = @a + @b; | ||
lizmat | perlawhirl: it probably should, please provide an example and make a Github Issue :-) | ||
Juerd | Thrush: Arrays are not concatenated, but to add the elements from one array to the other, use append (or push with list flattening) | 22:38 | |
perlawhirl | cool lizmat... while i've got your attention, and on the subject of int-bounds... re: RT131846 | ||
synopsebot | RT#131846 [open]: rt.perl.org/Ticket/Display.html?id=131846 [BUG] [REGRESSION] not accepting Inf/Whatever as upper bound | ||
perlawhirl | an obvious fix would be to change '$ofrange.int-bounds(my int $i, my int $to)' to '(my (int $i, int $to) = $ofrange.int-bounds || ($ofrange.head, $elems))' | 22:39 | |
performance hit seems minimal... does it look ok to you on the face of it? | |||
Thrush | m: my @a = 1..3; my @b = <a b c>; (my @c = @a).append(@b); @c.perl.say | ||
Juerd | Thrush: To create a new list containing the array elements of an array, use "flat" or "|", e.g. "my @c = flat @foo, @bar;" or "my @c = |@foo, |@bar;" | ||
camelia | [1, 2, 3, "a", "b", "c"] | ||
COMBORICO | Juerd, thanks! I need to meditate on these terms. My head is starting to spin. Ha. | ||
Thrush | m: my @a = 1..3; my @b = <a b c>; my @c = flat @foo, @bar; | 22:40 | |
lizmat | perlawhirl: looking | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '@foo' is not declared at <tmp>:1 ------> 3a = 1..3; my @b = <a b c>; my @c = flat 7⏏5@foo, @bar; |
||
Thrush | m: my @a = 1..3; my @b = <a b c>; my @c = flat @a, @b; | ||
camelia | ( no output ) | ||
Juerd | COMBORICO: Basically, in C++ it will mutate a private copy of the argument that was passed, so the result is not visible in the outer scope. | ||
Thrush | m: my @a = 1..3; my @b = <a b c>; my @c = flat @a, @b; @c.perl.say | ||
camelia | [1, 2, 3, "a", "b", "c"] | ||
perlawhirl | lizmat: sorry, should have linked specific line: github.com/rakudo/rakudo/blob/b07e...t.pm#L1123 | 22:41 | |
Juerd | COMBORICO: So basically, "Int $foo is ro" translates to "const int foo", "Int $foo is rw" translates to "int &foo", "Int $foo is copy" translates to "int foo" | 22:42 | |
Thrush | Here's a question: I have an array @a (set to, say [1,2,3]) and I want to get the product of itself with itself. I can do: my @b = @a X @a; But then let's say I want to get a product of @b with @a, like this: my @c = @b X @a; | ||
m: my @a = [1,2,3]; my @b = @a X @a; my @c = @b X @a; @c.perl.say | 22:43 | ||
camelia | [($(1, 1), 1), ($(1, 1), 2), ($(1, 1), 3), ($(1, 2), 1), ($(1, 2), 2), ($(1, 2), 3), ($(1, 3), 1), ($(1, 3), 2), ($(1, 3), 3), ($(2, 1), 1), ($(2, 1), 2), ($(2, 1), 3), ($(2, 2), 1), ($(2, 2), 2), ($(2, 2), 3), ($(2, 3), 1), ($(2, 3), 2), ($(2, 3), 3)… | ||
Juerd | Thrush: An easier way to print variables for debugging is "dd". It also gives more detail. | ||
Thrush | m: my @a = [1,2,3]; my @b = @a X @a; my @c = @b X @a; dd @c; dd @a X @a X @a | ||
camelia | Array @c = [($(1, 1), 1), ($(1, 1), 2), ($(1, 1), 3), ($(1, 2), 1), ($(1, 2), 2), ($(1, 2), 3), ($(1, 3), 1), ($(1, 3), 2), ($(1, 3), 3), ($(2, 1), 1), ($(2, 1), 2), ($(2, 1), 3), ($(2, 2), 1), ($(2, 2), 2), ($(2, 2), 3), ($(2, 3), 1), ($(2, 3), 2), (… | ||
Juerd | Things with long output are probably better tested locally :D | 22:44 | |
Thrush | I notice that the elements of @c are in the nested form of [[a,b], c] instead of [a,b,c] (like I would get with @a X @a X @a). How can I get the [a,b,c] form? | 22:45 | |
m: my @a = [1,2,3]; my @b = @a X @a; my @c = @b X @a; dd @a X @a X @a | |||
camelia | ((1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 3, 1), (1, 3, 2), (1, 3, 3), (2, 1, 1), (2, 1, 2), (2, 1, 3), (2, 2, 1), (2, 2, 2), (2, 2, 3), (2, 3, 1), (2, 3, 2), (2, 3, 3), (3, 1, 1), (3, 1, 2), (3, 1, 3), (3, 2, 1), (3, 2, 2… | ||
timotimo | m: my @a = <a b c>; my @b = <x y z>; my @result = flat @a, @b; say @result.perl | 22:47 | |
camelia | ["a", "b", "c", "x", "y", "z"] | ||
COMBORICO | Jeurd, i will write that in my textbook. I'm still not getting it 100%, but I'm close. Thanks for the help. | ||
Juerd | COMBORICO: You're welcome | 22:48 | |
22:52
sena_kun left
|
|||
COMBORICO | Juerd, You're sure read-write means constant, right? | 22:52 | |
Juerd | COMBORICO: No, constant == read-only aka immutable | ||
COMBORICO | I thought read-write would mean able to write. And const means not able to write. | 22:53 | |
So why does rw == const? | 22:54 | ||
Juerd | COMBORICO: That is not the case. | ||
COMBORICO: Where does it say that rw is const? | |||
COMBORICO | Ahh! I miswrote it! | ||
Juerd | rw is more like passing a value by reference, like "void mutate(int &ref) { ... }" in C++ | ||
22:55
mcmillhj joined
|
|||
COMBORICO | Right, okay. Too much reading today, i guess. | 22:55 | |
"is copy" is call-by-value, right? | 22:57 | ||
22:58
Cabanossi left
|
|||
Juerd | Yes. It creates a local copy of the value that can be mutated, but the changes won't be made to the value in the caller's scope. | 22:58 | |
lizmat | "is copy" is call-by-value *but* also creates a local container so you can change it locally | ||
Juerd++ # faster :-) | 22:59 | ||
22:59
darkmorph left
|
|||
Juerd | lizmat: Lots and lost of typing-speed-test.aoeu.eu/ :) | 22:59 | |
s/lost/lots/ # still not enough apparently. | |||
lizmat feels lots every now and then as well :-) | |||
COMBORICO | Lizmat, I'll add that to my notes. | 23:00 | |
23:00
aindilis left
23:01
Cabanossi joined
|
|||
COMBORICO | So Perl 6's default for parameters again is . . . ro (const), right? | 23:04 | |
Juerd | Yes | ||
COMBORICO | Whew! Time to take a break! Haha. Thanks for the help, you two! My textbook credits you both! | 23:05 | |
23:05
Guest73995 left
|
|||
timotimo | oh be aware that the copy "is copy" makes is extremely shallow :) | 23:06 | |
lizmat | perlawhirl: testing a fix for RT #131846 now | 23:07 | |
synopsebot | RT#131846 [open]: rt.perl.org/Ticket/Display.html?id=131846 [BUG] [REGRESSION] not accepting Inf/Whatever as upper bound | ||
[Coke] | Should protoregex be one word or two? | 23:08 | |
lizmat | m: proto regex foo { } | 23:09 | |
camelia | 5===SORRY!5=== Null regex not allowed at <tmp>:1 ------> 3proto regex foo { 7⏏5} Proto regex body must be {*} (or <*> or <...>, which are deprecated) at <tmp>:1 ------> 3proto regex 7⏏5foo { } |
||
lizmat | m: protoregex foo { } | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Undeclared routines: foo used at line 1 protoregex used at line 1 |
||
lizmat | two I guess ? | ||
[Coke] | in prose, I mean. so 'protoregex' isn't code, so I'm guessing it should be 2 words in prose. | ||
23:09
Herby_ joined
|
|||
Herby_ | \o | 23:09 | |
Just read the weekly | 23:10 | ||
everyone++ for the 2017.10 release | |||
23:12
troys_ is now known as troys
23:14
nadim left
|
|||
knight__ | hmm, What shall I read to know what is the meaning of word like graphemes...? | 23:14 | |
lizmat | en.wikipedia.org/wiki/Grapheme | ||
knight__ | ok, some linguistic books:-) | 23:15 | |
23:15
darkmorph joined
|
|||
lizmat | tl;dr: what a human thinks a character is | 23:15 | |
perlawhirl: github.com/rakudo/rakudo/commit/bdc73563f4 | 23:16 | ||
23:16
mcmillhj left
|
|||
perlawhirl | lizmat++ thanks so much! | 23:17 | |
[Coke] | f | ||
lizmat | sorry for it falling through the cracks | ||
[Coke] | whoops | 23:18 | |
23:18
mcmillhj joined
|
|||
perlawhirl | lizmat: no probs | 23:20 | |
Thrush | If I have @a = [1,2,3]; and @b = @a X @a; how can I combine @b and @a to make a @c that is the same as @a X @a X @a ? I would think @c = @b X @a; but that gives a different answer. | 23:22 | |
m: my @a = [1,2,3]; my @product = @a X @a X @a; dd @product | |||
camelia | Array @product = [(1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 3, 1), (1, 3, 2), (1, 3, 3), (2, 1, 1), (2, 1, 2), (2, 1, 3), (2, 2, 1), (2, 2, 2), (2, 2, 3), (2, 3, 1), (2, 3, 2), (2, 3, 3), (3, 1, 1), (3, 1, 2), (3, 1, 3), (3… | ||
Thrush | m: my @a = [1,2,3]; my @b = @a X @a; my @c = @b X @a; dd @c | 23:23 | |
camelia | Array @c = [($(1, 1), 1), ($(1, 1), 2), ($(1, 1), 3), ($(1, 2), 1), ($(1, 2), 2), ($(1, 2), 3), ($(1, 3), 1), ($(1, 3), 2), ($(1, 3), 3), ($(2, 1), 1), ($(2, 1), 2), ($(2, 1), 3), ($(2, 2), 1), ($(2, 2), 2), ($(2, 2), 3), ($(2, 3), 1), ($(2, 3), 2), (… | ||
Thrush | See? Not the same. | ||
timotimo | yup | ||
m: my @a = [1,2,3]; my @b = @a X @a; my @c = @b X @a; @c = @c.map({ flat $_[0].List, $_[1] }); dd @c | 23:24 | ||
camelia | Array @c = [(1, 1, 1).Seq, (1, 1, 2).Seq, (1, 1, 3).Seq, (1, 2, 1).Seq, (1, 2, 2).Seq, (1, 2, 3).Seq, (1, 3, 1).Seq, (1, 3, 2).Seq, (1, 3, 3).Seq, (2, 1, 1).Seq, (2, 1, 2).Seq, (2, 1, 3).Seq, (2, 2, 1).Seq, (2, 2, 2).Seq, (2, 2, 3).Seq, (2, 3, 1).Seq,… | ||
timotimo | m: my @a = [1,2,3]; my @b = @a X @a; my @c = @b X @a; @c = @c.map({ (flat $_[0].List, $_[1]).List }); dd @c | ||
camelia | Array @c = [(1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 3, 1), (1, 3, 2), (1, 3, 3), (2, 1, 1), (2, 1, 2), (2, 1, 3), (2, 2, 1), (2, 2, 2), (2, 2, 3), (2, 3, 1), (2, 3, 2), (2, 3, 3), (3, 1, 1), (3, 1, 2), (3, 1, 3), (3, 2, 1… | ||
Thrush | I can do this: my @a = [1,2,3]; my @b = @a X @a; my @c = (@b X @a).map({|$_[0], $_[1]}); dd @c | 23:25 | |
m: my @a = [1,2,3]; my @b = @a X @a; my @c = (@b X @a).map({|$_[0], $_[1]}); dd @c | |||
camelia | Array @c = [(1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 3, 1), (1, 3, 2), (1, 3, 3), (2, 1, 1), (2, 1, 2), (2, 1, 3), (2, 2, 1), (2, 2, 2), (2, 2, 3), (2, 3, 1), (2, 3, 2), (2, 3, 3), (3, 1, 1), (3, 1, 2), (3, 1, 3), (3, 2, 1… | ||
Thrush | But is there a simpler way? | ||
Is there any way to convert the 'X' infix operator to a regular method? | 23:27 | ||
I tried [email@hidden.address] but that doesn't work. | |||
timotimo | m: say &METAOP_CROSS | 23:28 | |
camelia | sub METAOP_CROSS (\op, &reduce) { #`(Sub|34398544) ... } | ||
Thrush | For that matter, is there any way to convert any infix operator (like, say, '+') to a method? For example, I want to call "4+5" as "4.+(5)". Can that be done? | 23:29 | |
timotimo | you can by using its full name | ||
m: say 1.&infix:<+>(2); | |||
camelia | 3 | ||
lizmat | m: say 1.&[+](3) # shorter | ||
camelia | 4 | ||
timotimo | m: say &[X] | 23:30 | |
camelia | sub infix:<X> (| is raw) { #`(Sub+{is-pure}+{Precedence}|31444240) ... } | ||
timotimo | neat. | ||
Juerd | I don't think that'll make it easier, though. | ||
timotimo heads out | |||
m: say &[X](<a b c>, <2 3>, <☺ ☹>); | 23:31 | ||
camelia | ((a 2 ☺) (a 2 ☹) (a 3 ☺) (a 3 ☹) (b 2 ☺) (b 2 ☹) (b 3 ☺) (b 3 ☹) (c 2 ☺) (c 2 ☹) (c 3 ☺) (c 3 ☹)) | ||
Juerd | I would have expected something simple like [X] |@b, @a to work but I really don't understand what that does, apparently | ||
timotimo | that'll put the contents of @b into the same argument list that @a is put into | 23:32 | |
Juerd | Is there any syntax to get the [0]s of a list, then the [1]s, then the [2]s, etc? | ||
timotimo | depending on what's inside @b at that point, it's probably wrong :) | ||
m: my @lists = <a b c>, <d e f>, <g h i>; say [Z] |@lists; | 23:33 | ||
camelia | ((a d g) (b e h) (c f i)) | ||
timotimo | only works properly if @lists has at least two elements i believe | ||
Juerd | @c = [X] @b»[0], @b»[1], @a works but hard coding indices feels wrong :) | 23:34 | |
m: my @a = [1,2,3]; my @b = @a X @a; my @c = [X] |([Z] |@b), @a; dd @c; | 23:35 | ||
camelia | Array @c = [(1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 3, 1), (1, 3, 2), (1, 3, 3), (1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 3, 1), (1, 3, 2), (1, 3, 3), (1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1… | ||
Juerd | Oh my. | ||
23:35
espadrine left
|
|||
Juerd | That's ugly :) | 23:35 | |
23:36
espadrine joined
|
|||
Juerd | Would be slightly prettier if you could write something like @b.zip instead of [Z] |@b | 23:37 | |
23:37
mcmillhj left
|
|||
Thrush | The reason I want @a X @a to be done, THEN Xed with @a again is because in my code I'm doing an array product, then filtering (with grep) then doing a product again. | 23:37 | |
I want to get something like @a X @a X @a, but instead I'm getting something like [@a X @a] X @a. | 23:38 | ||
Juerd | Thrush: Is the [X] |([Z] |@b), @a what you wanted? | ||
Thrush | So how do I undo the "[]" part of [@a X @a] x @a ? | ||
Juerd: Let me check real quick... | 23:39 | ||
Juerd: I notice that that returns lots of elements. I only want 3*3*3 elements (27), which is the number that @a X @a X @a returns. | 23:40 | ||
m: (@a X @a X @a).elems.say; ([X] |([Z] |@b), @a).elems.say | 23:41 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '@a' is not declared at <tmp>:1 ------> 3(7⏏5@a X @a X @a).elems.say; ([X] |([Z] |@b) |
||
Thrush | m: my @a = [1,2,3]; (@a X @a X @a).elems.say; ([X] |([Z] |@b), @a).elems.say | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> Variable '@b' is not declared at <tmp>:1 ------> 3; (@a X @a X @a).elems.say; ([X] |([Z] |7⏏5@b), @a).elems.say |
||
Thrush | m: my @a = [1,2,3]; (@a X @a X @a).elems.say; my @b = @a X @a; ([X] |([Z] |@b), @a).elems.say | 23:42 | |
camelia | 27 243 |
||
Thrush | That's 27 elements vs. 243 elements. | ||
Juerd: That's 27 elements vs. 243 elements. So, not quite what I was looking for. | |||
Juerd | 3³ vs 3⁵ | ||
Thrush | Juerd: Yes. Not sure why, though. | 23:43 | |
Juerd | Neither am I | ||
23:43
Cabanossi left,
mcmillhj joined
23:45
piojo1 joined
|
|||
Thrush | Juerd: I've come up with this: (@b X @a).map( {|$_[0], $_[1]} ); but it seems a bit too wordy. | 23:45 | |
Juerd | Because @a X @a is not 3 elements, it's 9. | ||
23:45
piojo left
|
|||
Thrush | m: my @a = [1,2,3]; my @b = @a X @a; my @c = (@b X @a).map( {|$_[0], $_[1]} ); dd @c | 23:45 | |
camelia | Array @c = [(1, 1, 1), (1, 1, 2), (1, 1, 3), (1, 2, 1), (1, 2, 2), (1, 2, 3), (1, 3, 1), (1, 3, 2), (1, 3, 3), (2, 1, 1), (2, 1, 2), (2, 1, 3), (2, 2, 1), (2, 2, 2), (2, 2, 3), (2, 3, 1), (2, 3, 2), (2, 3, 3), (3, 1, 1), (3, 1, 2), (3, 1, 3), (3, 2, 1… | ||
Thrush | m: my @a = [1,2,3]; my @b = @a X @a; my @c = (@b X @a).map( {|$_[0], $_[1]} ); @c.elems.say | ||
camelia | 27 | ||
23:46
Cabanossi joined,
cdg joined
|
|||
Geth | doc/master: 12 commits pushed by (Will "Coke" Coleda)++ review: github.com/perl6/doc/compare/acea6...a10c20d447 |
23:47 | |
23:48
rindolf left,
cdg_ left
23:50
cdg left
23:52
callyalater left
23:53
knight__ left,
schelcj joined
|
|||
Juerd | Thrush: I give up | 23:55 | |
lizmat | perhaps a GH Issue is in order ? | ||
Thrush | Thanks for trying, Juerd. I appreciate it. | 23:57 | |
I gotta go. But thanks for all your help. | |||
23:57
Thrush left,
mcmillhj left
|
|||
Juerd | lizmat: Maybe more a stackoverflow or perlmonks thing | 23:58 | |
lizmat | maybe |