🦋 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.
Util Xliff: your second line was missing a final double-quote after `scriptinglanguage`. This does not address your real problem with 0x228a not working; looking at that now. 00:05
Xliff Thanks, Util! 00:25
Util Of U+2282..U+228B (⊂ ⊃ ⊄ ⊅ ⊆ ⊇ ⊈ ⊉ ⊊ ⊋), the last two (8A,8B) do not appear in the Rakudo source code. 00:51
I don't know if that is intentional, or just Not Yet Implemented.
FYI: used info from www.compart.com/en/unicode/block/U+2200
Util Xliff: To implement, in github.com/rakudo/rakudo/tree/main/src , 01:16
most of the code could be cloned-and-hacked in core.c/set_subset.pm6 and core.c/set_proper_subset.pm6,
with trivial entries also in core.c/OperatorProperties.pm6, core.c/precedence.pm6, Perl6/Grammar.nqp, Raku/Grammar.nqp, Raku/ast/operator-properties.rakumod .
I don't know if that would actually be in `core.e` instead of `core.c`.
But, I would suggest filing the issue first, just in case it is intentionally un-implemented.
Xliff Util: Thanks. Will do. 02:26
Due to orthogonality, I think it's core.c
Xliff m: DateTime.new( minute => 20, second => 1 ).say' 02:29
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> ime.new( minute => 20, second => 1 ).say⏏'
expecting any of:
infix
infix stopper
statement end
statement …
Xliff m: say DateTime.new( minute => 20, second => 1 )'
camelia ===SORRY!=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> ateTime.new( minute => 20, second => 1 )⏏'
expecting any of:
infix
infix stopper
postfix
statement end
Xliff m: say DateTime.new( minute => 20, second => 1 )
camelia Cannot call DateTime.new with these named parameters: minute second
in block <unit> at <tmp> line 1
Xliff HUNH?
O_o
m: say DateTime.new( year => 0, month => 1, minute => 20, second => 1 ) 02:31
camelia 0000-01-01T00:20:01Z
Xliff Missing defaults?
Util m: say DateTime.new(date => Date.today, minute => 1, second => 1); 02:43
camelia 2023-07-07T00:01:01Z
Util Xliff: You must provide a year, or a date, to construct a DateTime. My guess is that there is no clear "correct" default, between year-of-todays-date and year zero. 02:51
In docs.raku.org/type/DateTime#method_new , this restriction is detailed via `:$year!` and `:$date!` in the first and second `multi`s. The `bang` forces a (normally optional) named argument to be required. 02:53
Xliff Util: That's fine. It is then the error message that is LTA. 03:05
Because you CAN call DateTime.new with minute and second named arguments. 03:06
A check with another die if year is not specified would go a long way to cutting down on programmer WTF moments. 03:07
Util Hmmm. I agree. The message is LTA. However, fixing it should be generalized into everything that has that kind of `multi` constructor (IMO), and the general solution is not obvious to me. 03:11
Definitely worth an issue.
Util Xliff: relevant to the U+00228A,B issue : math.stackexchange.com/questions/1...eqq-symbol 04:50
teatwo lol, The name of the Unicode codepoint is purely descriptive of the symbol: It is a “subset of” symbol (⊂) above a “not equal” symbol (≠); hence “subset of above not equal”. 04:51
patrickb tbrowder_: DE : Zwölf Boxkämpfer jagen Viktor quer über den großen Sylter Deich. 06:17
tbrowder_: Or without Umlauts: Franz jagt im komplett verwahrlosten Taxi quer durch Bayern 06:18
tbrowder_: Also see de.m.wikipedia.org/wiki/Pangramm in different languages. 06:19
xinming_ Hi, Is there a good way to implement customized rouding logic? Let's say, with 3 digits xyz , with lowest digit z, we round as normal, 9 -> 10, but with y, we round as octal, so 7 -> 10, with x, we round with 4 base, which is 3 -> 10. 07:34
I don't mean the actual impelmentation, Some ideas to impelment this will be ok, now, what idea I have is write a class for this. But I fill it might be a bit over kill. 07:35
and I also want to do something like .. operator for this. 07:36
nemokosch Well, if x, y and z are digits of the very same number then I wouldn't call what you described "rounding" in any sense lol 07:48
xinming_ nemokosch, Yea, sorry for my poor English, What I mean is carry-over. :-) 07:49
I used rounding too much in recent days, Which caused me typing rounding. 07:50
nemokosch Damn, I thought round wouldn't be tied to a base at least... 08:00
xinming_ I know we can have :3<121> kind of things for this, just curious what is the best way to mix different bases 08:04
lizmat . 08:06
tellable6 hey lizmat, you have a message: gist.github.com/a2222449b0759a056b...2c42673d0a
xinming_ hmm, the :60<121> is not working. :-(
lizmat .tell tbrowder_ do you have a place I could link to for that request? with maybe more information? 08:07
tellable6 lizmat, I'll pass your message to tbrowder__
xinming_ I think I'll try to implement something like DateTime 08:09
lizmat xinming_ maybe something like docs.raku.org/routine/polymod could be of use ? 08:11
xinming_ lizmat: probably, quite happy I ask here, To save ton of efforts. 08:14
guifa is head out. Next time y'all'll see him will be TPRC 2023! 10:04
lizmat safe travels! 10:05
tbrowder__ lizmat: yes, i'll add a CONTRIBUTING doc to the module repo (i should have done that instead of blathering here). will a link to that suffice? 12:05
tellable6 2023-07-07T08:07:12Z #raku <lizmat> tbrowder_ do you have a place I could link to for that request? with maybe more information?
tbrowder__ patrickb: thanks! 12:10
lizmat tbrowder__: it will, just weekly: it :-) 12:13
tbrowder__ ok 12:23
thnx
tbrowder__ hm, patrickb has the perfect default solution with the Wikipedia pangrams, so I wiil just go with that for now for several languages. but users who want me to add a missing language can file an issue. in any case, my prog will allow for custom solutions if desired. this info will be in CONTRIBUTING, 12:40
xinming_ m: class A { has $.a = 1; submethod TWEAK (:$!a) { } }; A.new.a; 16:37
camelia ( no output )
xinming_ m: class A { has $.a = 1; submethod TWEAK (:$!a) { } }; A.new.a.say;
camelia (Any)
xinming_ m: class A { has $.a = 1; submethod TWEAK (:$!a) { return unless $!a; 'check $!a passed here' } }; A.new.a.say; 16:38
camelia (Any)
xinming_ In this case, how can we check the $!a value when passed, otherwise, we use the default provided in class definition please?
I know we can assign the default value in TWEAK method, But want to see the has $.a = default; can be used too 16:42
librasteve m: class B { has $.b = 1; method TWEAK { $!b = 21 } } B.new( b => 42 ).b.say; 20:33
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Strange text after block (missing semicolon or comma?) at /home/glot/main.raku:1 ------> has $.b = 1; method TWEAK { $!b = 21 } }⏏ B.new( b => 42 ).b.say; expecting any of: infix infix stopper statement end statement modifier statement modifier loop
librasteve m: class B { has $.b = 1; method TWEAK { $!b = 21 } }; B.new( b => 42 ).b.say; 20:34
Raku eval 21
librasteve xinming: sorry, I do not understand your question 20:35
gfldex m: class C { has $.a is rw is default('answer'); method TWEAK(:$a) { $!a = $a // $.a.VAR.default; } }; C.new.a.say; 21:00
camelia answer
gfldex xinming_: ^^^, Right now there is no ideomatic way to get hold of the delcarative default value. However, you might find a way in github.com/rakudo/rakudo/blob/main...u.pm6#L147 21:04
m: class B { has $.a = 'dragons'; }; use nqp; say B.^attributes; say nqp::getattr(B.^attributes[0], Attribute, '$!container_initializer'); 21:15
camelia (Mu $!a)
(Mu)
gfldex I expected that to work. :-/
Xliff Anyone have any ideas for a needed GUI? 22:00