Skip to content

Mondo Bizarro

In this thread about a closure puzzler Jens posted Eugene Kohlbecker’s mind-bender called Mondo Bizarro.

;;; Mondo Bizarro
 
; What does the following program print?
; Why?
 
(define program (lambda ()
    (let ((y (call-with-current-continuation (lambda (c) c))))
         (display 1)
         (call-with-current-continuation (lambda (c) (y c)))
         (display 2)
         (call-with-current-continuation (lambda (c) (y c)))
         (display 3))))
 
 
(program)

Mondo Bizarro seems to have been originally published in ACM SIGPLAN Lisp Pointers, Volume 1, Issue 2 (June-July 1987), located here; but I could not confirm that.

Here is an implementation of it in Java.

(via the PLT Discussion List)

One Trackback/Pingback

  1. Ending Concerts On A Flat Note | PureCountryMusic.Com Blog on Friday, January 30, 2009 at 7:57 pm

    [...] Mondo Bizarro | Wisdom and Wonder [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*