This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
CodeTortoise That would be funny. 00:00
I mean, the point of higher-level languages are to accomplish things that historically took a lot of low-level mastery. Hardware design in near natural language would be something else. 00:01
Are people doing signal processing, or art programming in Raku? A LONNG time ago I wanted to get into Processing, but was put off by Javascript and Python. 00:05
This seems more in the realm of what people have done with Racket, but it would be cool to do visual synthesis kind of stuff. Maybe that will be my white whale project, the thing I can offer once I get competent. 00:06
Nemokosch Sounds nice 00:07
CodeTortoise I was reading about the history of Perl, and some of the interviews at Slashdot, and one of the goals has always been to escape the niche as a text-processing language. The fact that Raku has an awesome math library that gives correct, expected results means it can be used for a lot more serious computaton, I think. 00:11
Eh, too muh waxing about the future. Gots to read read read and code.
jaguart CodeTortoise: but does it though? Nemokosch asked me if this is what I expected - it wasn't 00:14
m: say -1.succ
camelia -2
jaguart So while .succ is not defined for negatives, I have always viewed it as move-one-right on the number-line - expected -1.succ to return 0 :o 00:15
but Raku sees this as negation-operation on 1.succ => -2
CodeTortoise Oh, I suppose I have not explored the math system fully. I was just happy that it came back with exact results. 00:18
jaguart Oh yeah - there is lots of niceness too :) 00:19
CodeTortoise Haha. I just tried that. Yeah, come on, get out with the LEFT-->RIGHT tyranny.
Negative numbers need love too. 00:20
That too can succeed.
jaguart Its all about prioritising your operators - and thinking '-' is an op not an intrinsic
Nemokosch Raku parsing be like: if something doesn't work, add spaces 00:21
works 10 out of 10 haha
m: -1 .succ.say
dang, zero
CodeTortoise I got 2??
Nemokosch did you forget a '-'? 00:22
CodeTortoise Nope.
00:22 NemokoschKiwi joined
CodeTortoise (-1).succ = 0 00:23
NemokoschKiwi m: -1 .succ.say
camelia 0
NemokoschKiwi he? :D
again, I don't have any "insider info" but my conspiration is: the parsing engine is slow -> let's design a grammar that can be parsed with no backtracking at all -> ambiguities need resolution 00:24
CodeTortoise -2.succ.say == 3
NemokoschKiwi you mean, -3
but that's without the space
m: -3 .succ.say 00:25
camelia -2
NemokoschKiwi versus
m: -3.succ.say
camelia WARNINGS for <tmp>:
4
Useless use of "-" in expression "-3.succ.say" in sink context (line 1)
NemokoschKiwi oh right...
CodeTortoise Oh, I don't know. It is just what the REPL is spitting out.
jaguart just be careful when you write Apollo::Countdown::Controller.backwards(10).resume - you might end up getting further and further from launch 00:26
NemokoschKiwi say is still a method call, right? it still has higher precedence than unary minus
m: say -3.succ
camelia -4
NemokoschKiwi m: say -3 .succ
camelia -2
NemokoschKiwi there
CodeTortoise Same weirdness with .put. It works as expected with parentheses. 00:27
It must be ignoring the "-"? 00:28
NemokoschKiwi maybe someone could tell why the lack of negative literals is a good thing; I'm not one of them. I don't like this grammar choice.
CodeTortoise Might just be my computer. I don'tt know.
jaguart use m: to share your one-liners 00:29
NemokoschKiwi CodeTortoise: it's a bit tricky. let's break "-2.succ.say" down
I'm gonna just use parens
m: -((2.succ).say) 00:30
camelia WARNINGS for <tmp>:
3
Useless use of "-" in expression "-((2.succ).say)" in sink context (line 1)
jaguart yeah - parens are always telling you what to do
they give you that sink feeling
NemokoschKiwi the dot has higher precedence than the minus. Both for 2.succ and succ.say
so you get to see 3 coming from 2.succ.say
now, say also has a return value: True 00:31
so we end up with -True (which is -1) and the compiler warns us that we aren't using this value for anything
CodeTortoise m: -2.succ.say.print
camelia WARNINGS for <tmp>:
3
TrueUseless use of "-" in expression "-2.succ.say.print" in sink context (line 1)
NemokoschKiwi now you did print True as well :)
but the negation is still the last operation 00:32
CodeTortoise Yes, it has Additive precedence, which is the same as last I guess.
NemokoschKiwi let me show you another paren-less trick: an operator with really low precedence
an operator that sets the topic based on the LHS value 00:33
m: -2.succ.say.print andthen .say
camelia 3
True-1
NemokoschKiwi now we got everything, right?
2.succ.say gave as 3
,print on this gave us True
the negation turned it into -1
finally, andthen set this as the topic and we said the topic value: -1 00:34
jaguart m: say -True
camelia -1
jaguart m: say -True.so
camelia -1
jaguart m: say -True .so
camelia True
jaguart I see a lot of debugging in my future 00:35
CodeTortoise Wow, I just learned about andthen. Nice way to chain methods.
jaguart m: say -False
camelia 0
jaguart m: say -False .so
camelia False
CodeTortoise Future so bright you got to close your eyes, turn around and walk away.
NemokoschKiwi I like andthen a lot, especially for writing code without parens
jaguart so negative True is True and negative False is False 00:36
NemokoschKiwi yep :P
jaguart without parens means no Block though?
NemokoschKiwi it has ridiculously low precedence, by the way, almost the lowest. Lower than = for example
jaguart so lexical scope is wider...
NemokoschKiwi jaguart: actually, andthen creates a block under the hood 00:37
I've seen issues with this... rather subtle issues
jaguart ok - so you can pod:Declarator it
NemokoschKiwi I don't know but that definitely sounds like something that can involve bugs, lol 00:38
github.com/rakudo/rakudo/issues/5004 an issue I found with andthen
00:39 NemokoschKiwi left
jaguart did you try your example with a HyperWhatever? 00:40
yeah - same - just wondered because HyperWhatever has a magic block 00:43
CodeTortoise Oh, is it separating the result from -1 that would negate it, like the way it separates numerator and denominatore with nude?
m: print -3.succ.say 00:44
camelia 4
-1
Nemokosch not sure 00:45
oops
did the "not sure" message show up and how?
jaguart m: print -((3.succ).say) 00:46
camelia 4
-1
Nemokosch I accidentally sent that as a reply to the bot gathering IRC messages
Kaiepi what output are we looking for? 00:51
CodeTortoise -2 --> -1. The successor of any negative number should be right 1 on the numberline. 00:55
Kaiepi m: -2 ~~ *.succ.say 00:56
m: 2.:<->.succ.say
that one's kinda weird
Nemokosch disclaimer: these messages do generate output on the discord side - it just doesn't get sent over 00:57
Kaiepi oh 00:58
Nemokosch > 2.:<->.succ.say
by the way, what kind of syntax is this?
is .: like some operator invocation sugar? 00:59
jaguart m: -2 ~~ *.succ.say 01:01
camelia -1
CodeTortoise methodop. It is chaining the unary - operator.
01:03 jgaz left
jaguart first one -> (-2) ~~ (*.succ).say -> so expect (-2)+1 ==> -1 not -(2+1) ==> -3 01:03
Kaiepi only thing about `~~` is it'll boolify the return value of the `Code` on the rhs
m: say 1 ~~ *.succ
CodeTortoise docs.raku.org/language/operators#methodop_.=
jaguart and: 2.:<->.succ.say ==> left-to-right dot ((2.:<->).succ).say 01:04
Kaiepi er
m: say 1 ~~ *.succ
camelia True
jaguart m: say 1 ~~ Whatever.new 01:06
camelia True
Nemokosch it's not .= though 01:08
Kaiepi it's on that page, lower docs.raku.org/language/operators#m...perator%3E
Nemokosch oh thanks. Didn't show up when I typed .: in the search bar 01:09
CodeTortoise Oh no, I thought I would get some other result when is typed exit.WHAT, but it just exited. 01:10
jaguart lol 01:11
like trying to print Ctrl+D
CodeTortoise Yes. Now, nobody do that to camelia, alright? 01:12
m: -2.WHAT
camelia WARNINGS for <tmp>:
Useless use of "-" in expression "-2.WHAT" in sink context (line 1)
Use of uninitialized value of type Int in numeric context
in block <unit> at <tmp> line 1
jaguart I have a question about tests - how do you approach testing a call that generates large complex .say output 01:14
Nemokosch I'd rather skip this question and go to sleep. šŸ˜… as final words: didn't really see an elegant way in the modules I tried but it's true that they weren't written by sort of Raku monks. Those tests were like: "here, take this text, does it match?" 01:18
jaguart so slurp STDOUT and compare to a reference? 01:20
CodeTortoise jaguart: What kind of function would give a large .say result? Is it just for text?
jaguart yeah - my introspection tool generates output like: gist.github.com/jaguart/35ab71ade4...3f3a3a5554 01:21
I want to wrap it up into a module - with tests
CodeTortoise I am out of my incredibly shallow depth on this one. 01:22
jaguart so do I have to fork the call to read it's STDOUT? 01:26
or redirect STDOUT to a tmpfile before the call?
Nemokosch <@210313526928080896> (Kaiepi): your insights would be really welcome here ^^ 01:27
CodeTortoise It seems so roundabout. It seems that .say output can be captured in a variable, but I am not sure if that works for your case. 01:38
Perhaps you can have the say output right to a file and slurp it after?
Ahh, that makes less sense. Nevermind. 01:39
02:13 CodeTortoise left 03:34 CodeTortoise joined 03:39 CodeTortoise left 03:44 CodeTortoise joined 03:45 CodeTortoise left
jaguart aha: github.com/raku-community-modules/Test-Output 04:31
10:35 discord-raku-bot joined 10:39 discord-raku-bot left 10:40 discord-raku-bot joined 11:17 deadmarshal_ joined 12:30 deadmarshal_ left 13:31 jgaz joined 15:43 Kaiepi left 16:05 Kaiepi joined 18:01 jgaz left 18:05 jgaz joined 18:09 jgaz left
yabobay i have these two files in the same directory, yet when i run test.raku, i get this thing: 18:10
```
===SORRY!=== Error while compiling /home/pizza/stuff/test.raku
Could not find something in:
inst#/home/pizza/.raku
inst#/usr/share/perl6/site
inst#/usr/share/perl6/vendor
inst#/usr/share/perl6/core
ap#
nqp# 18:11
perl5#
at /home/pizza/stuff/test.raku:1
```
18:13 discord-raku-bot left, discord-raku-bot joined
Nemokosch You need to somehow inform the runtime to look up the module 18:16
Either by installing it, or, more lightweightly, by using the -I flag
yabobay ``` 18:18
Could not find symbol '&thing' in 'something'
in block <unit> at test.raku line 3
```
but how?
Nemokosch I don't know, I don't tend to use this 18:21
But cannot be too difficult
yabobay figured it out. turns out i just wasn't reading carefully. you need "our" on the subroutines 18:25
Nemokosch Oh, gotcha
Well that's true, my is really just for lexical scope 18:26
19:52 newuserofraku joined
newuserofraku Hi there....following instructions on rakudo.org/star/source 19:55
this stage here: ./bin/rstar install in the linux section gave me some errors, where to go for help?
Getting errors like: Could not find OpenSSL in.... No meta file located at.... Could not find Digest::SHA in.... if anyone knows what to do, please let me know, thanks 20:37
21:04 deadmarshal_ joined 21:06 deadmarshal_ left 21:33 CodeTortoise joined 21:39 CodeTortoise left 21:40 CodeTortoise joined 21:42 deadmarshal_ joined 21:52 jgaz joined 22:05 jgaz left
p6steve newuserofraku: welcome! this is the "ubuntu install raku latest from source" Dockerfile that I keep github.com/p6steve/raku-Dockerfile...Dockerfile 22:15
newuserofraku: from the errors you mention, I suspect that you need to preload the -dev packages like ```apt-get install -y build-essential libssl-dev libreadline-dev git curl \``` 22:16
newuserofraku: you are welcome to just use the Docker image like this ```docker run -it p6steve/rakudo:basic``` also 22:21
Fungi hey so what all should i be installing to get started with raku. im seeing a rakudo, zef, rakudo star, and some vm stuff. is there anything else im missing? 22:37
p6steve Fungi: the definitive downloads and instructions for rakudo (the most active raku compiler) are here rakudo.org 22:42
Fungi: you can build from scratch, but often there will be a pre-built binary install for your setup 22:44
Fungi: as it states on the instructions 'Archives contain a precompiled Rakudo and the Zef module manager.' 22:45
Fungi: the rakudo star bundle adds in a set of useful modules and is described at rakudo.org/star ... but I think it has a smaller coverage of platforms 22:50
Fungi: oh, and the 'vm stuff' is anyway included in all of the above (MoarVM is the raku execution engine for rakudo, bit like Java runs on the JVM) 23:00
23:11 CodeTortoise left
Fungi alrighty 23:19
23:31 CodeTortoise joined
p6steve enjoy! please come back and share your feedback... 23:35
Nemokosch I for one like the rakubrew tool a lot: rakubrew.org/ 23:36
p6steve Nemokosch: ++
jaguart Fungi: also see github.com/nxadm/rakudo-pkg for an alternative to rakubrew 23:40
23:46 CodeTortoise left 23:50 CodeTortoise joined