Article View: comp.lang.functional
Article #567Re: Is efficient backtracking feasible in functional languages?
From: Staffan Liljegren
Date: Wed, 11 Nov 1992 21:53
Date: Wed, 11 Nov 1992 21:53
48 lines
1860 bytes
1860 bytes
In article 18783@eua.ericsson.se, joe@erix.ericsson.se (Joe Armstrong) writes: > >|> >|> strangesucc n = hd [x|x<-[0..];x>n]; >|> > .... >|> >|> - Stream.head(Stream.filter(fn x => x > 1000000,Stream.iota())); >|> >|> [Major collection... 21% used (3397260/15733684), 1920 msec] >|> >|> [Major collection... 21% used (3397288/15730836), 1910 msec] >|> >|> [Major collection... 21% used (3397288/15730948), 1920 msec] >|> >|> [Major collection... 21% used (3397288/15730888), 1920 msec] >|> >|> [Major collection... 21% used (3397288/15730888), 1910 msec] >|> val it = 1000001 : int >|> - > > Wonderfull !! > > This is the kind of stuff that gives FP a bad name :-) > > Is their a transformation system which can prove that > > strangesucc x == x + 1 ? > > Joe I thought I should try this in Haskell, so I started Haskell B (the Chalmers implementation) and I had no problem with strangesucc 10000 Although it garbed three times it wasn't that slow. So ahead with some more courageus: strangesucc 100000 What happened ? Well: GC Stack Overflow ! So it's not only SML that has these problems. So what are some better mechanisms for representing backtracking OR how can You circumvent this problem ? /Staffan Liljegren
Technical Details
Message-ID:
<lg3071INN8m1@exodus.Eng.Sun.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!sun-barr!news2me.EBay.Sun.COM!exodus.Eng.Sun.COM!chivas!staffanReferences:
<1992Nov11.171742.18783@eua.ericsson.se>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!ames!sun-barr!news2me.EBay.Sun.COM!exodus.Eng.Sun.COM!chivas!staffan From: staffan@chivas.Eng.Sun.COM (Staffan Liljegren) Newsgroups: comp.lang.functional Subject: Re: Is efficient backtracking feasible in functional languages? Date: 11 Nov 1992 21:53:37 GMT Organization: Sun Microsystems Lines: 53 Distribution: world Message-ID: <lg3071INN8m1@exodus.Eng.Sun.COM> References: <1992Nov11.171742.18783@eua.ericsson.se> Reply-To: staffan@chivas.Eng.Sun.COM NNTP-Posting-Host: chivas