|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
suspensionsI've been working through the book "Purely functional data structures" using SML/NJ and came to the $ notation for creating suspensions. It seems as though SML/NJ has some kind of $-based notation, but it doesn't behave the same way as the one in the book. For instance, $f x doesn't work - it seems to bind as ($f) x - and writing $(f x) isn't what you want because that evaluates "f x" eagerly. The samples in the book don't compile and I can't find any mention of the $ notation in the documentation or indeed anywhere online.
Can anyone explain how the $ stuff works in SML/NJ? Any help would be much appreciated :) |
|
|
Re: suspensionsI believe that what is supported in SML/NJ is based on Wadler et al's
design as described in How to Add Laziness to a Strict Language Without Even Being Odd, Workshop on ML, 1998. Here is a link to the paper http://homepages.inf.ed.ac.uk/wadler/papers/lazyinstrict/lazyinstrict.ps Hope this helps. - John On Jan 18, 2008, at 2:37 PM, Luke_H wrote: > > I've been working through the book "Purely functional data > structures" using > SML/NJ and came to the $ notation for creating suspensions. It > seems as > though SML/NJ has some kind of $-based notation, but it doesn't > behave the > same way as the one in the book. For instance, $f x doesn't work - > it seems > to bind as ($f) x - and writing $(f x) isn't what you want because > that > evaluates "f x" eagerly. The samples in the book don't compile and > I can't > find any mention of the $ notation in the documentation or indeed > anywhere > online. > > Can anyone explain how the $ stuff works in SML/NJ? Any help would > be much > appreciated :) > -- > View this message in context: http://www.nabble.com/suspensions-tp14957803p14957803.html > Sent from the SML/NJ mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Smlnj-list mailing list > Smlnj-list@... > https://lists.sourceforge.net/lists/listinfo/smlnj-list > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Smlnj-list mailing list Smlnj-list@... https://lists.sourceforge.net/lists/listinfo/smlnj-list |
|
|
Re: suspensionsThanks John - the paper is indeed useful reading. Unfortunately I'm
still having problems using the $ notation in SML/NJ as described in that paper - for example, take the 'map' function from near the end (fig 7 in fact) fun $map f ($Nil) = $Nil ... This gives an error "non-constructor applied to argument in pattern" I've used the "Control.lazysml := true" directive. Is there anything else that needs to be done to get this syntax to work? Or has this functionality not been implemented in the compiler as described in the paper? Many thanks :) - Luke -----Original Message----- From: John Reppy [mailto:jhr@...] Sent: 18 January 2008 21:38 To: Luke Halliwell Cc: smlnj-list@... Subject: Re: [Smlnj-list] suspensions I believe that what is supported in SML/NJ is based on Wadler et al's design as described in How to Add Laziness to a Strict Language Without Even Being Odd, Workshop on ML, 1998. Here is a link to the paper http://homepages.inf.ed.ac.uk/wadler/papers/lazyinstrict/lazyinstrict.ps Hope this helps. - John On Jan 18, 2008, at 2:37 PM, Luke_H wrote: > > I've been working through the book "Purely functional data > structures" using > SML/NJ and came to the $ notation for creating suspensions. It > seems as > though SML/NJ has some kind of $-based notation, but it doesn't > behave the > same way as the one in the book. For instance, $f x doesn't work - > it seems > to bind as ($f) x - and writing $(f x) isn't what you want because > that > evaluates "f x" eagerly. The samples in the book don't compile and > I can't > find any mention of the $ notation in the documentation or indeed > anywhere > online. > > Can anyone explain how the $ stuff works in SML/NJ? Any help would > be much > appreciated :) > -- > View this message in context: > Sent from the SML/NJ mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------ - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Smlnj-list mailing list > Smlnj-list@... > https://lists.sourceforge.net/lists/listinfo/smlnj-list > ____________________________________________________________________ This email has been scanned by the MessageLabs Email Security System ____________________________________________________________________ DISCLAIMER This message and any attachments contain privileged and confidential information intended for the use of the addressee named above. If you are not the intended recipient of this message, you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. Please note that we cannot guarantee that this message or any attachment is virus free or that it has not been intercepted and amended. The views of the author may not necessarily reflect those of Realtime Worlds Ltd. Realtime Worlds Ltd is registered in Scotland, number 225628. Registered Office: 152 West Marketgait, Dundee, DD1 1NJ. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Smlnj-list mailing list Smlnj-list@... https://lists.sourceforge.net/lists/listinfo/smlnj-list |
| Free Forum Powered by Nabble | Forum Help |