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
;; finitud's solution to Nth Element | |
;; https://4clojure.com/problem/21 | |
(fn [x n] | |
(if (= n 0) (first x) | |
(recur (rest x) (- n 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
;; finitud's solution to Count a Sequence | |
;; https://4clojure.com/problem/22 | |
(fn [x] | |
((fn [x n] | |
(if (= (rest x) ()) | |
n | |
(recur (rest x) (+ n 1))) | |
) | |
x 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
; A REPL-based, annotated Seesaw tutorial | |
; Please visit https://github.com/daveray/seesaw for more info | |
; | |
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers | |
; Seesaw's basic features and philosophy, but only scratches the surface | |
; of what's available. It only assumes knowledge of Clojure. No Swing or | |
; Java experience is needed. | |
; | |
; This material was first presented in a talk at @CraftsmanGuild in | |
; Ann Arbor, MI. |
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 inc-sandbox.corr-demo | |
(:require [clojure.set :as set]) | |
(:use (incanter core stats charts io)) | |
(:require [clj-time.core :as time]) | |
(:use (clj-time [format :only (formatter formatters parse)] | |
[coerce :only (to-long)]))) | |
(defn sym-to-dataset | |
"returns a dataset read from a local CSV in './data/' given a Yahoo Finance symbol name" | |
[yf-symbol] |
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
;; finitud's solution to Reverse a Sequence | |
;; https://4clojure.com/problem/23 | |
#(if (empty? %2) | |
%1 | |
(recur (conj %1 (last %2)) | |
(butlast %2))) | |
[] |
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
;;; cljdoc.el --- eldoc mode for clojure | |
;; Copyright (C) 2011 tomykaira | |
;; Version 0.1.0 | |
;; Keywords: eldoc clojure | |
;; Author: tomykaira <[email protected]> | |
;; URL: https://gist.github.com/1386472 | |
;; This file is not part of GNU Emacs. |
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 boggle | |
(require [clojure.string :as str])) | |
(def words | |
(set (str/split-lines (slurp "brit-a-z.txt")))) | |
(defn select-words [s]) | |
"Produces a list of words which start with 's'" | |
(filter #(.startsWith % s) words)) |
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
# I am a scientist who has been using R for about 2 years. Today I achieved a measure of enlightenment into | |
# the zen of R, and I want to share it with you. | |
# I was simulating a set of independent random walks, which are formed by a multiplicative process. Here is | |
# the code I had built up over a few months of working on it and modifying it on and off as research | |
# questions changed: | |
TimeSteps <- 1000 | |
Walks <- 100 | |
ErrorMagnitude <- 0.03 |
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
;; finitud's solution to A nil key | |
;; https://4clojure.com/problem/134 | |
(fn [key map] (nil? (get map key ()))) |
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
# MAC manipulators | |
alias random_mac='sudo ifconfig en0 ether `openssl rand -hex 6 | sed "s/\(..\)/\1:/g; s/.$//"`' | |
alias restore_mac='sudo ifconfig en0 ether YOUR_ORIGINAL_MAC_ADDRESS_GOES_HERE' |
OlderNewer