🦋 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. |
|||
00:00
reportable6 left
00:02
reportable6 joined
00:03
epony joined
00:04
ab5tract left,
lichtkind left
|
|||
pingu | i dont think its cause the function has the same name as the file | 00:07 | |
ive done that before and it had no problems | |||
00:10
derpydoo joined
|
|||
Nemokosch | are you exporting that function in the ValidTokenChk module of yours? | 00:10 | |
pingu | nope | 00:11 | |
when do I need to export it | 00:12 | ||
Nemokosch | well, always 😄 or what do you mean | 00:13 | |
in order to get it pulled into your lexical scope when useing the module, you need to export your stuff | 00:14 | ||
pingu | k now it works | 00:15 | |
hmm but replace.rakumod doesnt need is export | |||
ah crap it is export | 00:16 | ||
ok my bad | |||
trying to renember a ocean of stuff here :| | |||
Nemokosch | 🍬 | ||
00:21
derpydoo left
00:27
Oshawott joined
00:30
archenoth left
00:44
stevied__ joined,
stevied_test left
01:11
Manifest0 left
01:17
stevied__ left
01:20
stevied_test joined
|
|||
[Coke] | (cold) HOLY CRAP is it. | 01:53 | |
pingu | bbl | 02:02 | |
02:20
linkable6 left,
evalable6 left,
NemokoschKiwi joined
02:21
NemokoschKiwi left,
evalable6 joined
02:23
linkable6 joined
|
|||
[Coke] | I have installed cro without test errors on an ubuntu box in azure, yes. | 02:29 | |
rf | Hmm, can I generate a class at runtime? | 02:30 | |
Nemokosch | interesting, for me it "broke" on WSL iirc | ||
sure you can, that's what the compiler itself does 😛 | 02:31 | ||
I think there is even a code example in the docs. It's MOP stuff | |||
rf | Awesome i'll look | ||
Was wondering how deep into Meta programming I could go lol | |||
I found that declaring types as JSON for this project makes the most sense so hopefully I can pull it off | |||
Nemokosch | this is actually the first example basically | 02:32 | |
hope it's up-to-date | |||
02:33
razetime joined,
cfa left
02:37
swaggboi joined
|
|||
rf | @Nemokosch can you pass a link | 02:38 | |
[Coke] | guessing docs.raku.org/language/mop | 02:40 | |
rf | [Coke]++ Nemokosch++ | ||
Geth | ¦ doc: coke unassigned from JJ Issue 1-file HTML does not yet exist github.com/Raku/doc/issues/3632 | 02:44 | |
¦ doc: coke unassigned from JJ Issue Change templates and the rest of the code to point to the new repo github.com/Raku/doc/issues/3101 | |||
¦ doc: coke unassigned from JJ Issue `is equiv`/`is tighter`/`is looser` underdocumented github.com/Raku/doc/issues/1730 | |||
¦ doc: coke unassigned from JJ Issue Create a new page with info about OS portability github.com/Raku/doc/issues/670 | 02:45 | ||
¦ doc: coke unassigned from JJ Issue Test internal modules github.com/Raku/doc/issues/1751 | |||
¦ doc: coke unassigned from JJ Issue Intent, not syntax github.com/Raku/doc/issues/1748 | 02:46 | ||
rf | Hmm how can I add a field to a MetaModel? | 02:49 | |
m: my T := MetaModel::ClassHOW.new_type(name => T); T.^add_attr('abc'); | 02:50 | ||
camelia | ===SORRY!=== Error while compiling <tmp> Malformed my (did you mean to declare a sigilless \T or $T?) at <tmp>:1 ------> my T⏏ := MetaModel::ClassHOW.new_type(name => |
||
rf | m: constant T := MetaModel::ClassHOW.new_type(name => T); T.^add_attr('abc'); | ||
camelia | ===SORRY!=== Error while compiling <tmp> Undeclared name: T used at line 1 |
||
rf | m: my constant T := MetaModel::ClassHOW.new_type(name => T); T.^add_attr('abc'); | ||
camelia | ===SORRY!=== Error while compiling <tmp> Undeclared name: T used at line 1 |
||
Nemokosch | m: my \T = MetaModel::ClassHOW.new_type(name => T); T.^add_attr('abc'); | 02:51 | |
Raku eval | Exit code: 1 Could not find symbol '&ClassHOW' in 'GLOBAL::MetaModel' in block <unit> at main.raku line 1 | ||
Nemokosch | m: my \T = Metamodel::ClassHOW.new_type(name => T); T.^add_attr('abc'); | ||
Raku eval | Exit code: 1 No such method 'add_attr' for invocant of type 'Perl6::Metamodel::ClassHOW' in block <unit> at main.raku line 1 | ||
Nemokosch | getting there | 02:52 | |
rf | To the source code I go | ||
Nemokosch | m: my \T = Metamodel::ClassHOW.new_type(name => T); T.^add_attribute('abc', Attribute.new); | ||
Raku eval | Exit code: 1 Required named parameter 'name' not passed in block <unit> at main.raku line 1 | ||
Nemokosch | well yeah, something like this | 02:53 | |
docs.raku.org/type/Metamodel::Clas..._attribute | |||
rf | Looks like I need ot use AttributeContainer | ||
Nemokosch | ClassHOW implements that 😉 | 02:54 | |
rf | Ah | ||
Nice | |||
m: my \T = Metamodel::ClassHOW.new_type(name => 'T'); T.^add_attribute('abc', Attribute.new); | 02:55 | ||
camelia | Required named parameter 'name' not passed in block <unit> at <tmp> line 1 |
||
rf | m: my \T = Metamodel::ClassHOW.new_type(name => 'T'); T.^add_attribute('abc', Attribute.new(name => 'abc')); | ||
camelia | Required named parameter 'type' not passed in block <unit> at <tmp> line 1 |
02:56 | |
rf | m: my \T = Metamodel::ClassHOW.new_type(name => 'T'); T.^add_attribute('abc', Attribute.new(name => 'abc', type => 'string')); | ||
camelia | Required named parameter 'package' not passed in block <unit> at <tmp> line 1 |
||
rf | m: my \T = Metamodel::ClassHOW.new_type(name => 'T'); T.^add_attribute('abc', Attribute.new(name => 'abc', type => 'string', package => ACME::Types)); | ||
camelia | Could not find symbol '&Types' in 'GLOBAL::ACME' in block <unit> at <tmp> line 1 |
||
rf | m: my \T = Metamodel::ClassHOW.new_type(name => 'T'); T.^add_attribute('abc', Attribute.new(name => 'abc', type => 'string', package => ACME)); | ||
camelia | ===SORRY!=== Error while compiling <tmp> Undeclared name: ACME used at line 1 |
||
rf | m: my \T = Metamodel::ClassHOW.new_type(name => 'T'); T.^add_attribute('abc', Attribute.new(name => 'abc', type => 'string', package => NativeCall)); | ||
camelia | ===SORRY!=== Error while compiling <tmp> Undeclared name: NativeCall used at line 1 |
||
rf | m: use NativeCall; my \T = Metamodel::ClassHOW.new_type(name => 'T'); T.^add_attribute('abc', Attribute.new(name => 'abc', type => 'string', package => NativeCall)); | ||
camelia | Too many positionals passed; expected 3 arguments but got 4 in block <unit> at <tmp> line 1 |
||
rf | Meh lol | ||
Nemokosch | What if it really wanted :: ? | 02:59 | |
As in, .WHO? | 03:00 | ||
Geth | ¦ doc: coke assigned to dontlaugh Issue We need to speed up tests or otherwise reduce dependence on Travis github.com/Raku/doc/issues/3777 | 03:05 | |
03:05
rf left
|
|||
Geth | ¦ doc: coke self-assigned Take care of CI and all repo-related tooling github.com/Raku/doc/issues/3102 | 03:14 | |
¦ doc: coke assigned to dontlaugh Issue Take care of CI and all repo-related tooling github.com/Raku/doc/issues/3102 | |||
¦ doc: coke self-unassigned Take care of CI and all repo-related tooling github.com/Raku/doc/issues/3102 | |||
¦ doc: coke assigned to dontlaugh Issue Run extended/author tests regularly/automatically github.com/Raku/doc/issues/3036 | 03:20 | ||
¦ doc: coke self-assigned Time to delete stale branches... again github.com/Raku/doc/issues/3003 | |||
¦ doc: coke self-assigned Version 2.0 Roadmap github.com/Raku/doc/issues/2983 | 03:21 | ||
¦ doc: coke self-assigned Parameterization vs. parametrization github.com/Raku/doc/issues/2967 | |||
doc/main: ddf8c69abd | (Will Coleda)++ | xt/word-variants.t Parameterization vs. parametrization |
03:29 | ||
doc/main: 520c466f4c | (Will Coleda)++ | app.pl Remove perl5 app runner |
|||
03:35
kjp left
|
|||
Geth | ¦ doc: coke self-assigned Intent, not syntax github.com/Raku/doc/issues/1748 | 03:41 | |
[Coke] | m: say 3.print-nl | 03:42 | |
camelia | Cannot resolve caller print(Int:D: Str:D); none of these signatures matches: (Mu: *%_) in block <unit> at <tmp> line 1 |
||
Geth | doc/main: a639587650 | (Will Coleda)++ | util/test-links.sh Remove link checker github.com/Raku/doc-website/issues/72 |
03:52 | |
03:57
razetime left
04:09
pingu left
04:14
pingu joined
04:24
razetime joined
04:34
kjp joined
04:36
Abhoerschutz joined
05:36
nativecallable6 left,
reportable6 left,
evalable6 left,
benchable6 left,
statisfiable6 left,
unicodable6 left,
bisectable6 left,
bloatable6 left,
committable6 left,
notable6 left,
coverable6 left,
tellable6 left,
quotable6 left,
greppable6 left,
sourceable6 left,
releasable6 left,
shareable6 left,
squashable6 left,
linkable6 left,
nativecallable6 joined
05:37
tellable6 joined,
benchable6 joined,
evalable6 joined,
releasable6 joined,
quotable6 joined
05:38
statisfiable6 joined,
greppable6 joined,
notable6 joined,
squashable6 joined
05:39
bisectable6 joined,
reportable6 joined,
coverable6 joined,
shareable6 joined,
linkable6 joined,
bloatable6 joined,
unicodable6 joined,
sourceable6 joined,
committable6 joined
06:00
reportable6 left
06:02
reportable6 joined
07:02
notable6 left,
statisfiable6 left,
shareable6 left,
linkable6 left,
sourceable6 left,
unicodable6 left,
coverable6 left,
nativecallable6 left,
greppable6 left,
tellable6 left,
reportable6 left,
quotable6 left,
bisectable6 left,
benchable6 left,
releasable6 left,
evalable6 left,
quotable6 joined,
notable6 joined,
evalable6 joined,
benchable6 joined,
reportable6 joined
07:03
greppable6 joined,
linkable6 joined,
statisfiable6 joined,
nativecallable6 joined
07:04
tellable6 joined,
coverable6 joined,
unicodable6 joined,
bisectable6 joined,
releasable6 joined
07:05
shareable6 joined,
sourceable6 joined
07:18
jpn joined
07:59
pingu left
08:01
razetime left,
razetime joined
08:05
razetime left
08:17
Abhoerschutz left
08:20
razetime joined
08:21
derpydoo joined
08:54
MoC joined
08:59
snonux joined,
rantanplan joined
09:06
snonux left
09:07
rantanplan left
09:21
rantanplan joined
09:22
snonux joined
09:26
Oshawott left
09:28
Oshawott joined
09:47
jpn left,
Manifest0 joined
10:02
jpn joined
10:09
ab5tract joined
10:17
sena_kun joined
10:19
freeside joined
10:20
jpn left
10:31
rantanplan left,
snonux left
10:49
Abhoerschutz_ joined
10:50
Abhoerschutz_ left,
Schokotraum joined
10:54
Sgeo left
10:58
Schokotraum left
|
|||
Nemokosch | The day has come: I'm adopting the Data::MessagePack module under raku-community-modules | 11:01 | |
and if there are no objections, soon I will remove the original version from p6c | 11:03 | ||
11:04
Schokotraum joined
11:07
Schokotraum left,
Schokotraum joined
|
|||
lizmat | Nemokosch++ | 11:08 | |
11:12
jpn joined
11:22
razetime left
11:59
jpn left
12:00
reportable6 left
12:01
reportable6 joined
12:23
lichtkind joined
12:48
codesections left
|
|||
Nemokosch | do you know about something like "bring PR to fork as well" ? | 13:09 | |
13:13
guifa left
13:15
jpn joined
|
|||
lizmat | nope, the only way is to transfer the whole repo to raku-community-modules | 13:15 | |
which would need the cooperation of the owner | |||
and I think lack of cooperation is the reason to fork, right ? | 13:16 | ||
Nemokosch | yes | 13:17 | |
Actually, in this case, it's easier to just replicate the idea of the PR since it couldn't be directly applied anyway and it's a one liner | |||
but there might be other cases where this would have been useful | 13:18 | ||
lizmat | indeed... | ||
similar to wikis | |||
I had to copy Ben Davies' wikis of some repos manually | 13:19 | ||
13:19
razetime joined
|
|||
Nemokosch | :\ | 13:19 | |
lizmat | in the end only 4 files, but still... | 13:20 | |
fortunately you could clone the wiki | |||
hmmm.. now I think about it, maybe I could have cloned and then pushed again .... | |||
ah well, next time | |||
Nemokosch | yes, in theory, this could get infinitely complex, if something big needs to be moved for whatever reason | 13:22 | |
one'd hope that in that case transferring would be an option | 13:23 | ||
lizmat | It *is* an option, but requires cooperation | 13:24 | |
and that's a good thing :-) | |||
Nemokosch | Unfortunately, someone's passing does not only leave the sorrow and missing behind, but also administrative complications. | ||
Eventually it would be good to get to process Ben's legacy, as in, unfinished work for example. But I can't even imagine when there will be a sufficient occasion for that... | 13:25 | ||
13:27
jpn left
|
|||
off topic: the overall CLI design of git is horrible regarding consistency | 13:30 | ||
as if the person designing git branch and the one designing git remote had no knowledge of each other's work | |||
el just use github desktop 😎 | 13:35 | ||
Voldenet | lazygit is pretty nice | 13:42 | |
13:42
freeside left
|
|||
Nemokosch | oh? never heard of it? | 13:42 | |
Voldenet | it was sold to me when I didn't have to use the stash before the pull, it's such a pointless chore | 13:45 | |
Nemokosch | you mean the "you have uncommitted changes" stuff? | 13:46 | |
Voldenet | Yeah, it gets really annoying if you see that for 800th time | ||
Nemokosch | fair enough haha | 13:47 | |
I don't often work on repos where this would be prevalent but it happened to me as well a couple of days ago, on my own Raku-ideas repo that I tend to edit all over the place | |||
13:49
razetime left
13:56
freeside joined
14:35
rf joined
|
|||
rf | Morning folks | 14:36 | |
Nahita | hi what is "<.kok>" seen in the grammar? | 14:40 | |
Voldenet | it's a `token kok` probably | 14:41 | |
Nahita | maybe, what couldn't find definition | ||
*but | |||
Voldenet | github.com/rakudo/rakudo/blob/37f5....nqp#L2752 | ||
Nahita | thank you sorry | 14:42 | |
Voldenet | np, it's a strange name nonetheless | ||
[Coke] | blogs.perl.org/users/damian_conway...ratch.html - "Keyword that's OK" | 14:45 | |
Nemokosch | lmao xD | ||
14:47
MoC left
14:49
derpydoo left
14:52
jgaz joined
|
|||
rf | I have a new project on the go, I think it's going to be very interesting to see how it plays out :D | 14:53 | |
Trying to apply Raku to cloud-infra and containers stuff | 14:54 | ||
Geth | doc/main: 7a30bae1b2 | (Will Coleda)++ | util/issue-with-all-pod6.raku Update repo reference Closes #3101 |
14:55 | |
14:59
freeside left
|
|||
Voldenet | I appreciate the explanation of `kok` and `tok` | 15:00 | |
15:12
derpydoo joined
15:16
freeside joined
15:21
freeside left
15:22
freeside joined
15:25
mst joined
15:27
freeside left
15:30
snonux joined,
snonux left,
snonux joined
15:33
snonux_ joined
15:41
freeside joined
|
|||
[Coke] | might be worth a glossary entry | 15:58 | |
16:00
freeside left
|
|||
el is there a “truncate with scale” function | 16:13 | ||
as in, i want to round a number to a multiple of 100 (for instance) towards zero | 16:14 | ||
16:15
freeside joined
16:18
razetime joined
16:25
derpydoo left
16:28
snonux left,
snonux_ is now known as snonux,
snonux left
16:32
snonux joined
|
|||
Voldenet | round? | 16:32 | |
m: my $x = "1234.5678"; say $x.round(100); say $x.round(0.01); | |||
camelia | 1200 1234.57 |
||
Voldenet | if you need truncate to accept scale, you'd need to write your subroutine :/ | 16:34 | |
m: sub trunc(Num() $num, Num() $scale) { truncate($num / $scale) * $scale }; say $x.trunc(100); say $x.trunc(0.01); | 16:36 | ||
camelia | ===SORRY!=== Error while compiling <tmp> Variable '$x' is not declared. Perhaps you forgot a 'sub' if this was intended to be part of a signature? at <tmp>:1 ------> truncate($num / $scale) * $scale }; say ⏏$x.trunc(100); say $x… |
||
Nemokosch | ohh, as opposed to "round with scale"? | ||
Voldenet | m: sub trunc(Num() $num, Num() $scale) { truncate($num / $scale) * $scale }; my $x = "1234.5678"; say $x.trunc(100); say $x.trunc(0.01); | ||
camelia | No such method 'trunc' for invocant of type 'Str'. Did you mean 'trans'? in block <unit> at <tmp> line 1 |
||
Nemokosch | That sounds like yet another thing that could be added to core eventually | ||
Voldenet | m: sub trunc(Num() $num, Num() $scale) { truncate($num / $scale) * $scale }; my $x = "1234.5678"; say $x.&trunc(100); say $x.&trunc(0.01); | ||
camelia | 1200 1234.56 |
||
Voldenet | well, 'truncate' could accept scale parameter | 16:37 | |
mst | something like $str.truncate($str.length.round(100)) ? | ||
Voldenet | something like that | 16:38 | |
hah, `round` pretty much does the same thing | 16:41 | ||
multi method round(Real:D: Real() $scale) { (self / $scale + 1/2).floor * $scale; } | |||
mst | hrm, the +1/2 means it's going to round to nearest, not down | 16:45 | |
I think there's a version that takes a direction but I don't remember clearly so you probably want to poke at the docs/code a bit if you want to find out whether I'm right and if so what it's called ;) | 16:46 | ||
Voldenet | well, it's rounding not truncating | 16:49 | |
truncate itself does floor/ceiling depending on the sign | 16:50 | ||
16:50
jgaz left
|
|||
mst | yes but at that point it's -already- rounded so truncate is potentially going to get the higher number | 16:51 | |
I suspect what you actually want is 'div' though I also don't remember if raku calls it that | 16:52 | ||
16:52
ab5tract left
16:54
NemokoschKiwi joined
|
|||
Voldenet | div only works on (Rat, Rat) sadly | 16:59 | |
mst | isn't string.length an Int and therefore trivially upgradable? | 17:01 | |
m: my $str = "foobarbaz"; say string.length div 4 | |||
camelia | ===SORRY!=== Error while compiling <tmp> Undeclared routine: string used at line 1 |
||
mst | m: my $str = "foobarbaz"; say $str.length div 4 | 17:02 | |
camelia | No such method 'length' for invocant of type 'Str'. Did you mean any of these: 'chars', 'codes'? in block <unit> at <tmp> line 1 |
||
mst | m: my $str = "foobarbaz"; say $str.chars div 4 | ||
camelia | 2 | ||
mst | Voldenet: see, works fine | ||
m: my $str = "foobarbaz"; say $str.truncate(($str.chars div 4) * 4) | |||
camelia | Too many positionals passed; expected 1 argument but got 2 in block <unit> at <tmp> line 1 |
||
mst | ok, I clearly did something stupid there | 17:03 | |
m: my $str = "foobarbaz"; say $str.truncate($str.chars div 4 * 4) | |||
camelia | Too many positionals passed; expected 1 argument but got 2 in block <unit> at <tmp> line 1 |
||
mst | I think I am failing at raku syntax and somebody else should likely take over now | ||
Voldenet: but div definitely works, it's just a question of putting the rest together | |||
Voldenet | whoa whoa, that truncate expects Str, the original question was about the Numeri | 17:04 | |
Numeric* | |||
I think | |||
mst: truncate is not doing what you think it does, it's for numbers | 17:05 | ||
mst | oh, I must've misunderstood something you said earlier | 17:06 | |
though if you have an int to start with, div 100, * 100, should work fine | 17:07 | ||
and if you have a Rat to start with, just int() it first | |||
gah | |||
Real | |||
mst grumbles | |||
m: my $x = 2.345; say $x.Int | |||
camelia | 2 | ||
mst | m: my $x = 9.345; say $x.Int div 4 * 4 | ||
camelia | 8 | ||
mst | Voldenet: that closer to what you had in mind? | 17:08 | |
Voldenet | the problem given was `truncate the number given the scale, so (0.01) or (100)` | ||
mst | which is what that does, no? | 17:09 | |
oh, except 0.01 is going to ... sigh | |||
Voldenet | that's why I've used truncate and / | 17:10 | |
Nemokosch | div reminds me | ||
mst | m: my $x = 9.345; say $x.Rat div 0.01 * 0.01 | ||
camelia | Cannot resolve caller infix:<div>(Rat:D, Rat:D); none of these signatures matches: (Int:D $a, Int:D $b --> Int:D) (int $a, int $b --> int) (uint $a, uint $b --> uint) in block <unit> at <tmp> line 1 |
||
Nemokosch | we haven't had an upgrade on the issue I opened about ^^^^ this | ||
mst | m: my $x = 9.345; say $x.Rat div 0.01.Rat * 0.01.Rat | ||
camelia | Cannot resolve caller infix:<div>(Rat:D, Rat:D); none of these signatures matches: (Int:D $a, Int:D $b --> Int:D) (int $a, int $b --> int) (uint $a, uint $b --> uint) in block <unit> at <tmp> line 1 |
||
Nemokosch | like, why does [&div] bizarrely not coerce? | ||
17:10
snonux left
|
|||
Voldenet | yeah, div is not Cool | 17:11 | |
Nemokosch | when even [&gcd] does | ||
I think MasterDuke adapted the tests to the coercing behavior back in the day, then the discussion kinda rallied off | |||
mst | it just gets annoyed about reals, which ... personally I like things that are picky about floats because of the number of times I've seen people shoot themselves in the foot with floats when there was no actual need to be using them | ||
however inconsistency between functions is suboptimal | 17:12 | ||
Nemokosch | Reals are not the same as floats - the latter would be Num | ||
Reals are really the abstract, mathematically sane category | |||
mst | sorry | ||
li'l bit rusty here | 17:13 | ||
Nemokosch | lately there've been work on adding more support for Complex operations to the core | ||
like the logarithm of -1 and the sign of complex numbers | |||
the "sign" is the normalized direction iirc | 17:14 | ||
I'm pro sqrt -1 as well, although that would definitely be a new language version for safety | 17:15 | ||
mst | I'm ambivalent because that would make sqrt return different types in different situations unless you made it always return Complex and that probably has its own Interesting Times attached as a choice | 17:16 | |
el sqrt(-1) eh most people don’t know complex numbers and its better to throw errors rather than giving something strange to them | 17:17 | ||
Nemokosch | I mean, use types if you aren't happy with a complex number | 17:19 | |
it's really not a huge risk | |||
if you cast to Real, you get the error | |||
mst expresses no opinion about that part because he's a pure maths grad without sufficient theory of mind to model how the general user would see it | |||
Nemokosch | yeah I'd say always complex tbh, there is .narrow to help out | 17:20 | |
17:21
NemokoschKiwi left
|
|||
mst | gut feeling is that most users would be better served by an exception, and having either a csqrt or a 'DWIMs for mathemamticans sqrt' that can be imported might be a wiser idea | 17:22 | |
Nemokosch | I think that genuinely goes against the decision of division returning rational numbers | 17:23 | |
this was a marketing topic, even, "it does the right thing, it knows math by default" | |||
why disregard it immediately with powers | |||
el but then is it a math oriented language? | 17:25 | ||
17:26
snonux joined
|
|||
does people use it for that purpose | 17:26 | ||
mst | the question, basically, is whether the feature will be more useful to people intending to do complex math than it will be confusing to everybody who isn't | 17:27 | |
and I'm unsure how one would answer that | 17:28 | ||
el id imagine the people using complex math to be a small subset of people using sqrt | |||
mst | m: say -1.Complex | 17:29 | |
camelia | -1-0i | ||
mst | wonder if taking a complex number as input as a hint would work | 17:30 | |
so you have Real -> Real and Complex -> Complex signatures | |||
Nemokosch | I think if you are doing that call at all, you do want it to work | ||
17:31
snonux left
|
|||
mst | or you're doing sqrt($x) and you -thought- $x wasn't negative and were mistaken | 17:31 | |
Nemokosch | getting an error for that is NOT that valuable, and if you want that to happen, it's really a very welcome solution to use types | ||
el m: say -1.Complex.sqrt | |||
Raku eval | -1-0i | ||
el the sqrt of -1 is -1 | 17:32 | ||
real | |||
mst | uh | ||
that ... uh | |||
el m: say (-1).Complex.sqrt | |||
Raku eval | 0+1i | ||
el ok | |||
mst | I think I'm just gonna hide under my desk and rock for a bit now. | 17:33 | |
Nemokosch | xD | ||
el why do i always forget that unary is less precedent than dot | |||
mst | oh, of course, so we ended up with -(1.Complex.sqrt) | 17:34 | |
el either that or -1 should be a number literal | |||
Nemokosch | -1 is not a number literal | 17:36 | |
buuut | |||
whitespace helps xD | |||
-1 .Complex.sqrt | |||
17:38
rypervenche left
17:40
rypervenche joined,
razetime left
|
|||
el ik | 17:49 | ||
17:51
snonux joined
17:52
jpn joined
17:53
pingu joined,
notna joined
17:56
jpn left
18:00
reportable6 left
18:01
reportable6 joined
18:09
simcop2387 left,
perlbot left
18:12
snonux left
18:13
snonux left
18:14
p6steve joined
|
|||
p6steve | m: (-1).sqrt | 18:14 | |
camelia | ( no output ) | ||
p6steve | m: (-1).sqrt.say | ||
camelia | NaN | ||
p6steve | sqrt coerces arg to Num (since it will return an irrational result by definition and uses the FPU sqrt for performance and IEEE P754 type error behaviour) | 18:17 | |
I just saw the above discussion ... made me smile | 18:18 | ||
18:20
snonux joined
18:29
freeside left
18:30
snonux left
18:43
freeside joined,
snonux joined
18:47
jgaz joined
18:49
snonux left
|
|||
pingu | if (Str($tok) == False) is not working if I assign a non string value to $tok | 19:03 | |
Nemokosch | it shouldn't be working so that's correct | 19:05 | |
pingu | it is meant to check if the value is a string | 19:07 | |
pastebin.com/SQrVhWxp | 19:08 | ||
doing my $x = 4; prints 4 | |||
Nemokosch | meant by whom, though 😛 because it's clearly not a Raku thing | 19:11 | |
pingu | are you saying that raku cant differentiate between 4 and '4' | 19:12 | |
19:12
jpn joined
|
|||
lizmat | m: say "4".^name; say 4.^name | 19:12 | |
camelia | Str Int |
||
pingu | I wish there was more help online for raku | 19:13 | |
derek banas has a video tut but its not very good and well,, I checked rakus website for how to do it and I dont know | 19:14 | ||
lizmat | m: say "is a string" if "42" ~~ Str | 19:15 | |
camelia | is a string | ||
lizmat | m: say "is a string" if 42 ~~ Str | ||
camelia | ( no output ) | ||
pingu | if I make $x 'a' now, doing if if ($x.^name) fails | 19:17 | |
but it works if its 4 or 4.4 | |||
19:17
jpn left
|
|||
pingu | ok ill try ~~ | 19:17 | |
it does the same | 19:18 | ||
lizmat | if you want to see if something is numeric, use Numeric | ||
m: say "numeric" if 42.2 ~~ Numeric | |||
camelia | numeric | ||
lizmat | m: say "numeric" if 42e4 ~~ Numeric | ||
camelia | numeric | ||
lizmat | m: say "numeric" if 42i ~~ Numeric | ||
camelia | numeric | ||
lizmat | m: say "numeric" if "42" ~~ Numeric | ||
camelia | ( no output ) | ||
pingu | in reality the string can contain numbers puncuation and alphanumerics | 19:19 | |
for now im adding ' ' around it but when its in a file that will be another problem | |||
because you cant have ' ' in ldraw format | |||
lizmat | ok, lemme get this straight what you want | ||
you want to create a lexical variable that may only contain strings? | 19:20 | ||
pingu | if it is " " or ' ' it should print the value else it should print ("must be a string value"); | 19:21 | |
< > is probably ok too but I will be using ' ' or " " only | |||
maybe if I try what you said and what I did in one if condition using && | 19:23 | ||
lizmat | ' ' and " " *create* a string. Or do you want a string that contains ' or " | ||
pingu | if ($x ~~ Str && Str($x) == False) | ||
lizmat | in normal words: if $x is a string and $x is not a string ??? | 19:24 | |
pingu | if its of type Str then yes print its contents | ||
if $is a not a string print an error else print the value of $x | 19:25 | ||
lizmat | I think what you need is: | ||
my Str $x | |||
if what you try to assign is not a string, then you will get an error | 19:26 | ||
m: my Str $x = 42 | |||
camelia | Type check failed in assignment to $x; expected Str but got Int (42) in block <unit> at <tmp> line 1 |
||
lizmat | so you want a better error message ? | ||
pingu | ah wait I need !~~ | 19:27 | |
I was putting ~~ in the false part of the if statement | 19:28 | ||
yeah my bad !~~ works thx | |||
so when it doubt try smart match | 19:29 | ||
lizmat | I guess | ||
19:30
snonux joined
19:34
jpn joined
19:45
freeside left
19:59
freeside joined
|
|||
Nemokosch | is "source-url" used for anything in META6.json these days? | 20:02 | |
20:03
jpn left,
freeside left
20:04
freeside joined
|
|||
ugexe | yes, its more of an ecosystem level thing though | 20:04 | |
as in - ecosystems can set this value or override the existing one if they wish | 20:05 | ||
Nemokosch | okay, then I will fix the value rather than delete it | 20:06 | |
in this MessagePack bundle | |||
One more thing: can Perl6-Data-MessagePack be removed from p6c? I'm about to release the Rakufied, community module version to zef's ecosystem | 20:12 | ||
ugexe | yeah, but you don't have to hurry either since the version of fez will be preferred regardless of i its higher or lower version | 20:14 | |
Nemokosch | fair enough, it's more the urge to leave a "clean sheet" that pushes me to this direction | 20:15 | |
ugexe | it should be fine since the zef ecosystem has been integrated for awhile now | 20:16 | |
fine to just remove it that is | 20:17 | ||
20:17
jgaz left
|
|||
Geth | ecosystem: 2colours++ created pull request #613: Remove Data::MessagePack |
20:22 | |
20:22
jgaz joined
20:27
jpn joined
|
|||
Geth | ecosystem/main: 808476955b | (Márton Polgár)++ (committed using GitHub Web editor) | META.list Remove Data::MessagePack (#613) |
20:33 | |
20:33
abraxxa-home joined
|
|||
lizmat | fg | 20:34 | |
20:35
abraxxa-home left
20:36
abraxxa-home joined
|
|||
Nemokosch | abraxxa: the msgpack.org/ site has a sort of weird flow: if you put a certain text into your repo description, it will be generated into the site, and this is updated hourly. This means, the Raku version would soon show up, however the Perl 6 version would also stay there | 20:37 | |
20:39
snonux left
20:40
snonux joined
20:50
guifa joined
21:00
rantanplan joined
21:02
plantanran joined,
jpn left
21:04
snonux left
21:05
rantanplan left
21:18
freeside left
21:30
freeside joined
21:37
notna left
21:41
Sgeo joined
21:49
freeside left
21:53
plantanran left
21:56
jpn joined
22:01
jpn left
22:04
freeside joined
22:24
jpn joined
22:29
jpn left
22:31
guifa left
23:06
ProperNoun left
23:07
freeside left
23:19
freeside joined
23:20
sena_kun left
23:24
freeside left
23:30
ab5tract joined,
abraxxa-home left
23:36
simcop2387 joined
23:37
perlbot joined
23:38
freeside joined
23:45
ab5tract left
|