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 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
; 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
#!/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
(ns roman-numerals.roman) | |
(def digits {\I 1 | |
\V 5 | |
\X 10 | |
\L 50 | |
\C 100 | |
\D 500 | |
\M 1000}) |
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/elixir | |
defmodule TheLittleSchemer do | |
defmodule Toys do | |
@moduledoc "Chapter 1" | |
@doc """ | |
The Law of Null? | |
The primitive null? is defined only for lists. |
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 Chess960 do | |
@moduledoc """ | |
Generate all 960 starting positions for Chess960 | |
https://en.wikipedia.org/wiki/Chess960#Starting_position_requirements | |
Run with | |
elixir chess960.exs | |
""" |
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
dataset = | |
[ | |
[lang: "C", loc: 79, t: {4, :s}, mem: {40, :MB}], | |
[lang: "Python", loc: 11, t: {4, :s}, mem: {150, :MB}], | |
[lang: "Ruby", loc: 9, t: {17, :s}, mem: {3, :GB}], | |
[lang: "Elixir", loc: 11, t: {120, :s}, mem: {700, :MB}], | |
[lang: "Elixir ETS", loc: 17, t: {40, :s}, mem: {730, :MB}], | |
[lang: "Elixir Regex", loc: 17, t: {70, :s}, mem: {730, :MB}], | |
[lang: "Elixir String.split", loc: 11, t: {30, :s}, mem: {730, :MB}], | |
[lang: "Elixir String.split pre-compiled", loc: 17, t: {29, :s}, mem: {730, :MB}], |
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 ants.core) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Copyright (c) 2008 Rich Hickey. All rights reserved. | |
; The use and distribution terms for this software are covered by the | |
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php) | |
; which can be found in the file CPL.TXT at the root of this distribution. | |
; By using this software in any fashion, you are agreeing to be bound by | |
; the terms of this license. | |
; You must not remove this notice, or any other, from this software. |
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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Copyright (c) 2008 Rich Hickey. All rights reserved. | |
; The use and distribution terms for this software are covered by the | |
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php) | |
; which can be found in the file CPL.TXT at the root of this distribution. | |
; By using this software in any fashion, you are agreeing to be bound by | |
; the terms of this license. | |
; You must not remove this notice, or any other, from this software. | |
; | |
; Original Clojure JVM code :- https://gist.github.com/michiakig/1093917 |