#(= (seq %1) (reverse %1))
(fn [key map] (and (contains? map key) (= nil (key map))))
| (ns mouse-interactivity.core | |
| (:require [quil.core :refer :all])) | |
| (def max-stroke-weight 40) | |
| (defn setup [] | |
| (background 255) | |
| (color-mode :hsb) | |
| (smooth)) |
| (ns fun-mode-sketch | |
| (:require [quil.core :as q] | |
| [quil.middleware :as m])) | |
| (def win-width 400) | |
| (def win-height 200) | |
| (def sd 60) ;standard deviation | |
| (def center-x (/ win-width 2)) | |
| (def center-y (/ win-height 2)) |
| (ns fun-mode-sketch | |
| (:require [quil.core :as q] | |
| [quil.middleware :as m])) | |
| (def win-width 400) | |
| (def win-height 200) | |
| (def bar-width 1) | |
| (def bar-height 10) | |
| (def bar-count (/ win-width bar-width)) | |
| (def grow-bar (partial + bar-height)) |
| (fn [my-seq] | |
| ((fn [rest-seq result] | |
| (if (= 0 (count rest-seq)) | |
| result | |
| (recur (butlast rest-seq) (conj result (last rest-seq))))) | |
| my-seq [])) |
| (defn fib-seq [x result] | |
| (if (= x 0) | |
| (reverse result) | |
| (let [next-fib (reduce + (take 2 result))] | |
| (fib-seq (dec x) (conj result next-fib))))) | |
| (defn fib [mx] | |
| (fib-seq (- mx 2) '(1 1))) |
| (fn [mx] | |
| (loop [x (- mx 2) result '(1 1)] | |
| (if (> x 0) | |
| (recur (dec x) | |
| (conj result | |
| (reduce + (take 2 result)))) | |
| (reverse result))))) |
| (fn [key map] (and (contains? map key) (= nil (key map)))) |
| (defn fib-anon [mx] | |
| ((fn [x result] | |
| (if (= x 0) | |
| (reverse result) | |
| ((let [next-fib (reduce + (take 2 result))] | |
| recur (dec x) next-fib)))) | |
| (- mx 2) '(1 1))) |
ctrl+actrl+xvi"; select second word vi" and paste pctrl+w - / ctrl+w +ctrl+w _ctrl+w =ctrl+w < / ctrl+w >