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 出阁宴祝福语姐姐简短