Antik Iter未知关键字矩阵元素

时间:2017-07-12 09:46:26

标签: loops common-lisp

我正在使用Antik,并且始终收到错误消息“未知关键字MATRIX-ELEMENT”:

CL-USER> (defparameter m1 #m(1 2 3 grid:^ 0 6 8))
M1
CL-USER> m1
#2A((1.0 2.0 3.0) (0.0 6.0 8.0))
CL-USER> (iter:iter (iter:for e :matrix-element m1) (princ e) (princ " "))

Iterate, in (FOR E MATRIX-ELEMENT M1):
Unknown keyword MATRIX-ELEMENT
   [Condition of type SIMPLE-ERROR]

Restarts:
 0: [*ABORT] Return to SLIME's top level.
 1: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {10030F0003}>)

Backtrace:
  0: (ITERATE::CLAUSE-ERROR "Unknown keyword ~a" :MATRIX-ELEMENT)
  1: (ITERATE::ARG-CHECK (ITERATE:FOR E :MATRIX-ELEMENT M1) #S(ITERATE::CLAUSE-INFO :FUNCTION ITERATE::CLAUSE-FOR-2 :KEYWORDS (ITERATE:FOR &OPTIONAL :FROM :UPFROM :DOWNFROM :TO ...) :REQ-KEYWORDS (ITERATE:..
  2: (ITERATE::PROCESS-CLAUSE (ITERATE:FOR E :MATRIX-ELEMENT M1))
  3: (ITERATE::WALK-LIST-NCONCING ((ITERATE:FOR E :MATRIX-ELEMENT M1) (PRINC E) (PRINC " ")) #<FUNCTION ITERATE::WALK> #<FUNCTION (LAMBDA (#:G562 #:G563) :IN "/Users/toni/.roswell/lisp/quicklisp/dists/quic..
  4: ((MACRO-FUNCTION ITERATE:ITER) (ITERATE:ITER (ITERATE:FOR E :MATRIX-ELEMENT M1) (PRINC E) (PRINC " ")) #<NULL-LEXENV>)
  5: ((FLET SB-IMPL::PERFORM-EXPANSION :IN MACROEXPAND-1) #<FUNCTION (MACRO-FUNCTION ITERATE:ITER) {22A4B42B}> NIL)
  6: (MACROEXPAND (ITERATE:ITER (ITERATE:FOR E :MATRIX-ELEMENT M1) (PRINC E) (PRINC " ")) #<NULL-LEXENV>)
  7: (SB-INT:SIMPLE-EVAL-IN-LEXENV (ITERATE:ITER (ITERATE:FOR E :MATRIX-ELEMENT M1) (PRINC E) (PRINC " ")) #<NULL-LEXENV>)
  8: (EVAL (ITERATE:ITER (ITERATE:FOR E :MATRIX-ELEMENT M1) (PRINC E) (PRINC " ")))
  9: (SWANK::%EVAL-REGION "(iter:iter (iter:for e :matrix-element m1) (princ e) (princ \" \")) ..)
 10: ((LAMBDA NIL :IN SWANK::%LISTENER-EVAL))
 11: (SWANK-REPL::TRACK-PACKAGE #<CLOSURE (LAMBDA NIL :IN SWANK::%LISTENER-EVAL) {10063764DB}>)
 12: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA NIL :IN SWANK::%LISTENER-EVAL) {10063764BB}>)
 13: (SWANK::%LISTENER-EVAL "(iter:iter (iter:for e :matrix-element m1) (princ e) (princ \" \")) ..)
 14: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK-REPL:LISTENER-EVAL "(iter:iter (iter:for e :matrix-element m1) (princ e) (princ \" \")) ..)
 15: (EVAL (SWANK-REPL:LISTENER-EVAL "(iter:iter (iter:for e :matrix-element m1) (princ e) (princ \" \")) ..)
 16: (SWANK:EVAL-FOR-EMACS (SWANK-REPL:LISTENER-EVAL "(iter:iter (iter:for e :matrix-element m1) (princ e) (princ \" \")) ..)
 17: (SWANK::PROCESS-REQUESTS NIL)
 18: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
 19: ((LAMBDA NIL :IN SWANK::HANDLE-REQUESTS))
 20: (SWANK/SBCL::CALL-WITH-BREAK-HOOK #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL :IN SWANK::HANDLE-REQUESTS) {10030EFFEB}>)
 21: ((FLET SWANK/BACKEND:CALL-WITH-DEBUGGER-HOOK :IN "/Users/toni/.roswell/lisp/slime/2017.02.27/swank/sbcl.lisp") #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA NIL :IN SWANK::HANDLE-REQUESTS) {..
 22: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-INPUT* . #1=#<SWANK/GRAY::SLIME-INPUT-STREAM {10030067E3}>) (*STANDARD-OUTPUT* . #2=#<SWANK/GRAY::SLIME-OUTPUT-STREAM {10030D76A3}>) (*TRACE-OUTPUT* . #2#) (*ERR..
 23: (SWANK::HANDLE-REQUESTS #<SWANK::MULTITHREADED-CONNECTION {1002F60393}> NIL)
 24: ((FLET #:WITHOUT-INTERRUPTS-BODY-1148 :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 25: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE))
 26: ((FLET #:WITHOUT-INTERRUPTS-BODY-358 :IN SB-THREAD::CALL-WITH-MUTEX))
 27: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE) {724DCFB}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THREAD "..
 28: (SB-THREAD::INITIAL-THREAD-FUNCTION-TRAMPOLINE #<SB-THREAD:THREAD "repl-thread" RUNNING {10030F0003}> NIL #<CLOSURE (LAMBDA NIL :IN SWANK-REPL::SPAWN-REPL-THREAD) {10030EFF6B}> (#<SB-THREAD:THREAD "re..
 29: ("foreign function: call_into_lisp")
 30: ("foreign function: new_thread_trampoline")
 31: ("foreign function: _pthread_body")
 32: ("foreign function: _pthread_body")
 33: ("foreign function: thread_start")

我有最新的quicklisp发行版:

CL-USER> (ql:update-all-dists)
2 dists to check.
Downloading http://beta.quicklisp.org/dist/quicklisp.txt
##########################################################################
You already have the latest version of "quicklisp": 2017-06-30.
Downloading http://dist.tymoon.eu/shirakumo.txt
##########################################################################
You already have the latest version of "shirakumo": 2017.05.09_08-35-29-GMT.

1 个答案:

答案 0 :(得分:3)

似乎有一个未记录的变更,检查gitlab上的source code文件iterate.lisp:

建议使用antik:for

(iter:iter (antik:for e :matrix-element #m(1 2 3 ^ 4 5 6)) (princ e) (princ " "))
1.0 2.0 3.0 4.0 5.0 6.0 

但是我觉得这很麻烦因为这也有效

(defparameter m1 #3m((1 2 3) (0 6 8) ( 9 8 7)))
(iter:iter (iter:for e :matrix-row m1) (princ e) (princ " "))