[comp.lang.functional] thunk's

lavinus@csgrad.cs.vt.edu (04/23/91)

Hi out there!

I have a question that has been nagging me for quite some time: why do we
call closures "thunk"s?  I mean, where did that word come from?  The only
two theories I've heard, neither with *any* supporting evidence, are that
it is an anagram for Knuth, and that perhaps it is a facetious past tense
of "think".  Anyone know??

Thanks,

Joe
--
_________________________________ \ ___________________________________
 Joseph W. Lavinus, Virginia Tech  \   email: lavinus@csgrad.cs.vt.edu
 1204-A University Terrace         /\  phone: (703) 552-0241
 Blacksburg, VA  24060            /  \        (703) 231-5853

harlan@copper.ucs.indiana.edu (Pete Harlan) (04/23/91)

>I have a question that has been nagging me for quite some time: why do we
>call closures "thunk"s?  I mean, where did that word come from?  The only
>two theories I've heard, neither with *any* supporting evidence, are that
>it is an anagram for Knuth, and that perhaps it is a facetious past tense
>of "think".  Anyone know??

"The word _thunk_ derives from the implementation of call-by-name in
Algol 60.  We do not know the origin of this name, but we have heard
that it refers to the sound made by data when pushed onto the stack in
a running Algol system."

  ---Abelson and Sussman, "Structure and Interpretation of Computer Programs"

Well, there you are! :-)

Pete Harlan
harlan@copper.ucs.indiana.edu

raja@copper.ucs.indiana.edu (Raja Sooriamurthi) (04/23/91)

>>I have a question that has been nagging me for quite some time: why do we
>>call closures "thunk"s?  I mean, where did that word come from?  The only
>>two theories I've heard, neither with *any* supporting evidence, are that
>>it is an anagram for Knuth, and that perhaps it is a facetious past tense
>>of "think".  Anyone know??

>"The word _thunk_ derives from the implementation of call-by-name in
>Algol 60.  We do not know the origin of this name, but we have heard
>that it refers to the sound made by data when pushed onto the stack in
>a running Algol system."

>  ---Abelson and Sussman, "Structure and Interpretation of Computer Programs"

To quote another source: 

	"The implementation of call-by-name is discusses by Ingerman
who introduces the term thunk to refer to this type of closure
[Ingerman 61]. (The term _thunk_ was presumably a reference to the
'noise' that a static chain pointer makes as it moves within
activation records)" 

			-Horowitz "Fundamentals of Programming Languages"

[Ingerman 61] Ingerman, P. "Thunks" Comm. ACM, 4,1,1961 55-58

(looks like this is where it originated)

-Raja
raja@cs.indiana.edu

sean@castle.ed.ac.uk (S Matthews) (04/23/91)

lavinus@csgrad.cs.vt.edu writes:

>I have a question that has been nagging me for quite some time: why do we
>call closures "thunk"s?  I mean, where did that word come from?  The only

