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 rules-to-pred) | |
(def products | |
[{:id 1 | |
:department "bedding" | |
:category "pillow" | |
:color "white"} | |
{:id 2 | |
:department "cloth" | |
:category "shirt" |
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 correct-tags.use-parser | |
(:require [instaparse.core :as insta])) | |
; Additional dependencies | |
; [instaparse "1.4.10"]] | |
; https://github.com/Engelberg/instaparse | |
(def annot-parser | |
(insta/parser | |
"LINE = ('|' GROUP)+ '|' |
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
#!/bin/sh | |
#_( | |
DEPS=' | |
{:deps {org.clojure/clojure {:mvn/version "1.10.0"} | |
ring/ring-core {:mvn/version "1.7.1"} | |
ring/ring-jetty-adapter {:mvn/version "1.7.1"} | |
compojure {:mvn/version "1.6.1"}}} | |
' |
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
{:deps {org.clojure/clojure {:mvn/version "1.10.0"} | |
ring/ring-core {:mvn/version "1.7.1"} | |
ring/ring-jetty-adapter {:mvn/version "1.7.1"} | |
compojure {:mvn/version "1.6.1"}}} |
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
(require '[cognitect.transcriptor :refer (check!)]) | |
(require '[hangman.reactive-hangman :refer :all]) | |
(comment "win case") | |
(-> (init-game-data "bigbear" 7) | |
(prefill-letters ["a"]) | |
(handle-new-event [:guess "b"]) | |
(handle-new-event [:guess "o"]) |
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
(defn hangman [secret-words letters] | |
(->> secret-words | |
(map str) | |
(every? (set letters)))) |
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
(defn group-amphoes [locations] | |
(->> locations | |
(group-by :amphoe) | |
(map (juxt first (comp #(mapv :district %) second))) | |
(into {}))) | |
(defn group-provinces [locations] | |
(->> locations | |
(group-by :province) | |
(map (juxt first (comp group-amphoes second))) |
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
(->> {1 [:a :b], 2 [:a], 3 [:b], 4 [:b :c], 5 [:a], 6 [:a :c :e]} | |
(map (fn [[k v]] (zipmap v (repeat [k])))) | |
(apply merge-with into)) | |
;=> {:a [1 2 5 6], :b [1 3 4], :c [4 6], :e [6]} |
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 playground.transducer) | |
(def f1 (comp #(map str %) #(filter even? %) #(map inc %))) ; right -> left | |
(def nums [4 7 8 9 5 3]) | |
(f1 nums) | |
(defn f2 [x] | |
(map str (filter even? (map inc x)))) |
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
{:paths ["."] | |
:deps {org.clojure/clojurescript | |
{:git/url "https://github.com/clojure/clojurescript" | |
:sha "3f4084efcb5cd92cceb8ca30765144691d8cfd7e"}}} |
NewerOlder