[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Date: Thu, 3 Apr 86 10:56 EST
From: Guy Steele <gls@THINK-AQUINAS.ARPA>
From the SCHEME mailing list:
Date: Tue, 1 Apr 86 21:42:41 EST
From: Jonathan A Rees <JAR@MC.LCS.MIT.EDU>
I intend to add all the hyperbolic trig functions to Scheme. Also, the
gamma function, Bessel functions, and Legendre polynomials. I use these
all the time and don't know how anyone gets by without them.
I never use them, but Chebychev are used all the time for generating FM
modulated audio waves.
I think Scheme numbers are really ad hoc. The ring should be a required
argument to +, *, etc. so that they know where the answer should come
from. (E.g. (+ 4 7 (MOD Z 5)) ==> 1.)
That's not the way to do it at all. The right way to do it is extend
numbers, not functions. That leaves + unchanged. Coersion rules apply,
and error checking is in force. For example, the way you do the above
(+ 4 7 (mod z 5))
(+ (coerce 4 '(mod 5)) (coerce 7 '(mod 5))) => #<1 mod 5>
Coersion lets you do
(+ (coerce 4 '(mod 5)) 7)
to get the same answer, but
(+ (coerce 4 '(mod 5)) (coerce 7 '(mod 6)))
is an error because of incompatible moduli.
Scheme should support arithmetic
mod N, polynomial arithmetic, and arithmetic in arbitrary algebraic
number fields. Complex number fall out as a special case:
(SQRT -1 (MOD (POLY R) (LAMBDA (X) (+ (* X X) 1 R)))) ==> 1i
Again, don't extend arithmetic, extend numbers:
(sqrt (coerce -1 <whatever>))
This should be easy to implement.
I don't see why we need all these random special forms. For example,
there's no need to have QUOTE or LAMBDA. We can write
(SET! (X Y Z) (+ X (* Y Z N) N))
(LAMBDA (X Y Z) (+ X (* Y Z N) N)).
No ambiguity will result because if the first thing is a list then
obviously the expression can't be an assignment. Similarly, we should
(SET! (D #(A (B C) 4)))
(QUOTE (D #(A (B C) 4)))
because what would one-argument SET! mean?
I like this!
I don't understand why there's no existential quantifer in Scheme.
For example, I often find myself wanting to write
(EXISTS (X) (AND (MEMQ X L1) (MEMQ X L2)))
to find out whether the lists L1 and L2 intersect.
Doesn't scheme support prolog YET?
If we have first-class continuations I don't see any reason why we
shouldn't have first-class stores also. E.g.
(LET ((Z (CONS 1 2)))
(SET-CAR! Z 3)
(LIST (CAR Z) (S (LAMBDA () (CAR Z)))))))
==> (3 1)
And while we're on the subject of modules, why don't we just adopt
Common Lisp's package system wholesale? It's really useful and elegant.
Also Zetalisp's LOOP construct is really good.
I'll put all these features in the report (Penguin Books has already
expressed interest, by the way) unless people send me enough money.