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
import XMonad | |
import Data.Monoid | |
import System.Exit | |
import XMonad.Actions.SpawnOn | |
import XMonad.Util.EZConfig | |
import XMonad.Hooks.DynamicLog | |
import qualified XMonad.StackSet as W | |
import qualified Data.Map as M |
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
{- successively select elements from xs and remove one in each result list -} | |
import List | |
removeEach :: [a] -> [[a]] | |
removeEach xs = | |
zipWith (++) (List.inits xs) (tail (List.tails xs)) | |
alternate :: (Num a) => [a] -> [a] | |
alternate = zipWith id (cycle [id, negate]) |
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
class String | |
alias_method(:orig_concat, :concat) | |
def concat(value) | |
orig_concat value.force_encoding(Encoding::UTF_8) | |
end | |
end |
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
(import '(java.awt Frame) | |
'(java.awt.event WindowListener WindowAdapter) | |
'(javax.media.opengl GLCanvas GLEventListener GL) | |
'(com.sun.opengl.util Animator )) | |
(def gear1 (ref nil)) | |
(def gear2 (ref nil)) | |
(def gear3 (ref nil)) | |
(def angle (ref 0.0)) |
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
(import '(java.awt Color Dimension) | |
'(javax.swing JPanel JFrame Timer JOptionPane) | |
'(java.awt.event ActionListener KeyListener)) | |
(use '[clojure.contrib.import-static] | |
'[clojure.contrib.seq-utils :only (includes?)]) | |
(import-static java.awt.event.KeyEvent VK_LEFT VK_RIGHT VK_UP VK_DOWN)() | |
() | |
;; ^_^ |
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
(defproject tests "1.0.0-SNAPSHOT" | |
:description "FIXME: write description" | |
:dependencies [[org.clojure/clojure "1.2.1"] | |
[org.clojure/clojure-contrib "1.2.0"] | |
[org.clojars.automata/rosado.processing "1.1.0"]] | |
:dev-dependencies [[swank-clojure "1.3.0"]]) |
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 map-ext [f x & xs] | |
(let [colls (cons x xs) | |
res (apply map f colls) | |
next (filter not-empty (map #(drop (count res) %) colls))] | |
(if (empty? next) res | |
(lazy-seq (concat res (apply map-ext f next)))))) |
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 elevator [commands] | |
(letfn [(ff-open [[cmd & rest]] | |
#(case cmd | |
:close (ff-closed rest) | |
:done true | |
false)) | |
(ff-closed [[cmd & rest]] | |
#(case cmd | |
:open (ff-open rest) | |
:up (sf-closed rest) |
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
-- LeNsTR | |
module Main where | |
comp :: (a -> a -> Bool) -> [a] -> Bool | |
comp f = comp' where | |
comp' (x:[]) = True | |
comp' (x:y:[]) = x `f` y | |
comp' (x:y:(h:t)) | x `f` y = comp' (y:h:t) | |
| otherwise = False |
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 game-of-life.core | |
(:require [clojure.string :as str] | |
[clojure.core.reducers :as r])) | |
(comment | |
" Rules | |
The universe of the Game of Life is an infinite two-dimensional orthogonal | |
grid of square cells, each of which is in one of two possible states, | |
alive or dead. Every cell interacts with its eight neighbours, |
OlderNewer