🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
00:41 guifa left 00:51 guifa joined 01:11 kjp left 01:13 kjp joined 01:14 kjp left, kjp joined 01:36 hulk joined, kylese left 02:15 hulk left, kylese joined 02:29 sftp left 03:01 guifa left 04:40 Aedil joined 05:30 Sgeo left 06:20 sftp joined 06:59 merp joined 08:00 dakkar joined 08:24 MasterDuke left 09:08 sftp left 09:09 tea3po left 09:10 sftp joined 10:16 misterfish joined
librasteve o/ 10:18
I am currently working on htmx <=> cro ideas ... I am drawn to htmx since I seek simplicity and find react very heavy cognitively ... but one idea of react that I like is that I can manage all aspects (html, css, js) of a component locally and not have to wade into separate html templates / css-sass / js files to change a local thing 10:22
to this end, I am wondering if anyone knows how to embed a small crotmp into the raku routes file eg as a HEREDOC ... well I know how to do that part, but the cro template doc cro.services/docs/reference/cro-webapp-template only shows a pattern like this 10:25
get -> 'product', Int $id { my $product = $repository.lookup-product($id); template 'templates/product.crotmp', $product; }
so --- is there an alternative to passing in the crotmp as a Str "immediate", as opposed to passing in the IO path? 10:26
10:34 misterfish left
rootles around in github github.com/croservices/cro-webapp/...kumod#L186 ... #| Parse a template from a source string. 10:34
thank you my ducks
10:41 dawids joined
content 'text/html', (parse-template($index-tmp)).render($data); 10:47
^^ if you were wondering
10:48 misterfish joined 11:41 dawids left 11:57 teatime joined
patrickb m: my $keyword = "use"; grammar G { token TOP { [<keyword> | <text> ]* }; token keyword { $keyword }; token text { . }}; dd G.parse("use my stuff;"); 12:13
camelia Match.new(:orig("use my stuff;"), :from(0), :pos(13), :hash(Map.new((:keyword([]),:text([Match.new(:orig("use my stuff;"), :from(0), :pos(1)), Match.new(:orig("use my stuff;"), :from(1), :pos(2)), Match.new(:orig("use my stuff;"), :from(2), :pos(3)), …
patrickb Why does that not match the interpolated "my"?
*"use"
Not interpolating makes it work. 12:16
12:54 jgaz joined
[Coke] anyone know of a program like "auto hot key" for mac? I have it setup on windows so I can do things like type "//dd" and get a nicely formatted version of today's date. I can do this with static text on the mac, but not something like today's date. 13:00
lizmat newer MacOSes have something called Shortcuts? 13:02
never used it myself
antononcube Yes, Shortcuts is that can be used for automations in macOS. I used two years ago extensively. Then got bored from it… 13:03
librasteve patrickb: you have basically said "match when you find any char" ... ie text { . } then [...|<text>]* 13:04
antononcube @Coke here is Raku-&-Shortcuts demo, “Doing it like a Cro”: www.youtube.com/watch?v=wS1lqMDdeIY 13:05
librasteve m: my $keyword = "use"; grammar G { token TOP { [<keyword> | <text> ]* }; token keyword { $keyword }; token text { . }}; say ~G.parse("use my stuff;");
Raku eval use my stuff;
evalable6__ use my stuff;
[Coke] googling for "shortcuts" gets me things like "here's how you use copy and paste". :) 13:14
lizmat [Coke]: it's a standard app on MacOS 13:17
go to the LaunchPad and type shortcuts
[Coke] gotcha. OK, there's a lot of complexity there, will take some time to digest this, thanks. 13:19
looks like the keyboard shortcut support is limited. can't tie it to a string of characters to input, but only to key modifier combinations. 13:22
lizmat ack 13:36
in that case, you might look at Karabiner-Elements app in the App store 13:37
patrickb librasteve: I'm unsure I understand your explanation. 13:40
<patrickb> m: my $keyword = "use"; grammar G { token TOP { [<keyword> | <text> ]* }; token keyword { use }; token text { . }}; say G.parse("use my stuff;")<keyword>; 13:42
m: my $keyword = "use"; grammar G { token TOP { [<keyword> | <text> ]* }; token keyword { use }; token text { . }}; say G.parse("use my stuff;")<keyword>; 13:43
camelia [「use」]
patrickb m: my $keyword = "use"; grammar G { token TOP { [<keyword> | <text> ]* }; token keyword { $keyword }; token text { . }}; say G.parse("use my stuff;")<keyword>;
camelia []
13:44 xinming_ joined 13:45 xinming left
librasteve sorry ... maybe i misunderstood yours 13:46
patrickb The last two code fragments differ only in one having "use" literally in the token keyword and the other having it interpolated. One matches, the other doesn't 13:48
I wonder why. Is this a bug? How can I make it work with interpolation?
librasteve yeah - i see ... sorry i answered the wrong question
13:48 donaldh joined
[Coke] I happen to already be using KBE for some simple remapping I needed, checking. 13:49
antononcube "Shortcuts" is a very "unfortunate" name because most of time search engines produce irrelevant results of generic shortcuts. The documentation for "Shortcuts" was very short / sparse two years ago. I had to lookup details for functions in Reddit, and/or actual working shortcuts. Many of the directions were for older versions of the Shortcuts app. 14:07
I have not tried to make a specific LLM-persona for Shortcuts yet, because, well, I stopped using Shortcuts. But I wonder how good that LLM-persona might be. 14:08
patrickb Ok. The issue with interpolation is fixed in RakuAST. \o/ 14:19
14:31 misterfish left 14:32 sftp left
nahita3882 my guess is LTM sees the interpolation as having 0 declarative prefix length and chooses the other one; my "proof" is that if you do my $keyword = "se"; and then token keyword { 'u' $keyword }, it does work as expected (now has 1 declarative prefix length and compares the same with the other branch . on that metric; and since it has more specifity ("u" versus any-char), it wins to match "use") 14:36
m: my $keyword = "se"; grammar G { token TOP { [<keyword> | <text> ]* }; token keyword { 'u' $keyword }; token text { . }}; say G.parse("use my stuff;")<keyword>;
evalable6__ [「use」]
Raku eval [「use」]
nahita3882 it seems then that RakuAST regards interpolation differently for LTM (or maybe something else is off and so am i) 14:38
15:36 xinming_ left 15:38 xinming joined
[Coke] is 0rir on here with a different nick? 16:08
.seen 0rir
tellable6 [Coke], I haven't seen 0rir around, did you mean rir?
[Coke] .seen rir
tellable6 [Coke], I saw rir 2024-06-01T20:40:07Z in #raku: <rir> Touch
[Coke] rir++ 16:09
librasteve patrickb: and @nahita3882 - I agree with your findings ... I wonder if this is to be regarded as a bug or a feature ... imho it's a bug 16:11
16:37 dakkar left 17:01 sena_kun joined
coleman rebooting docs site server; maybe a little downtime 17:02
lizmat log enough for the monitors to notice :-) 17:06
*long
coleman should be back 17:09
yea, i wanted to give a heads up that it was expected :) 17:10
librasteve I have some names and a loop and would like to use compact pair syntax for args maybe like this... 17:34
my @name = <firstName lastName email>; for ^@name -> \i { div( input :@name[i] ) #<== shorthand for name => @name[i] } 17:36
can this be done?
(obviously this example could be done with for ^@name -> $name { ... :$name ...} but I have other arrays to fu 17:39
17:39 xinming left
fill other args to input 17:39
17:40 xinming joined
vendethiel my $name = @name[i]; :p 17:49
librasteve yeah - that's what I figured - thanks! 17:54
guess I'll just go with this 17:55
for ^@names -> \i { div label @labels[i], input :type(@types[i]), :name(@names[i]), :value(@values[i]) }
jgaz Is it possible to change the default location of `~/.raku` to somewhere else? 18:13
tbrowder there be demons... 18:50
lizmat afaik, it's just HOME/.raku 18:56
change HOME and you're set ?
jgaz Well, I'd like to move it to `~/.local/state/raku`. 18:59
nahita3882 what about zipping? for zip(@labels, @names, @types, @values) -> ($label, $name, $type, $value) { div label $label, input :$name:$type:$value; }
lizmat jgaz: looks like it's hard-coded in CompUnit::RepositoryRegistry line 174 19:02
jgaz lizmat, Any philisophical objections to me opening a request to have Rakudo respect XDG directory structures if the env variables are defined? 19:03
lizmat no, but github.com/rakudo/rakudo/issues/2984 may be of interest 19:05
19:09 Aedil left
jgaz lizmat, Done: github.com/rakudo/rakudo/issues/5625. Thanks. 20:00
lizmat jgaz: thank you! 20:01
librasteve @nahita3882 awesome! 20:02
21:03 wayland joined 21:08 guifa joined
scullucs I seem to be missing some context (and some knowledge). What are the raw 'div' (int. division?), 'label', and 'input' there, and what is that :$name:$type:$value syntax? 21:32
wayland Does anyone know why, when I use a declarator block on my code, the Pod6 to HTML renderer makes it a h1? 21:52
Example: hasRelation$!relationis built is required;#= The relation which contains this field
Also, I'm not seeing anything for numbered lists. 22:05
[Coke] "what are the ... there" - where? 22:13
Guessing you're seeing something on the discord side that isn't showing over here on IRC. 22:14
scullucs Oh, could be. (I'll go to IRC.) 22:19
lucs [Coke]: The code I was looking at is this: 22:20
for zip(@labels, @names, @types, @values) -> ($label, $name, $type, $value) { div label $label, input :$name:$type:$value; }
[Coke] OH. I also was conflating your send and wayland's send. :) 22:23
yes. div is int division.
is there a more code? wondering if there's a module being pulled in there. 22:24
lucs I'm not sure.
I believe the example started with librasteve's earlier discord comment (it's 18:25 here in my IRC client, and that librasteve comment was at 13:34). 22:26
[Coke] I think :$name:$type:$value is three named args to the input routine 22:28
m: dd &input
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
input used at line 1
[Coke] but I think while div is normally:
m: say 10 div 5 22:29
camelia 2
[Coke] that div, label, and input there are all imports from some use'd module
22:30 sena_kun left
[Coke] m: sub a (:$this, :$that) { dd $this, $that }; my $this = "foo"; my $that = "bar"; a :$this:$that; 22:32
camelia "foo"
"bar"
[Coke] you don't *have* to have the outer scope vars have the same name as the routines, but if you do, you can use them as is. 22:35
lucs Oh, I'd never seen that using-no-spaces syntax. 22:38
22:48 jgaz left 22:50 guifa left 22:53 wayland left
teatime $this $that paddywack, give a dog a bone(); 22:58
23:21 guifa joined
[Coke] m: dd :3:4:5 23:31
camelia ===SORRY!=== Error while compiling <tmp>
Malformed radix number
at <tmp>:1
------> dd :3⏏:4:5
expecting any of:
number in radix notation
[Coke] m: dd :<a>:<b>
camelia ===SORRY!=== Error while compiling <tmp>
You can't adverb :<a>
at <tmp>:1
------> dd :<a>:<b>⏏<EOL>
[Coke] m: dd 3:<a>:<b>
camelia ===SORRY!=== Error while compiling <tmp>
You can't adverb 3
at <tmp>:1
------> dd 3:<a>⏏:<b>
[Coke] gives up trying to find another place it works. :) 23:32
lucs Hehe :) 23:37
teatime: In case you've never seen it: www.youtube.com/watch?v=7PbQRMVXOqU 23:38
23:50 guifa left