🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
SmokeMachine It’s a memorizes dom module, it can help to write html and interact with it on the browser 00:00
fco.github.io/MemoizedDOM/todo6.html
(This is a old test using webperl6, I don’t know if it would be faster currently) 00:01
oddp timotimo: why doesn't this work when you can use something like .reduce(&[+]) just fine?
m: say <1 2 3 4>.rotor(2 => -1).map(&[-])
camelia (0 2)
SmokeMachine [Coke]: the API is not finalised, but it was cool to play with that 00:04
[Coke] Ok. the lack of readme is daunting. 00:04
I will add it to my research list. thanks
SmokeMachine github.com/FCO/MemoizedDOM/tree/ma...mples/todo 00:05
timotimo oddp: you want &[R-] at least
cpan-raku New module released to CPAN! Text::Diff (1.0.4) by 03RBT
oddp m: say <1 2 5 10>.rotor(2 => -1).map(&[R-]) 00:06
camelia (2 2 2)
oddp ok?
timotimo huh that's not quite it 00:07
SmokeMachine (Last comment, I promise) this is how you do the app: github.com/FCO/MemoizedDOM/blob/ma...do/App.pm6
timotimo i assume it's giving you a two-item list on both sides of the - there
m: say <1 2 5 10 20 50 100>.rotor(3 => -2).map(&[R-]) 00:08
camelia (3 3 3 3 3)
timotimo m: say <1 2 5 10 20 50 100>.rotor(4 => -3).map(&[R-])
camelia (4 4 4 4)
timotimo yeah it's only about the size of list you put out of the rotor
SmokeMachine m: say <1 2 5 10>.map: &[R-] 00:09
camelia (1 2 5 10)
SmokeMachine m: <1 2 5 10>.map: &[-] 00:14
camelia ( no output )
SmokeMachine m: say <1 2 5 10>.map: &[-]
camelia (-1 -5)
oddp That one seems to eat two list elements, right?
SmokeMachine Yes 00:15
oddp Hm, guess I'll defer from using this syntax sugar till I get the hang of it. A bit unintuitive coming from ruby. 00:16
SmokeMachine m: say <1 2 5 10 20>.map: -> $a, $b = 0 { $b - $a } 00:17
camelia (1 5 -20)
SmokeMachine oddp: it goes 2 by 2 because the function I’ve passed to map accepts 2 parameters 00:21
oddp Too late over here, maybe it will all make sense tomorrow morning. Thanks for your time and patience. 00:28
thundergnat m: say <1 2 5 10 20>.rotor(2=>-1).flat.map: * R- * 10:24
camelia (1 3 5 10)
thundergnat You were all _so_ close. 10:25
cpan-raku New module released to CPAN! Gnome::Cairo (0.1.0.1) by 03MARTIMM 12:45
New module released to CPAN! Gnome::Gdk3 (0.16.0) by 03MARTIMM 12:53
cpan-raku New module released to CPAN! Gnome::Gtk3 (0.28.6) by 03MARTIMM 14:38
Geth doc: 093cbb3ec2 | (JJ Merelo)++ | doc/Language/control.pod6
Some minor reformatting.
15:55
linkable6 Link: docs.raku.org/language/control
Geth doc: bedfefdd21 | (JJ Merelo)++ | doc/Language/control.pod6
Additional minor corrections.
16:03
linkable6 Link: docs.raku.org/language/control
JJMerelo Well, I just broke the documentation 16:20
Trying to fix it back.
It might be due to latest changes in Documentable, but I am not so sure
reverting to an old version of Documentable to generate it 16:21
codesections I kind of like that look. Very clean 16:22
JJMerelo Yep, that's the thing 16:24
I mean, the content is the same, but all the old CSS and JS are totally lost 16:25
There have been lots of changes in documentable lately, and I just moved to a new laptop, so I installed the new version. I'm reverting to generating it with the old version
Fortunately, every version of raku installed with rakudobrew keeps its own version of everything, so we should be good I guess
Generating the new (old) pages now, should take only a few minutes 16:26
codesections Makes sense. I'm just expressing admiration for how well it degrades, without (external) CSS
JJMerelo I'm going to save also this version to a repo, so that we can always get the old look back when we want.
codesections maybe we should add a toggle... 16:27
well, old crufty version is back 16:28
Replica of this version saved to rakudocs.github.io/ 16:30
Geth ¦ problem-solving: landyacht assigned to jnthn Issue Exponentiation with Rat or FatRat exponent results in Num github.com/Raku/problem-solving/issues/209 17:21
Geth ¦ problem-solving: lizmat unassigned from jnthn Issue Exponentiation with Rat or FatRat exponent results in Num github.com/Raku/problem-solving/issues/209 17:30
Geth doc: 10f8491990 | Antonio++ (committed using GitHub Web editor) | assets/doc-generation.json
fix: update config file, refs Raku/Documentable#63
17:45
codesections This is very much a beginner question, but do I need to do something (beyond installing Rakudo Star) to install/use the documentation? I see the source for the docs has been installed to ~/rakudo/install/share/perl6/site/doc, but I don't see any way to interact with those docs. In particular, I thought I'd be able to see something in the REPL with an expression like `&say.WHY`, but I don't get 19:42
anything with that. Do I have something set up wrong or am I just confused about what to expect?
codesections Ok, partly answering my own question: after reading the FAQ more carefully, I realize that I needed to be using p6doc to interact with the documentation locally (I'd tried `raku --doc` and checked the `raku -h` output, but had somehow missed the existence of `p6doc`) 19:53
But that still leaves me confused about the second half of my question: should I be able to see documentation for items in the REPL? 19:55
I'm currently getting messages like
No documentation available for type 'Sub'.
Perhaps it can be found at docs.raku.org/type/Sub
which *suggests* (to me) that I may not have something installed correctly… 19:56
hmm, maybe I should try on here. Let's see… 19:58
raku: &say.WHY
evalable6
codesections raku: say &say.WHY 19:59
evalable6 No documentation available for type 'Sub'.
Perhaps it can be found at docs.raku.org/type/Sub
»
codesections hmm, same message I get locally
lizmat codesections: the .WHY functions sadly do not work on built-ins 20:06
long story cut short: during development, it was a. too much in flux, and b. hindering the development cycle as it would at least double compilation time (this was in the Parrot days) 20:07
since then, no effort has been made to remedy this, other than what you saw with the "perhaps it can be found" message
for most built-in types, the link is actually correct 20:08
codesections Ok, thanks – very informative! So what do they work on? From the docs, I thought I could add .WHY help strings to my own sub by adding a comment above it with #|, but couldn't get that to work. 20:09
lizmat are you trying things in the REPL ? 20:10
codesections Well, I tried both in the REPL and by sending an Emacs buffer to the REPL via raku-mode 20:11
lizmat #| foobar 20:12
sub zip() { }
say &zip.WHY;
evalable6 No documentation available for type 'Sub+{is-pure}+{Precedence}'.
Perhaps it can be found at docs.raku.org/type/Sub+{is-pure}+{Precedence}
»
lizmat works for me
codesections when you say that it works for you, you get output with `foobar` when running those statements in the REPL? I am getting a message similar to the one from evalable6 20:16
lizmat yes, that's what I was saying: it should say "foobar" 20:17
because that is the .WHY text associated with the sub
codesections That is what I thought. I wonder why I and evalable6 are both getting an error instead 20:18
lizmat evalable6 only does line at at time, and loses knowledge of the previous lines 20:19
*one
codesections Hmm, that seems to be the case for the REPL version I'm using as well (both when I paste the three lines in together and when I send the full buffer from Emacs). I get the expected output when I save those lines to a file and execute them as a standalone script 20:21
lizmat yeah, the REPL and the bots only know of one line at the time, really 20:26
although the REPL tries to fake it, but fails in a lot of cases
this being one of them I guess
codesections Fair enough. And I guess Emacs' raku-mode is still sending the text as lines to the REPL, and runs into the same limitations 20:28
lizmat probably, dunno, /me uses vim
if it would be smart enough to write it to a temp file, and then run that, it should work 20:29
codesections Fair enough. Maybe I'll switch back one of these days :)
lizmat :) 20:30
codesections While you're being so helpful, a (semi) related question: is there a way to have Raku print a human readable representation of a `sub`? 20:32
raku: sub add1($i) { $i + 1 }; say &add1.raku; 20:34
evalable6 sub add1 ($i) { #`(Sub|94400420871152) ... }
codesections I was looking for a textual version of the sub in place of that hash 20:35
lizmat alas, no
jnthn's RakuAST work might make that possible
moritz keeping all that around after compilation would still be a huge waste of memory 20:35
lizmat moritz: not necessaryily: could be a single int value with an offset and a length in it, that would index into the source 20:36
codesections moritz, I hadn't really thought though the technical details – I just remember that being a feature of the JavaScript REPL, and it's one I miss a bit 20:40
timotimo iirc we currently don't ship the core setting source into the installation folder 20:52
in typical javascript VMs the functions are actually stored as javascript source in the installation, except for some "[native function]" functions?
because i guess javascript parses ridiculously quickly?
lizmat I've been toying with the idea of having a module in lib with all of the docs of core functionality, that could be loaded on demand by .WHY and the have it produce the right doc 21:14
[Coke] returns from his brief power outage 22:35
wind must have knocked something down somewhere.
timotimo knock knock 23:12
sjn who's there? 23:16
timotimo it's me, i don't know how knock knock jokes work 23:19
codesections Following up on our earlier discussion of how Raku can't currently print the source of a built-in function, I decided to write a helper function that would print the source. I'm sure this isn't super robust (did I mention that I'm just now discovering Raku) but I expect I'll find it helpful in testing things out in the REPL. I'll paste it here, in case anyone else is interested. 23:40
sub src($sub) {
my ($sub-name, $path) = ($sub.gist.substr(1), $sub.file);
$path ~~ s|'SETTING::'|/home/{$*USER}/rakudo/rakudo/|;
my $sources = (slurp $path) ~~ m:g/^^<([\w||\h]*?"$sub-name".*?\{.*?\})>/;
my $c = 1;
"&$sub-name defined {$sources.elems} times:\n\nDefintion #1:\n"
~ $sources.reduce({$^a ~ "\n\nDefintion #{ ++$c }:\n" ~ $^b})
}