存在称为meep的电磁模拟器,其以诡计解释器的形式提供作为前端.模拟器由一堆方案宏组成.
我试图找出以下错误的含义.代码来自教程.当我在一个过程中包装教程时,我得到一个运行时错误,我不确定解释器(guile)告诉我什么.
不工作的代码
(define diffthick
(lambda (n) ; n doesn nothing
(
(set! geometry-lattice (make lattice (size 16 8 no-size)))
(set! geometry (list
(make block (center 0 0) (size infinity 1 infinity)
(material (make dielectric (epsilon 12))))))
(set! sources (list
(make source
(src (make continuous-src (frequency 0.15)))
(component Ez)
(center -7 0))))
(set! pml-layers (list (make pml (thickness 1.0))))
(set! resolution 10)
(run-until 200
(at-beginning output-epsilon)
(at-end output-efield-z))
)
)
)
(diffthick 3)
Run Code Online (Sandbox Code Playgroud)
工作守则(无程序)
(set! geometry-lattice (make lattice (size 16 8 no-size)))
(set! geometry (list
(make block (center 0 0) (size infinity 1 infinity)
(material (make dielectric (epsilon 12))))))
(set! sources (list
(make source
(src (make continuous-src (frequency 0.15)))
(component Ez)
(center -7 0))))
(set! pml-layers (list (make pml (thickness 1.0))))
(set! resolution 10)
(run-until 200
(at-beginning output-epsilon)
(at-end output-efield-z))
Run Code Online (Sandbox Code Playgroud)
错误
creating output file "./eps-000000.00.h5"...
creating output file "./ez-000200.00.h5"...
run 0 finished at t = 200.0 (4000 timesteps)
Backtrace:
In standard input:
21: 0* [diffthick 3]
3: 1 [#<unspecified> #<unspecified> #<unspecified> ...]
standard input:3:5: In expression ((set! geometry-lattice #) (set! geometry #) (set! sources #) ...):
standard input:3:5: Wrong type to apply: #<unspecified>
ABORT: (misc-error)
Run Code Online (Sandbox Code Playgroud)
工作
-----------
creating output file "./eps-000000.00.h5"...
creating output file "./ez-000200.00.h5"...
run 0 finished at t = 200.0 (4000 timesteps)
Run Code Online (Sandbox Code Playgroud)
在一天结束时,我觉得有些事情正在被评估两次.但我不确定那是什么东西.
该错误表示代码正在尝试应用结果,(set! geometry-lattice #)就好像它是一个函数,但set!结果却是如此#<unspecified>.发生这种情况是因为一系列set!s被包裹在parens中.
你可能正在寻找
(begin
(set! geometry-lattice ...)
...
(run-until ...))
Run Code Online (Sandbox Code Playgroud)
或者只是摆脱那对额外的parens,因为lambda体被隐含地包裹在一个begin.