HDTenEightyP/NetNews huggingface dataset:
From: pop@cs.umass.edu ( Robin Popplestone )
Newsgroups: comp.lang.functional
Subject: Compiling transparent closures
Keywords: closure compile
Date: 17 Dec 92 19:20:43 GMT
Organization: University of Massachusetts, Amherst
Originator: pop@roo.cs.umass.edu

In POPLOG SML there is the possibility of compiling closures to a more
efficient form by relying on the fact that there is a POP-11 view of any
ML object, available through the POP-11/SML interface. In POP-11, a closure
C is a transparent entity for which pdpart(C) is the code, and frozval(i,C)
is the i'th frozen value. Thus something like

define compile_closure(C);
 popval( [ procedure  compile_1(C) %]);     ;;; compile stacked tokens.
enddefine;

define compile_1(C);            ;;; Stack up POP-11 tokens
  lvars C;
  if is_closure(C) then
    lvars i,n = datalength(C);
    pdpart(C),                    ;;; Treat code part as function call
    "(",
    for i from 1 to n do          ;;; Stack up frozen values
      compile_1(frozval(i,C));","
    endfor, ")";
  else C
  endif;
enddefine;

ml_val compile:('a->'b)->('a->'b) = compile_closure;

should work (The POP-11 compiler has a very general notion of "token").
Or alternatively one could generate VM code directly using sysPUSH, sysCALL
etc..

With any implementation, doing something more direct like trying to take
code blocks apart is liable to present long-term maintenance problems. The
POP-11 function product operation does in fact appear to concatenate the
code blocks, but then it is maintained by the implementors...  The
underlying conventions of any implementation can undergo cataclysms that
are transparent to users (e.g. the requirements of an efficient interface
to X-Windows, including callback from C, caused a significant revamp of
POPLOG in the late 80's).

Thus it is an interesting question  as to what abstractions on  code-blocks
would  be  useful.  The  frozval/pdpart   abstraction  was  based  on   the
lambda-lifting approach  to  closures developed  for  POP-2 c.1968.  It  is
general, but to prescribe it for a language like ML could be considered  as
too  constraining  on   implementors,  who   might  want  to   go  for   an
environment+code model of closure. Even worse is the problem of the code
for non-closures. These may be considered to consist of a prologue (which
establishes the PAR) a body and an epilogue. The POP-2/POP-11 approach of
specifying argument passing and result returning on a stack provides a nice
way in which one might be able to treat the above components of a code
block as independent entities susceptible to recombination. However it is
not an approach that makes for lightweight continuations (and I for one
would dearly like to see ML outperform C for systems-programming
applications; this clearly requires continuations to be light-weight).
Organization: Junior, Math/Computer Science, Carnegie Mellon, Pittsburgh, PA
Newsgroups: comp.lang.functional
Date: Thu, 17 Dec 1992 15:45:34 -0500 
From: "Eric A. Anderson" <eanders+@CMU.EDU>
Subject: Re: Values escaping their type definition

morrison@cs.uiuc.edu (Vance Morrison) writes:
> The oddity is that a value can escape the scope in which its type
> definition was made.   Thus
> 
>         let 
>            datatype aType = constA | constB of int;
>         in
>            constA
>         end;
[ Gives ?.aType as a type.]
From what I recall, this isn't a really big problem because you can't
do anything with those values.  This occurs in a similar and possible
more obnoxious way with exceptions, I think you can look that up in
the SML manual, I know it's discussed somewhere.
This problem can also occur with recursive types and stuff like that.
It doesn't break the typechecking of the system, and I don't think it
causes any substantial semantical problems since you can't operate on
the values anymore.
          -Eric 
*********************************************************
"Overhead, without any fuss, the stars were going out."
           -The Nine Billion Names of God
"Yes, you're very smart.  Shut up."
           -In "The Princess Bride"
*********************************************************
From: Geraint.Jones@comlab.oxford.ac.uk (Geraint Jones)
Newsgroups: comp.lang.functional
Subject: Re: breadth-first relabelling in a functional language
Date: 13 Dec 92 14:01:21 GMT
Organization: The Imperial Aerated Doughnut and Steamship Company Limited
Originator: geraint@pierrot.comlab

A short (four page) paper by Jeremy Gibbons and myself and containing a less
buggy account of linear-time breadth-first searching and labelling than my /
original postings is available (as about 47kb of compressed postscript)   /
from our anonymous ftp server.                                           / g
___

host:     ftp.comlab.ox.ac.uk

file:     Documents/techpapers/Geraint.Jones/PRG-TR-31-92

title:    Linear-time breadth-first tree algorithms
                -- an exercise in the arithmetic of folds and zips

abstract: This is a paper about an application of the mathematics
          of zip, fold (reduce) and accumulate (scan) operations on
          lists.  It gives an account of the derivation of a linear-
	  time breadth-first enumeration function, and of a subtle 
	  and efficient breadth-first tree labelling function.
Newsgroups: comp.lang.functional
From: richmcdm@netcom.com (Richard McConnell)
Subject: The OBJ language
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Date: Mon, 14 Dec 1992 09:31:36 GMT

I've recently read a paper which describes a language called OBJ, and I'm 
wondering if anyone knows where I could go for more info.t
    The paper is from 1988 ("Higher-Order Functions Considered
Unnecessary for Higher-Order Programming" by Joseph A. Goguen, in the book 
Research Topics in Functional Programming). I haven't found a trace of OBJ 
OBJ in any newsgroups, "archie", etc., except a few bibliographic references
to other papers written around the same time. The list of lots and lots of
languages available on comp.lang.misc has no mention of it either.
    If anyone could point me in the right direction, I'd appreciate it.

Basil Hosmer	(richmcdm@netcom.com)
Newsgroups: comp.lang.functional
From: doerr@inf.fu-berlin.de (Heiko Doerr)
Subject: Q: garbage collection in Miranda
Keywords: garbage collection Miranda
Organization: Free University of Berlin, Germany
Date: Mon, 14 Dec 1992 18:45:41 GMT


While looking for data structures to store states of a computation
the following questions arose concerning the garbage collector of
Miranda. 

1) Where is the implementation difference between list comprehensions
and explicit recursive list definitions like the following? In an
environment with heap size set to 10000 cells (this is small, I know),
the lenght of the list defined by a comprehension cannot be evaluated.

    >list 0 = []
    >list n = n : list (n-1)

    Miranda /heap 10000
    heaplimit = 10000 cells
    Miranda /count
    Miranda #[1..50000]
    <<not enough heap space -- task abandoned>>
    ||reductions = 5548, cells claimed = 11094, no of gc's = 3, cpu = 0.32
    Miranda #(list 50000)
    50000
    ||reductions = 400003, cells claimed = 417248, no of gc's = 51, cpu = 7.90
    Miranda


