Re: [Haskell-cafe] Mapping string to a function

2012-03-15 Thread Haisheng Wu
Thanks Oliver. That's good enough. I was ever curious about whether parse String to the function rather than a mapping. -Haisheng On Thu, Mar 15, 2012 at 1:26 PM, Oliver Batchelor saul...@gmail.com wrote: You could store your test data in a named map e.g. import qualified Data.Map as M

Re: [Haskell-cafe] Mapping string to a function

2012-03-15 Thread Brandon Allbery
On Thu, Mar 15, 2012 at 02:21, Haisheng Wu fre...@gmail.com wrote: Thanks Oliver. That's good enough. I was ever curious about whether parse String to the function rather than a mapping. GHC has the ability to embed an interpreter. You do not want to use it. If you want Perl/Python/Ruby,

[Haskell-cafe] Mapping string to a function

2012-03-14 Thread Haisheng Wu
Hi there, Do you have any comments / suggestions for the following scenario? I have two list and a function over list testdata :: [Int] testdata2 :: [Int] f testdata = map g testdata What I like to do is choosing what test data via command line arguments. i.e. test.hs testdata2 will

Re: [Haskell-cafe] Mapping string to a function

2012-03-14 Thread Oliver Batchelor
You could store your test data in a named map e.g. import qualified Data.Map as M import System testSets :: M.Map String [Int] testSets = M.fromList [ (testdata, testdata) , (testdata2, testdata2) ] f :: Int - Something f = main = do [arg] - getArgs case M.lookup arg