Re: [Haskell-cafe] Language Shootout reverse-complement benchmark

2010-06-03 Thread Martin Drautzburg
Inspired by this post I looked at the language shootout. There is one thing which strikes me: On http://shootout.alioth.debian.org/u64/performance.php?test=spectralnorm#about It sais for the spectralnorm benchmark that both Haskel GHC #4 and HaskellGHC produce bad output. For GHC I connt see

[Haskell-cafe] How to Show an Operation?

2010-06-04 Thread Martin Drautzburg
Dear all, If I have a problem where I have to select from a set of operations, how would I print the result? Example: If I can chose from (x+y), (x*y), (x^2+y)... and I feed them all into my problem solver and it finds that (x*y) is right, how can I print that string? -- Martin

Re: [Haskell-cafe] How to Show an Operation?

2010-06-07 Thread Martin Drautzburg
On Friday, 4. June 2010 18:02:15 Daniel Fischer wrote: On Friday 04 June 2010 17:37:16, Martin Drautzburg wrote: Dear all, If I have a problem where I have to select from a set of operations, how would I print the result? Example: If I can chose from (x+y), (x*y), (x^2+y)... and I

[Haskell-cafe] How to name a mapped function?

2010-06-07 Thread Martin Drautzburg
Hello all, I like some of the naming conventions in haskell quite a lot, like calling a list of something xs, or function which takes a function as a parameter ..By as in sortBy or groupBy. If I have a function, say compute whose last parameter is some value ... and I create another function,

Re: [Haskell-cafe] How to Show an Operation?

2010-06-09 Thread Martin Drautzburg
On Monday, 7. June 2010 23:28:08 Evan Laforge wrote: I just meant you could add instances: instance Functor (Named a) where fmap f named = named { val_of = f (val_of named) } instance Applicative (Named a) where ... likewise, but maybe not a great fit unless you have a no name for 'pure'

Re: [Haskell-cafe] How to Show an Operation?

2010-06-10 Thread Martin Drautzburg
On Thursday, 10. June 2010 00:08:34 Luke Palmer wrote: Or just: apply = val_of So, to summarize: if you have something that isn't a function and you want to use it like a function, convert it to a function (using another function :-P). That's all. No syntax magic, just say what you're

Re: [Haskell-cafe] Re: How to Show an Operation?

2010-06-10 Thread Martin Drautzburg
On Thursday, 10. June 2010 22:10:08 Maciej Piechotka wrote: Wow! this is somewhat above my level. I guess I need to go back to the books. I'll document my ignorance nontheless. data Named a = Named String a instance Functor Named where f `fmap` (Named s v) = Named s (f v) okay so far

Re: [Haskell-cafe] Re: How to Show an Operation?

2010-06-10 Thread Martin Drautzburg
On Friday, 11. June 2010 00:12:03 Daniel Fischer wrote: Thanks Daniel. Upgrade. We're at 6.12 now! Did that. Everything is available now. I am still having trouble with the test function. First it seems I need braces, so I can mix == and *. test :: Num a = (a - a) - (a - a) - (a - a) -

[Haskell-cafe] Literate programming

2010-06-12 Thread Martin Drautzburg
Hello all, Is literate programming something you guys actually do (I only know that Paul Hudak does), or is it basically a nice idea from days gone by? In case you do, then how do you do it? Do you use lhs2TeX or what? Do you use bird style of full-blown LaTeX? Does any of you use leksah? I

Re: [Haskell-cafe] Literate programming

2010-06-12 Thread Martin Drautzburg
On Saturday, 12. June 2010 19:06:39 Darrin Chandler wrote: On Sat, Jun 12, 2010 at 12:34:37PM -0400, aditya siram wrote: It's weird I was just thinking about LP in Haskell this morning. Check out John Milliken's dbus-core [1] written entirely in noweb. Okay I'll check out noweb. My

[Haskell-cafe] How to browse code written by others

