Sha256: b5ae194ae8e7bbe48cffbc57c71ce5ba71aa25172385fb9034b4dcaf4fbba911

Contents?: true

Size: 336 Bytes

Versions: 1

Compression:

Stored size: 336 Bytes

Contents

# frozen_string_literal: true

require 'ddmemoize'

TELEMETRY = DDTelemetry.new

class FibFast
  DDMemoize.activate(self, telemetry: TELEMETRY)

  memoized def fib(n)
    case n
    when 0
      0
    when 1
      1
    else
      fib(n - 1) + fib(n - 2)
    end
  end
end

p FibFast.new.fib(1000)

DDMemoize.print_telemetry(TELEMETRY)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ddmemoize-1.0.0a2 samples/fib.rb