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 balance-of-n.core-test | |
(:require [clojure.test :refer :all])) | |
(defn number->digits | |
([number] (number->digits number [])) | |
([number result] | |
(if (< number 10) | |
(-> result (conj number) vec) | |
(number->digits (quot number 10) | |
(cons (mod number 10) result))))) |
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 roman-numerals.core-test | |
(:require [clojure.test :refer :all])) | |
(def roman-digit->arabic | |
{\I 1 | |
\V 5 | |
\X 10 | |
\L 50 | |
\C 100}) |
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 simple.core | |
(:require [reagent.core :as reagent] | |
[re-frame.core :as rf])) | |
;; -- Domino 1 - Event Dispatch ----------------------------------------------- | |
(defn dispatch-click | |
[] | |
(rf/dispatch [:click-count])) ;; send event `:click-count` |
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 color-sorting.core | |
(:require [reagent.core :as reagent])) | |
(def colors ["blue" "yellow" "green" "purple" "red"]) | |
(def color-row (reagent/atom ["blue" "yellow" "green"])) | |
(def sorted-color-row (reagent.ratom/reaction (sort @color-row))) | |
(defn square [color] | |
[:svg {:style {:background color |
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 simple.core | |
(:require [reagent.core :as reagent] | |
[re-frame.core :as rf] | |
[clojure.string :as str])) | |
;; A detailed walk-through of this source code is provied in the docs: | |
;; https://github.com/Day8/re-frame/blob/master/docs/CodeWalkthrough.md | |
;; -- Domino 1 - Event Dispatch ----------------------------------------------- |