2010-06-13 Thread Martin Drautzburg
Hello all, I need your advice about how to browse code which was written by someone else (Paul Hudak's Euterpea, to be precise, apx. 1 LOC). I had set some hopes on leksah, and it indeed shows me the interfaces, but I have not yet convinced it to show me more than that. I ran haddock over

[Haskell-cafe] Vague: Assembly line process

2010-06-14 Thread Martin Drautzburg
Hello all, this is a problem which has haunted me for some time. If this is simply hillarious, please tell me so. Or it may be some well known unsolvable problem... An assembly process takes inputs and produces outputs. I could say a Process is a function canProduce :: [Input]-[Output]-Bool

Re: [Haskell-cafe] Vague: Assembly line process

2010-06-15 Thread Martin Drautzburg
AM, Martin Drautzburg martin.drautzb...@web.de wrote: Hello all, this is a problem which has haunted me for some time. If this is simply hillarious, please tell me so. Or it may be some well known unsolvable problem... An assembly process takes inputs and produces outputs. I could

Re: [Haskell-cafe] Vague: Assembly line process

2010-06-16 Thread Martin Drautzburg
On Tuesday, 15. June 2010 19:43:26 Steve Schafer wrote: On Tue, 15 Jun 2010 19:23:35 +0200, you wrote: When I know my supplies I want to know what I can produce. When I know what I want to produce I want to know what supplies I need for that. Both kinds of questions should be answered by a

[Haskell-cafe] Mapping a list of functions

2010-06-17 Thread Martin Drautzburg
Hello all The standard map function applies a single function to a list of arguments. But what if I want to apply a list of functions to a single argument. I can of course write such a function, but I wonder if there is a standard way of doing this, Related to that is the problem, that the

[Haskell-cafe] When the unknown is unknown

2010-06-23 Thread Martin Drautzburg
Hello all, I am currently playing with Paul Hudak's Euterpea (a music program, formely called Haskore) and I am trying to teach it about rhythm. I said that a rhythm is a series of Moments (or Beats), each expressed as fractions of a bar. But each Moment also has volume. So I could model

Re: [Haskell-cafe] When the unknown is unknown

2010-06-24 Thread Martin Drautzburg
On Thursday, 24. June 2010 00:04:18 Alexander Solla wrote: On Jun 23, 2010, at 1:50 PM, Martin Drautzburg wrote: I said that a rhythm is a series of Moments (or Beats), each expressed as fractions of a bar. But each Moment also has volume. So I could model rhythm as Pairs of (Moment

[Haskell-cafe] Parser left recursion

2013-02-19 Thread Martin Drautzburg
Hello all, this was previously asked on haskell-beginners, but only partially answered. As an exercise I am writing a parser roughly following the expamples in Graham Hutton's book. The language contains things like: data Exp = Lit Int -- literal integer | Plus Exp Exp My naive

Re: [Haskell-cafe] Parser left recursion

2013-02-20 Thread Martin Drautzburg
:47 Tillmann Rendel wrote: Hi, Martin Drautzburg wrote: As an exercise I am writing a parser roughly following the expamples in Graham Hutton's book. The language contains things like: data Exp = Lit Int -- literal integer | Plus Exp Exp So the grammar is: Exp

Re: [Haskell-cafe] Parser left recursion

2013-02-24 Thread Martin Drautzburg
On Wednesday, 20. February 2013 09:59:47 Tillmann Rendel wrote: So the grammar is: Exp ::= Int | Exp + Exp My naive parser enters an infinite recursion, when I try to parse 1+2. I do understand why: hmm, this expression could be a plus, but then it must start with

Re: [Haskell-cafe] Parser left recursion

2013-02-26 Thread Martin Drautzburg
On Sunday, 24. February 2013 16:04:11 Tillmann Rendel wrote: Both approaches are essentially equivalent, of course: Before considering the very same nonterminal again, we should have consumed at least one token. I see. Thanks So for the laymen: expr ::= expr + expr is a problem, because

[Haskell-cafe] What pattern is this (Something.T - IO a) in Sound.ALSA.Sequencer

2013-03-03 Thread Martin Drautzburg
Hello all, this was previously posted on Haskell Beginners, but only partially answered. In Sound.ALSA.Sequencer, there are a number of functions which together set up a midi environement (client, port, queue). They all have a type, where the last argument has a type like: (something.T - IO

Re: [Haskell-cafe] What pattern is this (Something.T - IO a) in Sound.ALSA.Sequencer

2013-03-04 Thread Martin Drautzburg
On Sunday, 3. March 2013 21:11:21 Roman Cheplyaka wrote: Admittedly, programming with callbacks is not very pleasant. So we have an excellent alternative — the continuation monad transformer! This nested code something1 $ \x - do something2 $ \y - do