Refactor
:my
=>
'code'
Codes
Refactorings
Popular
Best
Submit
Spam
Account
Logout
Login
JavaScript doesn't seem to be activated, expect things to be ugly and sloppy!
Learn How to Create Your Own Programming Language
createyourproglang.com
Recent
How to get accepted in Fileice (200% Working) 22/2012
Premium Account
FILE HOSTS PREMIUM ACCOUNT
ALL FILE HOST PREMIUM ACCOUNTS
Zynga Slingo Trainer v5.12
iTunes Gift Card Generator V3.1 2012
Diablo 3 GOLD Coins FREE
Working PS3 Jailbreak 3.65 And 3.66
ExtaBit Premium Accounts and Cookies
Steam Wallet Hack - Money Adder & Hack v3
Popular
XBOX POINTS GENERATOR - MICROSOFT POINTS GENERATOR v1.2012
11 may 2012 premium uploading accounts 100% working
Free Microsoft Points
Free Microsoft Points - Microsoft Points Generator - Xbox Live Codes 2012
Car Town Free Blue Points Hack
Free CarTown Blue Points Generator and CarTown Templates
Better way to get content via jQuery $.get()
Free Microsoft Points
Simple Days Purger
Sharecash Downloader Bypass Surveys New 05/2012
Pastable version of
Combinatorial explosion with continuations
<pre class='prettyprint' language='ruby'>$c = [] def fork_reality(*l) callcc {|c| $c << c } $c.pop if l.size <= 1 l.shift end def collect_realities $c.last.call until $c.empty? end def contract_sentence(arr, index = 0, res = []) return res.compact.join(' ') if index == arr.size skip = 1 x = arr[index] nxt = arr[index+1] nxt2 = arr[index+2] r = case when x == 'a' && (nxt =~ /^[aeiuo]/ || nxt =~ /^hono/ || nxt =~ /^honest/ || nxt =~ /^hour/) 'an' when x == 'I' && nxt == 'am' skip = 2 fork_reality("I'm", "I am") when %w(you we they).include?(x) && %w(are have).include?(nxt) && nxt2 == 'not' skip = 3 fork_reality("#{x}'#{nxt[-2,2]} not", "#{x} #{nxt}n't", "#{x} #{nxt} not") when %w(you we they).include?(x) && %w(are have).include?(nxt) skip = 3 fork_reality("#{x}'re", "#{x} #{nxt}") when %w(he she it).include?(x) && %w(is has).include?(nxt) && nxt2 == 'not' skip = 3 fork_reality("#{x} #{nxt}n't", "#{x} #{nxt} not") when %w(he she it).include?(x) && %w(is has).include?(nxt) skip = 2 fork_reality("#{x}'s", "#{x} #{nxt}") when %w(is are).include?(x) && nxt == 'not' skip = 2 fork_reality("#{x}n't", "#{x} #{nxt}") else x end contract_sentence(arr, index + skip, res + [r]) end r = [] r << contract_sentence(%w(I am green but you are not white and Bob is not a honest man while Alice and Ina are not purple)) collect_realities raise unless r.include? "I'm green but you aren't white and Bob isn't an honest man while Alice and Ina aren't purple" raise unless r.include? "I'm green but you are not white and Bob is not an honest man while Alice and Ina are not purple" raise unless r.include? "I am green but you are not white and Bob is not an honest man while Alice and Ina aren't purple" p r</pre> <a href="http://www.refactormycode.com/codes/83-combinatorial-explosion-with-continuations" style="color:#fff" title="As seen on RefactorMyCode.com"><img alt="Small_logo" src="http://www.refactormycode.com/images/small_logo.gif" style="border:0" /></a>