Looking to the garbage collection report (/gc) shows the different
runtime behaviour of both implementations. In the first expression the
number of collected cells drops one or more times but reaches 0 at
some stage. The second implementation is more stable in that sense
that in more runs the number of collected cells is around 9940.

But this leads to the second question.

2) Is the garbage collector non-deterministic or can the following effect
be predicted?
 
Once you evaluate the expressions "#(list 50000)" and "#[0..50000]"
several times you will notice that the evaluation does not succeed all
the times. Could anybody tell me whether and if so how the garbage
collector is related to the operating system to explain this
non-deterministic behaviour.

3) Why does the extension of the heap changes the situation to the
reverse effect?

    Miranda /heap 200000
    heaplimit = 200000 cells
    Miranda #[1..50000]
    50000
    ||reductions = 50004, cells claimed = 117248, no of gc's = 0, cpu = 1.88
    Miranda #(list 50000)

    <<gc after 192248 claims>>

    <<gc after 83646 claims>>

    <<gc after 31371 claims>>

    <<gc after 11763 claims>>

    <<gc after 4413 claims>>
    <<not enough heap space -- task abandoned>>
    ||reductions = 297407, cells claimed = 314644, no of gc's = 4, cpu = 9.08
    Miranda

Setting the heap to 200000 cells causes the successfull termination of
the standard definition whereas the explicit definition causes heap
overflow. 

These runs were executed on SUN-4 with 16 MB and Miranda version 2.014.
Thanks to any hints on this questions.

Heiko

