Raku Conference Day 2 on Youtube: www.youtube.com/watch?v=BL9-XdC9WYI 🦋 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 14 August 2022.
grondilu wasn't there a shorthand for &infix:<op>? 11:20
m: dd &[+] 11:21
camelia Sub+{is-pure}+{Precedence infix:<+> = proto sub infix:<+> ($?, $?, *%) {*}
grondilu found it
Geth docker: 652cf35f9d | (Daniel Mita)++ (committed using GitHub Web editor) | README.md
Fix travis-ci badge
12:20
leont Apparently, junctions will turn ranges into lists when they're the only argument 14:06
m: dd any(1..4) 14:07
camelia any(1, 2, 3, 4)
leont Is that a bug or is that intended? (it is annoying me because it doesn't allow me to do none(1..4) to negate the junction)
m: dd any(1..4, 42) 14:08
camelia any(1..4, 42)
leont It's especially annoying because I haven't found any way to turn it off without passing more arguments 14:09
lizmat I think that's intentional, to prevent a lot of code having to be more or less duplicated 14:14
wrt to collapsing the Junction
leont There should be some way to override that, though. 14:19
thundergnat m: say any(1..4,Empty) # Kinda bogus but... 14:29
camelia any(1..4)
leont thundergnat: unexpected, but for now I can work with it
thundergnat Yeah, not ideal but sometimes you gotta go with what works. 14:30
leont I think that fundementally we're missing a negated() builtin. Which is a bit like none but only takes one value.
Smartmatching against none($whatever) feels a bit confusing, even if it's terribly useful 14:31
Nemokosch Junctions have underdeveloped semantics 14:55
I say this every now and then but yeah, junctions have a very anglocentric interface, even at the expense of usefulness 14:58
tonyo what could anglocentric interface possibly mean 15:12
Nemokosch Embracing logically vague or convoluted concepts like "any" and "none" 15:49
Altreus This perspective interests me because I am an anglo, and therefore I have never seen it before 15:56
Are these concepts not formalised? Could they not be replaced with some set logic symbols and become purely mathematical?
tonyo not sure i'd consider those vague, any means at least one of a set and none seems clear to me. why do you consider those vague or convoluted? 16:04
Nemokosch "For none, P holds" is logically equivalent to "For all, P doesn't hold". This is no big deal, except Raku _forces_ you to write the former, because of "negation lifting" which is, well, a questionable principle 16:06
So you are left with a less clear and less mentally flexible phrasing
"Any" is unsavable on the other hand
tonyo a∈B == any && x∉A == none
Nemokosch Since "I can do anything" and "Can I do anything" have different "any"s in them, it's a mess, without inventing some higher order logic 16:08
tonyo can you write that equivalence in raku?
i think by asking the latter you've already answered it
Nemokosch I think I have pinpointed a legitimate design mistake 16:10
tonyo i don't disagree, i'd like to see what you're saying the equivalent "For none, P holds" and "For all, P doesn't hold" translate to 16:12
without the translation to actual code it's just vague and convoluted
tonyo thinking about that a bit more, i don't think those two statements are equivalent "For none, P holds", "For all, P doesn't hold" 16:20
m: say 1 ~~ all(1,2,3); say 1 ~~ none(1,2,3); 16:21
camelia False
False
tonyo m: say 1 ~~ all(1,1,1); say 1 ~~ none(1,1,1);
camelia True
False
tonyo sure enough, en.wikipedia.org/wiki/Denying_the_antecedent 16:22
nemokosch ^ 16:23
Nemokosch I think you are getting this wrong 16:41
There is no inversion here 16:42
This is really just "no prime numbers are even" versus "all prime numbers are not-even aka odd" 16:43
(1, 2, 3).none == 2 # False 16:45
Versus
(1, 2, 3).all != 2 # True, transformed into !((1, 2, 3) == 2) for the wrong reasons
So yeah, if you want to say "all of these are different from X", you are forced to say "none of these are equal to X" 16:46
tonyo (1,1,1).none == 1 # False 17:02
(1,1,1).all != 1 # False
you can pick examples where the inversion is true but there are at least as many cases as there are real numbers where it's untrue 17:03
i mean, the logical fallacy i posted is using exactly the language you are using, i'm not sure how you can defend it 17:06
"If all, then P" "If none, then !P" 17:07
().none == 2 #False 17:13
().all == 2 #False
tonyo ().all != 2 # still False 17:20
Nemokosch If you can point out where the fallacy is in "all primes are odd" <=> "no primes are even", I pay you a trip to Dubai 17:23
tonyo i said already, your hand picked single example works fine. asserting something based on one example is wrong and so is your thought process. i've already shown you counter examples using your same logic 17:24
Nemokosch You literally didn't
tonyo haha, ok. 17:25
Nemokosch You just showed that you failed to understand the very example and went for some strawman
tonyo no strawman here, just an example of you misunderstanding set theory and showing your logic applied to an example where it doesn't work out for you 17:26
Nemokosch The fact that you linked something about implications when I'm talking about quantors on sole predicates
No "if"s to begin with 17:27
tonyo set.none == 2 == false, set.all != 2 == true where set = (1,2,3) => (true), set = () => (false)
set = (2,2,2) => (false) 17:28
Nemokosch Yes, and this is wrong behavior
set.all != X is NOT the same as !(set.all == X) in logic, only in Raku 17:29
It is the same as set.none == X
tonyo it isn't.
(set.all != X) != (set.none == X) in logic or in theory 17:30
Nemokosch Not in Raku, yes in logic 17:31
If and only if all values are different from X, are none of the values equal to it
Yes, it is, lol
tonyo no, it isn't. what is the result of set.none == 2 when set is empty?
Voldenet True, obviously 17:35
Nemokosch See, that's what the problem is by using anglo-centric quantors in the first place...
tonyo and then what is the result of set.all != 2 when, again, the set is empty?
oops, nemokosch there is not problem with anglo-centric quantors 17:36
ugexe the result should obviously be True, nil or False, nil
Voldenet none -> no element matches the predicate 17:37
all -> all elements match the predicate
Nemokosch True, that one is for sure
tonyo going back to work instead of arguing with someone who just says `no` and then refuses to use examples outside of cherry picked examples
Voldenet so `set.all != 2` and `set.all == 2` can be used to test whether the set is empty
tonyo or set.elems : ) 17:38
Voldenet with empty set and a single predicate, all elements match the predicate and no elements match the predicate
that makes perfect sense
Nemokosch For "all", it's a well-established practice that the value on an empty set is true, that's the algebraically sane "default" for logical "and" 17:39
No gotcha with this
Voldenet so `().all == 2`, `().all != 2`, `().none != 2` and `().none == 2` should be all true
Nemokosch ^this 17:40
Seems like we can agree with Voldenet on some things, after all :D 17:41
Voldenet ;)
Nemokosch Although I would stay away from .none in borderline cases like this, which is part of my whole point
Because it's not really a common quantifier in math 17:42
Who would dare to contradict a cornerstone of basically all formalisms used for e.g relational databases 17:45
Voldenet …in relational databases predicate can be both true and false at the same time and I think it's beautiful ;) 17:46
Anton Antonov For what is worth, here is how Mathematica does the tests listed by Voldenet : 17:52
Here is the image link: i.imgur.com/uGy6WVu.jpg 17:54
Meaning Mathematica agrees with Voldenet's statement : 17:55
"` ().all == 2, ().all != 2, ().none != 2 and ().none == 2` should be all true."
Voldenet raku/mathematica definitions are slightly different though 17:57
Nemokosch It's rather the issue itself in this case 17:58
Voldenet Sure, I'd expect the mathematica ones
Anton Antonov Sure, I am just mentioned the handling/implementation in Mathematica of similar functionalities.
Nemokosch We do know that blah.all != X implicitly transforms into !(blah.all == X)
Voldenet which is unfortunate in this case 17:59
Nemokosch This is a deliberate design... mistake, and I really feel I can't just drop the judgemental part 18:00
Anton Antonov @Voldenet Sorry for this ignorant question -- did you see the image I posted in Discord, or saw the image I posted at Imgur?
tonyo @anton antonov: yes
it came through
Voldenet The imgur one, discord one was just devoured by bot
Anton Antonov Ok, good to know!
@tonyo Which one came through? 18:02
tonyo also, nemokosch isn't 2 a prime number? nevermind about dubai though.
anton - the imgur link (at least in irc) 18:03
ugexe 12:54:30 <discord-raku-bot>
<Anton Antonov> Here is the image link: i.imgur.com/uGy6WVu.jpg
Nemokosch It is but what does this have to do with logical equivalence? :D 18:04
Anton Antonov @tonyo and @ugexe -- Thanks! I will use Imgur in the future.
tonyo <Nemokosch> If you can point out where the fallacy is in "all primes are odd" <=> "no primes are even", I pay you a trip to Dubai
Voldenet hehehe :D 18:05
tonyo aside from that, your original assertion was about any and none, which is still untrue, no matter how many times you say otherwise 18:06
not sure how we got off on the all <> none strawman you brought forth, possibly a backtrack 18:07
Voldenet fortunately this is easy fo tix 18:15
to fix*
m: sub infix:<!=>($a, $b) { !($a == $b) }; 18:16
camelia ( no output )
tonyo only two prime numbers are even <=> all but two prime numbers are odd (sometimes)
Voldenet m: sub infix:<!=>($a, $b) { !($a == $b) }; say so ().none != 2;
camelia True
tonyo m: say 2 !~~ none(); say 2 ~~ none(); 18:17
camelia False
True
tonyo m: say 2 !~~ any(); say 2 ~~ any();
camelia True
False
leont Apparently, coercing to a role isn't well supported. It puns, and therefor only works on concrete types. I'd argue this a bug, because it's really not helpful for anything. 18:52
Nemokosch Good sir, I made points that you had no intentions to engage in, instead you started pointing fingers at random unrelated things, like whether equivalent statements used as an example for equivalence are true or not, and some random fallacy that I also don't like but doesn't fit here whatsoever. 18:55
melezhik . 18:56
Nemokosch What should I prove further? You yourself proved pretty well that none is a mess to start defining 18:57
[Coke] iwbni raku.land deps were links 19:06
tbrowder anyone tired of debating is welcome to voice an opinion of rakudo PR #5031 which is concerned with adding a method for breaking down an IO::Path basename onto parts.. 19:33
already existing is .extension, but no equivalent method exists for the part of the basename with the extension removed. 19:35
Nemokosch I'm not at home but if you need an advocate for "torturing implementors on the user's behalf", I'm ready to help :) 20:17
p6steve tbrowder: phew 21:26
tbrowder: you have this ```<_file.tar.gz.1_> ``` what are the underscores? 21:31
tbrowder Those were the examples given by … I’ll have to check. If you look at the PR you should be able to see the author. I’ll check and return… 21:46
Ah, I saw those _ while editing my reply to @vrurg. I see now they don’t show in the browser view, so I need to clean up my response—thanks for that catch! 21:54
leont Did we ever end up documenting the details of the coercion protocol? I have questions and I can't find the answers anywhere 21:55
tbrowder <p6steve>: it looks correct now, thnx 22:00
leont m: sub f(\rows) { dd rows }; f([ [ 1, 2 ] ]) 22:17
camelia [1, 2]
leont I don't get why Raku eats the outer brackets 22:18
Is there any way to make it not do that?
thundergnat m: sub f(\rows) { dd rows }; f([ [ 1, 2 ], ]) # single argument woes once again 22:26
camelia [[1, 2],]
leont I was expecting \ not to have those woes 22:28
Wasn't the whole point of that "pass me this verbatim"? 22:30
thundergnat m: sub f(**@rows) { dd @rows }; f([ [ 1, 2 ] ]) # maybe this will help?
camelia [[1, 2],]
thundergnat single argument ends up biting in unexpected places. I still prefer to have it but it can lead to some convolutions. 22:32
leont thundergnat: that breaks when actually having more than one inner list 22:33
thundergnat hmm. It does. ok, I've got nothing. 22:35
ugexe i really dislike having these generic method names like 'suffix' and 'stem' being added for very specific, not often used features
when those terms, to me at least, are very much not tied to a path 22:36
this can introduce future inconsistencies where you have a 'suffix' for IO::Path that acts on the basename only, and a suffix for strings in general that would have no concept of basename 22:38
like whats wrong with basename-suffix or basename-stem? 22:39
leont I can't imagine ever wanting stem in particular 22:43
What is want is the basename as implemented in Unix and in Perl: one that can remove a given suffix. Bonus points if it can take a junction of them.
The basename method not doing what any other basename does is rather frustrating 22:44
Possibly basename should just take an optional argument to do just that 22:45