Did this not come from work on implementing call by name in Algol 60,
where the stack pointer was imagined to go `thunk!' as it jumped from
one environment to another. 

Sean

-- 
Sean Matthews                        80 South Bridge, Edinburgh, UK 
Dept. of Artificial Intelligence     +44 (0) 31 650 2722
University of Edinburgh              sean@castle.ed.ac.uk

cspw@alpha.cs.ru.ac.za (Peter Wentworth) (04/23/91)

In <1151@creatures.cs.vt.edu> lavinus@csgrad.cs.vt.edu writes:
>I have a question that has been nagging me for quite some time: why do we
>call closures "thunk"s?  I mean, where did that word come from?  The only
>two theories I've heard, neither with *any* supporting evidence, are that
>it is an anagram for Knuth, and that perhaps it is a facetious past tense
>of "think".  Anyone know??

In Gries' book on compiler construction he says its because of the 
noise that the base pointer makes as you drop it back to the previous
context. 'Thunk!' (It was a long time ago when we used the book ... hope I've
remembered it right ...!)
Pete
--
EP Wentworth - Dept. of Computer Science - Rhodes University - Grahamstown.
cspw@alpha.ru.ac.za  

sakkinen@jyu.fi (Markku Sakkinen) (04/23/91)

In article <harlan.672371659@copper> harlan@copper.ucs.indiana.edu (Pete Harlan) writes:
>>I have a question that has been nagging me for quite some time: why do we
>>call closures "thunk"s?  I mean, where did that word come from?  The only
>>two theories I've heard, neither with *any* supporting evidence, are that
>>it is an anagram for Knuth, and that perhaps it is a facetious past tense
>>of "think".  Anyone know??

>"The word _thunk_ derives from the implementation of call-by-name in
>Algol 60.  We do not know the origin of this name, but we have heard
>that it refers to the sound made by data when pushed onto the stack in
>a running Algol system."
>
>  ---Abelson and Sussman, "Structure and Interpretation of Computer Programs"
>
>Well, there you are! :-)
>
>Pete Harlan
>harlan@copper.ucs.indiana.edu

I have always somehow thought that it is a Lewis Carroll -style
combination of 'think' and 'chunk', which probably goes well with
the effort of implementing call-by-name.  The onomatopoietic
interpretation of Abelson and Sussman was obviously made with
tongue in cheek - although perhaps with a tiny, subconscious
resentment toward the most important programming-language
development in the history of computing.
One could define in the same manner:

'clunk' -- the rattling noise of garbage cans caused by garbage
           collection in a running Lisp system

The anagram theory does not sound likely:  I suppose Knuth was not
very famous yet when the term was adopted.

The chapters on Algol in the proceedings of the ACM History of
Programming Languages conference (1978?) might shed some light on this.
The proceedings appeared as a special issue of SIGPLAN Notices.

Markku Sakkinen
Department of Computer Science and Information Systems
University of Jyvaskyla (a's with umlauts)
PL 35
SF-40351 Jyvaskyla (umlauts again)
Finland
          SAKKINEN@FINJYU.bitnet (alternative network address)

dat@ukc.ac.uk (D.A.Turner) (04/23/91)

In article <1151@creatures.cs.vt.edu> lavinus@csgrad.cs.vt.edu () writes:
>Hi out there!
>
>I have a question that has been nagging me for quite some time: why do we
>call closures "thunk"s?  I mean, where did that word come from?

I can throw some light on the origin of the word "thunk".  It was in use
around  1960  amongst  school-children  in London (maybe elsewhere but I
have no evidence) as slang for day-dream or fantasy.  Eg.  "You look far
away, are you having a thunk?" In this context I always assumed it to be
a facetious past tense for "think".

The  word  entered  computer  science   not   long   after,   when   the
mini-procedures   needed   to   implement  Algol-60's  call-by-name  got
christened "thunks" (I think by Randell and Russell).  Its use today for
closures obviously descends from that.  Whether Randell and Russell took
the word from the use mentioned in the previous para I do not know.

David Turner
(University of Kent)

jk@cs.man.ac.uk (John Kewley ICL) (04/23/91)

In article <1151@creatures.cs.vt.edu> lavinus@csgrad.cs.vt.edu () writes:
>Hi out there!
>
>I have a question that has been nagging me for quite some time: why do we
>call closures "thunk"s?  I mean, where did that word come from?  The only
>two theories I've heard, neither with *any* supporting evidence, are that
>it is an anagram for Knuth, and that perhaps it is a facetious past tense
>of "think".  Anyone know??

and, are they they the same as wigglies (what is the derivation of
this term?).


--
        J.K.
 
John M. Kewley, ICL, Wenlock Way, West Gorton, Manchester. M12 5DR
Tel:   (+44) 61 223 1301 X2138  Email: jk@cs.man.ac.uk / jk@nw.stl.stc.co.uk

kinnersley@kuhub.cc.ukans.edu (Bill Kinnersley) (04/23/91)

In article <1151@creatures.cs.vt.edu>, lavinus@csgrad.cs.vt.edu writes:
> Hi out there!
> 
> I have a question that has been nagging me for quite some time: why do we
> call closures "thunk"s?  I mean, where did that word come from?  The only
> two theories I've heard, neither with *any* supporting evidence, are that
> it is an anagram for Knuth, and that perhaps it is a facetious past tense
> of "think".  Anyone know??
> 

The following AUTHORITATIVE answer was recently posted to 
alt.folklore.computers:

------------

Newsgroups: alt.folklore.computers
Subject: THUNKS
Message-ID: <QbxsiCu00VsaA0oms6@andrew.cmu.edu>
From: jn11+@andrew.cmu.edu (Joseph M. Newcomer)
Date: 1 Apr 91 19:35:42 GMT
Organization: Carnegie Mellon, Pittsburgh, PA

[...]

Back around 2.6, I sent a note to Eric saying that the definition of "thunks"
was not quite accurate.  He had included the explanation "...the sound of
the result hitting the stack" whereas I remembered it as "...the sound of
the result hitting the accumulator".  While he held that his two correspondents
were absolutely certain they were right, I was absolutely certain that
they were wrong.  Machines in 1960 didn't HAVE stacks; they
had software implementations of stacks, and no sane programmer would
have developed a result in the accumulator, pushed it onto the stack, and
then have to pop it off the stack back to the accumulator; this was too
expensive.  Besides, I pointed out that the sound of a result hitting a
stack is more like a "whoosh" than a "thunk".

The "stack" version remained, and I was certain this was wrong.  I called or
sent mail to several people trying to find their memory of the evolution
of this
term and to try to locate Peter Z. Ingerman.  Brian Randell claimed that he
found the name unacceptable, and in his book ("Algol-60 implementation")
they referred to the construct as "implicit subroutine".  Art Evans said
he thought the term came about because the result had "already been
thunk about".  Nobody else had any leads.  Gwen Bell at the Computer
Museum said that ACM probably had Peter's address as he had been an
editor of Computing Reviews until a few years ago.

This morning I called ACM headquarters, got Peter's address, and
directory assistance gave me his phone number.  I introduced myself and
told about both my interest in computer history and my desire to know
the etymology of the word "thunks".  He asked "do you /really/ want to
know?"  After being convinced I was serious, he gave the explanation. 
The following transcript is from my notes which I tried to make
reasonably complete.  I asked Peter for permission to post this to
a.f.c. and he granted it.  Any errors, mis-spellings of peoples' names,
or omissions are my fault.

"Ned Irons, Wally Feuerzeig, Kirk Sampley, Herb Tanner and myself (and I
think there were a couple of others, but I'm not sure) got together to
decide how Algol call-by-name worked.  We ended up in Princeton (where
Ned Irons worked) and we co-opted a classroom for our discussion.  We
tossed the thing back and forth and worked out the idea that we had to
do it differently if the parameter was a label, a variable, an
expression, an array, etc.   By the time we were done it was 2 in the
morning (you understand how it gets to be 2 in the morning...and that is
possibly the most significant part of this story) and it suddenly dawned
on us, more or less simultaneously, that all of the thinking about this
-- that it was an array, label, etc., -- could be done at compile time. 
This meant that all of the thinking was already done.  At 2 in the
morning the past tense of "think" is "thunk", and that's how the name
came about.

"Interestingly enough, Andrei Yershov [of the Soviet Academy of
Sciences, and, alas, the late Andrei Yershov now; one of the significant
pioneers of the field...-jmn] asked me this same question at a
conference in Warsaw a few years ago.  This was after he had introduced
the word "thunk" into the Russian language as "methoda sankov" [the
phonetic rendering; spelling is Peter's English transliteration...-jmn],
which translates as "the method of thunks"."

Of the responses I got, Art's was the correct one.

[...]

						joe
------------

-- 
--Bill Kinnersley

sestoft@diku.dk (Peter Sestoft) (04/23/91)

raja@copper.ucs.indiana.edu (Raja Sooriamurthi) writes:

>>>I have a question that has been nagging me for quite some time: why do we
>>>call closures "thunk"s?  I mean, where did that word come from?  The only
>>>two theories I've heard, neither with *any* supporting evidence, are that
>>>it is an anagram for Knuth, and that perhaps it is a facetious past tense
>>>of "think".  Anyone know??

>>"The word _thunk_ derives from the implementation of call-by-name in
>>Algol 60.  We do not know the origin of this name, but we have heard
>>that it refers to the sound made by data when pushed onto the stack in
>>a running Algol system."

>>  ---Abelson and Sussman, "Structure and Interpretation of Computer Programs"

>To quote another source: 

>	"The implementation of call-by-name is discusses by Ingerman
>who introduces the term thunk to refer to this type of closure
>[Ingerman 61]. (The term _thunk_ was presumably a reference to the
>'noise' that a static chain pointer makes as it moves within
>activation records)" 

>			-Horowitz "Fundamentals of Programming Languages"

>[Ingerman 61] Ingerman, P. "Thunks" Comm. ACM, 4,1,1961 55-58

There is little doubt that the term "thunk" originates in P.Z.
Ingerman's paper, but the paper is silent as to its etymology.  

The pseudo-onomatopoetic explanations for "thunk2 offered above are
clearly not to be taken seriously.  By the way, the paper contains
other examples of linguistic creativity: one example procedure is
called "glub", another "george"; and a procedure (due to Sattley) for
allocating arrays is called the FUSBUDGET mechanism.

As far as I recall, Peter Naur described the word as "foolish American
slang" in a lecture --- or maybe it was the "dope vector" he derided.

-- 
Peter Sestoft  *  sestoft@diku.dk   *   DIKU,  Department of Computer Science
University of Copenhagen, Universitetsparken 1, DK-2100 Copenhagen O, Denmark
Tel: +45 31 39 64 66  *  Direct: +45 31 39 33 11/406  *  Fax: +45 31 39 02 21

dat@ukc.ac.uk (D.A.Turner) (04/24/91)

In article <2444@m1.cs.man.ac.uk> jk@cs.man.ac.uk (John Kewley ICL) writes:

>>I have a question that has been nagging me for quite some time: why do we
>>call closures "thunk"s? ...

>and, are they they the same as wigglies...

Essentially, yes.  The term "wigglies" or "wiggly values" was introduced
by  Christopher  Strachey,  circa  1970,  when  giving an account of the
denotational semantics of Algol-60 call by name.

In verbal presentations he would say something like "I call these values
'wiggly'  because  they can be different each time you look at them." In
the later published account [1] the notation "W"  is  retained  for  the
domain  of  wiggly  values,  although  the reason for the choice of this
letter in the paper was obvious only to those who had  heard  Strachey's
lecture.  His lectures were always very colourful!

In a functional language lazy evaluation does not make  values  "wiggly"
because  there  are  no side effects - but in a procedural language like
Algol-60, call-by-name produces this rather strange effect.

[1]  C.  Strachey  "The  Varieties  of  Programming   Language"   Oxford
University Compyting Laboratory Technical Monograph, PRG-10, March 1973.

gupta_d@apollo.HP.COM (Dipankar Gupta) (04/26/91)

In article <1151@creatures.cs.vt.edu> lavinus@csgrad.cs.vt.edu () writes:
>Hi out there!
>
>I have a question that has been nagging me for quite some time: why do we
>call closures "thunk"s?  I mean, where did that word come from?  The only
>two theories I've heard, neither with *any* supporting evidence, are that
>it is an anagram for Knuth, and that perhaps it is a facetious past tense
>of "think".  Anyone know??
>
Weren't the "call-by-name" params in Algol-60 called thunks?

Dipankar
Hewlett-Packard India Software Operation
Bangalore, INDIA

Gupta_D@apollo.hp.com