Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!uunet!mcsun!ukc!icdoc!zmacx07 From: zmacx07@doc.ic.ac.uk (Simon E Spero) Newsgroups: comp.lang.functional Subject: Re: Extensional functions in SML? Message-ID: <2279@gould.doc.ic.ac.uk> Date: 22 Sep 90 21:37:44 GMT References: <1990Sep20.074513.19190@d.cs.okstate.edu> Sender: news@doc.ic.ac.uk Reply-To: zmacx07@doc.ic.ac.uk (Simon E Spero) Organization: Imperial College Department of Computing Lines: 32 In article stabl@unipas.fmi.uni-passau.de (Robert Stabl) writes: > >Norman is right, the function names were misleading (esp. the name f). >But, I wanted to show that (higher-order) functional programming can be used >to define databases, not implementing them by arrays, lists, or any other >standard method. > The code in your example strongly resembles the way stores are handled in denotational semantics. Surely the chain of closures that results from this process would take up much more heap space than the standard methods, and be O(N) in time? Surely it would be better to store the data in a more efficent manner (an AVL tree, or suchlike), and to only package it up in function when one is needed ; foo tree <= let f == lambda x => look_up(tree,x) in map (f,[1,2,3] By the way, prehaps the best way of handling this problem is using a hash-table, but this is not really an option unless one is prepared to supply all values in one hit. Ever get the craving for a := ? :-( Simon -- zmacx07@uk.ac.ic.doc | sispero@cix.co.uk | ..!mcsun!ukc!slxsys!cix!sispero ------------------------------------------------------------------------------ The Poll Tax. | Saddam Hussein runs Lotus 123 on | DoC,IC,London SW7 2BZ I'm Not. Are you?| Apple Macs.| I love the smell of Sarin in the morning