There is a bug with makelist. It does not compile properly, as the following
example shows.
-----file "text.mac"-----------
trial(n):=block([l,i],
i : 3,
l : makelist(j+i,j,1,9))$
-----end of file "text.mac"-----
Lines 392-396 of src/trans1.lisp (the file in which makelist is supposed
to be lisp-ed) say:
;;; Makelist is a very sorry FSUBR. All these FSUBRS are just to avoid
;;; writing LAMBDA. But lots of users use MAKELIST now.
;;; MAKELIST(EXP,X,0,N) with 4 args it is an iteration, with three it
;;; is a mapping over a list (the third argument).
and looks like the code is not very good... In fact, if one makes a list with
three arguments
makelist(i,i,[1,2,3,4,5])
it compiles OK, so the bug is the translation of the (= (LENGTH FORM) 4)
case in lines 413ff.
=========transcript of session follows==============
bash-2.05$ maxima
GCL (GNU Common Lisp) Version(2.4.0) Sat Jul 14 20:26:43 GMT 2001
Licensed under GNU Library General Public License
Contains Enhancements by W. Schelter
Maxima 5.6 Sat Jul 14 20:26:37 GMT 2001 (with enhancements by W. Schelter).
Licensed under the GNU Public License (see file COPYING)
(C1) load("text.mac");
(D1) text.mac
(C2) trial(3);
(D2) [4, 5, 6, 7, 8, 9, 10, 11, 12]
(C3) compile_file("text.mac");
Translation begun on #ptext.mac.
Compiling text.LISP.
; (DEFUN |$trial| ...) is being compiled.
;; The variable #:G1050 is undefined.
;; The compiler will assume this variable is a global.
;; The variable #:G1049 is undefined.
;; The compiler will assume this variable is a global.
;; The variable #:G1049 is undefined.
;; The compiler will assume this variable is a global.
;; The variable #:G1050 is undefined.
;; The compiler will assume this variable is a global.
;; The variable #:G1051 is undefined.
;; The compiler will assume this variable is a global.
;; The variable #:G1051 is undefined.
;; The compiler will assume this variable is a global.
;; The variable #:G1049 is undefined.
;; The compiler will assume this variable is a global.
;; The variable #:G1050 is undefined.
;; The compiler will assume this variable is a global.
;; Warning: The variable #:G1049 is not used.
;; Warning: The variable #:G1050 is not used.
End of Pass 1.
End of Pass 2.
OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
Finished compiling NIL.
(D3) [text.mac, text.LISP, text.UNLISP, #ptext.o]
(C4) load("text.o");
Loading text.o
start address -T 85e2840 Finished loading text.o
(D4) text.o
(C5) trial(3);
Error: Caught fatal error [memory may be damaged]
Fast links are on: do (si::use-fast-links nil) for debugging
Error signalled by CATCH.
Broken at MACSYMA-TOP-LEVEL. Type :H for Help.
MAXIMA>>:
====================================================================
--
Pedro Fortuny Ayuso -------------> www.maths.qmul.ac.uk/~pf
School of Mathematical Sciences. Queen Mary College, Univ. London
Mile End Road, London E1 4NS, UK ------> www.qmul.ac.uk
P.Fortuny@maths.qmul.ac.uk Tfn. Nr. 44 20 7882 5493