Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
(defn handler | |
[] | |
(println "HANDLER")) | |
(defn wrap-1 | |
[handler] | |
(fn [request] | |
(println 1) | |
(handler request) |
Lisp, the original high-level language, introduced a long list of features common in languages today, including dynamic typing, interpretation, and garbage collection. The original Lisp language is long gone, but it had many imitators, which we call 'dialects' of Lisp. Clojure, introduced in 2007, is the first Lisp dialect to gain wide usage in three decades.
Though Lisp features have been co-opted by many other languages, what still distinguishes Lisp dialects from all other languages is how Lisp dialects translate source code into running programs. In non-Lisp languages, the code translation process has two primary steps:
- lexing (a.k.a. tokenization) and parsing
- code generation (compilation or interpretation)
- AngularU Server Rendering Presentation (6/25/2015): https://www.youtube.com/watch?v=0wvZ7gakqV4
- AngularConnect Full Stack Angular 2 Presentation (10/20/2015): https://www.youtube.com/watch?v=MtoHFDfi8FM
- ์๋ฌธ: http://www.nurkiewicz.com/2016/06/functor-and-monad-examples-in-plain-java.html
- ์์ฑ์: Tomasz Nurkiewicz
์ด ๊ธ์ ์ฐ๋ฆฌ๊ฐ ์ด ์ฑ , 'Reactive Programming with RxJava' ์ ๋ถ๋ก์ด์๋ค. Reactive programming๊ณผ ๊ด๋ จ์ด ๊น์ ์ฃผ์ ๊ธด ํ์ง๋ง ๋ชจ๋๋๋ฅผ ์๊ฐํ๋ค๋ ๊ฒ ์ฑ ๊ณผ ์ฉ ์ด์ธ๋ฆฌ์ง๋ ์์๋ค. ๊ทธ๋์ ๋๋ ๋ฐ๋ก ๋ธ๋ก๊ทธ์ ์ฌ๋ฆฌ๊ธฐ๋ก ํ๋ค. ํ๋ก๊ทธ๋๋ฐ์ ๋ค๋ฃจ๋ ๋ธ๋ก๊ทธ์์ *"๋ฐ์ ๋ง๊ณ ๋ฐ์ ํ๋ฆด ์ง ๋ชจ๋ฅด๋ ๋๋ง์ ๋ชจ๋๋ ์ค๋ช "*์ด๋ ๊ฒ์ด ์๋ก์ด *"Hello World"*๋ผ๋ ์ ์ ๋๋ ์ ์๋ค. ํ์ง๋ง ์ด ๊ธ์ ํํฐ(functor)์ ๋ชจ๋๋(monad)๋ฅผ ์๋ฐ ์๋ฃ ๊ตฌ์กฐ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ผ๋ ๊ฐ๋์์ ๋ฐ๋ผ๋ณด๊ณ ์์ผ๋ฉฐ, ์ด๋ ๊ณต์ ํ ์ ๋์ ๊ฐ์น๋ ์์๊ฑฐ๋ผ ์๊ฐํ๋ค.
Many programming languages are designed to favour writing code over writing literal data. For example, in Python the syntax for accessing an instance variable on an object is:
student.name
But to access a value in a dictionary data structure:
(ns hub.db | |
(:require [clojure.tools.logging :as log] | |
[clojure.java.jdbc :as jdbc] | |
[mount.core :refer [defstate]] | |
[cheshire.core :refer [parse-string generate-string]] | |
[config.core :refer [env]] | |
[hub.util :as util] | |
[honeysql.core :as sql] | |
[honeysql.helpers :refer [merge-where]]) | |
(:import [java.sql PreparedStatement] |