- Source http://tinyurl.com/alice-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 clojure-meetup-2019-11.core | |
(:require [clojure.java.io :as io])) | |
(defn split-name [x] | |
(let [[_ letters id checksum] (re-find #"^(.+)-(\d+)\[([a-z]{5})\]$" x)] | |
[letters (Long/parseLong id) checksum])) | |
(defn freq-comparator [[a-ltr a-freq] [b-ltr b-freq]] | |
(let [freq-result (compare a-freq b-freq)] | |
(if (zero? freq-result) |
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 nonogram.core | |
(:require [mikera.image.core :as image] | |
[mikera.image.dither :as dither])) | |
;; create column and row wise matrices | |
(defn create-matrices [image-path] | |
(let [img (-> (image/load-image image-path) | |
(image/resize 20 20) | |
#_(dither/dither (dither/mono-palette-function)))] | |
[(for [x (range 20) y (range 20)] |
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 chess.core | |
(:require [clojure.string :as string])) | |
(def board | |
{[:a 1] [:R :w] | |
[:b 1] [:N :w] | |
[:c 1] [:B :w] | |
[:d 1] [:Q :w] | |
[:e 1] [:K :w] | |
[:f 1] [:B :w] |
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 clojure-dojo-2019-02-13.core) | |
(defn board [width height] | |
(into {} (for [x (range width) | |
y (range height)] | |
[[x y] (rand-nth [:blue :red])]))) | |
(defn neighbours [board width height x y step-x step-y] | |
(let [end-x (if (neg? step-x) -1 width) |
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 adventofcode2015.core) | |
(defn step [[row column value]] | |
(let [new-value (mod (* value 252533) 33554393) | |
max-depth (dec (+ row column)) | |
new-row (if (= column max-depth) (inc max-depth) (dec row)) | |
new-column (if (= column max-depth) 1 (inc column))] | |
[new-row new-column new-value])) |
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | |
<title>Clara Rule Engine (Clojure Meetup 24-05-2017)</title> | |
<link rel="stylesheet" href="css/reveal.css"> | |
<link rel="stylesheet" href="css/theme/white.css"> |
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 alice-clj.core) | |
(def text (slurp "resources/19033.txt")) | |
(def words (clojure.string/split text #"[^A-Za-z]+")) | |
(def pairs (partition 2 1 (map clojure.string/lower-case words))) | |
(defn add-pair [m [w1 w2]] | |
(update-in m [w1 w2] (fn [count] | |
(if count (inc count) 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
# fork this gist and provide your solution | |
(ns nonogram.core | |
(require [mikera.image.core :as image] | |
[mikera.image.dither :as dither])) | |
(defn create-matrix [image-path] | |
(let [img (-> (image/load-image image-path) | |
(image/resize 20 20) | |
(dither/dither (dither/mono-palette-function)))] |
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 dojo.core | |
(:import [goog.date.DateTime]) | |
(:require [reagent.core :as reagent :refer [atom]] | |
[reagent.session :as session] | |
[secretary.core :as secretary :include-macros true] | |
[accountant.core :as accountant])) | |
;; ------------------------- | |
;; Views |
NewerOlder