[comp.lang.lisp] Translating Franz to Common

kramer@cme.nbs.gov (Tom Kramer) (06/09/89)

I have been trying to send the following to many requestors, but my mailer
keeps returning it.  Oddly, mail to Hawaii, Canada, and Denmark has been
delivered, but nothing to the continental US seems to go through.

I hope those who have asked for this will be able to pick it up from this
message.

         COMPARISON OF FRANZ LISP WITH COMMON LISP
                      T. Kramer 5/25/89


This is a comparison of Franz and Common LISP functions.  It is intended
to be useful to programmers who want to rewrite existing Franz LISP code
in Common LISP (and vice versa, if there are any such people).

It is divided into four sections:
1. Franz Functions Not in Common
2. Franz Functions that Work (Almost) the Same in Common
3. Franz Functions that Work Differently in Common
4. Common Functions Not in Franz

This comparison includes about 200 functions but is not complete.
Section 4, in particular, contains only a small fraction of the entries
it could have.

Each entry has been kept to one line for the sake of brevity.  A full
understanding of differences might require up to a page for some entries,
so do not take this material as gospel.  The comparison is most useful
as a pointer to what to read about in the Franz and Common Manuals.

Franz Allegro, release 3, Common LISP was used for preparing this
comparison.  I suppose it will be almost completely valid for other
Common LISPS but have not checked.

Corrections, additions, and comments are welcome.  There are no known
errors in this comparison, but there are bound to be some.

T. Kramer
NIST
Rm. A-127, Building 220
Gaithersburg, MD 20899
E-mail to: kramer@cme.nbs.gov


1. Franz Functions Not in Common
--------------------------------

add1 (use 1+)
array (use make-array)
arrayref (use aref)
ascii (use char-code)
concat (write your own using read-from-string)
copy (called copy-tree in common, also see copy-alist, copy-list)
def (use defun)
diff (use -)
drain (use finish-output or force-output)
explode
explodec
exploden
fact (no equivalent)
fake (no equivalent)
fix (use truncate or round)
fixp (use integerp or typep)
getd (use symbol-function)
get-pname (use symbol-name)
implode
implodes
infile (use open or with-something)
lessp (use <)
maknum
minus (use -)
msg (use format)
neq (use not with eq)
nequal (use not with equal)
new-vectori-... (no equivalent)
nthchar (use elt with index decreased by 1)
nthelem (use nth or elt with index decreased by 1)
numbp (use numberp)
outfile (use open or with-...)
patom (use princ)
pp-form (use pprint)
probef (use probe-file)
ptr (no equivalent)
putprop (use setf and symbol-plist)
readc (use read-char)
readline (use read-line)
readlist (no equivalent)a
resetio
setplist (use setf and symbol-plist)
sortcar (use sort with :key set to car)
strcat (No equivalent. Write your own using concatenate and princ-to-string)
string-length (use length or array-total-size)
substring (use subseq)
sub1 (use 1-)
tab (try format with a "~numberT" control string. Does not work for me.)
terpr (use terpri)
tyipeek (use peek-char)
vectori-... (no equivalent)
vref (use aref)
vrefi-... (no equivalent)
vseti-... (no equivalent)



2. Franz Functions that Work (Almost) the Same in Common
--------------------------------------------------------

abs (common but not Franz handles complex arguments)
acos (common but not Franz handles complex arguments)
and
append
apply
asin (common but not Franz handles complex arguments)
atan (common has more options)
atom
butlast (exists in Franz but is not documented)
car
case
cdr
c...r (in common, up to four a's and d's work, in Franz, any number)
chdir
cond
cons
cos (common but not Franz handles complex arguments)
defmacro (common has more options)
defsetf
defun (common has more options)
do (common allows declarations and use of tags, like prog)
do* (same exceptions as do)
eighth (exists in Franz but is not documented)
eq
equal (common handles more types of data)
error
evenp
exp (common handles any number)
expt (common handles any number)
fifth (exists in Franz but is not documented)
first (exists in Franz but is not documented)
float
fourth (exists in Franz but is not documented)
funcall
gensym
go (common can use it in more situations)
identity (exists in Franz but is not documented)
if (common has fewer options)
intersection (exists in Franz but is not documented)
last
ldiff
length
let
let*
list
listp
log (common has an optional base argument)
makunbound
mapc
mapcan
mapcar (in common the arguments do not have to be the same length)
mapcon
max
merge
min
minusp
mod (common handles any number types, Franz only integers)
nbutlast (exists in Franz but is not documented)
nconc
nintersection (exists in Franz but is not documented)
ninth (exists in Franz but is not documented)
not
nreconc
nreverse
nth
nthcdr
null
numberp
oddp
or (in common multiple values may be returned from last argument)
plusp
pop
pp (exists in common but is not documented)
princ
prog (in common prog variables may be initialized)
progn
push
quote
read (options differ in common)
remprop (except first argument must not be a list - see remf)
rest (exists in Franz but is not documented)
return
reverse
rplaca
rplacd
second (exists in Franz but is not documented)
set
setf (common handles many more situations)
setq
seventh (exists in Franz but is not documented)
sin (common but not Franz handles complex arguments)
sixth (exists in Franz but is not documented)
sort (common has more options)
sqrt (common handles any number, Franz only non-negative reals)
string-capitalize
string-downcase
string-upcase
subst (common has more options)
symbol-function
symbol-name
tailp
tenth (exists in Franz but is not documented)
terpri
third (exists in Franz but is not documented)
union (exists in Franz but is not documented)
y-or-n-p
zerop (except argument must be a number in common)
1+
+ (common handles all types of numbers)
- (common handles all types of numbers)
* (common handles all types of numbers)
> (common handles more number types)
>= (common handles more number types)
= (common handles more number types)
< (common handles more number types)
<= (common handles more number types)
' (the quote function)



3. Franz Functions that Work Differently in Common
--------------------------------------------------

boundp (returned value differs if bound)
break (fairly similar to Franz)
close (common returns nil, Franz t)
delete (common has many options)
eval (Same at top level. In functions Franz uses local values, common global)
get (common does not handle gets from disembodied plists)
load (common looks for different suffixes)
loop (Franz version is fancy, common is simple)
map
member (common has more options)
nunion (not documented in Franz, but results differ from common sometimes)
print (prints newline and space as well as argument)
remove (common does much more)
throw (argument order reversed)
vector (the data type differs between Franz and common)



4. Common Functions Not in Franz (a small fraction of such functions)
--------------------------------

acosh (no equivalent)
aref (use arrayref)
atanh (no equivalent)
cosh (no equivalent)
denominator (no equivalent)
elt (use nth or nthchar with arguments reversed)
getf (use get after consing a dummy on the front of the list)
get-setf-method (use (get function_name 'setf-expand))
isqrt (no equivalent)
lcm (no equivalent)
make-array (use array or marray)
make-list (no equivalent)
make-string (no equivalent)
notevery (no equivalent)
numerator (no equivalent)
pathname (no equivalent)
pathname-... (no equivalent)
peek-char (use tyipeek)
phase (no equivalent)
position (no equivalent)
pprint (use pp or pp-form)
print-to-string
prog* (no equivalent, use prog)
read-char (use readc)
read-line (use readline)
sinh (no equivalent)
some (no equivalent)
tan (no equivalent)
tanh (no equivalent)
write (use print, princ, etc.)