[racket-dev] And/or as procedures when not in application position
I don't like this idea for Racket. The macros "and" and "or" do not behave
like functions any more than "if" does. This isn't Haskell, our functions
are eager while our conditional forms are short-circuiting. If we want
first-order values that perform conjunction and disjunction, but eagerly,
we should give them separate names. Otherwise we're going to get some very
confusing programs. For instance, if you treat "and" / "or" as functions,
various program transformations that seem sensible no longer hold. For
instance,
(and #true 'result (error "oh no"))
is not the same as
(let {[f and]} (f #true 'result (error "oh no")))
...if "and" produces a short-circuiting form in the former case and an
eager function in the latter.
I do agree that functions performing boolean conjunction/disjunction are
useful. We could call these things andf / orf, and/proc / or/proc, conj /
disj, or any number of other paired names that aren't already taken for
conditional special forms.
Carl Eastlund
On Mon, Dec 10, 2012 at 6:16 PM, J. Ian Johnson <ianj at ccs.neu.edu> wrote:
> I just made a pull request for making and/or expand to functions that
> perform and/or following a discussion with stamourv and asumu. Vincent
> believes these additions should also be made to the student languages, but
> I thought I'd start a discussion about this before doing that work.
> What are people's thoughts on this?
> -Ian
> _________________________
> Racket Developers list:
> http://lists.racket-lang.org/dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20121210/a31f28ec/attachment-0001.html>