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
(def triangle-numbers | |
(lazy-cat [1] | |
(map + triangle-numbers (iterate inc 2)))) | |
(defn num_devisors [x] | |
(* 2 (count (filter #(= (rem x %) 0) | |
(range 1 (Math/sqrt x)))))) | |
(first | |
(filter #(> (num_devisors %) 500) |
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 proper-devisors [n] | |
(filter #(= (rem n %) 0) (range 1 (inc (quot n 2))))) | |
(defn d [n] | |
(reduce + (proper-devisors n))) | |
(defn amicable? [n] | |
(let [dn (d n) | |
ddn (d dn) ] | |
(and (= n ddn) (not (= n dn))))) |
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
1) install haskell platform and mingw | |
2) run mingw shell | |
3) cabal update | |
# cabal from the latest haskell platform is 1.16 but we need >= 1.18 to use sandboxes so: | |
4) cabal install cabal-install | |
5) put C:\Users\<your user name>\AppData\Roaming\cabal\bin in your PATH | |
6) test cabal version with cabal -V (you may need to restart the mingw shell) | |
7) download sources from https://github.com/idris-lang/Idris-dev/archive/v0.9.12.zip and extract to in c:/dev/haskell/idris | |
8) cd /c/hasell/idris | |
we will install idris in a cabal sandbox to make shure it is a clean start |
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 'package) ;; You might already have this line | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.org/packages/") t) | |
(when (< emacs-major-version 24) | |
;; For important compatibility libraries like cl-lib | |
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))) | |
(package-initialize) ;; You might already have this line | |
(load-theme 'misterioso) |
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
#!/bin/sh | |
# Install stack | |
curl -sSL https://get.haskellstack.org/ | sh | |
# Install LLVM | |
sudo apt-get install llvm-3.7 | |
# Add symbolic links to opt and llc | |
ln -s /usr/bin/opt-3.7 /usr/bin/opt |