{{ message }}

Instantly share code, notes, and snippets.

# Nic Smith Ariarule

Created Nov 12, 2013
;; ariarule's solution to Intervals ;; https://4clojure.com/problem/171 ;; Slightly bleh
View gist:7424829
 (fn [s] (vec (apply sorted-set (map vec (let [t (set (sort s)) w (rest (butlast t)) v (sort (if (empty? t) t (cons (first t) (conj (vec (map first (remove #(and (contains? (second %) 1) (contains? (second %) -1)) (reduce #(assoc %1 %2 (set (map (partial - %2) t))) {} w)))) (last t)))))] (if (empty? v)
Created Nov 11, 2013
View gist:7406146
 ;; ariarule's solution to Generating k-combinations ;; https://4clojure.com/problem/103 (fn [n z] (set (filter #(= (count %) n) (reduce (fn [seqs b] (mapcat (fn [s] (#(map (partial conj %) z) s)) seqs)) [#{}] (range n)))))
Created Jun 13, 2012
Reimplement Trampoline (4clojure)
View 4clojue-78-ariarule.clj
 (fn [f & s] (let [result (apply f s)] (if (fn? result) (recur result ()) result)))
Created Jun 13, 2012
Reimplement Map (4clojure)
View 4clojure-118-ariarule.clj
 (fn mm [f s] (lazy-seq (let [fs (f (first s))] (if (next s) (cons fs (mm f (next s))) (list fs)))))
Created Apr 13, 2012
time-balance
View time-balance.clj
 (defn time-balance [schedule time-track excluded-items] (- (time-until-the-end time-track) (time-left-to-do schedule excluded-items)))
Created Mar 23, 2012 — forked from anonymous/ariarule-4clojure-solution114.clj
View ariarule-4clojure-solution114.clj
 ;; ariarule's solution to Global take-while ;; https://4clojure.com/problem/114 (fn [n p s] (take (dec (count (take-while #(< % n) (reduce #(let [n (if %2 (inc (last %1)) (last %))] (conj %1 n)) [0]
Created Nov 10, 2011
Safety Goggles
View goggles.js
 ///////////////////// // SafetyGoggles // @name SafetyGoggles // @version 0.1.10082010 // @description Highlighlights Weasel Words in Text. Just a proof of concept version. // @include http://* // THIS VERSION IS SLOW AND SOMETIMES BREAKS LINKS -- Still needs work var docbod; docbod = document.body;