This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defproject something "0.0.1" | |
:dependencies [[org.clojure/core.typed.core "0.x"]] ;; with minimal trace | |
:profiles {:dev {:dependencies [[org.clojure/core.typed "0.x"]]}}) ;; with full |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; https://scott.mn/2014/01/26/first_thoughts_on_liberator_clojure/ | |
(defn blog-post-resource [request id] | |
{:authorized? | |
(fnk [logged-in-user request] | |
(or logged-in-user | |
(= (:method request) :get))) | |
:allowed? | |
(fnk [logged-in-user author request] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type rectPointer struct { | |
width int | |
height int | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM clojure | |
ADD . /usr/src/app | |
WORKDIR /usr/src/app | |
RUN lein deps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def articles | |
[{:title "3 Langs" :author "boris" :tags #{:java :clojure :haskell}} | |
{:title "mylangs" :author "rocky" :tags #{:ruby :clojure :haskell}} | |
{:title "2 Langs" :author "boris" :tags #{:java :haskell}}]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns readyforzero) | |
(def txt1 "en3pG3+nz+A2acXKrsyDouhViP9EDQS4JQK6uJqM3rBjKEBKC3yc=AA1=LUQqRPHvQ4dopgkbb/axClP3smzVcaTkRsCqHSG5aKFQ2TbOae0t5r4nWrCVesGK1Z3yEq+dClrDwXXOiAMyW09WdCS+CaKcfu=6kv9dUFBcS4KsUIgwMiXimoBpJZSWlBzILVf4zVA=7GjRP8RXn6uKjbjAPkpFEs/mYJpeOpEnhQfPhjoscgjfL5/SQsU6+jaAf5pg9MQzZdQAEJt7Jm1541fEmnumpjmJMd/MTJ5vzBttBBA7b5rbjDX0nHdTWn8C5suYKfNyYzc6x8S6FIepoEBsMS2mKhx5BRH5jSBrYRem4iQgYARzGnCFot3jPhp3cHj7qjXBWfZZASz8YJqi2d+r393AmdGm1L9NfU2f=FJprbLwJpuE7uT7xAlQA3Ry8aHRNgNkffP29Iqb2DSoQ0PK+9LX0t37HIAhI5zvoP6b4J7yQZEQDgeNlnPQMvSjw9pLWAxQ1VUY+NMU5BLZ2Bxuma1cIsHxcx4PwHcg0u1HYPJAWM2WK=xhJP5aQSc6oNMQK4s2=6guQRVFll6rvWkXTebrdsws7m/Kpa29spUFl8XzFx0ondEMCF3byAyWj875wAI3Hn8ZY92ddTAKj0s+a4X7qSti2lA0GzePHjBjMCD5g9kZYLtB94kkbVZ6eCle/xtto4LHH8GElc5YoUi=mk3nmQ5iOL1zMWfDyRUMLq+HCXbQL9NTejNa/yTdL3sayJOlMW1T7/Jmaz1FMbfBRFzruHeMT41=Zu3nYZJ3nIP22qKrFzNkt/24RuQ+7IMVCI2ngh2Yr8qLiL7QjSThRJPxA1wIJXwR2wqGiMhOqpun4DyQ5b/fTw1eTavpbFg6+tvqS4GKOt6p=bPoTV0GHIBBlXgHF/GUss90N0mXMKKiGwHhn/kyz=FxN0j=mfQUuUQa7lrZLjr10sqflWTwskIUkp1Cd8GYU |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def x [1 2]) | |
(def y [4 5]) | |
(defn- tree-comp-each [root branch & leaves] | |
(apply | |
root (map branch leaves))) | |
(defn euclidean-distance | |
[a b] | |
{:pre [(= (count a) (count b))]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn eval-decompose | |
[coll] | |
(let [super-d (distinct coll) | |
freqs (loop [ps [] | |
d super-d] | |
(if (seq d) | |
(let [c (count (filter (partial = (first d)) coll))] | |
(recur (conj ps c) (rest d))) | |
ps))] | |
(map #(vector %1 %2) super-d freqs))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn match-count | |
" Given key, k, returns number of occurrences of k in collection, coll. | |
" | |
[k coll] | |
(let [match? (fn [i x] | |
(if (= k x) ;; closure on k | |
(inc i) | |
i))] | |
(reduce match? 0 coll))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(workflow [tmp-path] | |
step-A ([:tmp-dirs stage-a] | |
(query-A input stage-a)) | |
step-B ([:deps step-A] | |
(query-B input stage-a output-b))) |
OlderNewer