Sha256: 6ce21970c1b274a7f890d63f2f4aa1805d4c94955da45ddcd79d1babe86e6bde

Contents?: true

Size: 311 Bytes

Versions: 5

Compression:

Stored size: 311 Bytes

Contents

require 'nyara'

get '/factorial(%u)' do |n|
  redirect_to '#product', 1, n
end

meta '#product'
get '/%u*factorial(%u)' do |product, n|
  if n == 0
    redirect_to '#result', product
  else
    redirect_to '#product', product * n, n - 1
  end
end

meta '#result'
get '/%u' do |result|
  send_string result
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nyara-0.1.pre.2 example/factorial.rb
nyara-0.1.pre.1 example/factorial.rb
nyara-0.0.1.pre.9 example/factorial.rb
nyara-0.0.1.pre.8 example/factorial.rb
nyara-0.0.1.pre.6 example/factorial.rb