Skip to content

Instantly share code, notes, and snippets.

View lagenorhynque's full-sized avatar
🐬
architecting & managing

Kent OHASHI lagenorhynque

🐬
architecting & managing
View GitHub Profile
@lagenorhynque
lagenorhynque / duct-guide.md
Last active November 11, 2022 07:10
ClojureサーバサイドフレームワークDuctガイド

ClojureによるWeb開発のサーバサイドで注目度の高い(マイクロ)フレームワークとしてDuctがあります。

ちょうど1年前の2017年12月に私自身初めてDuctによる簡単なREST APIを試作してみて、その過程をAdvent Calendar記事にしたことがありました。

今回は主にClojure言語のことを知っていてWebアプリ開発に興味のある方向けに、英語も含めてドキュメントのとても少ないDuctというフレームワークがどのようなものなのか、技術的な詳細に踏み込んだ解説を試みます。

ちなみに、執筆時点で参照/動作確認した各種ライブラリのバージョンは、サンプルプロジェクト"hello-duct"のproject.cljの通りです(Duct最新安定版0.11.2のテンプレートのまま)。

Ductとは

@lagenorhynque
lagenorhynque / introduction-to-law.md
Last active November 11, 2022 07:10
法学入門

法学入門


カマイルカ🐬/laʒenɔʁɛ̃k/

(defprofile lagénorhynque
 :name "Kent OHASHI"
@lagenorhynque
lagenorhynque / interceptors-into-the-core-of-pedestal.md
Last active November 11, 2022 07:11
Interceptors: Into the Core of Pedestal

Interceptors

Into the Core of Pedestal


カマイルカ🐬/laʒenɔʁɛ̃k/

(defprofile lagénorhynque
@lagenorhynque
lagenorhynque / boost-your-productivity-with-clojure-repl.md
Last active November 11, 2022 07:11
Boost your productivity with Clojure REPL

Boost your productivity

with Clojure REPL


カマイルカ🐬/laʒenɔʁɛ̃k/

(defprofile lagénorhynque
dev> (defrecord Tree [left right])
dev.Tree
dev> (defn ->list [tree]
(letfn [(rec [acc {:keys [left right] :as t}]
(if (instance? Tree t)
(if (instance? Tree left)
(recur acc (->Tree (:left left) (->Tree (:right left) right)))
(recur (cons left acc) right))
(cons t acc)))]
(reverse (rec [] tree))))
@lagenorhynque
lagenorhynque / deps.edn
Created July 12, 2018 13:04
EDN to YAML conversion
{:deps
{io.forward/yaml {:mvn/version "1.0.9"}}}
@lagenorhynque
lagenorhynque / sicp-study-progress.md
Last active February 12, 2020 12:17
SICP勉強会の進捗状況
  • 序文
  • 1  手続きによる抽象の構築
    • 1.1 プログラムの要素
      • 1.1.1 式
      • 1.1.2 名前と環境
      • 1.1.3 組合せの評価
      • 1.1.4 合成手続き
      • 1.1.5 手続き作用の置換えモデル
      • 1.1.6 条件式と述語
  • 問題 1.1
cljs.user=> (defn leibniz [n-terms]
#_=> (->> (iterate inc 1)
#_=> (filter odd?)
#_=> (map / (cycle [1 -1]))
#_=> (take n-terms)
#_=> (apply +)
#_=> (* 4.0)))
#'cljs.user/leibniz
cljs.user=> (time (leibniz 10000))
"Elapsed time: 51.138105 msecs"
@lagenorhynque
lagenorhynque / clojurescript-the-good-parts.md
Last active November 11, 2022 07:12
ClojureScript: The Good Parts

ClojureScript

The Good Parts


カマイルカ🐬/laʒenɔʁɛ̃k/

(defprofile lagénorhynque
;;; unless
user> (defmacro unless [cond then]
`(if (not ~cond)
~then))
#'user/unless
user> (macroexpand-1 '(unless foo? bar))
(if (clojure.core/not foo?) bar)
;;; case
user> (defmacro case-table [k m]
`(case ~k