19 Oct 2025 | |||
SmokeMachine | I Amy very impressed on how easy Raku made that possible… the only problems are the same I had with Red (but on Red I was able to find a workaround). The short circuit operators not being overridable. I still plan to change that with RakuAST, but I’m not sure if it will be possible/enough. | 21:05 | |
I'm rethinking it... what would be better to be the name of a operator to receive 2 args, coerce them to Logic::Ternary and return the `and` of them? `AND` or `and3`? | 22:09 | ||
arkiuat | I prefer and3 of those two. | 22:24 | |
lizmat | wouldn't it make more sense to put the code in a role, and mix that into the enum ? | 22:26 | |
also, I think method gist could just be self.Str ? | 22:27 | ||
afk& | |||
SmokeMachine | I tried putting that in a role, but couldn’t make it work… | 22:36 | |
I prefer this way too: github.com/FCO/Logic-Ternary | 23:44 | ||
20 Oct 2025 | |||
Logic::Ternary sent to Zef... :) | 00:04 | ||
m_zero | trand and then, course tror and trxor or if you prefer triand, trior, and trixor | 00:40 | |
(and for bonus, these are fun to say out loud! 😁 ) | 00:41 | ||
SmokeMachine | I released and3, or3, xor3, not3 and so3... | 00:59 | |
raku.land/zef:FCO/Logic::Ternary | 01:18 | ||
Voldenet | SmokeMachine: I think and3 for regular `Bool:U, Bool::True, Bool::False` values would be more obvious | 03:32 | |
m: sub infix:<and3>($x, $y) { return False if $x eqv False; return False if $y eqv False; return Bool unless $x.defined; return Bool unless $y.defined; $x and $y }; my @v = (Bool, False, True); for (@v X @v) -> ($x, $y) { say ($x,$y,$x and3 $y).map(*.gist) } | 03:37 | ||
camelia | ((Bool) (Bool) (Bool)) ((Bool) False False) ((Bool) True (Bool)) (False (Bool) False) (False False False) (False True False) (True (Bool) (Bool)) (True False False) (True True True) |
||
Voldenet | I'm sure it can be more elegantly written maybe by even mapping Bool:U to Logic::Ternary::Unknown | 03:41 | |
current problem with Logic::Ternary is that it overrides Bool making it very non-obvious trap | 03:46 | ||
m: enum Ternary ( False => -1, Unknown => 0, True => +1 ); sub thing(Bool $x) { say $x }; thing(True) # uhhhh | 03:47 | ||
camelia | ===SORRY!=== Error while compiling <tmp> Calling thing(Ternary) will never work with declared signature (Bool $x) at <tmp>:1 ------> => +1 ); sub thing(Bool $x) { say $x }; <HERE>thing(True) # uhhhh |
||
Voldenet | also `Unknown` should become `Bool:U`, not False | 03:49 | |
after coercing | |||
but really coercing should be done for internal logic, because Bool is enough | 03:50 | ||
m: multi sub infix:<and3>(Bool $x, Bool $y) { given any($x, $y) { when * eqv False { False }; when not .defined { Bool }; default { $x and $y }} }; my @v = (Bool, False, True); for (@v X @v) -> ($x, $y) { say ($x,$y,$x and3 $y).map(*.gist) } | 04:03 | ||
camelia | ((Bool) (Bool) (Bool)) ((Bool) False False) ((Bool) True (Bool)) (False (Bool) False) (False False False) (False True False) (True (Bool) (Bool)) (True False False) (True True True) |
||
Voldenet | m: multi sub infix:<and3>(Bool $x, Bool $y) { any($x, $y) eqv False ?? False !! $x and $y }; my @v = (Bool, False, True); for (@v X @v) -> ($x, $y) { say ($x,$y,$x and3 $y).map(*.gist) } | 04:26 | |
camelia | ((Bool) (Bool) (Bool)) ((Bool) False False) ((Bool) True (Bool)) (False (Bool) False) (False False False) (False True False) (True (Bool) (Bool)) (True False False) (True True True) |
||
Voldenet | m: multi sub infix:<and3>(Bool $x, Bool $y) { any($x, $y) !eqv False && $x and $y }; my @v = (Bool, False, True); for (@v X @v) -> ($x, $y) { say ($x,$y,$x and3 $y).map(*.gist) } | 04:29 | |
camelia | ((Bool) (Bool) (Bool)) ((Bool) False False) ((Bool) True (Bool)) (False (Bool) False) (False False False) (False True False) (True (Bool) (Bool)) (True False False) (True True True) |
||
melezhik. | . | 06:36 | |
SmokeMachine | Voldenet: Bool:U is already mapped to Unknown (github.com/FCO/Logic-Ternary/blob/...kumod#L59) | 07:11 | |
Voldenet: yes, you will need to use Bool::* if you need to use boolean values. But I don't see it as a problem... | 07:12 | ||
Voldenet | but raku is dynamic language, it's not java where you can count on types | 07:15 | |
m: enum X <True>; sub Y(Bool $x) { }; sub Z($x) { Y($x) }; Z(True) # consider this | 07:17 | ||
camelia | Type check failed in binding to parameter '$x'; expected Bool but got X (X::True) in sub Y at <tmp> line 1 in sub Z at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
Voldenet | redefining those is a bit like redefining Int or Bool | 07:18 | |
m: enum X<Bool>; say Bool::True; # this is what I mean | |||
camelia | Could not find symbol '&True' in 'X' in block <unit> at <tmp> line 1 |
||
Voldenet | Yes, you can still access it through CORE::Bool::True, but it's still messy code | 07:24 | |
so I'd still use Bool:U and actual Bool values, because they already exist | 07:25 | ||
SmokeMachine | Voldenet: about Unknown -> Bool:U, I plan to do that... I only forgot about it on 0.0.2... | 07:37 | |
Voldenet | it'd work, but I'd say that the module shouldn't export True/False by default either way | 07:40 | |
in fact, I think the following should be valid: `use Logic::Ternary;; sub foo(Logic::Ternary() $_) { .say }; foo(Bool); foo(Bool::True); foo(Bool::False);` | 07:45 | ||
so, `True` and `False` from Bool are being used, you can convert things to and from Logic::Ternary but it doesn't override True/False anyhow | 07:46 | ||
melezhik | Sparky ci has switched to Rakudo 2025.10 , if someone wants to test their modules against fresh Rakudo … | 08:30 | |
El_Che | . | 10:01 | |
librasteve | o/ | 13:34 | |
[Coke] | not really a zef question but: if I do zef look META6 in powershell, and then hit ^C for some reason... the shell gets VERY confused, and keeps asking me More? More? More? - if this were bash, I'd try 'stty sane', but it looks completely messed up - only option is to open another powershell, run zef look again. | 15:54 | |
(and after the ^C, I appear to back in the original powershell, not the zef look shell) | |||
ah, ^Z helps. | |||
... ah, no, it's just not asking me more any more, still borked. | 15:55 | ||
ugexe | exit so shell(%*ENV<SHELL> // %*ENV<ComSpec> // %*ENV<COMSPEC>, :cwd($dist-path)) ?? 0 !! 1; | 15:56 | |
that is what zef does for zef look |