#45 makelist (4 params) not compiling

closed
nobody
None
5
2002-07-15
2002-04-19
No

There is a bug with makelist. It does not compile
properly *when used with 4 parameters* (with 3 it
compiles without problems) 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"-----

=========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>>:
====================================================================

Comment:

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.

Discussion

  • Nobody/Anonymous

    Logged In: NO

    My fixes have been committed by R. Toy. So I think this bug should be
    closed.

     
  • Nobody/Anonymous

    Logged In: NO

    Sorry, I didn't know that the bug tracking system wouldn't retain my
    email address. So the previous comment is by

    Wolfgang Jenkner <wjenkner@inode.at>

     
  • Raymond Toy

    Raymond Toy - 2002-07-15

    Logged In: YES
    user_id=28849

    Wolfgang Jenkner's fix to makelist translation bug fixes
    this bug.

     
  • Raymond Toy

    Raymond Toy - 2002-07-15
    • status: open --> closed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks