Skip to content

Instantly share code, notes, and snippets.

View hutch's full-sized avatar

Bob Hutchison hutch

View GitHub Profile
main :: IO ()
main = do
mapM_ fizzbuzz [1..100]
mapM_ fizzbuzzbazz [1..120]
where
fizzbuzz :: Int -> IO ()
fizzbuzz i | i `rem` 3 == 0 && i `rem` 5 == 0 = putStrLn "FizzBuzz"
| i `rem` 5 == 0 = putStrLn "Buzz"
| i `rem` 3 == 0 = putStrLn "Fizz"
| otherwise = print i
@hutch
hutch / HOMEBREW_MAKE_JOBS1 VERBOSE1 brew install ghc --32-bit
Created November 8, 2012 18:55
ghc --32-bit failed to build on OS X 10.8.2
This file has been truncated, but you can view the full file.
>> HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install ghc --32-bit
==> Downloading http://www.haskell.org/ghc/dist/7.4.2/ghc-7.4.2-src.tar.bz2
Already downloaded: /Library/Caches/Homebrew/ghc-7.4.2.tar.bz2
/usr/bin/tar xf /Library/Caches/Homebrew/ghc-7.4.2.tar.bz2
==> Downloading patches
/usr/bin/curl -f#LA Homebrew 0.9.3 (Ruby 1.8.7-358; Mac OS X 10.8.2) http://hackage.haskell.org/trac/ghc/raw-attachment/ticket/7040/ghc7040.patch -o 000-homebrew.diff
######################################################################## 100.0%
==> Patching
/usr/bin/patch -f -p1 -i 000-homebrew.diff
patching file rts/Linker.c
@hutch
hutch / example.go
Created June 27, 2012 18:39
Follow up to "A Rubyist has Some Difficulties with Go"
package main
import "fmt"
type A struct{}
func (A) Name() { fmt.Println("A") }
func (self A) SomeAMethod() {
self.Name()
@hutch
hutch / FunctionVsMethod.go
Created June 26, 2012 18:26
related to blog post "A Rubyist has Some Difficulties with Go"
package main
import "fmt"
type Thing interface {
Step1AsMethod()
Step2AsMethod()
}
type Base struct {
@hutch
hutch / bmark_test.go
Created June 22, 2012 19:06
accompanies the blog post: Comparing JSON and XML as DataFormats… Again http://xampl.com/so/2012/06/22/1164/
package main
// run from the command line as:
// go test -bench=".*
import (
"testing"
)
func BenchmarkJSON(b *testing.B) {
@hutch
hutch / loop-recursive-tco-comparison.clj
Created January 9, 2011 22:24
compare loop, recursive calls, recurring calls
(use 'criterium.core)
(defn looping [n]
(loop [i n]
(when (< 1 i)
(recur (dec i)))))
(defn recursive [n]
(when (< 1 n) (recursive (dec n))))
@hutch
hutch / 00Readme.markdown
Created December 18, 2009 00:15
Code to demonstrate problems with some Ruby HTTP clients when dealing with multi-value params
@hutch
hutch / 0-readme.md
Created December 17, 2009 01:38
Code demonstrating multi-value params working and not working with Rack
@hutch
hutch / _original-question.txt
Created December 6, 2009 19:31
Question, answered, on how to dispatch a multimethod in Clojure based on a deftype
[ a link to the whole thread: http://tr.im/GRyQ ]
Hi,
I'm new to Clojure, not new to lisp (CL and scheme), and having a
thoroughly good time. I've been having a go at the new deftype stuff
and using a clone of the new branch from the git repository (up-to-
date as of this message being posted). So far everything I've tried
has worked very nicely, except for one thing.