+-----------------------------------------------------------------+
| Heiko Doerr                          Tel.: 030/896 91 106       |
| Institut fuer Informatik             Fax.: 030/896 91 123       |
| Freie Universitaet Berlin            e-mail:                    |
| Nestorstrasse 8-9                      doerr@inf.fu-berlin.de   |
| D-1000 Berlin 31                                                |
+-----------------------------------------------------------------+
Xref: sparky comp.lang.functional:1446 alt.lang.ml:101
From: mikef@dcs.ed.ac.uk (Mike Fourman)
Newsgroups: comp.lang.functional,cs-lists.sml-list,alt.lang.ml
Subject: PolyML
Date: 11 Dec 92 18:16:00 GMT
Organization: Department of Computer Science, University of Edinburgh
Cc: Dave Gladstein <daveg@com.icad>

Dave Gladstein <daveg@com.icad> writes
      From: mikef@dcs.ed.ac.uk (Mike Fourman)
      Poly/ML is a mature system; it has evolved over a period of more than
      six years. The compiler and run-time system are both reliable products
      that have passed the test of time; Poly/ML is being used to produce
      industrial-scale software products. Large source files will not break
      the Poly/ML system (modules containing thousands of lines of code are
      common) nor will large data-structures (each workspace may grow to
      32Mb). The speed and code quality of the Poly/ML compiler are both up
   
   As a matter of curiousity, why the restriction?  We've had complaints
   from customers when our lisp-based product hit a hardware vendor's
   limit of 256Mb per process.
   

Mike Crawley of AHL writes:

We also have a hardware vendor's limit. The Sparc workstations
we use cannot address more than 256MB per process either.
We are waiting for new workstations and operating systems from Sun
that make these limits much bigger - like 4GB per process.

Poly/ML allows 256MB of dynamic data and 36MB per level in each persistent
hierarchic database (each database is roughly 32MB immutables and 4MB 
mutables), with up to 4 levels of hierarchy giving a total of 144MB of 
static data. (A further 36MB is reserved for garbage collection of the 
persistent store.)

There is an address range 0x01000000 to 0x0D000000 available
for the static data in databases. This is actually 201,326,592 bytes.
Hopefully newer machines won't have this limit.

-------------------------------------------------------------------------------
From: ark@alice.att.com (Andrew Koenig)
Newsgroups: comp.lang.functional
Subject: Re: Is Miranda the one?
Date: 10 Dec 92 14:10:53 GMT
Article-I.D.: alice.24378
Reply-To: ark@alice.UUCP ()
Distribution: comp
Organization: AT&T Bell Laboratories, Murray Hill NJ

In article <dt4.723949863@persimmon> dt4@persimmon.ucsb.edu (David E. Goggin) writes:

> I am wondering whether everyone out there
> believers that Miranda is the BEST functional language?

Best for what purpose?
-- 
				--Andrew Koenig
				  ark@europa.att.com
From: jaxh@dcs.ed.ac.uk (Jon Hanson)
Newsgroups: comp.lang.functional
Subject: Re: Values escaping their type definition
Date: 18 Dec 92 04:32:36 GMT
Organization: Department of Computer Science, University of Edinburgh

In article <BzDIL1.B4I@cs.uiuc.edu>, morrison@cs.uiuc.edu (Vance Morrison) writes:
> I have just realized something about ML that I find rather odd and 
> I am hoping to get some advice about consequences.
> 
> The oddity is that a value can escape the scope in which its type
> definition was made.   Thus
> 
> 
> 	let 
> 	   datatype aType = constA | constB of int;
> 	in
> 	   constA
> 	end;
> 
> 
> This of course returns the value 'constA', in the outer scope, but
> in this scope there is no type for this value!!
> 
> I tried this SML of NJ and it accepted it and returned the message
> 
> 		val it = constA : ?.aType
>  
> It seems to me that this can cause problem with the sematics of
> the language and would be a problem in any language that allows
> type definitions in inner scopes.  
> 
> Now my problem is that I don't know what the exact problems this 
> could cause, and I was hoping that those who have had more experience
> both defining and implementing ML could give their input.  
> 
> I have a copy of the Definition of ML, so if something there would
> make this clear, please feel free to refer to it.
> 
> Vance

