timo | we do have things like trait_mod:is<blah> and friends but these have a word between the : and <...> | 00:00 | |
and of course the statement:sym<if> and such in the grammar | |||
ab5tract | I was thinking along the lines of porting the `%h<key>:kv` behavior | 00:01 | |
timo | right, that applies to all kinds of operators, so a map operator could be made to take these | ||
ab5tract | but maybe it's just as good to provide the candidates you already mentioned | ||
hmm... an infix:<map> ... very intriguing :) | 00:04 | ||
timo | m: multi sub postcircumfix:<🗺️ 🗺️>($on, $with) { $on.map($with) }; multi sub postcircumfix:<🗺️ 🗺️>($on, $with, :$flat!) { $flat ?? $on.flatmap($with) !! $on.map($with) }; multi sub postcircumfix:<🗺️ 🗺️>($on, $with, :$deep!) { $deep ?? $on.deepmap($with) !! $on.map($with) }; .say for [[1, "a"], [2, "b"], [3, "c"]]🗺️ * ~ "lol" 🗺️:flat; .say for [[1, "a"], [2, | 00:05 | |
"b"], [3, "c"]]🗺️ * ~ "lol" 🗺️:deep; | |||
camelia | ===SORRY!=== Error while compiling <tmp> Unable to parse expression in array composer; couldn't find final ']' (corresponding starter was at line 1) at <tmp>:1 ------> ~ "lol" 🗺️:flat; .say for [[1, "a"], [2,<HERE><EOL> expecting any… |
||
timo | ah damn too long | ||
ab5tract | EOLostThePlot | 00:06 | |
timo | m: multi sub postcircumfix:<🗺️ 🗺️>($on, $w) { $on.map($w) }; multi sub postcircumfix:<🗺️ 🗺️>($on, $w, :$flat!) { $flat ?? $on.flatmap($w) !! $on.map($w) }; multi sub postcircumfix:<🗺️ 🗺️>($on, $w, :$deep!) { $deep ?? $on.deepmap($w) !! $on.map($w) }; my @a = [1, "a"], [2, "b"], [3, "c"]; .say for @a🗺️ * ~ "lol" 🗺️:flat; .say for @a🗺️ * ~ "lol" | 00:07 | |
🗺️:deep; | |||
camelia | ===SORRY!=== Error while compiling <tmp> Unable to parse expression in postcircumfix:sym<🗺️ 🗺️>; couldn't find final '🗺️' (corresponding starter was at line 1) at <tmp>:1 ------> * ~ "lol" 🗺️:flat; .say for @a🗺️ * ~ "lol… |
||
timo | nooooo | ||
m: multi sub postcircumfix:<🗺️ 🗺️>($on, $w) {$on.map($w)}; multi sub postcircumfix:<🗺️ 🗺️>($on, $w, :$flat!) {$flat ?? $on.flatmap($w) !! $on.map($w)}; multi sub postcircumfix:<🗺️ 🗺️>($on, $w, :$deep!) {$deep ?? $on.deepmap($w) !! $on.map($w)}; my @a = [1,"a"],[2,"b"],[3,"c"]; .say for @a🗺️ *~"!" 🗺️:flat; .say for @a🗺️ *~"?" 🗺️:deep; | |||
camelia | WARNINGS for <tmp>: 1 a! 2 b! 3 c! [1? a?] [2? b?] [3? c?] Useless use of "~" in expression "*~\"?\"" in sink context (line 1) Useless use of "~" in expression "*~\"!\"" in sink context (line 1) |
00:08 | |
timo | i'm not sure why it's behaving like that | 00:10 | |
like, it's doing what i expect it to, it's mapping flat first, and deep second, but the warnings though? | |||
ab5tract | EEMOJITOOPOWERFULDOWNGRADEORCRY | 00:14 | |
which of cours triggers EERRTXT2LNG | |||
timo: does it break that way locally? | 00:15 | ||
timo | m: multi sub postcircumfix:<☺ ☺>($on, $w) {$on.map($w)}; multi sub postcircumfix:<☺ ☺>($on, $w, :$flat!) {$flat ?? $on.flatmap($w) !! $on.map($w)}; multi sub postcircumfix:<☺ ☺>($on, $w, :$deep!) {$deep ?? $on.deepmap($w) !! $on.map($w)}; my @a = [1,"a"],[2,"b"],[3,"c"]; .say for @a☺ *~"!" ☺:flat; .say for @a☺ *~"?" ☺:deep; | 00:17 | |
camelia | WARNINGS for <tmp>: 1 a! 2 b! 3 c! [1? a?] [2? b?] [3? c?] Useless use of "~" in expression "*~\"!\"" in sink context (line 1) Useless use of "~" in expression "*~\"?\"" in sink context (line 1) |
||
timo | this should be more copy-paste-friendly | 00:18 | |
it doesn't throw "useless use" warnings when i make it a curly block with $_ instead of a WhateverCode | 00:21 | ||
m: sub postcircumfix:<X[ ]X>($on, $w) { say "yop"; $on.map($w) }; say [1,2,3]X[* ~ "hi"]X | 00:23 | ||
camelia | WARNINGS for <tmp>: yop (1hi 2hi 3hi) Useless use of "~" in expression "* ~ \"hi\"" in sink context (line 1) |
||
timo | not related to using silly emoji and stuff, and also triggers without an adverb | 00:24 | |
ab5tract | m: sub infix:<map>($inv, &block, :$flat!) { $inv.flatmap: &block }; dd [[1,2],[3,4]] map:flat { $_.map(*+1) } | 00:26 | |
camelia | ===SORRY!=== Error while compiling <tmp> Unexpected block in infix position (missing statement control word before the expression?) at <tmp>:1 ------> map: &block }; dd [[1,2],[3,4]] map:flat<HERE> { $_.map(*+1) } expecting any of: … |
||
ab5tract | ^^ the semantics my druthers dream of | 00:27 | |
m: sub infix:<map>($inv, &block, :$flat!) { $inv.flatmap: &block }; dd [[1,2],[3,4]] map { $_.map(*+1) } :flat | |||
camelia | (2, 3, 4, 5).Seq | ||
ab5tract | ^^ the way it works | ||
m: sub infix:<map>($inv, &block, :$flat!) { $inv.flatmap: &block }; dd [[1,2],[3,4]] map:flat, { $_.map(*+1) } | |||
camelia | Type check failed in binding to parameter '&block'; expected Callable but got Pair (:flat) in sub infix:<map> at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
ab5tract | That's probably a bit of an infix quirk.. I wonder what it would take to get that functional | 00:28 | |
m: Q| sub postcircumfix:<X[ ]X>($on, $w) { say "yop"; $on.map($w) }; say [1,2,3]X[* ~ "hi"]X |.AST.EVAL.say | 00:29 | ||
camelia | ===SORRY!=== Cannot find method 'to-begin-time' on object of type QAST::Op |
||
ab5tract | dang, I love it when that just Fixes It | 00:30 | |
timo | i think it makes sense that it would do that thing with the pair object up there | 00:32 | |
you are terminatign the argument sequence with the , so it takes what it can | |||
i imagine if the argument asked for Any $foo it would then complain about the lack of the named argument | |||
ab5tract | well my initial example doesn't inclue a `,` | 00:33 | |
that was just a stab. the preferred semantics are (1) `@a.map:flat[':'?] &block` or (2) @a map:flat &block | 00:34 | ||
anyway, I should take an honest try at sleeping :) | 00:35 | ||
timo | best of luck! | ||
01:42
librasteve_ left
|
|||
Geth | PrettyDump/main: 447beb12a1 | (Patrick Böker)++ | lib/PrettyDump.rakumod Fix `pd` to print the results out, as it should |
07:59 | |
PrettyDump/main: 3010484511 | (Patrick Böker)++ | lib/PrettyDump.rakumod Make `pd` return it's input This allows putting pd in the middle of a pipeline. |
|||
PrettyDump/main: 0aa97642af | (Patrick Böker)++ (committed using GitHub Web editor) | lib/PrettyDump.rakumod Merge pull request #2 from raku-community-modules/pd-fix-and-improvement Pd fix and improvement |
|||
09:40
sena_kun joined
|
|||
Geth | PrettyDump/refs/tags/1.2.3: 53652f96c3 | (Patrick Böker)++ | 2 files 1.2.3 |
09:56 | |
09:57
sjn joined
|
|||
Geth | PrettyDump/main: 8831aa6de3 | (Patrick Böker)++ | 2 files 1.2.3 |
09:58 | |
timo | MasterDuke, the graph for the sorted_keys timings is a bit silly, since you can't really see any values except for the 1M one on the left and the 10M on the right ad just the linear connection between the two makes up 99% of the plot :D | 10:42 | |
indexingoptimized has the drawback of allocating new storage for the string ... i wonder though if we should re-do the heuristic for when we should and shouldn't be using strands for a concatenated string; in the lowered_lex + _ + 12345 case for example. we are re-using the initial string, and i assume also the string of the _ in between. so strand storage is pointer + two int for start and end + | 10:49 | ||
32bit repetition count | |||
sizeof tells me it's 24 bytes | 10:50 | ||
and we'll also have a string for the number but those are likely always in_situ_8 | 10:51 | ||
an MVMString is 48 bytes, which includes its header | 10:52 | ||
i should double-check if the _ in the middle really is a string of its own or not | 10:53 | ||
patrickb | ugexe, MasterDuke, timo, nine, whoever else is interested: I'd like your feedback on github.com/Raku/problem-solving/issues/455 - "Revamping wrapper scripts in CURI" (It's a long one, sorry!) | 13:26 | |
ugexe | patrickb: just to be sure we're on the same page, you are aware you can do `zef install 'ABC:ver<0.6.13>:auth<zef:colomon>'` on windows by using double quotes right? | 15:45 | |
which i would agree is not ideal either | 15:46 | ||
patrickb | did you try that and managed to make it work? | 15:51 | |
(I did not) | |||
I tried in a powershell | 15:52 | ||
timo | surely powershell is able to represent < and > inside of strings | 16:12 | |
patrickb | it is. but "zef" is a goodctually "zef.bat" And that's where the horrors are. | 16:15 | |
*actually | |||
timo | badctually? | 16:16 | |
patrickb | androidorected | 16:18 | |
ugexe | patrickb: ah ok it does not work. i was thinking of when i use bin/zef, not an installed zef | 16:31 | |
i.e. raku -I. bin/zef 'ABC:ver<0.6.13>:auth<zef:colomon>' | 16:32 | ||
patrickb | Yes that works (because it skips the bat/COM part). | 16:33 | |
And replacing those bat files is one of the key points I want to work towards. :-) | 16:37 | ||
ugexe | i think im just realizing (or re-realizing) that bin scripts do not get the naming "benefits" of modules that we sha1 | 18:40 | |
since the installed wrapper still has to retain the original file name | |||
patrickb | Right. But I think it's not that bad. Scripts are usually at the end of the line. If we have to normalize the script file names some time in the future we'll mostly only break the muscle memory of the users, not much more. I guess we'll just I've with that. | 19:13 | |
ugexe | over the years i've actually gone in the opposite direction: i wish we would have never tried to rename files | 20:02 | |
lizmat | m: my str $a = "foo"; my str $a = "foo"; say $a | 20:21 | |
camelia | Potential difficulties: Redeclaration of symbol '$a'. at <tmp>:1 ------> my str $a = "foo"; my str $a<HERE> = "foo"; say $a Cannot assign to an immutable value in block <unit> at <tmp> line 1 |
||
lizmat | m: no worries; my str $a = "foo"; my str $a = "foo" | ||
camelia | Cannot assign to an immutable value in block <unit> at <tmp> line 1 |
||
lizmat | this happens in the dispatcher | ||
fortunately, this does not happen (yet) in RakuAST | 20:22 | ||
ab5tract | patrickb: what do you mean by breaking the muscle memory of users? How are they supposed to invoke scripts if we have renamed the script files? | 21:09 | |
patrickb | They'll have to adapt. I.e. relearn that the script has a slightly different name (because their filesystem doesn't support the actual name). | 21:27 | |
I'd guess that a typical human user will typically figure it out. | 21:28 | ||
22:06
kjp left,
kjp_ joined
22:43
kjp_ left,
kjp joined
22:58
sena_kun left
|
|||
ab5tract | That does sound misty read If their file system doesn’t support the actual name, how would they have gotten used to typing that name in? | 23:46 | |
*misty read = mostly reasonable | |||
gah, the whole message is poorly worded | 23:48 | ||
Rather than the question of typing the name, I am curious how they would have gotten used to referring to a script that cannot exist as a file in their FS | 23:50 | ||
ugexe | the easiest way to think of ways to hit problems is case insensitive file systems | 23:52 | |
for example on macOS you can use `ZEF`, `Zef`, etc instead of `zef` because by default the file system is not case sensitive | 23:54 |