Skip to content

Instantly share code, notes, and snippets.

@zhouqiang-cl
Created November 28, 2016 03:49
Show Gist options
  • Save zhouqiang-cl/9eca6bfe9077b32e79fd496e1177ad0c to your computer and use it in GitHub Desktop.
Save zhouqiang-cl/9eca6bfe9077b32e79fd496e1177ad0c to your computer and use it in GitHub Desktop.
common lisp 特殊操作符 BLOCK
语法
block name form* => result*
变量和值
name --- 一个符号
form --- 一个form
results --- 如果正常的返回, 则是 form 的返回. 如果一个显示的 return 触发. 那就是 return 的 value.
描述
block 创建一个名字为 name 的区块, 并且对 forms 进行. block 像是一个带紧急出口的 progn.
在主体中的任何地方,可以停止求值,并通过使用 return-from 指定区块的名字,来立即返回数值
代码
* (block head
(format t "Here we go.")
(return-from head 'idea)
(format t "We'll never see this."))
Here we go.
IDEA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment