01:05
hulk joined,
kylese left
02:15
hulk left,
kylese joined
|
|||
ingy | I wanted to mention here that YAMLScript is an official language track on exercism.org now: exercism.org/tracks/yamlscript | 02:15 | |
The exercise solutions in YS are always among the most concise... Raku, Haskell and Python generally do quite well also... | 02:17 | ||
Here's a generated language comparison of one of the exercises: gist.github.com/ingydotnet/03d6e44...8b298cbc9e | 02:18 | ||
The Raku solution there is lovely <3 :) | |||
03:18
Aedil joined
|
|||
xinming | Hi, Is there a better way to do something like this: my $class = Int; Any ~~ $class ? | 03:21 | |
Check class in scalar not Any | |||
03:33
nine_ joined,
nine left,
camelia left
03:38
camelia joined
05:35
Sgeo left
06:26
xinming_ left
06:28
xinming_ joined
06:49
xinming_ left
06:51
xinming_ joined
07:11
simcop2387 left,
perlbot left
07:25
simcop2387 joined
07:26
perlbot joined
07:28
MasterDuke left
|
|||
antononcube | @ingy What “generated” means? I do not think it means “LLM-generated”, but I might be wrong. | 07:39 | |
ab5tract | xinming: are you trying to check whether the object is a scalar? | 08:00 | |
08:14
dakkar joined
08:32
Aedil left,
sena_kun joined
08:40
Aedil joined
09:05
sena_kun left
10:33
jjido joined
10:57
jjido left
11:00
teatwo left
|
|||
xinming | ab5tract: Nope, I'm trying to check the $scalar has class assigned. $scalar.defined returns False for class | 11:54 | |
So what I can think of is, use Any to test with, but wish to know if we can have better way for this. | 12:02 | ||
antononcube | @xinming You can probably use Perl6::Metamodel::ClassHOW. | 12:05 | |
timo | you want to check what the variable is defined as? | 12:07 | |
m: my Int $foo; my Any $bar; say $foo.VAR.of; say $bar.VAR.of; | 12:08 | ||
camelia | (Int) (Any) |
||
timo | or you want to see if the thing stored in the variable is not definite, i.e. not an instance? | ||
m: my $foo = Any; my $bar = Pair; my $baz = 99; class Meanie { method defined { False } }; my $quux = Meanie.new(); for ($foo, $bar, $baz, $quux) { say "DEFINITE? $_.DEFINITE() - defined? $_.defined()"; } | 12:10 | ||
camelia | DEFINITE? False - defined? False DEFINITE? False - defined? False DEFINITE? True - defined? True DEFINITE? True - defined? False |
||
timo | m: my $foo = Any; my $bar = Pair; my $baz = 99; class Meanie { method defined { False } }; my $quux = Meanie.new(); my $blorb = Meanie; for ($foo, $bar, $baz, $quux, $blorb) { say "DEFINITE? $_.DEFINITE() - defined? $_.defined() - ~~ Mu:U? $( $_ ~~ Mu:U )"; } | 12:11 | |
camelia | DEFINITE? False - defined? False - ~~ Mu:U? True DEFINITE? False - defined? False - ~~ Mu:U? True DEFINITE? True - defined? True - ~~ Mu:U? True DEFINITE? True - defined? False - ~~ Mu:U? True DEFINITE? False - defined? False - ~~ Mu:U? True |
||
timo | m: my $foo = Any; my $bar = Pair; my $baz = 99; class Meanie { method defined { False } }; my $quux = Meanie.new(); my $blorb = Meanie; for (:$foo, :$bar, :$baz, :$quux, :$blorb) -> $_ is copy { say .key; $_ = .value; say "DEFINITE? $_.DEFINITE() - defined? $_.defined() - ~~ Mu:U? $( $_ ~~ Mu:U )"; } | 12:12 | |
camelia | foo DEFINITE? False - defined? False - ~~ Mu:U? True bar DEFINITE? False - defined? False - ~~ Mu:U? True baz DEFINITE? True - defined? True - ~~ Mu:U? True quux DEFINITE? True - defined? False - ~~ Mu:U? True blorb DEFINITE? False -… |
||
timo | m: my $foo = Any; my $bar = Pair; my $baz = 99; class Meanie { method defined { False } }; my $quux = Meanie.new(); my $blorb = Meanie; say "DEFINITE? defined? Mu:U?"; for (:$foo, :$bar, :$baz, :$quux, :$blorb) -> $_ is copy { say .key; $_ = .value; ($_.DEFINITE(), $_.defined(), $_ ~~ Mu:U).fmt("% 10s").say; } | 12:14 | |
camelia | DEFINITE? defined? Mu:U? foo False False True bar False False True baz True True True quux True False True blorb False False True |
||
timo | ok not 100% sure why Mu:U gives True for all those | 12:15 | |
m: my $foo = Any; my $bar = Pair; my $baz = 99; class Meanie { method defined { False } }; my $quux = Meanie.new(); my $blorb = Meanie; say "Mu:U?"; for ($foo, $bar, $baz, $quux, $blorb) { say ($_ ~~ Mu:U) } | 12:16 | ||
camelia | Mu:U? True True True True True |
||
timo | m: my $foo = Any; my $bar = Pair; my $baz = 99; class Meanie { method defined { False } }; my $quux = Meanie.new(); my $blorb = Meanie; say "Mu:U?"; for ($foo, $bar, $baz, $quux, $blorb) { say ($_ ~~ Mu:U, $_ ~~ Mu:D, $_ ~~ Mu:_) } | 12:17 | |
camelia | Mu:U? (True False True) (True False True) (True True True) (True True True) (True False True) |
||
timo | m: say 42 ~~ Int:U | ||
camelia | False | ||
timo | m: for (42,) { say $_ ~~ Int:U } | 12:18 | |
camelia | False | ||
timo | m: for (42,) { say $_ ~~ Any:U } | ||
camelia | False | ||
timo | m: for (42,) { say $_ ~~ Mu:U } | ||
camelia | True | ||
timo | okay, stay away from Mu:U i guess? | ||
m: given 42 { say $_ ~~ Mu:U } | 12:23 | ||
camelia | True | ||
timo | m: say 42 ~~ Mu:U | ||
camelia | False | ||
timo | i wonder if it checks against the scalar container there | 12:24 | |
say Scalar ~~ Any; say Scalar ~~ Mu | |||
evalable6 | True True |
||
timo | hmm. yeah, not sure. | ||
lizmat | and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2024/09/17/2024-...omma-plug/ | 12:27 | |
xinming | timo: Just test wether the class in var is other than Any. | 12:54 | |
m: $c = Int; $c.Bool.say; (Any ~~ Int).Bool.say; | |||
camelia | ===SORRY!=== Error while compiling <tmp> Variable '$c' is not declared. Perhaps you forgot a 'sub' if this was intended to be part of a signature? at <tmp>:1 ------> <BOL>⏏$c = Int; $c.Bool.say; (Any ~~ Int).Boo |
||
xinming | m: my $c = Int; $c.Bool.say; (Any ~~ Int).Bool.say; | ||
camelia | False False |
||
timo | m: my $a = Int; say $a =:= Any; $a = Any; say $a =:= Any | 13:23 | |
camelia | False False |
||
timo | m: my $a = Int; say $a === Any; $a = Any; say $a === Any | ||
camelia | False True |
||
13:23
xinming left
13:26
xinming joined
13:35
silug left
13:36
silug joined
14:29
andinus2 left
14:30
andinus joined
|
|||
timo | m: gist.github.com/timo/2aa2a740fba4e...ee3d337e1c | 15:12 | |
camelia | Ip.new(a => $[Address.new(address => 999, ifname => "eth0"), Address.new(address => 123, ifname => "wlp0")], r => $[Route.new(dev => "eth0", dst => "default"), Route.new(dev => "lo", dst => "127.0.0.1")]) | ||
timo | here, have some sillyness | ||
17:07
dakkar left
17:41
sena_kun joined
18:51
MoC joined
18:54
MoC left
|
|||
ingy | antononcube: by generated I mean I have a ys program that generated the markdown gist I posted by cloning the 74 exercism language repos, pulling out the code from each and formatting it all into markdown | 19:01 | |
I can make pages showing all the exercises as implemented by the langs I'm interested in. or 1 exercise showing every lang implementation | 19:03 | ||
19:07
xinming left
19:28
jjido joined
|
|||
antononcube | @ingy This is cool -- it should be a treasure trove for LLM training. | 19:38 | |
19:58
sena_kun left
|
|||
weekly: x.com/antononcube/status/1836081920981209089 | 20:40 | ||
notable6__ | antononcube, Noted! (weekly) | ||
22:11
Aedil left
22:23
Sgeo joined
22:39
sena_kun joined
22:41
sena_kun left
23:06
jjido left
|