[Haskell-cafe] Re: Richer (than ascii) notation for haskell source?
Lots of folk have suggested writing code with Unicode symbols, but that doesn't really get me where I'm thinking of. Back in the day, I spent many happy hours writing math(s) in amstex style, peppered with latex backslash references/macros for greek symbols, set operators as well as character attributes like underline, bold, goth, italic and so on. With the magic of (la)tex and dvips you get a rich intuitive representation of your equations - where you can 'see' types by character attributes (bold vectors, gothic sets or whatever) and have easily readable operators, functions, etc. Similarly to display alternative pattern cases as a display equation? So maybe what I really want is to essentially write my source in (la)tex and be able to both compile and render to dvi at the same time? I suppose word's crazy equation editor or mathml is another option but it makes the source itself either less portable or less readable? I think Knuth talks about literate programming as this ability to intermingle 'beautified' human-readable representation along with code, and it seems like Haskell is close to delivering that. (Tho I think literate Haskell is not the same thing.) Perhaps a pipe dream tho. Patrick DISCLAIMER: This e-mail is intended only for the addressee named above. As this e-mail may contain confidential or privileged information, if you are not the named addressee, you are not authorised to retain, read, copy or disseminate this message or any part of it. If you received this email in error, please notify the sender and delete the message from your computer. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] RE: Richer (than ascii) notation for haskell source?
Sorry, missed a mail digest: LyX and lhs2tex sound more like what I mean. Patrick -Original Message- From: Patrick Surry Sent: Wednesday, May 14, 2008 10:24 PM To: 'haskell-cafe@haskell.org' Subject: Re: Richer (than ascii) notation for haskell source? Lots of folk have suggested writing code with Unicode symbols, but that doesn't really get me where I'm thinking of. Back in the day, I spent many happy hours writing math(s) in amstex style, peppered with latex backslash references/macros for greek symbols, set operators as well as character attributes like underline, bold, goth, italic and so on. With the magic of (la)tex and dvips you get a rich intuitive representation of your equations - where you can 'see' types by character attributes (bold vectors, gothic sets or whatever) and have easily readable operators, functions, etc. Similarly to display alternative pattern cases as a display equation? So maybe what I really want is to essentially write my source in (la)tex and be able to both compile and render to dvi at the same time? I suppose word's crazy equation editor or mathml is another option but it makes the source itself either less portable or less readable? I think Knuth talks about literate programming as this ability to intermingle 'beautified' human-readable representation along with code, and it seems like Haskell is close to delivering that. (Tho I think literate Haskell is not the same thing.) Perhaps a pipe dream tho. Patrick DISCLAIMER: This e-mail is intended only for the addressee named above. As this e-mail may contain confidential or privileged information, if you are not the named addressee, you are not authorised to retain, read, copy or disseminate this message or any part of it. If you received this email in error, please notify the sender and delete the message from your computer. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Data structure to manage collection of sets with efficient lookup, intersection?
New to Haskell, with a mental block about how to represent this situation efficiently: I have an unknown function f which is defined on subsets of some universal set (say integers 1...N). I know the values of f for some subsets, and using those can infer values on other subsets. So what I need is a way to manage a collection of subsets s_i (and the associated values f(s_i)) so that I can efficiently (a) check whether a subset s is already 'known' in my collection, and (b) find all subsets t in the collection that intersect s. In a traditional language, I'd likely create a dictionary with keys s_i containing the f(s_i) as values, along with a separate dictionary keyed on the elements of the universal set (1...N) in which each entry is a list of all s_i containing the given element of the universal set. Together they let me check, given a subset s, whether I know f(s), and also get the list of all known subsets intersecting s (by the union of the lists of sets containing each element of s). I can't quite wrap my head around how to do this efficiently in Haskell, maybe because of the way the above is duplicating information about the subsets across two different data structures? Any thoughts? Thanks, Patrick DISCLAIMER: This e-mail is intended only for the addressee named above. As this e-mail may contain confidential or privileged information, if you are not the named addressee, you are not authorised to retain, read, copy or disseminate this message or any part of it. If you received this email in error, please notify the sender and delete the message from your computer.___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Help understanding sharing
I'm new to Haskell and trying to get a better understanding of sharing (and ultimately memoization). I've read SOE and various of the tutorials, as well as browsing around the wiki and old mailing lists. Most of the examples of memoization seem to revolve around Fibonacci, and are based either on the fact that a list defined within the function will get shared between calls, or on doing some 'unsafeIO' (which I haven't dug too deeply into.) I've read various discussions that explain why function calls are generally not automatically memoized (e.g. f x gets recalculated rather than looked up based on the prior result). The rationale for that (big space leak and no guarantee of improved performance) makes sense. (Though I did like one poster's suggestion of a compiler pragma that hints that a particular function should be memoized.) I've seen other discussions that suggest that lists are always shared while in scope (so the fibs trick works). But is that just a feature of the standard compilers, or is it somewhere mandated in the Hakell spec (I don't see anything obvious in the Haskell Report tho haven't read it cover to cover)? The wiki page http://www.haskell.org/haskellwiki/Performance/Strictness says laziness == non-strictness + sharing but again nowhere gives a set of rules that guarantees what will be shared and what won't. I was hoping I might find it here: http://www.haskell.org/haskellwiki/Sharing but no such luck. Or are there no guarantees and you just have to know how your particular compiler works?? Cheers, Patrick DISCLAIMER: This e-mail is intended only for the addressee named above. As this e-mail may contain confidential or privileged information, if you are not the named addressee, you are not authorised to retain, read, copy or disseminate this message or any part of it. If you received this email in error, please notify the sender and delete the message from your computer.___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe