tag:blogger.com,1999:blog-10770855.post114358938146529869..comments2024-03-28T03:20:57.393-04:00Comments on The Little Calculist: How do you say "maybe"?Dave Hermanhttp://www.blogger.com/profile/00405190527081772997noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-10770855.post-1147391358923506302006-05-11T19:49:00.000-04:002006-05-11T19:49:00.000-04:00Fine, but that's no different from T option in ML....Fine, but that's no different from T option in ML. My list was intended to demonstrate implementations of the pattern that are different in interesting ways.Dave Hermanhttps://www.blogger.com/profile/00405190527081772997noreply@blogger.comtag:blogger.com,1999:blog-10770855.post-1147391204521857172006-05-11T19:46:00.000-04:002006-05-11T19:46:00.000-04:00In scala:val foo: Option[T]Here's the API doc.In <A HREF="http://scala.epfl.ch/" REL="nofollow">scala</A>:<BR/><BR/>val foo: Option[T]<BR/><BR/>Here's <A HREF="http://scala.epfl.ch/docu/files/api/scala/Option.html" REL="nofollow">the API doc</A>.scruziahttps://www.blogger.com/profile/04753665681997405438noreply@blogger.comtag:blogger.com,1999:blog-10770855.post-1143627343475720572006-03-29T05:15:00.000-05:002006-03-29T05:15:00.000-05:00"Either T or #f" is not so good in Scheme if T can..."Either T or #f" is not so good in Scheme if T can be #f. Better is "(list T) or #f", or your favorite box of T or your favorite non-box cookie (empty list, zero element vector).<BR/><BR/>But the other way to say maybe is "pair of continuations", sometimes even in direct style.KSMhttps://www.blogger.com/profile/00099227831391062934noreply@blogger.comtag:blogger.com,1999:blog-10770855.post-1143603112051505262006-03-28T22:31:00.000-05:002006-03-28T22:31:00.000-05:00Hey,I've used ternary logic in Smalltalk before, u...Hey,<BR/><BR/>I've used ternary logic in Smalltalk before, using the values 'true', 'false' and 'nil'.<BR/><BR/>^ aPerson isHappy<BR/> ifNil: ['Maybe?.'];<BR/> ifTrue: ['It's true']<BR/> ifFalse: ['It's false'].<BR/><BR/>Notice that this consists of 2 message sends (cascaded to the same receiver by the semicolon syntax), they are:<BR/><BR/>1) ifNil: <BR/>2) ifTrue:ifFalse:Duncanhttps://www.blogger.com/profile/13843763027842460609noreply@blogger.comtag:blogger.com,1999:blog-10770855.post-1143595200207638102006-03-28T20:20:00.000-05:002006-03-28T20:20:00.000-05:00Ack! Of course. Fixed.Ack! Of course. Fixed.Dave Hermanhttps://www.blogger.com/profile/00405190527081772997noreply@blogger.comtag:blogger.com,1999:blog-10770855.post-1143594986040938612006-03-28T20:16:00.000-05:002006-03-28T20:16:00.000-05:00it's actually (T option) in ML :) -- well what you...it's actually (T option) in ML :) -- well what you actually *say* is (SOME V) or (NONE), (T option) is the type.<BR/><BR/>-mariusAnonymousnoreply@blogger.com