Skip to content

Instantly share code, notes, and snippets.

View m0dd3r's full-sized avatar

Jason Rankin m0dd3r

  • BatchBlue Software
  • Providence, RI
View GitHub Profile
@m0dd3r
m0dd3r / gist:34ad41886ff58a88b3fe
Created June 12, 2015 00:23
monad based floyd cycle detection
require_relative 'linked_list_node'
Maybe = Struct.new(:value) do
def and_then(&block)
if value.nil?
Maybe.new(nil)
else
block.call(value)
end
end