🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Logs can be inspected at colabti.org/irclogger/irclogger_log/raku
Set by lizmat on 1 May 2021.
00:02 reportable6 left 00:03 reportable6 joined 00:36 aborazmeh left 00:38 aborazmeh joined 00:39 aborazmeh left 00:43 brtastic left 01:33 canbenshanlo left 01:34 kvw_5 left 01:36 kvw_5 joined 02:10 parabolize joined 03:10 evalable6 left, statisfiable6 left, sourceable6 left, tellable6 left, bloatable6 left, reportable6 left, nativecallable6 left, releasable6 left, quotable6 left, greppable6 left, bisectable6 left, coverable6 left, committable6 left, linkable6 left, notable6 left, shareable6 left, unicodable6 left, squashable6 left, benchable6 left 03:11 greppable6 joined, quotable6 joined, statisfiable6 joined, unicodable6 joined, tellable6 joined, nativecallable6 joined, squashable6 joined 03:12 shareable6 joined, benchable6 joined, reportable6 joined, releasable6 joined, evalable6 joined, bisectable6 joined, notable6 joined, bloatable6 joined 03:13 sourceable6 joined, linkable6 joined, committable6 joined 03:14 coverable6 joined 03:20 |Sno| joined 03:23 [Sno] left 03:47 rindolf joined 04:28 tejr left 04:30 tejr joined 04:59 squashable6 left 05:01 squashable6 joined 05:54 stoned75 joined 06:02 reportable6 left 06:03 epony left 06:04 reportable6 joined 06:05 epony joined 06:24 wamba joined 06:25 Sgeo left, Sgeo_ joined, stoned75 left 06:28 parabolize left 07:05 sxmx1 left 07:16 brtastic joined 07:18 stoned75 joined 07:45 aluaces joined 08:32 stoned75 left
Geth doc: 9ef2ef0046 | (JJ Merelo)++ | doc/Language/variables.pod6
Removing references to "interpolation"

Slightly rewording and explaining what a twigil is, too. Following @treyharris pointed advice on the thoughts on the original test. Closes #2588
linkable6 Link: docs.raku.org/language/variables
08:48 linkable6 left 08:49 linkable6 joined 08:52 daxim left 08:55 frost-lab joined 08:56 squashable6 left, pecastro joined 08:57 squashable6 joined 08:59 Sgeo_ left 09:08 daxim joined 09:41 stoned75 joined 10:15 rindolf left 10:17 Black_Ribbon left
Geth doc: d685762903 | (JJ Merelo)++ | 2 files
Splits the "environment variables" file in two parts

The original file no longer reflected its intent, so it's better to have it split. It also helps with making information on running raku more prominent, following #2263
doc: 185de4d168 | (JJ Merelo)++ | doc/Programs/04-running-raku.pod6
Changes text to current raku -h text

Which includes a good amount of stuff...
doc: 530d05ed56 | (JJ Merelo)++ | doc/Programs/04-running-raku.pod6
Some clarifications #2263

