Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix rackup sample

  • Loading branch information...
commit e32a1e759969fa36f24af560ed362a6e6cb76f48 1 parent 7c0adf1
@mwotton authored
Showing with 5 additions and 3 deletions.
  1. +2 −2 sample/Fibonacci.hs
  2. +3 −1 sample/config.ru
View
4 sample/Fibonacci.hs
@@ -7,8 +7,8 @@ import Maybe
-- main = putStrLn "11"
-fibonacci :: Int -> Int
-fibonacci n = fibs !! n
+fibonacci :: Integer -> Integer
+fibonacci n = fibs !! (fromIntegral n)
where fibs = 0 : 1 : zipWith (+) fibs (tail fibs)
-- local_map = Data.Map.fromList [(1,2), (3,4)]
View
4 sample/config.ru
@@ -10,12 +10,14 @@ end
def arg_from env
- env['REQUEST_URI'] ? env['REQUEST_URI'].to_s.sub(/^\//, '').to_i : 0
+ #env['REQUEST_URI'] ? env['REQUEST_URI'].to_s.sub(/^\//, '').to_i : 0
+ env['PATH_INFO'] ? env['PATH_INFO'].to_s.sub(/^\//, '').to_i : 0
end
app = proc do |env|
value = Fibonacci.new.fibonacci( arg_from env )
[ 200, {'Content-Type' => 'text/plain'}, "The fib number is #{value }" ]
+ # [ 200, {'Content-Type' => 'text/plain'}, "The fib number is #{arg_from env}" ]
end
run app
Please sign in to comment.
Something went wrong with that request. Please try again.