»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
Geth mu: 020f0d0524 | (Tom Browder)++ (committed using GitHub Web editor) | misc/perl6advent-2018/schedule
add entry
00:30
ToddAndMargo what am I doing wrong (this time) with this regex? p6 'my $x="a"~chr(0x0A)~"b"; $x~~s/ chr(0x0A) /Q/; say "$x";' 01:50
timotimo ToddAndMargo: that regex would match the literal text chr0x0A and capture the 0x0A part 01:51
ToddAndMargo How do I fix? 01:51
timotimo m: my $x="a"~chr(0x0A)~"b"; $x~~s/ "{chr(0x0A)}" /Q/; say "$x"; # one way
camelia aQb
timotimo m: my $x="a"~chr(0x0A)~"b"; my $weird-char = chr(0x0A); $x~~s/ $weird-char /Q/; say "$x"; # one way 01:52
camelia aQb
ToddAndMargo I am writing that down., Thank, you! 01:52
timotimo another way
m: my $x="a"~chr(0x0A)~"b"; my $weird-char = chr(0x0A); $x .= subst($weird-char, "Q"); say "$x"; # yet another way
camelia aQb
ToddAndMargo Writing those down too! 01:53
timotimo m: my $x="a"~chr(0x0A)~"b"; $x~~s/ "\x0A" /Q/; say "$x"; # yet another another way 01:56
camelia aQb
ToddAndMargo how about when used with split? for split "{chr( 0x0A )}", $WebPage -> $Line { 01:57
timotimo you can get the character like that, yes
or with "\x0A", too
ToddAndMargo source look like 2A 21 0A 20 2A 20 from hexedit. My split gives me one YUGE line 01:58
"0X0A" gives me one YUGE line too 02:00
timotimo did it become part of one grapheme with something else? 02:01
m: say uniname(0xA); say uniname(0x21); say uniname(0x20); 02:02
camelia <control-000A>
EXCLAMATION MARK
SPACE
timotimo linefeed, i see
m: say ord("\n")
camelia 10
timotimo m: say ord("\n").base(16)
camelia A
ToddAndMargo I don't know a grapheme is. It only looped once. 02:03
ToddAndMargo uniname(0xA) gives one loop 02:04
I am getting my data rom a web page, so perl has no idea what \n means 02:05
Geth doc: uzluisf++ created pull request #2470:
Mention the $! variable in the 'try blocks' section
02:06
timotimo oh
of course
wait, are you talking about s/.../.../ with the yuge line? 02:07
ToddAndMargo need to leave for a few minutes 02:09
The web page is hundereds of lines long. It uses 0x0A as its line delimiter 02:12
timotimo and .lines won't work? 02:14
ToddAndMargo Yee Gads!! I just figured it out. Perl is working perfectly. The line is question is about 1000 characters long. That is why is seemed like a single loop. 02:17
in question
all is okay now. Thank you!
timotimo no prob!
ToddAndMargo Looking oer the line. What sloppy programming. He included a javascript sub in the line and it just rolled over to the next line in mid command 02:19
Now I got to go work on Libreoffice's weird Basic language for a customer. Thank you again! 02:24
timotimo good luck!
Xliff timotimo++ # Thanks 02:54
holyghost .tell jmerelo I proposed a file change in the schedule, I was removed the time before, I will work on a Math-Stat advent, the name is "a sample of statistics" 06:14
yoleaux holyghost: I'll pass your message to jmerelo.
holyghost .tell jmerelo I'll work on it this weekend and depose on github for at Dec 11 2018 06:15
yoleaux holyghost: I'll pass your message to jmerelo.
hankache hello #perl6 08:31
yoleaux 21 Sep 2018 00:16Z <b2gills> hankache: `abs` isn't the only one it catches, but it is specific to a few functions github.com/rakudo/rakudo/blob/d596...3558-L3565
hankache m: use MONKEY-SEE-NO-EVAL; my $result = EVAL 'my $a = 3; say $a;'; say $result; 08:32
camelia 3
True
hankache Any idea how to store EVAL's result in a variable as a String?
I would have expected the OUTPUT to be «3␤T» and not «3␤True␤» 08:33
I would have expected the OUTPUT to be «3␤» and not «3␤True␤» 08:34
any idea?
moritz say return True, even through the EVAL 08:35
*returns 08:36
hankache yes, but is there a way I can achieve what I want?
moritz what do you want? 08:38
hankache kind of a REPL behaviour. If I type 'my $a = 3; say $a;' in the REPL I get 3 08:40
moritz m: say $*IN.^methods()
camelia (TWEAK open out-buffer nl-in close eof EOF READ get getc comb split words lines read readchars seek tell write WRITE opened t lock unlock printf print put print-nl slurp-rest slurp spurt path IO flush encoding DESTROY native-descriptor Method+{is-noda…
moritz erm, wrong handle
hankache I want a way to EVAL this piece of code and store the result "3" in a variable
moritz hankache: if you compare $*OUT.tell before and after the EVAL, you know if it has produced output 08:41
but the EVAL return True, so you don't have access to the 3 in the caller's code
and the REPL doesn't offer the 3 anywhere either 08:42
m: my @tells = $*OUT.tell; say "dummy"; @tells.push: $*OUT.tell; say @tells
camelia dummy
[0 6]
hankache ok thanks alot 08:44
Xliff m: use MONKEY-SEE-NO-EVAL; my $result = EVAL 'my $a = 3; say $a;'; say $result; $a;
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$a' is not declared
at <tmp>:1
------> 3EVAL 'my $a = 3; say $a;'; say $result; 7⏏5$a;
Xliff m: use MONKEY-SEE-NO-EVAL; my $result = EVAL 'my $a = 3; say $a; $a'; say $result;
camelia 3
3
Xliff m: use MONKEY-SEE-NO-EVAL; my $result = EVAL 'my $a = 3; $a'; say $result; 08:45
camelia 3
Xliff ^^ hankache
m: use MONKEY-SEE-NO-EVAL; my $result = EVAL 'my $a = 3; say "A = $a"; $a'; say $result;
camelia A = 3
3
Xliff Since your last command was a "say", you get the True.
hankache indeed 08:46
Xliff So if you want a return value, use that as the last expression of the block.
hankache I was just looking for a way to silence/not show the True
Xliff s/a return/a different return/
Well, that should be it.
hankache how can one redirect $*OUT to a variable? 09:06
tadzik github.com/sergot/IO-Capture-Simpl...ples/e0.p6 could work 09:09
github.com/sergot/IO-Capture-Simpl...ple.pm#L29 here's how it works 09:10
hankache perfect! thanks 09:12
SmokeMachine Is anyone here on lpw? 10:25
There is a live stream on YouTube
But that’s not showing anything! 10:26
youtu.be/MUIBoDoG0wE 10:28
timotimo oh no! they don't have an internet connection provided by the venue! 11:13
drclaw a 12:05
timotimo m: say "a".succ
camelia b
drclaw p6: say 3; 12:07
camelia 3
timotimo i wonder if having a bot that greets newcomers with a random code snippet would be obnoxious or interesting/fun 12:09
drclaw Random code would hurt my brain :) 12:12
timotimo i'd hope we'd come up with a good selection of interesting code 12:13
rather than completely random code generation :D
drclaw using this "list" method on a supply, the docs say "Taps the Supply it is called on, and returns a lazy list...". . However react block doesn't execute. Calling a "tap" method and building my own list works as expected.. 12:17
trying to read the lines from a Proc::Async ...
does the "list" method indeed tap the supply? 12:19
timotimo can you provide a short example, or your whole code? 12:26
list on a supply gives you something you can use just like a list, so you wouldn't put that into a react block 12:27
because the supply block will .Supply on the list again, i believe
drclaw so starting a external process ($proc) and reading the stdout, wait until the process finishes, as say the list: my @list=$proc.stdout.lines.list; await $proc.start; say @list; 12:32
just seems to 'hang' 12:33
timotimo it might iterate the list when assigning it to @list
supplies themselves don't add any concurrency, but you'll need concurrency here 12:34
i think
you can coerce the supply to a Channel and the channel to a list
drclaw however if I explicitly tap: my @list; $proc.stdout.lines.tap: {@list.push: $_}; and then start the process it runs as I expect 12:35
timotimo by assigning to a $-sigiled var instead of an @-sigiled var, it retains the lazyness properly 12:38
and doesn't block
jnthn `.list` on a `Supply` is pretty much saying "I want to turn this async thing into a blocking sync thing"; it's not generally what you'd want to do. 12:53
timotimo interesting, since the docs use "lazy" there, making it sound kind of like a nonblocking thing 12:54
that should get a little mention in the docs
jnthn The typical pattern is something like the first thing that is shown in the docs: `my @lines; react { my $proc = Proc::Async.new(...); whenever $proc.stdout.lines { push @lines, $_ }; whenever $proc.start { done } };`
drclaw I'm pretty new to perl6 so thank you for your help 12:59
jnthn Also if you want stdout and stderr lines togehter, then it's just `whenever $proc.Supply.lines { push @lines, $_ }` 13:00
drclaw ok must be a chicken an egg problem... 13:13
obtaining the list as follows blocks : my @list=$proc.stdout.line.list; 13:14
trying to use await on the promise from $proc.start is also blocking. Maybe the process already finished at this point?... 13:16
not using await and using the $-sigil variable works. 13:17
drclaw my $list=$proc.stdout.lines.list; 13:18
$proc.start;
jnthn Yes, because array assignment is mostly eager.
drclaw say $list[0];
thanks again everyone for your help 13:19
jnthn Proc::Async is providing an *async* API, and expects to be used in such a way (e.g. with the `react` block as shown earlier). If you don't actually need the async, then consider using `Proc` instead, which has an API intended for synchronous consumption. 13:21
SmokeMachine drclaw: does that work with `my @list := ...`?
jnthn It's not as flexible as a result, but for simple things it's, well, simpler. :) 13:22
drclaw yes actually, the := operator also works 13:28
works on the @-sigil version 13:29
finanalyst i just asked a question on StackOverflow about getting a regex out of a string to match it. Would someone please answer it. 14:46
basically, I store a regex in a YAML file and slurp it into a hash as a string. But how to I turn it into a regex? 14:47
Suppose %h<regex> = '/ ^ <[ a..b, A..B ]> /' how do I match against %h<regex> ? 14:48
sena_kun m: use MONKEY-SEE-NO-EVAL; my $regex = EVAL '/' ~ '.a.' ~ '/'; say 'faf' ~~ $regex; 14:51
camelia 「faf」
sena_kun I am not sure there is a solution without using EVAL though.
m: my $a = '.a.' my $regex = / <$a> /; say 'faf' ~~ $regex; 14:53
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3my $a = '.a.'7⏏5 my $regex = / <$a> /; say 'faf' ~~ $reg
expecting any of:
infix
infix stopper
postfix
stat…
sena_kun m: my $a = '.a.'; my $regex = / <$a> /; say 'faf' ~~ $regex; 14:53
camelia 「faf」
ufobat_ do you know what i am missing 15:11
a perl6 docker image with Inline::Perl5
uzl Hello! Anybody here? 15:55
sena_kun o/ 15:57
uzl "Java’s language support for helping to enforce immutability is the final modifier. When you 16:00
declare a variable to be final , you are promising to assign it a value only once, either
in an initializer or in the constructor."
sena_kun: Is this default on P6 class? If not, what's the equivalent keyword in P6?
sena_kun uzl, do you mean class meaning of `final` keyword in java, as being impossible to inherit from it? as for final variables, I think it is just `constant $foo = 5`. 16:02
I believe `final` is a patch for java absence of `constant/const`-like declaration. in Perl 6 we have it: 16:03
uzl What about inside of a class?
sena_kun m: constant $foo = 3; say $foo; $foo = 10;
camelia 3
Cannot assign to an immutable value
in block <unit> at <tmp> line 1
uzl Would the absense of `is rw` be the equivalent?
sena_kun class attributes are still writeable, but from class insides. 16:04
meaning of `rw` is a note that not only getter, but also setter is "created" automatically if you write your attribute as `$.a` instead of `$!a`. 16:05
like
uzl What if I want the private attribute to be inmutable inside the class too?
m: class A { has constant $!attr; }; say A.new(:attr(''));
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing initializer on constant declaration
at <tmp>:1
------> 3class A { has constant $!attr7⏏5; }; say A.new(:attr(''));
uzl m: class A { has constant $!attr; }; say A.new(); 16:06
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing initializer on constant declaration
at <tmp>:1
------> 3class A { has constant $!attr7⏏5; }; say A.new();
sena_kun m: class A { has $!a; has $.b; has $.c is rw; }; my $a = A.new; # And here: $!a is for internal use only(from methods), $.b can be accessed from outside, $.c can be both accessed and set from outside.
camelia ( no output )
timotimo "constant" in perl6 is compile-time-constant
so not equivalent to "assign-once" semantics
sena_kun so the question is how to make an attribute have only single assignment? 16:07
and what are means for a class to prohibit its extending, if I understood correctly. 16:08
uzl I guess so? I'm not sure. I am reading Sedgewick's Algorithm but implementing everything in P6.
sena_kun ah
uzl so I wanted to see if there was some P6 equivalent.
sena_kun well, if you are only implementing algorithms, you don't need to translate exact Java semantics here. 16:09
it is a one question when it's a design rule or something like that, but I myself rarely use final keyword in Java except for constants(considering I am something of full-time with it). 16:10
final keyword is more of a safe net from shooting yourself, but cases when you cannot find a tricky bug because a variale is re-assigned somewhere are, hmm. well, I myself cannot remember last time when it happened. 16:12
uzl you're right. I'm still reading chapter 1 so the examples are pretty straightforward. 16:13
sena_kun so I'd just pretend there is no `final` on variables and classes. Also, making a class `final` is hardly a nice design, as there are cases when you need to dive into some guts and copy-paste stuff(which feels bad!), but that's just me.
on the other hand, two questions raised(how to make a variable die on second assignment and how to make class non-extensible) are ones I don't know answer to. :) 16:14
and that'd be interesting to look at.
uzl Stack Overflow! Not me though. 16:15
where is jmerelo? ;)
sena_kun: thanks! have a good weekend. 16:18
Poohman hello all 16:57
sena_kun o/
Poohman sena_kun: checked the libeay32.dll - i think the dll we have does not have the function 16:58
i think we have v1.0.2
the newer ones seem to have it
im trying to build openssl in windows to get the dll
but am having problems with building zlib which is a dependancy 16:59
sena_kun yes, saw that. huh, zlib... I wonder if there are some pre-built ones for windows.
I thought about that yesterday.
stackoverflow.com/questions/653450...ound-error <- in answers here some clues should be about where to find needed .dll. 17:00
Poohman ok ill have a look tomorrow - a bit under the weather tonight 17:01
sena_kun sure.
Poohman thanks for the help
sena_kun I'll try to have a look at it today, I think.
jjmerelo Hi 17:20
sena_kun jjmerelo, hi there. o/
jjmerelo I don't know who's around, but this is a little reminder that the deadline for lightning talk in FOSDEM is about to finish
Just in case you don't know, FOSDEM is a huge open source conference that takes place in Brussels in the first weekend of February 17:21
The deadline for submitting lightning talks finishes today fosdem.org/2019/news/2018-08-10-ca...icipation/ 17:22
It would be nice to have some Perl 6 presence there, since there's no devroom this year. I've already submitted one, lizmat is also doing it (or has already done it), so please go ahead and submit something! 17:23
It would really help to spread the word and enlarge the community :-). So please do it! 17:24
If it's accepted, it's a great CV boost! Guaranteed!
But mainly, it will help the community if you spread the word about Perl 6 and to a bit of evangelism. 17:25
mornfall hmm, fosdem... haven't been to that one for a while 18:04
Poohman sena_kun: before I hit the sack -I downloaded various precompiled dlls - v1.0.2 versions - o,p, etc until k 18:28
and tested them, none worked
i directly opened the dll in notepad and searched for the function
it is not available
sena_kun hmm, that's sad to know. :S I use LibreSSL myself, not sure what's even recent version of OpenSSL... I'll look into it after $dayjob will be done nicely. :) 18:29
Poohman but SSL_CTX_set_default_verify_paths() is present in ssleay.dll
oh sorry to have disturbed you 18:30
just wanted to let you know that maybe it is ssl-lib instead of gen-lib
thanks for the help and bye
Altreus I'm finding that as soon as I make my library work async, slowly everything starts returning a Promise 20:53
So I wonder whether it is or will be possible to specify what the Promise itself resolves to
it would look nicer and be more self-documenting if I had « method send-message returns Promise[Message] » or something like that
plus it could say something meaningful if it actually resolves to something else 20:55
jnthn Altreus: I've also pondered that sometimes. Feel free to submit it as an RFC 21:24
leont Yeah I would like that as well. Then again, my p6 code tends to be rather explicitly typed. 21:29
timotimo it takes all kinds to make a world 21:31
mornfall i guess there isn't a markdown parser as a p6 package? (if it did pandoc extensions that'd be even better :p) 21:46
pandoc is a mess and replacing it could be a good p6 exercise (not in full generality of course, i just need a very small subset of what it does)
jnthn There's multiple Markdown modules available; worth seeing if one of them does what you need. 21:48
mornfall goes looking more carefully (i only found perl5 mods and one very limited perl6 grammar) 21:50
okay the Text::Markdown modules.perl6..org looks better (even if the insides are not super pretty) 21:52
hmm, perl6 on openbsd isn't exactly... comprehensive; *goes looking for zef* 21:54
discoD i haven't seen a distro-packaged perl6 worth using yet. 21:57
mornfall well, the rakudo in ports managed to get me zef installed, so i guess i'll live 21:58
okay the source code for for Text::Markdown looks a little like it's been encrypted; getting used to p6 is going to take a while :P 22:01
discoD if anyone like riddles, this one is killing me: A native function call, which allocates its own memory, returns a pointer to a cstruct, 'A'. One of A's members is a pointer to another cstruct 'ImAnInstance', which has a member 'MaybeYouForgotDotNew'. How do you access ImAnInstance.MaybeYouForgotDotNew? 22:03
rakudo swears the second struct is a type object, and i can't figure out how to tell it otherwise. 22:04
jnthn A type object is how it'd map a C NULL 22:05
discoD oh ok, i think i know what's going on then. thank you very much 22:11
Geth doc/master: 4 commits pushed by (Luis F. Uceta)++, (Juan Julián Merelo Guervós)++ 22:13
mu: 043ad31ffc | (Tom Browder)++ (committed using GitHub Web editor) | README
Update README
22:24
Geth mu: 5476c42970 | (Tom Browder)++ (committed using GitHub Web editor) | misc/perl6advent-2018/schedule
update title
22:29