Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Predicates are incompatible with lif #2

Open
gilch opened this issue Jul 24, 2015 · 2 comments
Open

Predicates are incompatible with lif #2

gilch opened this issue Jul 24, 2015 · 2 comments

Comments

@gilch
Copy link
Member

gilch commented Jul 24, 2015

What's the rationale for making False truthy in lif? Because that's just bizarre. I know that nil in its various incarnations is the one true false in Common Lisp. But in every Lisp I know of that actually has a false, it is, in fact, falsey.

I do understand the need for both Pythonic if and Lispy lif. There are cases it simplifies, that could fail on e.g. 0 being falsey. I think Clojure is our best guide here. In Clojure, both nil and false (and nothing else) are falsey.

Now I am not proposing a third cif. I think that over-complicates things. If there truly are good reasons for making false truthy, then we should change all the ? predicates in Hy to return nil instead of false (as with Common Lisp's p predicates). Otherwise, can we make lif act more like Clojure, please?

@agentultra
Copy link
Member

It’s a macro and pretty harmless.

I needed a canonical lisp-ish sense of logical truth to implement a corner-case in a monadic parser-combinator I was writing to parse Hy… so that we could write READ in hy and eventually have Hy written in Hy. Python’s idea of truth is a little too broad in certain situations where 0 is a perfectly legitimate value and not a boolean.

On Jul 24, 2015, at 3:48 PM, gilch notifications@github.com wrote:

What's the rationale for making False truthy in lif? Because that's just bizarre. I know that nil in its various incarnations is the one true false in Common Lisp. But in every Lisp I know of that actually has a false, it is, in fact, falsey.

I do understand the need for both Pythonic if and Lispy lif. There are cases it simplifies, that could fail on e.g. 0 being falsey. I think Clojure is our best guide here. In Clojure, both nil and false (and nothing else) are falsey.

Now I am not proposing a third cif, I think that over-complicates things. If there truly are good reasons for making false truthy, then we should change all the ? predicates in Hy to return nil instead of false (as with Common Lisp's p predicates). Otherwise, can we make lif act more like Clojure, please?


Reply to this email directly or view it on GitHub.

@Kodiologist
Copy link
Member

@gilch's argument seems even better now that nil is gone in place of None. That said, I never use lif myself, so I can't say I have very strong preferences here.

@Kodiologist Kodiologist transferred this issue from hylang/hy Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants