Skip to content

Instantly share code, notes, and snippets.

@rosenk
rosenk / install-haskell-stack-arm.sh
Created December 18, 2016 18:04 — forked from tmspzz/install-haskell-stack-arm.sh
A scrip to install Haskell Stack and set up things properly on Raspbian
#!/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
@rosenk
rosenk / init.el
Last active August 29, 2015 14:17
emacs config
(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)
@rosenk
rosenk / Install Idris lang on Windows
Last active August 29, 2015 14:00
install Idris lang in Windows
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
(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)))))
(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)