Skip to content
Bernát Kalló edited this page Aug 13, 2013 · 4 revisions
require 'rubylog'

module Factorial
  extend Rubylog::Context
  predicate_for Integer, ".factorial()"

  0.factorial! 1
  N[thats > 0].factorial(K).if \
    N1.is{N-1}.
    and N1.factorial(K1).
    and K.is{N*K1}

  7.factorial(N).solve {puts N}
end
Clone this wiki locally