(define-syntax ifn't (syntax-rules () ((_ cond) (or cond #t)) ((_ cond false) (ifn't cond false #t)) ((_ cond false else) (if (not cond) false else))))
deadstare
Comment on ifn't
OpenStars@startrek.website 9 months ago
Please God let this be a humorous post that somehow does not also find a way to manage to come true…
(define-syntax ifn't (syntax-rules () ((_ cond) (or cond #t)) ((_ cond false) (ifn't cond false #t)) ((_ cond false else) (if (not cond) false else))))
deadstare
jtk@lemmy.sdf.org 9 months ago
I would have bought it if they said ifnot instead, it’s the same number of characters and wouldn’t require a major parser overhaul to support.
pupbiru@aussie.zone 9 months ago
i mean, “unless” tends to be the usual term for an “if not” keyword in languages that implement such a thing
Fal@yiffit.net 9 months ago
Which is awful and incredibly confusing. I hate ruby
pupbiru@aussie.zone 9 months ago
totally agree; just saying that if it’s GOT to be something, that something should probably be unless… unless . . .
msage@programming.dev 9 months ago
And Perl
frezik@midwest.social 9 months ago
I find that you need to choose carefully when to use it. Simple cases tend to be alright. Larger, more complex conditions shouldn’t touch it.
OpenStars@startrek.website 9 months ago
Yeah, to be clear, I don’t like it, I don’t like it one bit:-P.
jaybone@lemmy.world 9 months ago
If not anybody have time for that.
OpenStars@startrek.website 9 months ago
*ifn’t*
Oh dear Lord what have I done!? :-P