🦋 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 21 April 2021.
Xliff my $a = 0; my $s = '%sddd%s%s'; $s ~~ s:/'%s'/$a++/; $s.say 00:38
m: my $a = 0; my $s = '%sddd%s%s'; $s ~~ s:/'%s'/$a++/; $s.say
camelia 5===SORRY!5=== Error while compiling <tmp>
Colons may not be used to delimit quoting constructs
at <tmp>:1
------> 3my $a = 0; my $s = '%sddd%s%s'; $s ~~ s:7⏏5/'%s'/$a++/; $s.say
expecting any of:
colon pair (restricted…
Xliff m: my $a = 0; my $s = '%sddd%s%s'; $s ~~ s:g/'%s'/$a++/; $s.say 00:38
camelia 0++ddd0++0++
Xliff m: my $a = 0; my $s = '%sddd%s%s'; $s ~~ s:g/'%s'/<{ $a++ }>/; $s.say 00:39
camelia <0>ddd<1><2>
Xliff m: my $a = 0; my $s = '%sddd%s%s'; $s ~~ s:g/'%s'/<{ $a++ }/; $s.say 00:39
camelia <0ddd<1<2
Xliff m: my $a = 0; my $s = '%sddd%s%s'; $s ~~ s:g/'%s'/{ $a++ }/; $s.say
camelia 0ddd12
Xliff m: my %a = 0; my $s = '%sddd%sddd%sdda%s'; $s ~~ s:g/'%s'/<{ %a{$0 // ''}++ }/; $s.say 00:42
camelia Odd number of elements found where hash initializer expected:
Only saw 1 element
in block <unit> at <tmp> line 1
Xliff m: my %a ; my $s = '%sddd%sddd%sdda%s'; $s ~~ s:g/'%s'/<{ %a{$0 // ''}++ }/; $s.say
camelia <0ddd<1ddd<2dda<3
Xliff m: my %a ; my $s = '%sddd%sddd%sdda%s'; $s ~~ s:g/'%s'/{ %a{$0} // ''}++ }/; $s.say
camelia Use of Nil in string context
++ }ddd++ }ddd++ }dda++ }
in block at <tmp> line 1
Use of Nil in string context
in block at <tmp> line 1
Use of Nil in string context
in block at <tmp> line 1
Use of Nil in string context
in bloc…
Xliff m: my %a ; my $s = '%sddd%sddd%sdda%s'; $s ~~ s:g/(\w+)?'%s'/{ %a{$0} // ''}++ }/; $s.say
camelia Use of Nil in string context
++ }++ }++ }++ }
in block at <tmp> line 1
Use of Nil in string context
in block at <tmp> line 1
Xliff m: my %a ; my $s = '%sddd%sddd%sdda%s'; $s ~~ s:g/(\w+)'%s'/{ %a{$0} // ''}++ }/; $s.say
camelia %++ }++ }++ }
Xliff m: my %a ; my $s = '%sddd%sddd%sdda%s'; $s ~~ s:g/(\w+)'%s'/{ %a{$0 // ''}++ }/; $s.say 00:43
camelia %000
Xliff m: my %a ; my $s = '%sddd%sddd%sdda%s'; $s ~~ s:g/(\w+)'%s'/$0{ %a{$0 // ''}++ }/; $s.say
camelia Use of Nil in string context
%
in code at <tmp> line 1
Use of Nil in string context
in code at <tmp> line 1
Use of Nil in string context
in code at <tmp> line 1
Xliff m: my %a ; my $s = '%sddd%sddd%sdda%s'; $s ~~ s:g/(\w+)'%s'/{ $0 }{ %a{$0 // ''}++ }/; $s.say
camelia %sddd0ddd0dda0
Xliff m: my %a ; my $s = '%sddd%sddd%sdda%s'; $s ~~ s:g/(\w+)?'%s'/{ $0 }{ %a{$0 // ''}++ }/; $s.say
camelia Use of Nil in string context
0ddd0ddd1dda0
in code at <tmp> line 1
Xliff m: my %a ; my $s = '%sddd%sddd%sdda%s'; $s ~~ s:g/(\w+)?'%s'/{ $0 // ''}{ %a{$0 // ''}++ }/; $s.say 00:44
camelia 0ddd0ddd1dda0
Xliff m: my %a ; my $s = '%sddd%sddd%sdda%sddd%sddd%s'; $s ~~ s:g/(\w+)?'%s'/{ $0 // ''}{ %a{$0 // ''}++ }/; $s.say
camelia 0ddd0ddd1dda0ddd2ddd3
tonyo Xliff: give raku -e a shot 00:48
Xliff Does raku have a "first" statement that will only run first time through a loop? 01:01
FIRST phased I think is too early.
moon-child what's wrong with FIRST? 01:04
m: for ^5 { FIRST { say "O $_" } say $_} 01:06
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3for ^5 { FIRST { say "O $_" }7⏏5 say $_}
expecting any of:
infix
infix stopper
st…
moon-child m: for ^5 { FIRST { say "O $_" }; say $_}
camelia O 0
0
1
2
3
4
Xliff for ^5 { my $a = $_ + 1; FIRST { say "O $a" }; say $_} 01:09
m: for ^5 { my $a = $_ + 1; FIRST { say "O $a" }; say $_}
camelia Use of uninitialized value element of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
O
0
1
2
3
4
in block at <tmp> line 1
Xliff m: for ^5 { my $a = $_ + 1; FIRST { say "O { $a // 'undef'" }; say $_}
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3 $_ + 1; FIRST { say "O { $a // 'undef'7⏏5" }; say $_}
expecting any of:
infix
infix stopper
statement end
Xliff m: for ^5 { my $a = $_ + 1; FIRST { say "O { $a // 'undef' }" }; say $_}
camelia O undef
0
1
2
3
4
Xliff ^^ That's my current problem.
japhb Xliff: (First approximation) Phasers are attached to blocks and fire at entry and exit, they don't happen at their location in the source code. 01:18
So a CATCH {} block for example could be at the start, middle, or end of a block, and work the same.
The approximation part is that there are phasers that are associated with the entire program or comp unit
Xliff japhb: Yes. I figured that bit out. 01:21
japhb: In the end, I just had to use a loop sentinel. It works, but I always think a High Level Language should know when a loop is running its first iteration and provide some way to test for that.
moon-child what is a High Level Language? 01:48
Xliff moon-child: Anything that is not considered the base run-time. 02:09
Depends on the context.
For bare metal it means anything written in something other than ASM
MoarVM is considered run-time so NQP isn't quite considered High Level, but Raku is.
Geth doc: af682314b1 | (Stoned Elipot)++ (committed by Juan Julián Merelo Guervós) | doc/Type/Supply.pod6
Note ms granularity for Supply.batch ref #3744
06:24
doc: 8d298872e0 | (Stoned Elipot)++ (committed by Juan Julián Merelo Guervós) | doc/Type/Supply.pod6
Use a more appropriate tense
andinus .tell tonyo was away 07:10
tellable6 andinus, I'll pass your message to tonyo
kawaii How do I merge two Sets? I need an array-like structure with no duplicates so I figured Set was the best choice. 12:24
MasterDuke m: say set(1, 2) (|) set(1, 2, 3) 12:26
camelia Set(1 2 3)
lizmat m: dd <a b c d> (|) <d e f> 12:27
camelia Set.new("b","c","f","e","a","d")
kawaii ah, pipe!
thanks :)
lizmat with parens!
(|)
m: dd (<a b c d>, <d e f>).flat.unique # without Sets, but with set semantics 12:29
camelia ("a", "b", "c", "d", "e", "f").Seq
lizmat kawaii ^^ 12:30
kawaii Oooo, thank you, this might be useful too!
kawaii Am I interpreting TWEAK correctly here? If I'm making a class, and then a user creates an object to use the methods etc within my class, when the object is initialised any code in the TWEAK block will be run at that moment? 12:38
lizmat well, in general, yes, unless you create your own .new method
lizmat and that .new method doesn't do a self.bless(...) 12:39
kawaii lizmat: so, given my understanding above, my method here, register-termination-points, will run when the user creates an object like `my $m = Mint.new();`, and also allow the user to manually run that method if they wish to add any of their own into the produced set? www.irccloud.com/pastebin/FnMQP7wY/ 12:45
lizmat kawaii: what attributes is that class supposed to have? I don't see any ? 12:48
kawaii lizmat: sorry, it's supposed to be `has $termination-points` and to be populated by the method in the tweak 12:51
`has $termination-points = self.register-termination-points;` I think that would be 12:52
oh, so I don't need a tweak at all here
lizmat then please adapt your gist so I can make a better assessment of what you're trying achieve
yeah, looks like, if you trust the user to always provide valid termination points 12:53
MasterDuke m: sub a($b = Empty) { (1, 2) (|) $b }; say a(4); say a();  # kawaii if you default the parameter to Empty you don't need the if
camelia Set(1 2 4)
Set(1 2)
MasterDuke slip also works 12:57
kawaii if I `return $.termination-points;`, this will then overwrite my class attribute correct? 13:07
PimDaniel \o I did yet ask the question but this subject is still stalled for me: 13:43
1st of all : in which OS(es) all of you are using Raku? 13:44
Mine is Linux. Are many of you using Linux or not? 13:45
MasterDuke linux
El_Che linux as well 13:47
lizmat MacOS and Debian
Debian being the "production" environment for me
and MacOS the dev environment
El_Che a little on macos, but not much since I use it more as an expensive type machine 13:48
PimDaniel I'm on Debian too, since 1999 probably. Okay so may you look at that : github.com/Pim-tech/Orthogon/blob/...p.rakumod, plus make it work! I know it require a few time. I think MacOs could be suited to my needs too.
My question is an algorithm question : not a Raku one. 13:49
But i could found an answer or where to search, so .... 13:50
El_Che afk
PimDaniel Hooo it is not the good link, sorry: the whole code is : github.com/Pim-tech/Orthogon 13:51
PimDaniel the 1st link : HopcroftKarp.rakumod is a rewriting of this algorithm (Hopcropft and Karp) from Python to Raku by myself. 13:52
lizmat ... 13:53
PimDaniel There are of course probably many optimizations to do on this code but it works.
PimDaniel Now here comes my problem and the question: I,'ve transform the polygon to a set of rectangles this way: draw the Vertical and Horizontal cuts, reduce them by HopKorp and Karp algoritm. Add the cuts on concave angles, But now i can NOT found an easy way to fill the rectangles. 13:58
This is the ultimate final step.
To build the the polygon from the terminal, i've began a trace tool. At the end theses tools and the global polygon drawer will use box drawing characters automatically, but this is not a problem and not the priority. 14:01
The corresponding subject is described here: stackoverflow.com/questions/591929...68#6634668 14:03
PimDaniel But the algorithm i search could be resume as: How to fill a set of puzzeled rectangles. 14:10
The data given to define theses puzzeleded rectangles may be points or lines. 14:12
PimDaniel Hope i was clear. 14:14
lizmat PimDaniel: I think your question requires people getting into that problem, which would take significant effort here for most 14:17
and most people here are also busy doing other things
so there's a good chance this question will get warnocked
jdv79 lizmat: i forgot to ask earlier - where is this "EXPORT:refine" stuff supported? i grepped around and i couldn't find anything. 14:20
lizmat jdv79: only one module in the ecosystem so far: modules.raku.org/dist/Interval:cpan:ELIZABETH 14:21
jdv79 but how does that work? i couldn't find it in moar or nqp of rakudo... 14:23
*or
lizmat jdv79: it doesn't need anything extra in core for it to work 14:30
that's the nice part of it :-)
lizmat modules.raku.org/dist/Interval:cpa...al.pm6#L30 is the real trick 14:31
jdv79 cool. i don't understand how it works.
lizmat in the scope of the module, I've defined a subclass of DateTime
whenever I say use module :foo, then anything in the EXPORT:foo stash will be exported 14:32
BEGIN EXPORT::refine::<DateTime> := Interval;
make sure that there is a "DateTime" key in the EXPORT::refine stash
and that it is really the "local" Interval class
so this creates a lexical DateTime entry in the scope where the use is done 14:33
that *isn't* the core's DateTime, but the Interval class from the module
jdv79 oh... i guess i should re-read about export and friends. that's crazy. 14:35