[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A strange error message
Hmmm. Can't find a thing wrong with loop based on your message.
Maybe you forgot that te2 takes an arg! In your test, you didn't give
it one.
rascal% cp /usr2/ftp/pub/loop.lisp .
rascal% kcl
KCl (Kyoto Common Lisp) June 3, 1987
>(compile-file "loop.lisp")
Compiling loop.lisp.
Warning: LOOP is being redefined.
End of Pass 1.
;; Note: Tail-recursive call of LOOP-DECLARE-VARIABLE was replaced by iteration.
;; Note: Tail-recursive call of LOOP-DECLARE-VARIABLE was replaced by iteration.
End of Pass 2.
OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
Finished compiling loop.lisp.
>(load "loop.o") ; a freshly compiled copy of loop.
Loading loop.o
Finished loading loop.o
53376
>(use-package "LOOP")
T
>(defun te2 (expr) ; your test function
(loop for elt in expr do (format t "~s~%" elt)))
TE2
>(te2) ; your call on no args. What did you expect?
Error: TE2 requires one argument,
but only zero were supplied.
Error signalled by TE2.
Broken at TE2. Type :H for Help.
>>:q
Top level.
>(te2 '(1 2 3)) ; looks ok to me.
1
2
3
NIL
>; end of transcript.
By the way, I recommend sloop over loop because (1) it is, as far as I
know, upwards compatible with loop, (2) it is extensible, permitting
the addition of your own "collectors", etc., and (3) it produces
reliable but fast arithmetic. It is pretty essentialy for performance
to use fixnums wherever you can. But where can you safely? Schelter,
the author of sloop, puts in fixnum declarations, but always checks
for sure at run time. The overhead for this check seems completely
negligible. To my knowledge, loop does not provide this "safe but
fast" arithmetic.