Skip to content

Instantly share code, notes, and snippets.

View wavebeem's full-sized avatar

Sage Fennel wavebeem

View GitHub Profile
@wavebeem
wavebeem / list.hs
Created January 20, 2011 02:58
Haskell list
module List where
data List a
= Null
| Node (List a) a
deriving (Show, Eq)
build = build' Null
where
build' Null [] = Null
@wavebeem
wavebeem / sum.hs
Created January 20, 2011 07:39
3 different sum functions in Haskell
module Sum where
a [] = 0
a (x:xs) = x + a xs
b xs = b' 0 xs
where
b' q [] = q
b' q (x:xs) = b' (q + x) xs
a [] = 0
a (x:xs) = x + a xs
b xs = b' 0 xs
where
b' a [] = 0
b' a (x:xs) = b' (a+x) xs
c xs = foldl (+) 0 xs
# vim: syn=sh:
#
# Sleep before doing a command
SleepDo() {
local time="$1"
shift
sleep "$time"
eval "$@"
}
module Test where
data Range
= FromTo Integer Integer
deriving (Eq, Ord)
instance Show Range where
show (FromTo x y) = show x ++ " --> " ++ show y
x --> y
update_interval 1
#out_to_x no
out_to_console yes
temperature_unit fahrenheit
#temperature_unit celsius
TEXT
${uptime_short}\
::: ${mem}\
::: ${mixer}%${if_mixer_mute} (M)${endif}\
// author: Brian Mock <mock.brian@gmail.com>
#include <stdio.h>
typedef unsigned int uint;
double clamp(double, double, double);
uint pack_rgb(uint, uint, uint);
uint shade_color(uint, double);
void unpack_rgb(uint, uint*, uint*, uint*);
-------------------- Brian Mock -----------------------
module Lab3 where
import List
-------------------- Problem 1 -----------------------
(==>) = flip ($)
integerToDigit (i + 1) = digits !! i
#!/usr/bin/env ruby
#
# Ruby ruby ruby!
#
def fibo(a=1, b=1)
n = 0
yield 0, a
yield 1, b
loop do
a, b = b, a + b
#import <Foundation/Foundation.h>
#define I(n) [NSNumber numberWithInt:(n)]
int
main(int argc, char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSArray *ary = [NSArray arrayWithObjects:
I(4), I(5), I(1), I(0), I(6), nil
];