Re: [Haskell-cafe] about integer and float operations

2009-02-04 Thread Max Rabkin
On Wed, Feb 4, 2009 at 1:09 PM, Manlio Perillo manlio_peri...@libero.it wrote: In Haskell, something like (/) :: (Num a, Real b) = a - a - b You probably want (Real a, Fractional b) = a - a - b. Int is an instance of Real... Real is the class of types that can be converted to Rational. Then

Re: [Haskell-cafe] about integer and float operations

2009-02-04 Thread Max Rabkin
On Wed, Feb 4, 2009 at 2:03 PM, Manlio Perillo manlio_peri...@libero.it wrote: Max Rabkin ha scritto: [...] Then we can define (/.) :: (Real a1, Real a2, Fractional a) = a1 - a2 - a x /. y = fromRational $ toRational x / toRational y [...] (//) :: (Integral b, Real a, Real a1

Re: [Haskell-cafe] Re: Monad explanation

2009-02-04 Thread Max Rabkin
On Wed, Feb 4, 2009 at 9:38 PM, Benjamin L. Russell dekudekup...@yahoo.com wrote: Is it possible to write a self-referential function in Haskell that modifies itself? Is it possible to write *any* kind of function in Haskell that modifies *anything*? --Max

Re: [Haskell-cafe] Re: Why binding to existing widget toolkits doesn't make any sense

2009-01-30 Thread Max Rabkin
2009/1/30 Bryan O'Sullivan b...@serpentine.com: On Fri, Jan 30, 2009 at 1:11 PM, Antony Courtney antony.court...@gmail.com wrote: A 2-D vector graphics library such as Java2D ( or Quartz on OS/X or GDI+ on Windows ) supports things like computing tight bounding rectangles for arbitrary

Re: [Haskell] An Alternative Data.List.Zipper

2009-01-17 Thread Max Rabkin
This traverses the list three times (reverse, init and last are each linear time): fromListEnd xs = Zipper (reverse $ init xs) (last xs) [] But we only need to do it once: fromListEnd xs = let x:xs' = reverse xs in Zipper xs' x [] I don't *think* this has an effect on strictness/laziness, since

Re: [Haskell] Re: Teach theory then Haskell as example

2009-01-16 Thread Max Rabkin
On Fri, Jan 16, 2009 at 7:46 AM, Dave Bayer ba...@cpw.math.columbia.edu wrote: As a mathematician, Haskell has renewed my interest in category theory. I had thought one learns category theory most easily at age 20, because it paints such an eviscerated view of flesh-and-blood subjects like

Re: [Haskell-cafe] Simplification of this function?

2009-01-16 Thread Max Rabkin
2009/1/16 Andrew Wagner wagner.and...@gmail.com: I've been playing around with this, but haven't been able to come up with anything. myFunc f (a,b) (c,d) = (f a c, f b d) It feels as if there should be a nice simple version of this using some combination of {un,}curry, on, , ***, or something

Re: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt

2009-01-15 Thread Max Rabkin
On Thu, Jan 15, 2009 at 3:16 PM, Cale Gibbard cgibb...@gmail.com wrote: However, Appendable carries baggage with it which is highly misleading. Consider, for instance, the monoid of rational numbers under multiplication (which, by the way, is quite useful with the writer transformed list monad

Re: [Haskell-cafe] some ideas for Haskell', from Python

2009-01-14 Thread Max Rabkin
On Wed, Jan 14, 2009 at 10:48 AM, Jonathan Cast jonathancc...@fastmail.fm wrote: Do you have an example of a macro that can't be replaced by higher-order functions and laziness? I believe I do: one macro I found useful when writing a web app in Lisp was something I called hash-bind, which binds

Re: [Haskell-cafe] some ideas for Haskell', from Python

2009-01-14 Thread Max Rabkin
On Wed, Jan 14, 2009 at 11:11 AM, Alex Queiroz asand...@gmail.com wrote: I have one for binding GET/POST variables to regular variables transparently and with error checking, just inside the body of the macro. N! You reinvented PHP. What happens if a request variable shadows the name

Re: [Haskell-cafe] some ideas for Haskell', from Python

2009-01-14 Thread Max Rabkin
2009/1/14 Tim Wawrzynczak inforichl...@gmail.com: The reason the macro is better is that the length of the list is known at compile time, so you don't need to traverse the list to calculate the length of the list. Or you could use a real compiler (perhaps even a glorious one) that does

[Haskell] Re: [Haskell-cafe] ANNOUNCE: haskell-src-exts 0.4.8

2009-01-08 Thread Max Rabkin
On Thu, Jan 8, 2009 at 4:51 PM, Niklas Broberg niklas.brob...@gmail.com wrote: So unless someone can point out a good Unicode-aware editor for Windows, I'm afraid this is a feature that won't be implemented. A Windows port of a Unix editor? I know Vim is available on Windows. Otherwise,

Re: [Haskell-cafe] Taking Exception to Exceptions

2009-01-08 Thread Max Rabkin
On Thu, Jan 8, 2009 at 6:36 AM, Cristiano Paris fr...@theshire.org wrote: This avoids the possibility of having an unwanted/unknown behavior from the run-time stack (for example, having the web server returning a generic 500 Internal Server error report, filled with every sort of goods a

Re: [Haskell-cafe] ANNOUNCE: haskell-src-exts 0.4.8

2009-01-08 Thread Max Rabkin
On Thu, Jan 8, 2009 at 4:51 PM, Niklas Broberg niklas.brob...@gmail.com wrote: So unless someone can point out a good Unicode-aware editor for Windows, I'm afraid this is a feature that won't be implemented. A Windows port of a Unix editor? I know Vim is available on Windows. Otherwise,

Re: [Haskell-cafe] nested function application question

2009-01-05 Thread Max Rabkin
2009/1/5 Galchin, Vasili vigalc...@gmail.com: Hello, I have the following: B.intercalate $ B.intercalate ByteString [ByteString] [ByteString] I get a type error with this. If I comment out the 2nd

Re: [Haskell-cafe] nested function application question

2009-01-05 Thread Max Rabkin
On Mon, Jan 5, 2009 at 10:17 AM, Galchin, Vasili vigalc...@gmail.com wrote: Hi Max, That is what should happen The inner B.intercalate will produce the ByteString to be used by the B.intercalate. ?? Vasili Of course. My mistake. Ross Mellgren seems to be on the money though.

Re: [Haskell-cafe] Conditional properties in QuickCheck alter test data generation?

2008-12-18 Thread Max Rabkin
On Thu, Dec 18, 2008 at 3:55 PM, Duncan Coutts duncan.cou...@worc.ox.ac.uk wrote: However QuickCheck seems to be a case where people now expect to use QC-2, but old packages that don't specify a version typically only work with QC-1.x. Can't we just fix those .cabal files? --Max

Re: Fwd: [Haskell-cafe] Haskell as a religion

2008-12-18 Thread Max Rabkin
On Thu, Dec 18, 2008 at 4:15 PM, Henning Thielemann schlepp...@henning-thielemann.de wrote: Extrapolating the habit of programmers from the past to the future, I predict that Haskell can only become a mainstream language once there is a cleaner, simpler, safer and more powerful programming

Re: [Haskell-cafe] Please tell me this function exists

2008-12-17 Thread Max Rabkin
Hoogle is your friend: Searching for String - [String] - String Data.List intercalate :: [a] - [[a]] - [a] base intercalate xs xss is equivalent to (concat (intersperse xs xss)). It inserts the... Regards, Max On Wed, Dec 17, 2008 at 10:36 AM, Brian Hurt bh...@spnz.org wrote: I know

Re: [Haskell-cafe] Re: howto tuple fold to do n-ary cross product?

2008-11-30 Thread Max Rabkin
On Sun, Nov 30, 2008 at 9:30 AM, Luke Palmer [EMAIL PROTECTED] wrote: cross :: [a] - [b] - [(a,b)] It's just kind of a pain (you build [(a,(b,(c,d)))] and then flatten out the tuples). The applicative notation is a neat little trick which does this work for you. It seems to me like this

Re: [Haskell-cafe] Operator cheat sheet, and monadic style q

2008-11-22 Thread Max Rabkin
On Sat, Nov 22, 2008 at 11:31 AM, Owen Smith [EMAIL PROTECTED] wrote: I'm a longtime Haskell-curious programmer who, after a few aborted attempts at getting started and long nights staring at academic papers, finally managed to get the bug. I've been pleased with my progress so far, but a

Re: [Haskell] Re: The Real Monad Transformer or is Haskell.org hijacked?

2008-11-13 Thread Max Rabkin
On Thu, Nov 13, 2008 at 10:20 AM, Benjamin L. Russell [EMAIL PROTECTED] wrote: They also seem to have duplicated at least part of the rest of the HaskellWiki. It's a mirror that substitutes Monad for Warm, fuzzy thing everywhere (if you follow links, you'll see the Haddocks for class Warm,

[Haskell] ANN: hmm-0.1

2008-03-24 Thread Max Rabkin
HMM is a library for creating and manipulating Hidden Markov Models. It contains implementations of the forward algorithm and Viterbi's algorithm. It is still experimental, but I hope it can be of some interest or use. http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hmm-0.1 --Max

<    1   2