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.exports = { | |
config: { | |
// default font size in pixels for all tabs | |
fontSize: 14, | |
// font family with optional fallbacks | |
fontFamily: '"Fira Code", Menlo, "DejaVu Sans Mono", "Lucida Console", monospace', | |
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk) | |
cursorColor: 'rgba(100,255,229,0.75)', |
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
(def firsts | |
'((rand-nth [:a :b :c]) | |
(rand-nth ["TW" "DE" "UK" "FR" "US" "JP"]) | |
(rand-nth [:bob :alice :charles :georges :matz :is :nice]))) | |
(def key-length 2) | |
(def sample-depth 300) | |
(def sample | |
(->> (repeat (+ key-length 2) '(rand-int 10)) |
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
;; I have defined a function, let's call it modifier, which has a | |
;; specific logic inside. I want core.logic to deal with it in order to | |
;; find the correct parameters for this function to output the | |
;; result I want. | |
;; Let's define two states. The goal is to find out how to go from the | |
;; depart state to the arrival one. These states are not that very | |
;; difficult structures, they're basically maps. | |
(def depart-state {:a {:a 1 :c 4} :b {:a 2 :b 3 :c 6} :c 3}) | |
(def arrival-state {:a {:a 1 :b 2 :c 4} :b {:a 2 :b 3 :c 6} :c 3}) |
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 firstshot.chessknightmove | |
(:refer-clojure :exclude [== >= <= > < =]) | |
(:use clojure.core.logic | |
clojure.core.logic.arithmetic)) | |
(defn knight-moves | |
"Returns the available moves for a knight (on a 8x8 grid) given its current position." | |
[x y] | |
(let [xmax 8 ymax 8] | |
(run* [q] |
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 regex-for-hex-range | |
(:use clojure.test)) | |
(defn dec-to-hex | |
[number] | |
(clojure.string/upper-case (format "%x" number))) | |
(defn hex-to-dec | |
[string] | |
(let [conversion-table (zipmap |
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
(defn my-assoc-in | |
"Implement built-in assoc-in in the way I get it. It nicely inserts a value in the nested map and doesn't overwrite." | |
[map keys value] | |
(let [[k & keys] (reverse keys)] | |
(loop [[key & keys] keys | |
final map | |
initial (assoc {} k value)] | |
(if (not (empty? keys)) | |
(recur keys | |
final |
NewerOlder