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 world.core | |
(:require [clojure.core.async :refer [go chan >! <! <!! put! timeout close!]])) | |
(defn apply-to-fsm | |
[[state _] event] | |
(case [state event] | |
[:init :create] [:running [:allocate :run]] | |
[:running :stop] [:stopped [:stop]] | |
[:running :start] [:running []] |
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
;; claj's solution to Reverse Interleave | |
;; https://4clojure.com/problem/43 | |
(fn [a b] (map #(take-nth b (drop % a)) (range 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
;; claj's solution to Set Intersection | |
;; https://4clojure.com/problem/81 | |
(fn [a b] (set (filter a 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
;; claj's solution to Anagram Finder | |
;; https://4clojure.com/problem/77 | |
(fn [a] | |
(set | |
(map set | |
(filter #(< 1 (count %)) | |
(vals | |
(group-by | |
(fn [b] (reduce conj #{} 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
(require '[noir.server :as server]) | |
(use 'noir.core 'aleph.http 'lamina.core) | |
(defn async-response [response-channel request] | |
(enqueue response-channel | |
{:status 200 | |
:headers {"content-type" "text/plain"} | |
:body "async response"})) | |
(defpage "/" [] "hey from Noir!") |