clojurescript course

detective game 

 

 

slide url: http://tiny.cc/cljsl

clojurescript course : agenda

09:00   play game & install clojure & editor

09:30   basic clojurescript : data, pure function, lisp

12:00   lunch

13:00   play more game & install clojure & editor

13:15   reagent & reframe

16:00   play even more game

16:15   more clojurescript : interop, protocol

             more learning source

slide url: http://tiny.cc/cljsl

detective game

สรุป

1 คนเราสามารถสร้างความเข้าใจ

หรือสมมุติฐานที่อาจ ไม่ถูกต้องได้ง่ายมาก

 

2 ทุกคนพร้อมรับฟังสิ่งที่เราสงสัย 

  ผมพูดอะไรไม่รู้เรื่อง ถามได้เลย

 

 

 

slide url: http://tiny.cc/cljsl

clojurescript

install java & lein

java & lein 

window

ubuntu

mac

clojurescript

installation

atom 

vs code  

emacs 

spacemacs

vim 

sublime 

------------------

cursive  

nightlight 

light table 

clojurescript

online editor :

clojurescript

            Clojure is a dynamic, general-purpose programming language, combining the approachability and interactive development of a scripting language with an efficient and robust infrastructure for multithreaded programming. Clojure is a compiled language, yet remains completely dynamic – every feature supported by Clojure is supported at runtime. Clojure provides easy access to the Java frameworks, with optional type hints and type inference, to ensure that calls to Java can avoid reflection.

             Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy and a powerful macro system. Clojure is predominantly a functional programming language, and features a rich set of immutable, persistent data structures. When mutable state is needed, Clojure offers a software transactional memory system and reactive Agent system that ensure clean, correct, multithreaded designs.

              I hope you find Clojure's combination of facilities elegant, powerful, practical and fun to use.

Rich Hickey
author of Clojure and CTO Cognitect

clojurescript

real value            : ความจริงยังไง ก็ยังเป็นความจริงอยู่วันยันค่ำ

lisp                       : ง่ายกว่าก็ดีกว่า

pure function     : ผมไม่รู้ไม่เห็นอะไรทั้งนั้น

macro                  : กฎมีไว้แหก

seq abstraction  : รักเธอที่สุด แต่ไม่หยุดที่เธอ

repl                       : ทำงานต่อเนื่อง ไรรอยต่อ

hosted language &

fully inter op       :  ถ้าเธอพร้อมฉันก็พร้อมไปด้วยกัน 

protocol               :  รับๆ ไปก่อนแล้วค่อยแก้ทีหลัง

clojurescript

atom

core.async

tranduser

transient

core.logic

 

clojurescript

real value : ความจริงก็ยังเป็นความจริงอยู่วันยันค่ำ

 

5.1

"clj"

:days

'name

2/3

clojurescript

real value : ความจริงก็ยังเป็นความจริงอยู่วันยันค่ำ

 

(add 1 2)

[1 2 3 4]

(add 1 2)

{:name  clj}

#{ :red

         :yellow

         :green}

clojurescript

real value : ความจริงก็ยังเป็นความจริงอยู่วันยันค่ำ

 

{:flag :diamond

 :number :one

:power [1 2 4]}

clojurescript

real value : ความจริงก็ยังเป็นความจริงอยู่วันยันค่ำ

 

design & discuss

data for represent  :

1 playing card

2 game with 4 player play card

   each have 4 card,  one card for each type

3 priority of card 

4  http service

5  programming language

?

clojurescript

real value : ความจริงก็ยังเป็นความจริงอยู่วันยันค่ำ

 

clojurescript

real value : ความจริงก็ยังเป็นความจริงอยู่วันยันค่ำ

 

collection function

clojurescript

real value : ความจริงก็ยังเป็นความจริงอยู่วันยันค่ำ

 

clojurescript

real value : ความจริงก็ยังเป็นความจริงอยู่วันยันค่ำ

 

clojurescript

lisp : simple syntax

('i  :am "vehas"

     :height 180

     :hobby  ["board game"  :cooking

                     "programming" ])

     :color  #{'red 'green 'blue :pink})

clojurescript

lisp : simple syntax

(+ 1 2)

hug of love or parentheses

function

arguement

arguement

clojurescript

lisp : simple syntax

(def ten 10)

parentheses

function,

special form,

macro

arguement

arguement

clojurescript

lisp : simple syntax

(def eleven (inc ten))

parentheses

function,

special form,

macro

arguement

clojurescript

lisp : simple syntax

(def  pi 10) ; assign pi to ten

(def  name "munin")

(if (< pi 10)   10  -10)

(fn [] "hello")

(fn [name] (str "hello " name))

(def hello (fn [name] (str "hello " name))))

clojurescript

lisp : simple syntax

(def  pi 10)

