Re: [Haskell-cafe] What pattern is this (Something.T - IO a) in Sound.ALSA.Sequencer
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 something3 $ \z - do can be equivalently rewritten as this linear code import Control.Monad.Cont flip runContT return $ do x - ContT something1 y - ContT something2 z - ContT something3 lift $ do ... Mind-blowing. Thanks a lot. Before I dig into the continuation monad transformer, one more question (demonstrating my ignorance): The initialization actually starts with main = (do SndSeq.withDefault SndSeq.Block $ \h - do Client.setName (h :: SndSeq.T SndSeq.DuplexMode) Haskell-Melody Port.withSimple h out (Port.caps [Port.capRead, Port.capSubsRead, Port.capWrite]) (Port.types [Port.typeMidiGeneric, Port.typeApplication]) $ \p - do So there are some plain actions like Client.setName and Port.withSimple before it gets to the next do block. How would I write this in ContT style? -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] What pattern is this (Something.T - IO a) in Sound.ALSA.Sequencer
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 a) i.e. *Main :t SndSeq.withDefault SndSeq.withDefault :: SndSeq.OpenMode mode = SndSeq.BlockMode - (SndSeq.T mode - IO a) - IO a *Main :t Port.withSimple Port.withSimple :: SndSeq.T mode - String - Port.Cap - Port.Type - (Port.T - IO a) - IO a *Main :t Queue.with Queue.with :: SndSeq.T mode - (Queue.T - IO a) - IO a There is example code, where a full setup is created by a number of nested do blocks. The repeating pattern there is: something1 $ \x - do something2 $ \y - do something3 $ \z - do What is this all about? I particularly would like to understand, when this parttern is needed and what determines the the number of nested do blocks. -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Parser left recursion
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 the parser considers expr again without having consumed any input. expr ::= literal pluses pluses ::= many (+ expr) is not a problem, because by the time the parser gets to the rightmost expr is has consumes at least one +. Instead of literal we can put anything which promises not to be left-recursive expr ::= exprNonLr + expr exprNonLr := ... As exprNonLr gets more complicated, we may end up with a whole set of nonLr parsers. I wonder if I can enforce the nonNr property somehow, i.e. enforce the rule will not consider the same nonterminal again without having consumed any input. -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Parser left recursion
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 an expression, lets check. and it tries to parse expression again and again considers Plus. Indeed. Twan van Laarhoven told me that: Left-recursion is always a problem for recursive-descend parsers. Note that the left recursion is already visible in the grammar above, no need to convert to parser combinators. The problem is that the nonterminal Exp occurs at the left of a rule for itself. Just a silly quick question: why isn't right-recursion a similar problem? -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Parser left recursion
Thank you very much. To clarify: I am not in need of a parser, I just wanted to understand why left recursion is an issue (that was easy) and what techniques help to circumvent the problem. So your answer was spot-on (though I haven't implemented it yet) On Wednesday, 20. February 2013 09:59: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 ::= 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 an expression, lets check. and it tries to parse expression again and again considers Plus. Indeed. Twan van Laarhoven told me that: Left-recursion is always a problem for recursive-descend parsers. Note that the left recursion is already visible in the grammar above, no need to convert to parser combinators. The problem is that the nonterminal Exp occurs at the left of a rule for itself. One way to fix this problem is to refactor the grammar in order to avoid left recursion. So let's distinguish expressions that can start with expressions and expressions that cannot start with expressions: Exp-norec ::= Int Exp-rec ::= Exp-norec | Exp-norec + Exp-rec Note that Exp-rec describes a list of Exp-norec with + in-between, so you can implement it with the combinator many. Now if you want to add a rule like Exp ::= ( Exp ) you need to figure out whether to add it to Exp-norec or Exp-rec. Since the new rule is not left recursive, you can add it to Exp-norec: Exp-norec ::= Int | ( Exp-rec ) Exp-rec ::= Exp-norec | Exp-norec + Exp-rec If you implement this grammar with parser combinators, you should be able to parse (1+2)+3 just fine. Tillmann PS. Try adding multiplication to your grammar. You will need a similar trick to get the priorities right. -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Parser left recursion
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 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 an expression, lets check. and it tries to parse expression again and again considers Plus. Twan van Laarhoven told me that: Left-recursion is always a problem for recursive-descend parsers. and suggested to do something like: parseExp = do lit - parseLit pluses - many (parsePlusToken * parseLit) return (combinePlusesWithLit lit pluses) combinePlusesWithLit = foldr Plus -- or foldl This indeed does the trick, but only when the first token is a Lit (literal integer). I then added the possibility to optionally put things in parentheses. But then I cannot parse (1+2)+3. The original code fails, because (1+2) is not a Lit and when I allow an expression as the first argument to + I get infinite recursion again. I am generally confused, that saying a plus expression is an integer followed by many plus somethings is not what the language says. So this requires a lot of paying attention to get right. I'd much rather say a plus expression is two expressions with a '+' in between. I do know for sure, that it is possible to parse (1+2)+3 (ghci does it just fine). But I seem to be missing a trick. Can anyone shed some light on this? -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] When the unknown is unknown
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, Volume). However I certanly do not want to specify both the Moments and the Volume, but rather compute one from the other. How about something like: type RhythmScheme = [(Maybe Moment, Maybe Volume)] type Rhythm = [(Moment, Volume)] -- The resolution function will then be a function with type: rhythm_from_scheme :: RhythmScheme - Rhythm -- Though you might want something like -- rhythm_from_scheme :: RhythmScheme - IO Rhythm -- or -- rhythm_from_scheme :: Seed - RhythmScheme - Rhythm -- so that you can get and use random numbers, for example. I guess the point of my suggestion is to let pattern matching in function definitions deal with unification of constraints. Beta reduction and unification are two sides of a coin. Nice. But what if I have three or more values (and not just two). Then inside the rhythm_from_scheme function I will probably have functions like a-b-c, i.e. if two values are known I can compute the third. If only one value is known the result would be a partially applied function and I would need additional information to compute the result. So I will need more than just a Mabye, because I can either have Nothing, a value or a function. However I will need one such function for each permutation. The function a-b-c will not help me much if either b or c is known. This means I cannot stuff too many unknowns together, but I will have to layer the problem somehow, such that a 9tuple of unknowns is unified as three triples. I am still uncertain how to do this, but I believe it basically matches musical thinking. A composer cannot juggle 9 unknowns either without grouping them somehow. Another question is: how much past and future knowledge do I need. (I believe the fundamental property of music is that things are ordered). In order to compute Volumes from Moments I can get pretty much away without the past, but computing Moments from Volumes definitely requires knowing where I am, because each new Moment has to be placed after a preceding Moment. Any ideas? -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] When the unknown is unknown
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 rhythm as Pairs of (Moment, Volume). However I certanly do not want to specify both the Moments and the Volume, but rather compute one from the other. Often the Moments are known and I need to compute the Volumes, but this is not always the case. I might as well start with the volume and compute the moments. The latter would be particularly interesting when trying to find rhythms which are suitable for certain lyrics. In that case I must even be prepared to find more than one series-of-moments which fit to the given series-of-volumes. There are countless other problems like this, e.g. when trying to match harmony, melody and tension. In that case I even have three variables and I may want to specify tension first, then melody and have the harmony computed. At first glance this looks like a Prolog-like problem to me. I could say that certain things are always true for [(Moment, Volume)] and let an inference engine figure out the options which are still in consideration. From which angle would you approach problems like this? Should I get my hands on a prolog-in-haskel implementation (which indeed seems to exist)? Or should I roll my own poor-man's prolog? Or is this a constraint-satisfaction-problem? Or is there even a more straight-forward more haskellish pattern, which solves such problems? Any pointers would be much appreciated. -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Mapping a list of functions
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 function in map may require more than one argument, so I need to apply it partially to some value(s) first. But what if I want to fix its second and third argument and not its first argument? Can flip help? Thanks -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Vague: Assembly line process
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 singe Process thingy. I want to be able to chain processes and the whole thing should still act like a Process. This is a type of constraint network. If you have access to _Structure and Interpretation of Computer Programs_, there is a section therein devoted to constraint networks. Will check this out. I was hoping that something simpler would suffice. I am afraid of CSPs. Today I was playing with a matrix representation. I mean the one you learn in school for linear optimization problems. Usually the matrix is written so it tells you how much of each supply you need to produce a unit of outputs. So when you know the outputs you can compute what you need as a minimum. You can invert the matrix and it'll work on the oppsite direction: when you know the inputs it'll tell you what you can produce at most. Then I thought, what if I replace the (*) and (+) operations which are applied when I multipy the matrix with a vector (i.e. a vector if inputs or outputs) by something more general. So I replaced (+) by function application and my matrix was now a matrix of functions. But then I got lost trying to find a way to invert such a matrix. FWIW: while googeling around how to invert a matrix of functions I stumbeled across the Process Specification Language. At least they defined an ontology, but there isn't much of computing stuff there. http://www.mel.nist.gov/psl/ -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Vague: Assembly line process
On Tuesday, 15. June 2010 01:40:03 Luke Palmer wrote: So hang on, what is the problem? You have described something like a vague model, but what information are you trying to get? Say, perhaps, a set of possible output lists from a given input list? 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 singe Process thingy. I want to be able to chain processes and the whole thing should still act like a Process. Luke On Mon, Jun 14, 2010 at 11:16 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 say a Process is a function canProduce :: [Input]-[Output]-Bool which tells me if the outputs can be produced from the inputs There may be a similar function which tells me if the inputs are completely consumed to procude the output. The inputs do not determine the exact outputs. Think of a Process which combines a List of Ints into pairs, such that the input ints are consumed and each input Int occurs in only one position in the output. There are many ways to do this. Still for any set of input Ints and output pairs I could decide if the output can be produced from the input. Likewise the Input is not determined by the output. There may be lots of choices from what I could build my output (buy from different vendors). When I know more about the inputs and outputs my choices get more and more limited. I would like to to pass inputs and/or outputs to something and I would like to get a something which is more restricted, but still essentially a thing which tells me if the outputs can be produced from the inputs. I just cannot find a way to even THINK about this problem in a reasonable general way. -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Vague: Assembly line process
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 which tells me if the outputs can be produced from the inputs There may be a similar function which tells me if the inputs are completely consumed to procude the output. The inputs do not determine the exact outputs. Think of a Process which combines a List of Ints into pairs, such that the input ints are consumed and each input Int occurs in only one position in the output. There are many ways to do this. Still for any set of input Ints and output pairs I could decide if the output can be produced from the input. Likewise the Input is not determined by the output. There may be lots of choices from what I could build my output (buy from different vendors). When I know more about the inputs and outputs my choices get more and more limited. I would like to to pass inputs and/or outputs to something and I would like to get a something which is more restricted, but still essentially a thing which tells me if the outputs can be produced from the inputs. I just cannot find a way to even THINK about this problem in a reasonable general way. -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to browse code written by others
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 the sources, and again I could not see more that just signatures. I would be very happy with something like a Smalltalk browser. Something that would let me zoom down to the source code, but with search and hyperlink capabilities (senders and implementers in Smalltalk). Anyways, how do you guys do it, i.e. how to you dive into non-trivial foreign code? -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Literate programming
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 failed to see any support for literate programming in leksah. It candies the backslashes in e.g. \documentclass{article} to λdocumentclass{article}. In case you don't, then how do you document your code? If you write a paper which explains what your code does, then how do you do that? -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Literate programming
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 personal opionion as a haskell newbie is that I love literate programming. I can write down my train of thoughts along with the source code, then I read the generated document an I can find flaws in it much more easily than when reading the bare source. I understand that this becomes less of an issue when you become more experienced with haskell. Still it will always be a good way to promote haskel-style solutions. I don't have any problems with LaTeX, but a less verbose solution would do just fine. My biggest problem is actually literate programming in conjunction with leksah. Can anybody comment on this issue? Do you guys use leskah at all? -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to Show an Operation?
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 doing. Thanks Luke The reason I was asking is the following: suppose I have some code which uses some functions, and what it primarily does with those functions is CALL them in different orders. Now at a later point in time I decide I need to give names to those functions because at the end I need to print information about the functions which together solved a certain problem. Think of my problem as In which order do I have to call f,g,h such that (f.g.h) 42 = 42?. I don't want to change all places where those functions are called into apply style. Therefore I was looking for some idiom like the python __call__() method, which, when present, can turn just about anything into a callable. I could change the *definition* of my original functions into apply style and the rest of the code would not notice any difference. But that does not really help, because in the end I want to Show something like [g,h,f], but my functions would no longer carry names. Alternatively I could associate functions with names in some association function, but that function simply has to know to much for my taste. The thing is, I only need the names at the very end. Throughout the majority of the computation they should stay out of the way. -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: How to Show an Operation?
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 instance Applicative Named where pure x = Named x (Named s f) * (Named t v) = Named (s ++ ( ++ t ++ )) (f v) Applicative. Need to study that Control.Applicative (*) :: Applicative f = f (a - b) - f a - f b So in our case the Applicative is a Named. When I apply a Named to a function, then I get a function between the corresponding Named types. When I pass it an Int-Char function, I get a Named Int - Named Char function. But here it is applied to another Named ... is that the (a-b)? Puzzeled. instance Eq a = Eq (Named a) where (Named _ x) == (Named _ y) = x == y instance Show (Named a) where show (Named s _) = s Understood. namedPure :: Show a = a - Named a namedPure x = Named (show x) x When I can show something I can always name it so its name is what 'show' would return. Okay I guess I got it. This turns a showable into a Named. test :: Num a = (a - a) - (a - a) - (a - a) - [String] test f g h = do [f', g', h'] - permutations [Named f f, Named g g, Named h h] According to Hoogle permutations should be in Data.List. Mine (GHCI 6.8.2) does not seem to have it. Seems to have something to do with base, whatever that is. guard $ namedPure 42 == f' * g' * h' * namedPure 42 Ah, the 42 needs namedPure. Again this * operator... I believe the whole thing is using a List Monad. return $ show f' ++ . ++ show g' ++ . ++ show h' I wonder if the thing returns just one string or a list of strings. I guess return cannot return anything more unwrapped than a List, so it must be a List. But does it contain just the first match or all of them? All of them! And how many brackets are around them? -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: How to Show an Operation?
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) - [String] test f g h = do [f', g', h'] - permutations [Named f f, Named g g, Named h h] guard $ namedPure 42 == (f' * g' * h' * namedPure 42) return $ show f' ++ . ++ show g' ++ . ++ show h' But this leads to Occurs check: cannot construct the infinite type: a = (a - a) - a1 - t When generalising the type(s) for `test' This error message is still the maximum penalty for me (along with Corba marshall exception in J2EE and Missing right parenthesis in Oracle SQL) Then generally speaking, I have the feeling that this code does not allow namifying existing code either. In this respect it does not seem to do better than the apply method pattern discussed earlier in this thread. The problem it solves is very simple and therefore using (*) and namedPure isn't much of a drawback. But if I had tons of code to namify I would still have to do significant changes to it, right? -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to Show an Operation?
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' So far so good. However my Named things are all functions and I don't see I ever want to map over any of them. But what I'd like to do is use them like ordinary functions as in: f::Named (Int-Int) f x Is there a way to do this, other than writing apply::Named Int -Int apply n x = (val_of n) x -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to Show an Operation?
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 feed them all into my problem solver and it finds that (x*y) is right, how can I print that string? You'd have to pass the description string to the problem solver too. If it was previously solver :: Num a = Whatever - [a - a - a] - Result it would become for example solver :: Num a = Whatever - [(a - a - a, String)] - Result Thanks to Ozgur Akgun for his suggestion. However I really wanted a human readable name, but admittedly I haven't said so. About this one: The only thing I miss in this solution, is that the name is identified by its position in the Pair. In this case this is certainly not a problem. But anyways, I tried to give it a name, using record syntax. This worked well until I wanted to define a different set of operations, which should also be named. It turned out that the name function, which was implicitly created (using record syntax) cannot be used again. How should I work around that. I could use two different name function, but I don't like this. Would I have to define a typeclass namedFunction which all have a name function? I guess my mind is still a bit stuck in the OO world. -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to name a mapped function?
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, which applies compute to a list of values, how would I call this function? I was tempted to use all, but my original function already returns a list, so this would be misleading. Also note that the mapped version, does some additional things (remove duplicates), otherwise a new function would hardly be justified. -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to Show an Operation?
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 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Language Shootout reverse-complement benchmark
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 what's wrong because 1.274224153 seems to be the correct result. But there really seems to be something wrong with GHC#4. -- Martin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe