home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.functional
- Path: sparky!uunet!snorkelwacker.mit.edu!ai-lab!cs.tu-berlin.de!wg
- From: wg@opal.cs.tu-berlin.de (Wolfgang Grieskamp)
- Subject: Re: Is efficient backtracking feasible in functional languages?
- Message-ID: <1992Nov12.220621.14143@cs.tu-berlin.de>
- Followup-To: comp.lang.functional
- Sender: news@cs.tu-berlin.de
- Reply-To: wg@cs.tu-berlin.de
- Organization: Technical University of Berlin
- References: <1992Nov11.171742.18783@eua.ericsson.se> <lg3071INN8m1@exodus.Eng.Sun.COM>
- Date: Thu, 12 Nov 1992 22:06:21 GMT
- Lines: 65
-
-
- > strangesucc n = hd [x|x<-[0..];x>n];
- > ...
- > [Major collection... 21% used (3397260/15733684), 1920 msec]
- > ...
- > GC Stack Overflow !
-
- Whats funny with this example that the stream (lazy list) in the list
- comprehension can be seen as an imperative counter which is
- communicated to the consumer (hd):
-
- x := 0;
- while (1){
- if (x > n) output(x);
- x++;
- }
-
- We have prototyped a scheme for the compilation of streams which
- (nearly) essentially result in such an imperative counter. (Its not
- published, but believe, its fairly easy). Its embedded in the approach
- of mixed compile-time and run-time garbage collection via the
- reference counting model described in [SG91] [Sch92].
-
- It would use constant space for the example, i.e. one cell for the
- current "head" of the stream. The head becomes reused if the next
- element is demanded by the consument. A stupid straight-forward
- compilation would generate a run-time test for the reference counter
- of the cell to prove this reusability; a simple sharing analysis would
- even eliminate the test at all in the given example (it can easy
- detect that their is no context which can share the stream).
-
- Well, we have never implemented the scheme, since streams have been
- dropped from the language design we consider ([Pep91]).
-
-
- @InProceedings{SG92,
- author = {Wolfram Schulte and Wolfgang Grieskamp},
- title = {Generating {E}fficient {P}ortable {C}ode for a
- {S}trict {A}pplicative {L}anguage},
- booktitle = {Phoenix Seminar and Workshop on Declarative Programming},
- year = {1992},
- publisher = {Springer-Verlag}
- }
-
- @PhDThesis{Sch92,
- author = {Wolfram Schulte},
- title = {Zur {\"U}bersetzung strikter applikativer
- {P}rogrammiersprachen},
- school = {Techincal University of Berlin},
- year = {1992}
- }
-
- @TechReport{Pep91a,
- author = {P. Pepper},
- title = {The Programming Language OPAL},
- institution = {Technical University of Berlin},
- year = {1991},
- type = {},
- number = {91-04},
- month = {Apr},
- }
-
- --
- Wolfgang Grieskamp
- wg@cs.tu-berlin.de
-