🦋 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:00 reportable6 left 00:03 reportable6 joined 01:03 reportable6 left, linkable6 left, evalable6 left, benchable6 left, reportable6 joined, evalable6 joined 01:04 benchable6 joined, linkable6 joined, xinming left 01:06 xinming joined
lucs How can I fix this regex to match a non-digit printable character?: / <!digit> & <print> / 01:17
m: so 'x' ~~ / <!digit> & <print> / 01:18
camelia WARNINGS for <tmp>:
Useless use of "so " in expression "so 'x' ~~" in sink context (line 1)
lucs m: say so 'x' ~~ / <!digit> & <print> /
camelia False
lucs m: say so 'x' ~~ / <!digit> /
camelia True
lucs m: say so 'x' ~~ / <print> /
camelia True
guifa <!digit> is a negative lookaround. "They match, but they don't consume a character" per docs. 01:24
01:25 deoac joined
guifa m: (m/ <!digit> <print> /).so.say for <x 3> 01:25
camelia True
False
lucs Oh, I see, neat.
Thanks.
guifa (the opposite is a positive look around with <?digit> 01:26
m: (m/ <?digit> <print> /).so.say for <x 3>
camelia False
True
gugod <-digit> is probably what you want
lucs Well, I don't want to match a space. 01:27
guifa also 01:28
m: (m/ <+print -digit> /).so.say for <x 3>
camelia True
False
guifa the initial plus is important, because otherwise it gets interpreted as a method call
lucs I think I'd better go reread the regexes doc page... 01:29
But yeah, all that solves my problem. 01:30
Oh, by the way, in the description of the <punct> 01:32
character class, what does "(only Punct beyond ASCII)" mean?
Voldenet m: say so "。" ~~ /<punct>/ 01:35
camelia True
Voldenet m: say so "。、!?「」『』" ~~ /^<punct>+$/ 01:36
camelia True
Voldenet utf-8 punctuation is also matched
welp, unicode
lucs Okay, but why "only", shouldn't it be "also"? 01:37
m: say so ',' ~~ / <punct> / 01:38
camelia True
Voldenet "Symbols" but only <:P> ones 01:40
so… <punct> means punctuation (including unicode punctuation)
lucs I'm probably having trouble parsing the English there. 01:41
Voldenet it appears fairly confusing for me also 01:42
guifa yeah, I think it should just say "Including non-ASCII symbols" or something akin to that 01:44
gugod m: (m/ <+punct> /).so.say for qw/ , . : " ' < > = /; 01:45
camelia True
True
True
True
True
False
False
False
lucs Perhaps more precisely, Unicode points of the Pc, Pd, Pe, Pf, ... categories.
I'm really love the fact that for example Raku variable identifiers allow any characters from the L* Categories. 01:50
m: my $Džoo = 21; say $Džoo * 2
camelia 42
lucs It opens up the possibility of sigil-like notational devices, to name variables that somehow go together in a similar way. 01:51
gugod m: my $x = 41; my $xᅠ = 43; say ($xᅠ+ $x)/2; 01:53
camelia 42
gugod
or some amusements :)
guifa m: my @v = 3,4,5,7,8; my $v̄ = .sum / .elems with @v; say "The mean is $v̄" 01:55
camelia The mean is 5.4
lucs I've successfully (in my code) for example used variables named like $ᵢfoo for variables representing an index into an array (instead of $foo-ndx or something like that).
guifa: Yep, same idea.
Unfortunately, the current Vim syntax highlighter for Raku doesn't recognize those L* as being allowed in variable names, and the coloring suffers. 01:57
02:15 teatwo joined 02:16 teatwo left, teatwo joined 02:17 teatwo left, teatwo joined 02:18 tea3po left
tonyo . 02:52
03:18 linkable6 left, evalable6 left 03:19 evalable6 joined 03:21 linkable6 joined 03:34 deoac left 04:07 jmcgnh left 04:08 clarkema1 left, clarkema1 joined 04:16 jmcgnh joined 04:17 jpn joined 04:18 TypoToni left 04:22 jpn left 05:29 Util left 05:37 jpn joined 05:39 jaguart joined 05:41 Util joined 05:42 jpn left 05:44 jaguart left 05:45 zara joined 06:00 reportable6 left 06:02 reportable6 joined 06:03 zara left 07:03 linkable6 left, evalable6 left 07:04 linkable6 joined 07:05 evalable6 joined 07:06 zara joined 07:10 perlbot left, sena_kun joined 07:11 zara left, simcop2387 left 07:15 simcop2387 joined 07:17 perlbot joined 07:24 abraxxa joined 07:48 Sgeo left 08:34 jpn joined 09:34 linkable6 left, evalable6 left 09:35 evalable6 joined, linkable6 joined 10:35 linkable6 left 10:36 linkable6 joined
Anton Antonov Is there a way to serialize grammar objects? (So, they can be reused in different sessions.) I am/was thinking "CBOR::Simple" can be used... 11:07
Currently, I use grammar source code print-outs. (Via "Grammar::TokenProcessing".) 11:08
lizmat Grammars are basically classes 11:09
if grammars couldn't be serialized like classes , we wouldn't have a Raku based on a Raku grammar :-)
just put a grammar in a file as you would a class, and use it 11:10
Nemokosch hm, how to put it 11:11
a grammar is not like a usual class one would serialize because it doesn't revolve around data whatsoever 11:12
the "data" of a grammar is all "hardcoded" into methods
so "serializing" it, by usual terms, would mean basically a no-operation between using the very same "empty" (method-only/method-dominated) class twice 11:14
fair enough, you can call the source code of the grammar the serialization of it - with the usual security concerns of sharing code as data, if that is okay for the use-case 11:16
lizmat ah, ok, I guess I misunderstood the question 11:17
you should be able to call .raku on an instantiated Grammar object 11:18
it would basically give you a Match representation
m: grammar A { token TOP { .* } }; dd A.parse("foo") 11:19
camelia Match.new(:orig("foo"), :from(0), :pos(3))
Nemokosch I'm also not sure about the question but so far the way I understood it was a similar representation to, say, a Backus-Naur Form 11:20
Anton Antonov @lizmat "you should be able to call .raku on an instantiated Grammar object" -- I tried that on grammars I have generated and produced only the grammar (type) name. 11:22
Thanks for the interest lizmat and Nemokosch! My current solution is exemplified here : github.com/antononcube/Raku-Gramma...-code.raku 11:23
lizmat m: say Q|grammar A { token TOP { .* } }|.AST.statements.head.expression.DEPARSE 11:24
camelia grammar A { token TOP { .* } }
lizmat Anton Antonov ^ you want something like that ?
Anton Antonov @lizmat Yes, I just tried your example. Trying it on "bigger" grammars now. 🙂 11:25
11:28 zara joined 11:29 zara left
tbrowder__ howdy, all 11:56
i wonder why module builders can't be easier to use. i would love to be able to run a raku script during the build portion without a giant hassle, 11:58
back later...
12:00 reportable6 left 12:03 reportable6 joined 12:56 deoac joined 13:04 jgaz left 13:09 jgaz joined 14:09 bisectable6 left 14:11 bisectable6 joined 14:15 tea3po joined 14:16 tea3po left, tea3po joined 14:17 tea3po left, tea3po joined 14:18 teatwo left 15:03 Sgeo joined 15:17 TypoToni joined 15:22 sarna joined
ugexe tbrowder__: its pretty simple to run a raku script during the build phase 15:50
what are you trying that isn't working as you expect?
kybr zef can't install Cairo because it can't find the library because I am on a mac and it is in /opt/homebrew/lib and zef doesn't know that. how do I tell zef where to look for the library? 16:04
ugexe raku doesn't know that 16:05
tonyo kybr: usan environment variable 16:06
most likely setting DYLD_LIBRARY_PATH
or LD_LIBRARY_PATH 16:07
ugexe tbrowder__: something like gist.github.com/ugexe/d2bb004eea9c...52deffe46f should work 16:10
kybr ugexe: i don't know how to use that 16:12
tonyo: no luck with DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH 16:13
tonyo try with LD_LIBRARY_PATH
that's a more standard one
kybr doesn't work. but thanks 16:14
a symlink worked 16:16
16:22 linkable6 left, evalable6 left 16:23 linkable6 joined, evalable6 joined 16:24 abraxxa left 16:52 jpn left 16:55 jpn joined 17:01 perlbot left, simcop2387 left 17:05 falsifian left, oodani_ joined, andinus` left, oodani left, kaskal left
[Coke] symlink is the way to go. I think we have a writeup in some module's bug report somewhere. :| 17:06
I had similar issues on my m2 laptop trying to get something working with Nativecall
17:06 kaskal joined
tonyo LD_LIBRARY_PATH is useful for testing things, it does work if set correctly 17:07
symlink is much easier/more permanent
17:10 goblin joined, Matthew|m joined 17:27 jpn left 17:37 jpn joined 17:57 jpn left 18:00 reportable6 left, reportable6 joined 18:04 jpn joined 18:18 kathe joined 18:24 kathe left
patrickb docs.raku.org/language/nativecall#...is_ignored 18:31
18:37 TieUpYourCamel left 18:44 jpn left 18:49 jpn joined 19:49 linkable6 left, evalable6 left 19:53 deoac left 19:54 jpn left 19:57 TieUpYourCamel joined 20:23 jpn joined
tbrowder__ ugexe: that's great and helpful, but it need to be in the docs instead of or following the current entry. 20:27
if i get my current project working with it i'll take a shot at a doc PR. 20:28
thnx! 20:29
ugexe you could create a builder module to do it 20:43
see Distribution::Builder::MakeFromJSON
20:52 evalable6 joined 21:03 sena_kun left
tbrowder__ er, i have trouble figuring out what's going on with that. 21:03
I can create a Makefile to run raku scripts. Can that be transformed into such a builder? 21:05
the immediate need i have is a way to search for certain font files on the host system, and copy them to a location known to the module after it is installed. 21:08
tonyo i've used LD_LIBRARY_PATH to write libyaml 21:11
bindings
tbrowder__ i would 21:14
disregard finger fumble... 21:15
ugexe i'm having trouble understanding what you are having trouble with. that sounds like it is just adding the appropriate `run ...` in the Build.rakumod file 21:35
if you show me what you think should work i can comment further 21:37
tbrowder__ No, the Build.rakumod is pretty clear, it's the other one that's not so clear. 21:47
regarding Build.pm, what is $dist-path on github/workflows? 21:49
er, Build.rakumod 21:50
$dist-path i guess is '.' from the author's view 21:55
21:58 linkable6 joined 22:03 tea3po left 22:09 teatime joined 23:09 benchable6 left, statisfiable6 left, bisectable6 left, sourceable6 left, linkable6 left, shareable6 left, evalable6 left, tellable6 left, coverable6 left, unicodable6 left, committable6 left, reportable6 left, nativecallable6 left, squashable6 left, releasable6 left, bloatable6 left, greppable6 left, notable6 left, quotable6 left 23:10 benchable6 joined 23:11 unicodable6 joined, squashable6 joined, linkable6 joined 23:12 notable6 joined, nativecallable6 joined
ugexe It’ll be the directory the META6.json resides in 23:44