Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.haskell > #382
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.haskell |
| Subject | Re: when map a tuple of double to a double, it return nothing |
| Date | 2016-07-18 10:15 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <87twfni9xr.fsf@bsb.me.uk> (permalink) |
| References | <20d5aa48-72dd-4e67-a025-37e6b9c83144@googlegroups.com> |
meInvent bbird <jobmattcon@gmail.com> writes:
> after checking many times, do not know where is wrong
>
> when map a tuple of double to a double, it return nothing
>
> import Data.List
> import Control.Monad
> import Math.Combinat
> import System.IO
> import Data.Map (Map)
> import qualified Data.Map as Map
> let allparams = replicateM 2 [0.0, 1.0]
> let a1 = [0.0, 1.0, 1.0, 1.0]
>
>
> let { op1 :: Map (Double, Double) Double; op1 = Map.fromList
> [((allparams!!i!!0, allparams!!i!!1), a1!!i) | i <- [0..3] ] }
> Map.lookup (0.0,0.0) $ op1
> Map.lookup (0.0,0.1) $ op1
> Map.lookup (0.1,0.0) $ op1
> Map.lookup (0.1,0.1) $ op1
>
>
> *Main Data.Map Map> Map.lookup (0.0,0.0) $ op1
> Just 0.0
> *Main Data.Map Map> Map.lookup (0.0,0.1) $ op1
> Nothing
> *Main Data.Map Map> Map.lookup (0.1,0.0) $ op1
> Nothing
> *Main Data.Map Map> Map.lookup (0.1,0.1) $ op1
> Nothing
Check the data. 0.1 /= 1.0.
<snip>
--
Ben.
Back to comp.lang.haskell | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
when map a tuple of double to a double, it return nothing meInvent bbird <jobmattcon@gmail.com> - 2016-07-17 23:58 -0700
Re: when map a tuple of double to a double, it return nothing Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-18 10:15 +0100
Re: when map a tuple of double to a double, it return nothing meInvent bbird <jobmattcon@gmail.com> - 2016-07-18 02:20 -0700
csiph-web