Subject: Re: macros vs HOFs (was: O'Caml)
From: Erik Naggum <erik@naggum.no>
Date: 12 Sep 2002 21:51:02 +0000
Newsgroups: comp.lang.lisp
Message-ID: <3240856262261155@naggum.no>

* Gareth McCaughan
| I agree that static typing doesn't cause the problem.  (That was my point.)

  I think my point has been muddled.  When I said that this (/ int int) -> int
  is /a consequence of/ static typing, that does not mean that it is not also
  a consequence of more factors.  It means that if you choose static typing,
  you will also make this kind of design choice.  In particular, if you choose
  types that are close to the machine, (/ int int) -> int is the obvious choice
  because the hardware that you have chosen to model does precisely that.

  If, however, you think in mathematical terms, you do not have (/ int int) to
  begin with, you have (/ number number), and the result is of type number,
  but this would not aid efficiency at all!  Since better efficiency is a goal
  of the application of most type theories, a type systems that do not consider
  all (numeric) types disjoint are basically worthless.

* Ray Blaak
| (truncate (/ x y))

* Gareth McCaughan
| Of course.

  Pardon me, but (truncate (/ x y)) is stupid when (truncate x y) expresses
  the operation better and even returns the two values that machine division
  instructions routinely produce instead of having to compute a new, second
  return value.  Note the alternatives `floor´, `ceiling´, and `round´, as well.

-- 
Erik Naggum, Oslo, Norway

Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.