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 红包祝福语简短10字
18 周六早晨祝福语简短