[Haskell-cafe] FW: please help... small problem

Luke Palmer lrpalmer at gmail.com
Fri Nov 9 17:11:13 EST 2007


I'm not sure what you mean by not use auxillary functions.  This code
is about as compact as it is going to get if you don't want to use
library functions.

wordToInt is not necessary at all, of course; you could just replace
"wordToInt" everywhere with "read", and type inference will figure out
the types for you.

There is a (very common) library function which does exactly what
"method" does, but its types are polymorphic.  But you don't want to
use library functions?  That same function will accomplish what "test"
does very easily.  parseResults is your work horse; really that's the
only function that needs to be there; all the others are just simple
compositions of functions.

I don't see any opportunities to factor any of this logic _into_
pattern matching though.

Luke

On Nov 9, 2007 9:57 PM, Ryan Bloor <ryanbloor at hotmail.com> wrote:
>
>
> sorry heres the code....
>
>  I always do that.
>
>
>
>
>  ________________________________
>  From: ryanbloor at hotmail.com
> To: Subject: please help... small problem
> Date: Fri, 9 Nov 2007 21:44:35 +0000
>
>
>  hi
>
> Is there anyway to cut down this code and to not use auxillary functons, but
> instead use pattern matching?
>
> The code basically splits up a list 'rslis' into a list of lists - but so
> each word is split up and the integers have been parsed. so.... ["hi ryan
> 1","hi jeff 2"] becomes [["hi","ryan" 1], ["hi","jeff", 2]].
> The code is far too long. I don't wanna use premade functions too much...
> pattern matching is required.
>
> Ryan
>
>  ________________________________
>  The next generation of MSN Hotmail has arrived - Windows Live Hotmail
> ________________________________
> Are you the Quizmaster? Play BrainBattle with a friend now!
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>


More information about the Haskell-Cafe mailing list