2

There are quite a few questions about the "yin-yang puzzle" already in Stackoverflow:

I was wondering when and who find this beautiful programming pearl. So I dig into it. Here is my finding:

  • The first question was posted in 2010 and refers to a wikipedia page.
  • The current version of this page referred to Yin Wang's web blog.
  • Unfortunately he closed his blog but it is available in Web Archive, as at 2012/07/27.
  • This web blog refers to the first stack overflow question.
  • This means the wikipedia article was updated after the first question being asked.
  • The wikipedia article history shows the original yin-yang puzzle was added in 2009 by a registered user without any citation.

Now I lost all clues to track back the history before 2009. It is appear to be the case that this puzzle was well-known in 2009 at least in some society. Since the original puzzle is in Scheme, I assume it is a Scheme user group.

Can any one show more historical detail on this?

Community
  • 1
  • 1
Earth Engine
  • 10,048
  • 5
  • 48
  • 78
  • 1
    FWIW it was mention in the group comp.lang.scheme in 1999: https://groups.google.com/d/msg/comp.lang.scheme/Fysq_Wplxsw/awxEZ_uxW20J – soegaard May 23 '15 at 10:05
  • Greate thanks! That article clearly states the origin of this is through the invention of Unlambda language, and it was a computer found term that generates a specific result. So, shall I say that it is a computer found program? – Earth Engine May 23 '15 at 10:14
  • I turned the answer into a comment. – soegaard May 23 '15 at 11:46
  • FWIW the puzzle has been discussed multiple times in comp.lang.scheme so it is worth looking through the archives. – soegaard May 23 '15 at 12:31
  • Never mind. If we found something earlier than this we can update the answer though. But this one is pretty looks like it since it is converted from Unlambda, and there is a reason for it to be found - it is the shortest program in that language to generate a result. – Earth Engine May 23 '15 at 12:32

1 Answers1

2

From comp.lang.scheme in 1999:

https://groups.google.com/d/msg/comp.lang.scheme/Fysq_Wplxsw/awxEZ_uxW20J

From: mad...@news.ens.fr (David Madore)
Subject: call/cc mind-boggler
Date: 1999/06/24
Message-ID: <7ktbid$a29$1@nef.ens.fr>#1/1
X-Deja-AN: 493362808
Organization: Ecole normale superieure
Newsgroups: comp.lang.scheme

I sumbled (accidentally as it were) upon the following Scheme program:

(let* ((yin ((lambda (foo) (newline) foo)
             (call/cc (lambda (bar) bar))))
       (yang ((lambda (foo) (write-char #\*) foo)
              (call/cc (lambda (bar) bar)))))
  (yin yang))

(If you want the full story, I was inventing a language (called
``Unlambda'', essentially, an implementation of the lambda calculus
without the lambda operation) that is specially designed for
obfuscation, and whose interpreter is written in Scheme; I had written
a single program in it that was over 600 characters long to write the
integers consecutively (writing each integer by a line of asterisks). 
Then I added the call/cc operation to the language, and while
experimenting with it I found that a 12-character program performed
exactly the same task as my longer program, namely ``r`ci`.*`ci (where
` means apply, c means call/cc and i is the identity, r and .* are
essentially newline and write *).  Converting this program back to
Scheme gives the thing I have printed above.  Well, that's the whole
story, I didn't claim it was interesting.)
soegaard
  • 30,661
  • 4
  • 57
  • 106