Eager-Future2库:Lisp中的并行编程

use*_*980 1 lisp common-lisp

我正在使用Fedora 19 SBCL.我正在尝试安装eager-future2.我已经下载了源代码,但我无法弄清楚如何安装它.我试过了

(asdf:load-system 'eager-future)
Run Code Online (Sandbox Code Playgroud)

我甚至尝试在源代码中加载单个.lisp文件,但每当我尝试使用pcall函数时,我都会收到错误,"未定义函数PCALL".

Jos*_*lor 5

如果您正在使用Quicklisp,它可以与许多Common Lisp实现一起使用,那么您可以非常轻松地安装它.然后,pcall函数在eager-future2包中定义,因此您需要编写包前缀,例如eager-future2:pcall,或者在您自己的包中使用该包.使用apropos是找出符号存在的好方法.因此,我能够做到这一点:

CL-USER> (quicklisp:quickload "EAGER-FUTURE2")
;=> ("EAGER-FUTURE2")

CL-USER> (apropos "PCALL")
; EAGER-FUTURE2:PCALL (fbound)
; No value

CL-USER> (eager-future2:pcall (lambda () (print 'hello-world)))
;=> #<EAGER-FUTURE2:FUTURE {10059C8713}>
Run Code Online (Sandbox Code Playgroud)

CL-USER> (defparameter *f* (eager-future2:pcall (lambda () (print 'hello))))
;=> *F*
CL-USER> *f*
;=> #<EAGER-FUTURE2:FUTURE {1005F4AD93}>
CL-USER> (eager-future2:ready-to-yield? *f*)
;=> T
CL-USER> (eager-future2:yield *f*)
;=> HELLO
Run Code Online (Sandbox Code Playgroud)