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

Eager-Future2 Library :Parallel Programming in Lisp

我正在使用 Fedora 19 SBCL。我正在尝试安装 eager-future2。 我已经下载了源码,但我不知道如何安装它。我试过了

(asdf:load-system 'eager-future)

我什至尝试 loading 源中的单个 .lisp 文件,但每当我尝试使用 pcall 函数时,我得到一个错误,"undefined function PCALL".

如果您使用 Quicklisp, which works with a number of Common Lisp implementations, you can install this pretty easily. Then, the pcall function is defined in the eager-future2 package, so you'll need to write the package prefix, e.g., eager-future2:pcall, or use the package in your own package. Using 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}>

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