Code to accompany the weblog posting: Ruby/Rack and Multiple Value Request Param Pain — Part One
Demonstrating multi-value params not working with out-of-the-box Rack, but working with a monkey patched Rack.
| [ 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. |
Code to accompany the weblog posting: Ruby/Rack and Multiple Value Request Param Pain — Part One
Demonstrating multi-value params not working with out-of-the-box Rack, but working with a monkey patched Rack.
Code to accompany the weblog posting: Ruby/Rack and Multiple Value Request Param Pain — Part Two
Demonstrates problems with some Ruby HTTP clients when dealing with multi-value params
| (use 'criterium.core) | |
| (defn looping [n] | |
| (loop [i n] | |
| (when (< 1 i) | |
| (recur (dec i))))) | |
| (defn recursive [n] | |
| (when (< 1 n) (recursive (dec n)))) |
| package main | |
| // run from the command line as: | |
| // go test -bench=".* | |
| import ( | |
| "testing" | |
| ) | |
| func BenchmarkJSON(b *testing.B) { |
| package main | |
| import "fmt" | |
| type Thing interface { | |
| Step1AsMethod() | |
| Step2AsMethod() | |
| } | |
| type Base struct { |
| package main | |
| import "fmt" | |
| type A struct{} | |
| func (A) Name() { fmt.Println("A") } | |
| func (self A) SomeAMethod() { | |
| self.Name() |
| >> 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 |
| 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 |