Showing posts with label this sentence is false. Show all posts
Showing posts with label this sentence is false. Show all posts

Wednesday, April 27, 2011

This Sentence is False

In FreeBASIC, a functional demonstration of "This sentence is false" as a binary logarithm using a recursive function... This is the most perfect proof that I can muster of a double binary. Who needs evidence when you have proof?

;)

Original post: http://basenothing.blogspot.com/2009/04/much-ado-about-nothing-i-think-as-i.html

function CutSwap ( byref txt as string, byval idx0 as integer, byval idx1 as integer, byref newtxt as string ) as string

dim as string firsthalf = LEFT(txt,idx0), secondhalf = RIGHT(txt,len(txt)-(idx1+1))
return firsthalf + newtxt + secondhalf

end function

function ThisSentenceIsFalse ( byref s as string, byval it as integer ) as string
if it<1 then return s
dim as string res = CutSwap( s, InStr( "This sentence", s)-1, len("This sentence"), s & " " )
return ThisSentenceIsFalse ( res, it-1 ) & " "
end function

? ThisSentenceIsFalse ( "This sentence is false", 7 )
? 2^7
sleep