home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.functional
- Path: sparky!uunet!psgrain!percy!hfglobe!ichips!iWarp.intel.com|eff!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!agate!dog.ee.lbl.gov!hellgate.utah.edu!csn!teal.csn.org!sullivan
- From: sullivan@teal.csn.org (Steve Sullivan)
- Subject: ml questions
- Message-ID: <BxrLL9.A11@csn.org>
- Sender: news@csn.org (news)
- Nntp-Posting-Host: teal.csn.org
- Organization: Colorado SuperNet, Inc.
- Date: Sun, 15 Nov 1992 15:55:56 GMT
- Lines: 48
-
-
- I'm enjoying learning sml, and had a few
- questions. Please let me know if you can shed
- any light on any of these! Many thanks ...
-
-
- 1. The sml I'm using, from princeton.edu, includes Harper's notes.
- His notes document the "system" and "cd" commands.
- Yet sml apparently doesn't recognize them. How can I get them working?
-
-
- 2. How can I get a function to remember state?
-
- In particular, I want to write a random number
- generator that remembers it's last seed,
- so the caller doesn't have to provide it. Many modern
- generators require hundreds of bytes of state info, so passing
- that in and out on each call is very inefficient.
-
- Simple example - how to get sml to do something like:
-
- fun rand 1 = let val seed = ref 1 in !seed end (* initialize and return 1 *)
- | rand 2 = (seed := (xx*seed) mod yy; !seed;) (* update seed, return it *)
-
-
- 3. Why not allow nonlinear patterns? They wouldn't have to cover
- the whole general matching problem - just allow, for example,
- fun (x,x) = ...
- to bind the first x, and then fail if the second x doesn't match.
-
-
-
- 4. Why not lazy functions? Seems lazy and strict evaluation
- could be mixed, with functions being lazy by default, and
- strict if:
- - they used any imperative features
- - they used any function which is strict
- I looked at lsml from sbcs.sunysb.edu, but at first glance
- it seems very experimental and somewhat out of date.
-
-
- If you have light to shed on any of these, please let me
- know! Many thanks -
-
- Steve Sullivan
- sullivan@csn.org
-
-
-