This file contains hidden or 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
| #!/usr/local/bin/planck -cp | |
| (ns accrete | |
| (:require [cljs-time.core :as t] | |
| [cljs-time.format :as f] | |
| [clojure.string :refer [join]])) | |
| (def this-year (-> (t/now) (t/year))) | |
| (defn day-of-year [] |
This file contains hidden or 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
| ; lein try org.clojure/test.check | |
| (require '[clojure.test.check.generators :as gen]) | |
| ;"abcdefghkmnpqrstwxyABCDEFGHKMNPQRSTUVWXY23456789" | |
| (def prefix-u (partial into ["U"])) | |
| (def chars-to-str (partial apply str)) |
This file contains hidden or 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 words | |
| (:require [planck.core :refer [slurp]] | |
| [clojure.string :refer [split-lines upper-case]])) | |
| (def dinosaurs | |
| (->> "/usr/share/dict/words" | |
| (slurp) | |
| (split-lines) | |
| (map upper-case) | |
| (filter #(re-find #"AURUS$" %)))) |
This file contains hidden or 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 'goog.json) | |
| (-> | |
| (get "https://www.reddit.com/r/clojure/top/.json?count=20") | |
| (:body) | |
| (goog.json/parse) | |
| (js->clj)) |
This file contains hidden or 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 zuhlke.codingnight.binary) | |
| ; | |
| ; Coding night challenge - Binary | |
| ; Convert string of binary digits to int | |
| ; | |
| (defn binary-str-to-int [s] | |
| (loop [s (reverse s) | |
| acc 0 | |
| pwr 1] |
This file contains hidden or 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
| #!/usr/bin/env planck | |
| ; | |
| ; Coding night challenge - Scrabble | |
| ; Generate a rack of tiles and find highest scoring word | |
| ; | |
| ; Written in ClojureScript running on Planck | |
| ; http://planck-repl.org/guide-all.html | |
| ; | |
| ; To run on OS X: |
This file contains hidden or 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://en.wikipedia.org/wiki/Midpoint_circle_algorithm | |
| (defn mirror-point [x0 y0 x y] | |
| [[(+ x0 x) (+ y0 y)] | |
| [(+ x0 y) (+ y0 x)] | |
| [(- x0 y) (+ y0 x)] | |
| [(- x0 x) (+ y0 y)] | |
| [(- x0 x) (- y0 y)] | |
| [(- x0 y) (- y0 x)] | |
| [(+ x0 y) (- y0 x)] |
This file contains hidden or 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
| ; Neo4J CREATE | |
| (defn- format-props [props] | |
| "Format a map of {:symbol String} to Cypher format" | |
| (->> | |
| props | |
| seq | |
| (map (fn [[k v]] (format "%s: %s" (name k) (pr-str v)))) | |
| (clojure.string/join ", "))) |
This file contains hidden or 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
| module RomanNumeral exposing (numeral_to_number) | |
| type Digit = I | V | X | L | C | D | M | |
| value : Digit -> number | |
| value d = | |
| case d of | |
| I -> 1 | |
| V -> 5 |
This file contains hidden or 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 RomanNumerals do | |
| # Roman Numerals (Elixir) | |
| @digits %{"I" => 1, | |
| "V" => 5, | |
| "X" => 10, | |
| "L" => 50, | |
| "C" => 100, | |
| "D" => 500, | |
| "M" => 1000} |