owned this note changed 5 years ago
Linked with GitHub

JVM 語言中的外星生物 - Clojure - hyperion

tags: COSCUP2020 入門 TR313

歡迎來到 https://hackmd.io/@coscup/2020 共筆

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

點擊本頁上方的 開始用 Markdown 一起寫筆記!
手機版請點選上方 按鈕展開議程列表。

請從這裡開始
Slide

Symbol

  • 可以被求值的最小單位
  • 在 Clojure 文件中寫 exprs

Data Structure

  • List
  • Vector
  • Hash Map
  • Set

EVAL

(range 100) ;; output 0 1 2 3 4 ....
(reverse (range 100)) ;; output 99 98 97 ...

Data Type (Literal)

  • Integer
  • BigInt
  • Float Point >> Double
  • Character
  • String
  • Nil
  • Symbol

Clojure 可以直接使用 Java 的 Data Type & Object

Eval Function

def

(exp-1 exp-2 exp-3 exp-4)

(+ 1 2 3 4) ;; x = 1 ;; y = 2 ;; more = '(3 4) ;; [] [x] [x y] [x y &more] ;; output 10
(+ 1 (* 2 2) 3) ;; (* 2 2) ;; output 4 ;; (+ 1 4 3) ;; output 8

Command Substitution

Special Form

  • 已經定義好不能自行定義

def

(def symbol doc-string? init?)

if

(if test then else?)

do

(do exprs-1
exprs-2
exprs-3
exprs-4
exprs-5
exprs-6)

let

loop & recur

Macro

Threading

  • 可以自行定義

Collection Function

Combination

  • comp
  • partial
  • transducer

Development Tools

  • Emacs (最多 Clojure 開發者使用)
  • Vim
  • VS Code
  • Intellij (什麼都不知道選這個)
Select a repo