This file contains hidden or 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
#! /usr/bin/env python2 | |
from SimpleCV import Camera | |
from math import sqrt | |
from sys import exit | |
from numpy.linalg import norm | |
from subprocess import call | |
from time import sleep | |
camera = Camera() |
This file contains hidden or 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
fib = (\ n -> (if ((((==) n)) 0) then 0 else (if ((((==) n)) 1) then 1 else ((((+) ((fib) ((n) -1)))) ((fib) ((n) -2)))))) | |
fact = (\ n -> (if ((((==) n)) 0) then 1 else ((((*) ((fact) ((n) -1)))) n))) | |
ns = (((((:)) 1)) (((((:)) 2)) (((((:)) 3)) (((((:)) 4)) (((((:)) 5)) []))))) | |
main = ((((>>) ((print) ((fib) 19)))) ((print) ((((>>=) ns)) ((((.) return)) fact)))) |
This file contains hidden or 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 (fib n) | |
if (n == 0) | |
then 0 | |
else if (n == 1) | |
then 1 | |
else | |
((fib (n-1)) + | |
(fib (n-2))) | |
def (fact n) |
This file contains hidden or 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 pay(current_debt, amount): | |
return current_debt-amount | |
def next_year(previous_debt, amount, n): | |
if previous_debt <= 0: | |
return n | |
previous_debt = previous_debt + 0.068*previous_debt | |
previous_debt = pay(previous_debt, amount) | |
print previous_debt | |
return next_year(pay(previous_debt, amount), amount, n+1) |
This file contains hidden or 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
{-# LANGUAGE FlexibleInstances #-} | |
import Data.Void | |
data LinkedList a = Null | Cons a (LinkedList a) deriving (Show) | |
data Natural = Zero | Succ Natural deriving (Show) | |
instance Enum Natural where | |
succ n = Succ n | |
pred Zero = Zero |
This file contains hidden or 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
import System.Directory | |
import Control.Monad | |
import qualified Data.List as L | |
import Data.List.Split | |
import Control.Applicative | |
import qualified Data.Foldable as F | |
import Data.Monoid | |
import qualified Data.Text as T | |
data Directory a = Dir {fileName :: a, |
This file contains hidden or 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
import System.Directory | |
import Control.Monad | |
import qualified Data.List as L | |
import Data.List.Split | |
import Control.Applicative | |
import qualified Data.Foldable as F | |
import Data.Monoid | |
import qualified Data.Text as T | |
data Directory a = Dir { |
This file contains hidden or 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
#lang racket | |
(require racket/promise) | |
(struct Directory (root | |
sub-directories)) | |
(define (file-tree root) | |
(parameterize | |
([current-directory root]) |
This file contains hidden or 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
#lang racket | |
(require (planet neil/xexp:2:0)) | |
(require (planet neil/html-writing:2:0)) | |
(struct post-meta (title date category author)) | |
(struct url (url-str url-name)) | |
(define-struct/contract post |
This file contains hidden or 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
;; -*- scheme -*- | |
#| | |
Written by Eli Barzilay <[email protected]> | |
This file provides some useful facilities for interactive use of racket. It is | |
best used as (or loaded from) a ".racketrc" file or "racketrc.ss" on | |
Windows (evaluate `(find-system-path 'init-file)' to know where this file is on | |
your system). |