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
*Parser> :load "Calc.hs" | |
[1 of 3] Compiling ExprT ( ExprT.hs, interpreted ) | |
[2 of 3] Compiling Parser ( Parser.hs, interpreted ) | |
[3 of 3] Compiling Calc ( Calc.hs, interpreted ) | |
Calc.hs:50:14: | |
Couldn't match type ‘Integer’ with ‘Mod7’ | |
Expected type: Integer -> Mod7 -> Mod7 | |
Actual type: Mod7 -> Mod7 -> Mod7 | |
In the first argument of ‘flip’, namely ‘mod’ |
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
data Tree a = Leaf | |
| Node Integer (Tree a) a (Tree a) | |
deriving (Show, Eq) | |
height :: Integer -> [Integer] | |
height n = replicate e n | |
where e = (2 ^ n) | |
heightGen :: [Integer] | |
heightGen = concatMap height [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
skips :: [a] -> [[a]] | |
skips xs = foldl1 (\x y -> x !! y) (zip (take . length xs) (cycle [xs])) [1,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
;;ex 1.14 | |
(count-change 11) | |
(cc 11 5) | |
(+ (cc 11 4) | |
(cc -39 5)) | |
(+ (+ (cc 11 3) | |
(cc -13 4)) | |
0) | |
(+ (+ (+ (cc 11 2) | |
(cc 1 3)) |
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
;;; SICP, Chapter 1, section 1.2.2 (pg 40) | |
;; Counting change | |
(define (count-change amount) | |
(cc amount 5)) | |
(define (cc amount kinds-of-coins) | |
(cond ((= amount 0) 1) | |
((or (< amount 0) (= kinds-of-coins 0)) 0) | |
(else (+ (cc amount |
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
atool | |
brew-cask | |
clisp | |
emacs | |
gcc | |
gdb | |
git | |
htop-osx | |
leiningen | |
lynx |
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
(global-set-key [(meta w)] 'execute-extended-command) | |
(global-set-key [(super w)] 'execute-extended-command) | |
(global-set-key [(super r)] 'revert-buffer) | |
(global-set-key [(super i)] 'magit-status) | |
(global-set-key [(super f)] 'ido-find-file) | |
(global-set-key [(super b)] 'ido-switch-buffer) | |
(global-set-key [(super o)] 'other-window) | |
(global-set-key [(super e)] 'eval-defun) | |
(global-set-key [(super n)] 'next-buffer) | |
(global-set-key [(super p)] 'previous-buffer) |
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
(require 'web-mode) | |
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode)) | |
(add-to-list 'auto-mode-alist '("\\.css\\'" . web-mode)) | |
(add-to-list 'auto-mode-alist '("\\.scss\\'" . web-mode)) | |
(defun custom-web-mode-hook () | |
"Hooks for Web mode." | |
(setq web-mode-markup-indent-offset 2) | |
(setq web-mode-css-indent-offset 2) | |
(setq web-mode-code-indent-offset 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
(tool-bar-mode 0) | |
(menu-bar-mode 0) | |
(scroll-bar-mode 0) | |
(menu-bar-mode -1) | |
(global-linum-mode 1) ; display line numbers | |
(column-number-mode 1) ; display column/row of cursor in mode-line | |
(show-paren-mode 1) | |
(add-hook 'before-save-hook 'delete-trailing-whitespace) |
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
(require 'cl) | |
(require 'package) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.org/packages/") t) | |
(package-initialize) | |
(when (not package-archive-contents) | |
(package-refresh-contents)) |