[sage-devel] presentation about Maxima at Sage developer days
Subject: [sage-devel] presentation about Maxima at Sage developer days
From: Richard Fateman
Date: Thu, 19 Jun 2008 16:06:32 -0700
hmm .. except if you insist on infix for X/Y, I think lisp is pretty good.
I especially prefer cond to nested if/elseif/.... I think it is more
readable below.
Also, in Python, is c global or local? If it is global, it would seem to
be an error in the python program.
Here's a shorter lisp, using &aux to establish a local binding, instead of
(let ...).. I don't usually use &aux
but if we are talking "short"... Of course in lisp this can all be on one
line. The indentation is suggested by the editor or the author, not
required.
(defun compare(a b x &aux (c (limitinf (/ (log a) (log b)) x)))
(cond ((= c 0) '<)
((member c '(inf minf)) '>)
(t '=)))
________________________________
From: maxima-bounces at math.utexas.edu
[mailto:maxima-bounces at math.utexas.edu] On Behalf Of Marshall Hampton
Sent: Wednesday, June 18, 2008 1:02 PM
To: maxima at math.utexas.edu
Subject: [sage-devel] presentation about Maxima at Sage
developer days
You could get the python code even shorter if you really wanted to,
but I think it is most readable in the original version:
def compare(a, b, x):
c = limitinf(log(a)/log(b), x)
return '=' if c == 0 else ('>' if c in [oo, -oo] else '=')
Well, you can make the Python code above shorter too:
def compare(a, b, x):
c = limitinf(log(a)/log(b), x)
if c == 0: return "<"
elif c in [oo, -oo]: return ">"
else: return "="