Skip to content

Instantly share code, notes, and snippets.

View finitud's full-sized avatar
💭
Not really using this account anymore, find me on the other one!

Alice Wyan finitud

💭
Not really using this account anymore, find me on the other one!
View GitHub Profile
;; finitud's solution to Nth Element
;; https://4clojure.com/problem/21
(fn [x n]
(if (= n 0) (first x)
(recur (rest x) (- n 1))))
;; 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))
@finitud
finitud / seesaw-repl-tutorial.clj
Created February 18, 2012 14:15 — forked from daveray/seesaw-repl-tutorial.clj
Seesaw REPL Tutorial
; 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.
@finitud
finitud / corr_demo.clj
Created February 18, 2012 16:00 — forked from Quantisan/corr_demo.clj
first try using Incanter to analyse stocks data
(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]
;; finitud's solution to Reverse a Sequence
;; https://4clojure.com/problem/23
#(if (empty? %2)
%1
(recur (conj %1 (last %2))
(butlast %2)))
[]
@finitud
finitud / cljdoc.el
Created February 19, 2012 15:09 — forked from tomykaira/cljdoc.el
cljdoc.el --- eldoc mode for clojure
;;; cljdoc.el --- eldoc mode for clojure
;; Copyright (C) 2011 tomykaira
;; Version 0.1.0
;; Keywords: eldoc clojure
;; Author: tomykaira <tomykaira@gmail.com>
;; URL: https://gist.github.com/1386472
;; This file is not part of GNU Emacs.
(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))
@finitud
finitud / gist:2054209
Created March 17, 2012 01:37
The Zen of R
# 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
;; finitud's solution to A nil key
;; https://4clojure.com/problem/134
(fn [key map] (nil? (get map key ())))
@finitud
finitud / .bashrc
Created March 8, 2013 14:52 — forked from jashkenas/.bashrc
# 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'