Doesn't the "?.aType" mean that the object has a hidden type, ie a type inaccessible
in the current type environment. There is nothing you can actually do with the
returned value, so no problems should occur.

   .
   |on Hanson
 `-' jaxh@dcs.ed.ac.uk
Newsgroups: comp.lang.functional
From: lloyd@cs.monash.edu.au (lloyd allison)
Subject: Re: breadth-first traversal in a functional language
Organization: Computer Science, Monash University, Australia
Date: Mon, 14 Dec 1992 00:32:38 GMT

yet another one:

Allison L.,  Circular programs and self-referential structures,
Software Practice & Experience, 19(2) 99-109 Feb 1989

(BFT on pages 103-104)
Newsgroups: comp.lang.functional,comp.lang.scheme,comp.lang.lisp
From: Kenneth Dickey <kend@newton.apple.com>
Subject: Re: Spaghetti Stacks (reference)
X-Useragent: Nuntius v1.1.1d11
Date: Tue, 15 Dec 1992 18:07:08 GMT
X-Xxdate: Tue, 15 Dec 92 18:08:18 GMT
Organization: Bauhaus

In article <OZ.92Dec15121226@ursa.sis.yorku.ca> Ozan Yigit,
oz@ursa.sis.yorku.ca writes:
>	Daniel G. Bobrow, Ben Wegbreit ...

In addition, you might be interested in Guy Steele's "Macaroni is Better
than Spaghetti", SICPLAN Notices, v12, #8, August 1977.
From: sestoft@id.dth.dk (Peter Sestoft (EMP))
Newsgroups: comp.lang.functional
Subject: Re: Q: garbage collection in Miranda
Keywords: garbage collection Miranda
Date: 16 Dec 92 07:32:49 GMT
Organization: Department of Computer Science

doerr@inf.fu-berlin.de (Heiko Doerr) writes:

>While looking for data structures to store states of a computation
>the following questions arose concerning the garbage collector of
>Miranda. ...

>2) Is the garbage collector non-deterministic or can the following effect
>be predicted?
> 
>Once you evaluate the expressions "#(list 50000)" and "#[0..50000]"
>several times you will notice that the evaluation does not succeed all
>the times. Could anybody tell me whether and if so how the garbage
>collector is related to the operating system to explain this
>non-deterministic behaviour.

My experience from 2 years ago suggests that it is rather
nondeterministic (in the SUN 4 version, at any rate).  Maybe the
garbage collector looks at the (C?) stack and conservatively assumes
every word found there to be a heap pointer.  If some of those words
are not heap pointers but integers, arbitrary amounts of garbage will
not be collected.  Note that this is safe, but quite confusing for the
functional programmer whose program uses widely varying amounts of
storage.  

>These runs were executed on SUN-4 with 16 MB and Miranda version 2.014.

Try the VAX implementation.

Peter (almost merely guessing --- I can't find the relevant notes)
--
Peter Sestoft   *   sestoft@id.dth.dk   *   Department of Computer Science
Technical University of Denmark, Building 344      DK-2800 Lyngby, Denmark
Tel: +45 45 93 33 32 * Direct: +45 45 93 12 22/3749 * Fax: +45 42 88 45 30
From: torbenm@diku.dk (Torben AEgidius Mogensen)
Newsgroups: comp.lang.functional
Subject: Re: Run-Time Code Generation ?
Date: 15 Dec 92 15:24:11 GMT
Organization: Department of Computer Science, U of Copenhagen

olsson@ifi.uio.no (Jan Roland Olsson) writes:

>I have a program in Standard ML of New Jersey that
>synthesizes, i.e. writes, function definitions and
>translates them to closures in order to execute them.

>This works fine except for the fact that the resulting
>functions execute about twice as slowly as functions
>that are defined by ML source code and compiled.
>Since the functions created at run-time are needed
>over and over again, perhaps even millions of times
>including recursive calls, this is a significant
>performance problem for me.
>Here is a small trivial example that illustrates
>the problem.


>fun compose 0 F = ( fn X => X )
>  | compose N F = 
>      let val g = compose (N-1) F
>      in
>       fn X => F ( g X )
>      end;


>val f1 = compose 5 tl;

>val f2 = fn X => tl(tl(tl(tl(tl(X)))));


>The functions f1 and f2 are the same, but calls
>to f1 execute much slower than calls to f2.

>What I really would like to have is a built-in
>function 

>compile : ( 'a -> 'b ) -> ( 'a -> 'b )

>which has the same semantics as the identity 
>function, but changes the representation of the
>definition of its argument from lots of inter-
>linked closures to pure machine code.

You could try to rewrite compose into a somewhat more efficient form:

fun compose N F =
   let fun g 0 = (fn X => X)
         | g M = let val g1 = (g  N-1) in (fn X => F (g1 X)) end;
      in
       g N
      end;

This version does not carry F as a parameter to the recursive call.

f1 will still be slower than f2 when using this definition, but not by
the same extent. What is needed for this is that the application (g1
X) is unfolded so (fn X => F ((fn X' => F (g1' X')) X)) is reduced to
(fn X => F (F (g1' X))). This does not require compilation of the code,
but rather reduction to more than just WHNF. Of course, if this is to
be represented by a single closure, the code for it will not exist as
a single piece of the original code. But another representation in
between closures and straightline code would be feasible.

	Torben Mogensen (torbenm@diku.dk)
From: ard@cs.bham.ac.uk (Antoni Diller)
Newsgroups: comp.lang.functional
Subject: Re: Is Miranda the one?
Date: 15 Dec 92 13:59:39 GMT
Distribution: comp
Organization: School of Computer Science, University of Birmingham, UK

In article <dt4.723949863@persimmon> dt4@persimmon.ucsb.edu (David E. Goggin) writes:
>Hi!
>
>We just finished a class in prograamming languages here, and
>We used Miranda (not LISP) as the preeminant example of
>functional languages.  I am wondering whether everyone out there
>believers that Miranda is the BEST functional language?
>
>I have lloked thorugh several books on Comparative
>programming lanuages and none mention Miranda,  but o
>do mention LISP, LOGO, Hope, and a few other obscure one.
>
>*dt*
>.

I don't think that it makes sense to say of any programming language
that it is the best; it rather depends on what you want to do with it.
For some things Miranda is very good and at others it is lousy; similarly
with Lisp.  Eg, if you want to do meta-programming then obviously you
won't choose either Miranda or ML; you'll probably go for Lisp.
So, you first need to decide what you want to do with your functional
language and then you are in a better position to decide which one
is best for that purpose.


Antoni Diller
Xref: sparky comp.lang.functional:1459 comp.lang.scheme:2744 comp.lang.lisp:3081
From: sabry@datura.cs.rice.edu (Amr Sabry)
Newsgroups: comp.lang.functional,comp.lang.scheme,comp.lang.lisp
Subject: Spaghetti Stacks (reference)
Date: 15 Dec 92 15:32:20 GMT
Article-I.D.: rice.BzB4Hw.1II
Organization: Rice University, Houston


I have an incomplete reference to "Spaghetti Stacks":

Bobrow & Wegbreit 1972 ....

Does anybody have the complete reference.  Thanks.


-- 
Amr Sabry				     	    sabry@cs.rice.edu
---------------------------------------------------------------------
Man will occasionally stumble over the truth, but most of the time he
will pick himself up and continue on.-- Churchill's Commentary on Man
Newsgroups: comp.lang.functional
Subject: Re: The OBJ language
From: billk@hawk.cs.ukans.edu (Bill Kinnersley)
Date: Tue, 15 Dec 1992 17:56:10 GMT
Organization: University of Kansas Computer Science Dept

In article <1992Dec14.093136.23648@netcom.com> richmcdm@netcom.com 
(Richard McConnell) writes:
:
: I haven't found a trace of OBJ in any newsgroups, "archie", etc., 
: The list of lots and lots of languages available on comp.lang.misc has 
: no mention of it either.
: 
: Basil Hosmer	(richmcdm@netcom.com)
:
Just for the record, The Language List does have an entry for OBJ, along
with OBJ0, OBJ1, OBJ2, OBJ3 and OBJT.  Woefully *brief* entries, but
they are there.  

More complete entries for these languages (or any others) are eagerly sought!

-- 
--Bill Kinnersley
  billk@hawk.cs.ukans.edu
226 Transfer complete.
Newsgroups: comp.lang.functional,comp.lang.scheme,comp.lang.lisp
From: oz@ursa.sis.yorku.ca (Ozan Yigit)
Subject: Re: Spaghetti Stacks (reference)
Organization: York U. Student Information Systems Project
Date: Tue, 15 Dec 1992 17:12:26 GMT

Amr Sabry writes:

   I have an incomplete reference to "Spaghetti Stacks":

Here is the complete reference

	Daniel G. Bobrow, Ben Wegbreit
	A Model and Stack Implementation of Multiple Environments
	Communications of the ACM, 16(10):591-603
	Oct 1973


cheers...	oz
---
C++ was invented because Vogon poetry | electric: oz@sis.yorku.ca
wasn't destructive enough. -anonymous | ph:[416] 736 2100 x 33976