(def -name "munin")

(if (< pi 10)  10 -10)

(fn [] "hello")

(fn [name] (str "hello " name))

(def hello (fn [name] (str "hello " name))))

clojurescript

lisp : simple syntax

?

make absolute function

 

 

clojurescript

macro : แหกทุกกฎ (1: macro explaind )

(def hello

    (fn [name]

        (str "hello " name)))

(defn hello

    [name] (str "hello" name))

clojurescript

macro : แหกทุกกฎ (1: macro explaind )

js (text)

jsvm

javascript virtual machine

browser (render)

reader

interpreter

clojurescript

macro : แหกทุกกฎ (1: macro explaind )

js (text)

jsvm

javascript virtual machine

browser (render)

reader

interpreter

clojurescript

reader

complier

macro

clojurescript

macro : แหกทุกกฎ (1: macro explaind )

(macroexpand '(defn add [a b] (+ a b)))

clojurescript

macro : แหกทุกกฎ (1: macro explaind )

clojurescript

pure function     : ผมไม่รู้ไม่เห็นอะไรทั้งนั้น

(inc 2)

(dec 3)

((fn [n] (dec n)  20)

inc

1

2

clojurescript

pure function     : ผมไม่รู้ไม่เห็นอะไรทั้งนั้น

(str "a" "b" "c")

 

(* 2 3 4)

clojurescript

pure function     : ผมไม่รู้ไม่เห็นอะไรทั้งนั้น

hof : heighter order function

 

((fn [f a b] (f a b))

   *  2 3)

clojurescript

seq abstraction   : รักเธอที่สุด แต่ไม่หยุดที่เธอ

(inc 2)

(dec 3)

((fn [n] (dec n)  20)

inc

1

2

clojurescript

seq abstraction   : รักเธอที่สุด แต่ไม่หยุดที่เธอ

inc

1

2

inc

2

heigher order function :  function  over function

2

4

inc

3

clojurescript

seq abstraction   : รักเธอที่สุด แต่ไม่หยุดที่เธอ

 

inc

1

2

inc

2

heigher order function :  function  over function

3

4

inc

3

map

(map inc [1 2 3])

clojurescript

seq abstraction   : รักเธอที่สุด แต่ไม่หยุดที่เธอ

(defn even?

    [n]

       (= (mod 2 n) 0))

1

true

false

2

clojurescript

seq abstraction   : รักเธอที่สุด แต่ไม่หยุดที่เธอ

 

filter :  (filter even? [ 1 2 3])

1

2

false

2

heigher order function :  function  over function

3

3

clojurescript

seq abstraction   : รักเธอที่สุด แต่ไม่หยุดที่เธอ

 

filter :  (filter odd? [ 1 2 3])

heigher order function :  function  over function

clojurescript

seq abstraction   : รักเธอที่สุด แต่ไม่หยุดที่เธอ

 

clojurescript

clojurescript

repl: ทำงานต่อเนื่อง ไร้รอยต่อ 

 

clojurescript

hosted language & fully inter op :

              ถ้าเธอพร้อมฉันก็พร้อมไปด้วยกัน

clojurescript

protocol :  รับๆ ไปก่อนแล้วค่อยแก้ทีหลัง

 

clojurescript

etc:

clojurescript

life long learning

official introduction: clojure.org/reference/reader

book:  clojure for brave and truth 

             clojurescript book 

doc & example : clojuredocs.org

group :  fb.com/groups/clojurethai

newsletter : therepl.net

                    : purelyfunctional.tv/newsletter

community : reddit.com/r/Clojure/

clojurescript

life long learning

online learning course

free

   http://www.parens-of-the-dead.com/

 

paid 

    clojure inside out by Neal Ford , Stuart Halloway (oreilly free 10d )

    https://lambdaisland.com/   (7$/ mo free 7 d)

    https://purelyfunctional.tv/  (49$/mo)

clojurescript

life long learning

online learning book - free

clojurescript

life long learning

online learning book - paid

clojurescript

learner friendly but practical project

clojurescript

give me some feed back

clojurescript

http://crepl.thegeez.net/p/guest_77264_pad

clojurescript

reagent : ก็คือรีแอ็กนั้นแหละ

reagent: lein new reagent

http://reagent-project.github.io/

data

view

clojurescript

reagent : ก็คือรีแอ็กนั้นแหละ

read more :

 

https://purelyfunctional.tv/guide/re-frame-a-visual-explanation/

https://purelyfunctional.tv/guide/re-frame-building-blocks/

https://purelyfunctional.tv/article/react-vs-re-frame/

clojurescript

reagent : ก็คือรีแอ็กนั้นแหละ

 re-frame

data

view

signal

register

database

event

cljs

By Veha Suwatphisankij

cljs

  • 372