clojure 定义函数
例子
函数由五个组件定义:
标题,其中包括defn关键字,函数的名称。
(defn welcome ....)
一个可选的文档字符串,用于解释和记录函数的作用。
(defn welcome
"Return a welcome message to the world"
...)括号中列出的参数。
(defn welcome
"Return a welcome message"
[name]
...)主体,描述函数执行的过程。
(defn welcome
"Return a welcome message"
[name]
(str "Hello, " name "!"))调用它:
=> (welcome "World") "Hello, World!"
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短