🦋 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.
antononcube @ugexe Do you a think C-version of the subs in “Text::Levenshtein::Damerau” should be placed in that package, or it should be a new one? (“Text::Levenshtein::Damerau::C” or whatever._ 00:03
pony m: my $a = gather take $++ while 1; say $a[0]; 05:49
camelia 0
ab5tract My frustrations last night are clearly related to the one argument rule. 09:01
But I do find it hard to justify this:
m: [ %( :a<b>, :c<d>, :d<e> ) ].elems.say
camelia 3
ab5tract Surely if I wanted a list of pairs, I would t have put it into a hash?
m: [ $%( :a<b>, :c<d>, :d<e> ) ].elems.say 09:02
camelia 1
ab5tract I guess it just is what it is, though. 09:04
lizmat you have no idea how that has been a difficult decision: it's the waterbed all over 09:36
at least it's consistent now
lizmat m: Array.new( %(:a<b>, :c<d>, :d<e>) ).elems.say # does that meet expectations ? 10:17
camelia 3
lizmat m: .say for %(:a<b>, :c<d>, :d<e>) # or this? 10:18
camelia d => e
c => d
a => b
lizmat m: .say for :a<b>, :c<d>, :d<e> # or this?
camelia a => b
c => d
d => e
lizmat they're all example of the 1 argument role 10:19
and that comma is the list builder, not parens
ab5tract Ah, the Array.new approach does indeed match expectations 10:21
lizmat well, that's what [ ] does under the hood 10:22
github.com/rakudo/rakudo/blob/8706...mod#L7-L16 10:24
ab5tract m: [ %( :a<b>, :c<d>, :d<e> ) ]  ~~ Array.new( %( :a<b>, :c<d>, :d<e> ) ) ==> say()
camelia True
ab5tract I misread the output. I understand and appreciate that this was difficult to nail down 10:25
lizmat before the GLR it was a mess that was even harder to understand / teach 10:27
ab5tract Fair point. I guess for my taste hashes shouldn’t be auto-flattened in any case (that’s why |%h and %h.pairs are for). But the ship has sailed and in the light of day I see the source of and reasoning for what I was butting heads against yesterday 10:36
lizmat well... fwiw, one of the reasons (and I repeat: one of them) was to meet Perl user expectations 10:55
ab5tract: also, if you want to change semantics of { } lexically, you could do: 10:59
m: sub circumfix:<{ }>(|c) { item %(|c) }; dd { foo => "bar" }
camelia ${:foo("bar")}
lizmat versus: 11:00
m: dd { foo => "bar" }
camelia {:foo("bar")}
lizmat m: sub circumfix:<{ }>(|c) { item %(|c) }; [ { :a<b>, :c<d>, :d<e>} ].elems.say 11:01
camelia Odd number of elements found where hash initializer expected:
Only saw: $(:a("b"), :c("d"), :d("e"))
in sub circumfix:<{ }> at <tmp> line 1
in block <unit> at <tmp> line 1
lizmat meh :-)
anyways, you get the picture... 11:02
ab5tract :) 11:08
Since one of my goals is to ease potential readers of the code into Raku as gently as possible, the best option may in fact be to just add a second hash to this test case :) 11:14
antononcube @ab5stract "My frustrations last night are clearly related to the one argument rule." -- It was late for me also, when I read your code about this and I planned to try investigate myself. But well you figured it out -- and it is "good to know." 12:18
tbrowder any mac users have the binary fontconfig dev library working? 12:42
lizmat not 12:43
antononcube LOL
Does anyone know / recommend a GitHub repository with a complete and minimal example of using NativeCall ? 15:46
lizmat github.com/lizmat/P5localtime/blob...me.rakumod # as minimal as it gets 15:53
antononcube @lizmat Yes, looks minimal. Thanks! 15:57
lizmat no external library needed even :-) 15:58
antononcube That is too minimal for me, but still instructive. 16:06
lizmat antononcube whar's too minimal about it ? 16:41
*what
no external library?
raku.land/zef:lizmat/Unix::errno simple external library 16:42
lizmat github.com/lizmat/Unix-errno/blob/...#L136-L172 16:43
antononcube @lizmat It seems I needed a more comprehensive example in order to make some faster string distance computations. 17:19
github.com/antononcube/Raku-Math-D...tions-Edit 17:20
ugexe not sure using `const char *s1` is ideal for an edit distance - what about wide characters? 17:26
github.com/ugexe/Text--Levenshtein...-int.c#L69 17:27
when i did a C library I still used perl to convert things to ords and compared those
antononcube @ugexe Unfortunately, when I read your package documentation 4-5 years ago I was too ignorant about Raku, and missed that dld has a 3rd argument. 17:28
Meaning, did not understand how to use the output. 17:29
My C-implementation is mostly for orientation how much faster it is. (If at all.) 17:30
ugexe There is also StrDistance core raku class written in nqp (but only levenstein not damerau) 17:31
antononcube Right, I tried that too.
See here: github.com/antononcube/Raku-Math-D...ances.raku 17:32
tbrowder ugexe: in a module i'm working on (unpublished) i test it by installing it locally with "zef install . --debug" 20:39
when i do that, i get ' perl5' directory generated in the module rep and it has a subdir of ' perl5/short' 20:41
i am using a Build.rakumod module in the process. 20:42
i have searched all the module's code and don't see any reference to such. any debugging suggestions? 20:47
note the ' perl5' and its subdir are empty 20:48
there are quite a few dependencies and they are already installed 20:49
ok i see some more zef options to try... 20:51
it appears in both of the repos where i use Build and do a zef install . 21:22
tbrowder i can't pin it down, but no harm as far as i can tell...fingers crossed 21:33
[Coke] where's your source? 22:04
antononcube Cannot push to GitHub. 😦 22:05
It looks like it is a global problem...