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
defmodule UniversalServer do | |
def universal_server() do | |
receive do | |
{:become, f} -> | |
f.() | |
end | |
end | |
def factorial_server() do |
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
(defmodule universal-server | |
(export all)) | |
(defun universal-server () | |
(receive | |
((tuple 'become f) | |
(funcall f)))) | |
(defun factorial-server () | |
(receive |
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
(custom-set-variables | |
;; custom-set-variables was added by Custom. | |
;; If you edit it by hand, you could mess it up, so be careful. | |
;; Your init file should contain only one such instance. | |
;; If there is more than one, they won't work right. | |
'(ansi-color-names-vector ["#242424" "#e5786d" "#95e454" "#cae682" "#8ac6f2" "#333366" "#ccaa8f" "#f6f3e8"]) | |
'(custom-enabled-themes (quote (deeper-blue)))) | |
(custom-set-faces | |
;; custom-set-faces was added by Custom. | |
;; If you edit it by hand, you could mess it up, so be careful. |
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
;; Trident state persisted in redis. | |
;; Implemented in clojure using marceline lib. | |
;; Based on https://github.com/kstyrc/trident-redis | |
(ns state.redis | |
(:require [marceline.storm.trident :as t] | |
[clj-redis.client :as redis]) | |
(:import [storm.trident.state.map CachedMap TransactionalMap NonTransactionalMap OpaqueMap SnapshottableMap])) | |
(defn- get-type-map |
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 tree.core | |
(:require [clojure.core.match :refer [match]])) | |
(defn get-max | |
[tree] | |
(match tree | |
nil nil | |
[nil x nil] x | |
[a x b] (recur b))) |