It remains to check if those target options still remain.
10:18 linkable6 left 10:19 linkable6 joined 10:28 linkable6 left 10:31 linkable6 joined 10:42 canbenshanlo joined 11:01 rindolf joined 11:49 brtastic left 11:54 holli left 12:02 reportable6 left 12:04 reportable6 joined 12:30 whatnext joined 12:32 linkable6 left
whatnext hello all:)  quick question: I understand that executing a method stored in a variable can be done via `$object."$variable"()` - but what about a meta method? Neither `$object."^$variable"()` or `$object.^"variable"()` seem to work? 12:33
12:35 linkable6 joined
codesections there might be a shorter way, but this is what comes to mind: 12:38
m: my $meth = 'methods'; say 42.HOW."$meth"(42)
camelia (new Capture Int sign Num Rat FatRat abs Bridge sqrt base polymod expmod is-prime floor ceiling round lsb msb narrow Range conj rand sin asin cos acos tan atan atan2 sec asec cosec acosec cotan acotan sinh asinh cosh acosh tanh atanh sech asech cosech…
codesections (42.^methods is just sugar for 42.HOW.methods(42)) 12:39
whatnext ah yes ok I get it - thanks I will try that 12:40
ecocode[m]1 is HOW an acronym ? 13:16
13:17 whatnext left
codesections Yeah, for Higher Order Workings (I wasn't around, but I suspect they really wanted it to spell HOW, because that doesn't mean a whole lot...) 13:18
13:24 wamba left
tobs it also ties into WHO, WHICH, WHAT and WHY, other ALLCAPS introspection methods 13:26
and WHERE 13:27
ecocode[m]1 thx ! 13:58
14:05 domidumont joined 14:17 DiffieHellman left 14:18 DiffieHellman joined 14:41 frost-lab left 14:48 spacebat2 left 14:49 spacebat2 joined
xinming is there a json kind of file format which has richer types but cross platform please? 15:00
ugexe xml?
codesections TOML and YAML are also frequently suggested 15:01
15:06 rindolf left 15:07 parabolize joined
Geth doc: ea511b1702 | (Stoned Elipot)++ | doc/Language/nativetypes.pod6
Use code formatting
linkable6 Link: docs.raku.org/language/nativetypes
ecocode[m]1 < matrix.org/_matrix/media/r0/downlo...essage.txt > 15:18
xinming ugexe: xml feels too lengthy 15:19
I'll check TOML, I don't like yml
ecocode[m]1 < matrix.org/_matrix/media/r0/downlo...essage.txt > 15:20
15:45 stoned75 left 15:56 daxim left, daxim joined 16:18 Kaeipi joined, Kaiepi left 16:19 sftp left, sftp joined 16:23 Kaeipi left, sena_kun left, Kaeipi joined 16:25 sena_kun joined 16:31 aluaces left 16:42 mowcat joined
tbrowder howdy! 16:46
pray tell what is the unicode hex value for the tiny newline char as is desired in a pod doc OUTPUT: line? 16:48
lizmat m: say "foo" 16:50
camelia foo
lizmat m: say "␤".ord
camelia 10
lizmat m: say "␤".uniname
camelia <control-000A>
lizmat hmmmm
some weird interaction there, locally: 16:51
$ r 'say "␤".ord.base(16)'
$ r 'say "␤".uniname' 16:52
tbrowder the two enclosing guillemot codes are xaa and xbb 16:53
i can use the uniname, thanks, lizmat 16:54
lizmat m: say "\x2424" 16:55
ecocode[m]1 < matrix.org/_matrix/media/r0/downlo...essage.txt > 17:00
tbrowder m: say "\c[symbol for newline]" 17:02
tbrowder m: say "\c[newline]" 17:03
camelia 5===SORRY!5=== Error while compiling <tmp>
Unrecognized character name [newline]
at <tmp>:1
------> 3say "\c[newline7⏏5]"
lizmat ecocode[m]1 not sure how to interpret the gist: if it is a question, why not just asked ? 17:07
17:09 brtastic joined
ecocode[m]1 lizmat: there is a question 😉 "How do I send a pointer to an int32 raku var to a C-function ? " 17:09
but it is probably bad formulated
* but it is probably badly formulated
lizmat isn't this just about setting up the right signature for the "is native" sub? 17:10
tbrowder m: say "OUTPUT: \xabsome string\x2424\bb"
camelia OUTPUT: «some string
tbrowder m: print "\xabsome string\x2424\xbb" 17:11
camelia «some string
ecocode[m]1 ```
sub cfunc ( int32 is rw ) returns int32 is native('mylib') {*};
but does not work 17:12
or maybe it does, but I can't figure how to send take a Pointer to my ```int32 $var``` when I call the sub 17:13
* or maybe it does, but I can't figure how to take a Pointer to my `int32 $var` when I call the sub
lizmat from this code I cannot draw any conclusion on what could be wrong 17:14
need some code that shows a wrong answer and what you expect it to be
ecocode[m]1 hmmm 17:15
I'm trying to call a function from the lpsolve lib
I can send you the code I am trying out, but you'd need to install the lib on your system ... 17:16
and I don't want you to bloat your system for me 17:17
17:17 wamba joined
lizmat please make a gist of the code 17:18
is that lib apt-gettable ? 17:19
ecocode[m]1 glot.io/snippets/fynuds3xgg 17:20
<lizmat "is that lib apt-gettable ?"> I guess so... it should be called lpsolve
lizmat E: Unable to locate package lpsolve # meh 17:21
ecocode[m]1 > <@freenode_lizmat:matrix.org> is that lib apt-gettable ?
* I guess so... it should be called lp-solve
lizmat echo!
ecocode[m]1 corrected: lp-solve
```my $pv_row = nativecast(Pointer[num64],$v_row);``` 17:24
is just one of the many trials I did...
I did not expect it function
lizmat Cannot locate native library 'liblp-solve55.so' # meh 17:27
it *is* there
17:29 aluaces joined
ecocode[m]1 hmprf 17:30
lizmat Native call cast expected return type with CPointer, CStruct, CArray, or VMArray representation, but got a P6opaque (Num)
does that sound familiar ?
ecocode[m]1 yup
at least with the code I pushed ... 17:31
still trying out a lot of stuff
no success though
I can't seem to get a Pointer to the num64 $v_row 17:33
and nativecall is very opaque to me (if that is what I need)
lizmat ecocode[m]1: I don't see immediately what is wrong, I hope someone else will pick this up 17:36
ecocode[m]1 Ok. Thanks for looking into this ! 17:38
lizmat ecocode[m]1 just too deep into other stuff atm, sorry
in any case, looks like debian has the lp-solve library installed by default, so there no problem wrt bloating systems 17:39
ecocode[m]1: fwiw, I'm working on a better way to look at the IRC logs: 17:46
logs.liz.nl/raku/search.html # alpha version
ecocode[m]1 awesome ! 17:50
18:01 holli joined 18:02 reportable6 left 18:03 reportable6 joined
El_Che hi ecocode[m]1 18:03
raydiak ecocode[m]1: add_constraintex is expecting arrays, not just pointers to single values. something more like "sub add_constraintex( LPrec, int32, CArray[num64], CArray[int32], int32, num64)" is probably closer 18:04
18:17 canbenshanlo left, holli left
ecocode[m]1 <raydiak "ecocode: add_constraintex is exp"> I'll try that out 18:21
18:27 patrickb joined 18:33 domidumont left
raydiak here is one working example: gist.github.com/raydiak/4b41408ebf...ba54f23c4f 18:37
not saying it's the best way to do it, I'm no expert with nativecall and typed arrays and all that, but hopefully it's a starting point for learning 18:40
ecocode[m]1 thx ! 18:41
raydiak you're welcome :)
ecocode[m]1 I had this glot.io/snippets/fynwl27pky , but that gave an error... 18:42
I compare with yours 😀
18:44 stoned75 joined
raydiak also notice you can't have a space between "sub" and "(arg, arg, ...)". you can either do "sub arg, arg, ..." or "sub(arg, arg, ...)". it treats "sub (arg, arg, ...)" as passing a single list instead of multiple arguments to the sub 18:44
ecocode[m]1 excellent ! that space solved the issue !!!! 18:46
raydiak just for future reference, telling us what error you're getting can be very useful instead of just "an error" :) 18:47
ecocode[m]1 now that is weird though
is that only for NativeCall subs ? or also for normal methods ? 18:48
raydiak all subs
18:48 Sgeo joined
ecocode[m]1 yup, figured that 😀 18:48
it still feels weird ;) 18:49
raydiak it thinks "sub (arg1, arg2, ...)" is the "sub arg1, arg2, ..." form because of the space, so it treats the "(arg1, arg2, ...)" as a List being passed all into the first parameter
ecocode[m]1 because you define methods with a space after the subname and you can't when you call it 18:50
yup, I understand the idea..
raydiak you can define subs/methods without the space if it makes you feel better :) 18:51
ecocode[m]1 maybe it is good practice to never add a space between subname and (
lizmat that's what I prefer, but people like Tux disagree :-) 18:52
but then, they have a slang all to their own :-)
ecocode[m]1 so you do ```subname( arg1, arg2 )``` 18:53
or you just remove all the spaces ?
raydiak I don't, but you can :)
I tend to just not use the () unless I have to
ecocode[m]1 hmmm 18:54
when do you "have to" ?
raydiak my definitions usually look like "sub subname ($param1, $param2) {" and call like "subname $arg1, $arg2;" 18:55
ecocode[m]1 I'd love to have a rakutidy for this 😀
raydiak if there's something else after the sub call you need the parens. e.g. "get_something($with, $args).do_something_else_with_it" 18:56
ecocode[m]1 ah ok
raydiak or if it's in a list like "(sub1($arg), sub2($arg))" 18:57
because (sub1 $arg, sub2 $arg) parses as (sub1($arg, sub2($arg))) 18:58
I think
anywhere it seems ambiguous I just add the parens to make sure 18:59
ecocode[m]1 yup, I'll follow the footsteps of lizmat 😀 19:00
well, now that the code seems to work, it looks pretty clean 🤓
raydiak she is an excellent example to follow, very clean and clear code from what I've seen. better than my own, for sure
19:48 linkable6 left, evalable6 left, linkable6 joined 19:49 evalable6 joined 20:46 brtastic left 20:48 stoned75 left 20:59 rindolf joined 21:09 wingfold joined 21:12 patrickb left 21:22 kst left 21:30 mowcat left
raydiak m: sub f (Num() @a) { dd @a }; f [1] 21:37
camelia Type check failed in binding to parameter '@a'; expected Positional[Num(Any)] but got Array ([1])
in sub f at <tmp> line 1
in block <unit> at <tmp> line 1
raydiak this is something I never quite learned...I get that it isn't accepting it because the type of the passed array doesn't match the type of the parameter, but how *do* I get it to accept a plain untyped list of whatever and coerce it to an array of e.g. Num in this example?
21:37 wingfold left, kst joined
codesections m: sub f (Array[Num()]() $a) { dd $a}; say f [1] 21:39
camelia Array[Num(Any)].new(1e0)
codesections I don't know how to do so with an @ sigil, though 21:40
raydiak thanks! can I do that with an @-sigiled parameter?
ah, you beat me :)
codesections yeah, it _seems_ like there should be a way..., but I haven't found it 21:41
tonyo m: sub f (Num() @a) { dd @a; }; my Int @b = 1,2,3; f @b 21:42
camelia Array[Int] @b = Array[Int].new(1, 2, 3)
tonyo hmm
m: say Int ~~ Num(); 21:44
camelia True
codesections m: sub f (Array[Num()]() $a, @a = $a) { dd @a}; say f [1] # Not sure if this counts :D 21:45
camelia Array[Num(Any)].new(1e0)
raydiak heh...I'd be more inclined to put that in the body than the sig 21:50
codesections yeah, agreed, … but that _clearly_ wouldn't be creating an @-sigiled param, where as this kind of is 21:52
or, is, but at too high a cost
raydiak are you lawyering me? ;) 22:02
tonyo m: sub f (@a where { $_.map: *.=Num }) { dd @a[0]; }; f( [1,2,3] ); f([qw<a b c>]) 22:04
camelia Num element = 1e0
Failure element = Failure.new(exception => X::Str::Numeric.new(source => "a", pos => 0, reason => "base-10 number must begin with valid digits or '.'"), backtrace => Backtrace.new)
tonyo that works too but is just as ugly
codesections re lawyering 22:05
tonyo: I _think_ that has different semantics -- doesn't that always do a run-time check, whereas Array[Num()]() is at least theoretically compile-time? 22:06
tonyo yea that's always runtime 22:07
the coercion has to be runtime too 22:14
codesections fair point. Well, if we have to drop to runtime, then this is also an option 22:17
m: sub f (@a where all .map: * ~~ :Num | 0) { dd @a }; say f [1]; say f [1, 0]; f <a b c> 22:18
camelia Array element = [1]
Array element = [1, 0]
Constraint type check failed in binding to parameter '@a'; expected anonymous constraint to be met but got List (("a", "b", "c"))
in sub f at <tmp> line 1
in block <unit> at <tmp> line…
codesections (it'd actually be fairly pretty but for that 0 edge case ...) 22:19
22:23 aluaces left 22:24 dogbert11 left 22:25 dogbert11 joined
tonyo i guess it could be compile if everything was typed, eg eating json from a webservice into a predefined structure 22:30
22:33 wamba left 22:35 rindolf left 22:58 pecastro left 23:01 thundergnat joined
thundergnat m: sub f (*@a where {.=map: *.Num}) { dd @a; }; f 0, 1e0, 3, 1.19, e; 23:01
camelia Array element = [0e0, 1e0, 3e0, 1.19e0, 2.718281828459045e0]
tonyo m: sub f (*@a where {.=map: *.Num}) { dd @a; }; f 'a', 'b'; 23:05
camelia Array element = [Failure.new(exception => X::Str::Numeric.new(source => "a", pos => 0, reason => "base-10 number must begin with valid digits or '.'"), backtrace => Backtrace.new), Failure.new(exception => X::Str::Numeric.new(source => "b", pos => 0, …
23:06 dotdotdot left 23:08 dotdotdot joined
tonyo m: sub f (*@a where {all .=map: *.Num}) { dd @a; }; f 'a', 'b'; 23:10
camelia Constraint type check failed in binding to parameter '@a'; expected anonymous constraint to be met but got Array ([&CORE::infix:<orels...)
in sub f at <tmp> line 1
in block <unit> at <tmp> line 1
tonyo m: sub f (*@a where {all .=map: *.Num}) { dd @a; }; f 3, 4;
camelia Array element = [3e0, 4e0]
thundergnat m: sub f (*@a where {.=map({$_ ~~ Numeric ?? .Num !! Num}) }) { dd @a; }; f 0, 1e0, 3, 1.19, e, 'a'; 23:52
camelia Array element = [0e0, 1e0, 3e0, 1.19e0, 2.718281828459045e0, Num]
moon-child m: say 5i ~~ Numeric; say 5i.Num 23:57
camelia True
Cannot convert 0+5i to Num: imaginary part not zero
in block <unit> at <tmp> line 1
japhb s/Numeric/Real/