librasteve | renormalist: not that i’m aware of - i find that bash history/search is quite good after a while guess you have that already | 11:38 | |
11:58
Guest81 joined
12:06
Guest81 left
14:53
lizmat_ joined
14:57
lizmat left,
lizmat_ left
14:58
lizmat joined
17:26
stanrifkin joined
|
|||
renormalist | librasteve: ok, thanks, so at least I haven't created something overly redundant with my new repo yesterday: github.com/renormalist/raku-tools-...completion | 18:44 | |
18:46
renormalist left,
renormalist joined
|
|||
renormalist | m: my $x="9"; my $y="10"; say $x before $y ?? "ordered" !! "unordered";' | 20:00 | |
camelia | ===SORRY!=== Error while compiling <tmp> Unable to parse expression in single quotes; couldn't find final "'" (corresponding starter was at line 1) at <tmp>:1 ------> before $y ?? "ordered" !! "unordered";'⏏<EOL> expecting … |
||
renormalist | m: my $x="9"; my $y="10"; say $x before $y ?? "ordered" !! "unordered"; | ||
camelia | unordered | ||
renormalist | m: my $x=9; my $y=10; say $x before $y ?? "ordered" !! "unordered"; | ||
camelia | ordered | ||
renormalist | m: my $x; my $y=10; say $x before $y ?? "ordered" !! "unordered"; | 20:01 | |
camelia | Use of uninitialized value of type Any in string context. Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful. ordered in block <unit> at <tmp> line 1 |
||
renormalist | Extreme beginner here. I want to compare any type, and the "before/after" operators are said to work according to the type. Now how do I also let them Do The Right Thing with undefined values? | 20:02 | |
I don't even know what to choose for Perl's "undef" in Raku yet. | 20:03 | ||
Nil, Any, etc. - so please assume I am still an absolute idiot when you answer. Thanks. :-) | |||
(referring to the 3 m: lines above my question) | 20:09 | ||
librasteve | renormalist: suggest you try raku.guide as a good intro | 20:48 | |
I'll take a look at your completion stuff in a while - meantime on the specifics you ask | 20:49 | ||
ok - I gather that you are trying to work out the ordering of 9 and 10 (this is not clear from your question, but gotta start somewhere ;-0 ) | 20:52 | ||
20:54
MasterDuke joined
|
|||
m: my $x="9"; my $y="10"; say $x < $y ?? "ordered" !! "unordered";' | 21:06 | ||
Raku eval | Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Unable to parse expression in single quotes; couldn't find final "'" (corresponding starter was at line 1) at /home/glot/main.raku:1 ------> ay $x < $y ?? "ordered" !! "unordered";'⏏<EOL> expecting any of: single quotes term | ||
librasteve | m: my $x="9"; my $y="10"; say $x < $y ?? "ordered" !! "unordered"; | 21:07 | |
Raku eval | ordered | ||
librasteve | m: my $x="9"; my $y="10"; say $y < $x ?? "ordered" !! "unordered"; | ||
Raku eval | unordered | ||
librasteve | before and after are quite technical operators that relate to StringDist docs.raku.org/language/operators#t...literation | 21:08 | |
thay can also be used in regexes | 21:09 | ||
for numeric ordering you can use <, > and so on docs.raku.org/language/operators#infix_%3C | 21:10 | ||
or you can use the spaceship operator | 21:11 | ||
m: my $x="9"; my $y="10"; say $y <=> $x; | 21:12 | ||
Raku eval | More | ||
librasteve | m: my $x="9"; my $y="10"; say $x <=> $y; | ||
Raku eval | Less | ||
librasteve | m: +"9".say | 21:19 | |
Raku eval | 9 WARNINGS for /home/glot/main.raku: Useless use of "+" in expression "+\"9\".say" in sink context (line 1) | ||
librasteve | raku can happily treat a Str like "9" as a Num with the + prefix operator ... any numeric comparison <,>,<=> automagically does this | 21:21 | |
m: +"9".^name.say | 21:22 | ||
Raku eval | Str WARNINGS for /home/glot/main.raku: Useless use of "+" in expression "+\"9\".^name.say" in sink context (line 1) | ||
librasteve | m: my $x="9"; say (+$x).^name; | 21:23 | |
Raku eval | Int | ||
librasteve | .^name gives you the type name | 21:24 | |
21:34
Manifest0 joined
|
|||
renormalist | libreasteve: thanks for the time. Let's see I get my problem narrowed down: | 22:17 | |
I want to write a sort function that works with any elements. I could do an explicit type handling for Num, Str respectively. | |||
So I hoped there would be some common operator which works depending on Type. I understand that before/after seem to be from the wrong Type classes for my case. Would "cmp" be the right thing? | 22:22 | ||
cmp ... "Smart three-way comparator" says raku.guide. Let me try it... | 22:23 | ||
m: my $x=9; my $y=10; say ($x cmp $y == Same|Less) ?? "ordered" !! "unordered"; | 22:28 | ||
camelia | ordered | ||
renormalist | m: my $x="9"; my $y="10"; say ($x cmp $y == Same|Less) ?? "ordered" !! "unordered"; | 22:29 | |
camelia | unordered | ||
renormalist | I hope using a junction "Same|Less" is valid usage, equivalent to numeric "<=" or string "le". | 22:31 | |
antononcube | @renormalist Please add a “Why” section or a mission statement to “Data::DPath” : github.com/renormalist/raku-Data-DPath | 23:00 | |
Seems intriguing… | |||
renormalist | antononcube: Yeah, so far Data::DPath is just the package, I try to port everything from Perl. So far I'm still experimenting with super-basic basics with Raku. | 23:28 | |
antononcube: In the meantime you can read Data::DPath on Perl's metacpan, if that's what you are directly interested in. I will add a Why when I actually get to the code. | 23:29 | ||
So here is my problem in actual code: github.com/renormalist/raku-Acme-R...istic-Sort . | 23:33 | ||
When I uncomment the very last the with the single Nil in the list, github.com/renormalist/raku-Acme-R...kutest#L32 , then it prints warnings I try to fix. | |||
*the very last test | 23:36 |