dramforever 2017-03-01 02:45:10
That sucks even more
nate_ 2017-03-01 02:45:31
Try being someone thinking of the long run and working in consumer products. Everyone has the memory of a mayfly. The long run is fiction.
Boomerang 2017-03-01 03:05:59
In Data.Map there are functions like lookupLT, how should I go about making a more general one where I can supply a custom compare function: lookupBy :: k -> (k -> k -> Ordering) -> Map k v -> Maybe (k, v)
merijn 2017-03-01 03:08:06
Boomerang: You can't, really. Map always use the compare supplied by Ord
mauke 2017-03-01 03:08:10
that seems a bit pointless
merijn 2017-03-01 03:08:46
Boomerang: Since Map has to use the same comparison while constructing as it does while doing lookups
Boomerang 2017-03-01 03:08:53
Well I have a map with keys of type (Int, Int) and I want to easy compare on fst or snd depending on the situation
Boomerang 2017-03-01 03:09:03
*Map
Boomerang 2017-03-01 03:09:11
*easily
merijn 2017-03-01 03:09:19
Boomerang: There's no efficient way to do that using a single Map
merijn 2017-03-01 03:09:50
Because there's no efficient way that lookup could be implemented
Boomerang 2017-03-01 03:11:46
That makes sense, maybe a Map isn't an adequate data stucture for my purposes. Thanks for your inputs!
kubunto 2017-03-01 03:13:11
I am trying to remove extra spaces in my program but I cant seem to figure it out
kubunto 2017-03-01 03:13:27
source: http://lpaste.net/353096
kubunto 2017-03-01 03:13:40
output: ("time" ("party" 43 35 67 ) 72 )
kubunto 2017-03-01 03:14:09
i dont want space between 67 and the ) as well as between 72 and )
Detrumi 2017-03-01 03:16:13
kubunto: That's because the pattern match a:b also matches if b is the empty list
kubunto 2017-03-01 03:17:28
Detrumi: just thought of that
kubunto 2017-03-01 03:17:45
i made a case a:[] before a:b to cover
kubunto 2017-03-01 03:18:47
Detrumi: is there a guard i can put in beyond just a better match for this case?
kubunto 2017-03-01 03:19:08
so i could order it however i want to
hexagoxel 2017-03-01 03:21:23
kubunto: a:b@(_:_)
kubunto 2017-03-01 03:21:57
hexagoxel: that would check if the tail list has at least one element?
kubunto 2017-03-01 03:23:59
hexagoxel: so I would read that as a:b such that b has at least one element
hexagoxel 2017-03-01 03:24:54
kubunto: yes
kubunto 2017-03-01 03:25:39
what else could the @ have in it
hexagoxel 2017-03-01 03:26:02
without underscores and better names, it is like first:tail@(second:tailtail)
Detrumi 2017-03-01 03:26:05
The @ just gives a name to a pattern
kubunto 2017-03-01 03:26:41
could i do i@(<5)?
Detrumi 2017-03-01 03:27:18
I'd just go for 3 pattern matches: [a], a:b and [], it's simple to keep them in order
mauke 2017-03-01 03:27:44
kubunto: the syntax is IDENTIFIER '@' PATTERN
mauke 2017-03-01 03:27:50
(<5) is not a valid pattern
zipper 2017-03-01 03:37:02
I'm having trouble converting a bytes into MB/KB because it returns some scientific notation thing :(
zipper 2017-03-01 03:37:09
I mean result
zipper 2017-03-01 03:37:36
> 67824/1024^3
lambdabot 2017-03-01 03:37:40
6.316602230072021e-5
zipper 2017-03-01 03:37:54
Yeah so how can I get an actual Double?
kubunto 2017-03-01 03:37:57
Detrumi: hexagoxel is my match exaughstive?
Detrumi 2017-03-01 03:38:40
kubunto: You mean the first:tail@(second:tailtail) match?
kubunto 2017-03-01 03:39:08
Detrumi: meaning the empty list case
dramforever 2017-03-01 03:39:24
> printf "%f" (67824/1024^3)
lambdabot 2017-03-01 03:39:27
error:
lambdabot 2017-03-01 03:39:28
• Ambiguous type variable 'a0' arising from a use of 'show_M855349794792...
lambdabot 2017-03-01 03:39:28
prevents the constraint '(Show a0)' from being solved.
dramforever 2017-03-01 03:39:32
> printf "%f" (67824/1024^3 :: Double)
lambdabot 2017-03-01 03:39:37
error:
lambdabot 2017-03-01 03:39:37
• Ambiguous type variable 'a0' arising from a use of 'show_M395477717473...
lambdabot 2017-03-01 03:39:37
prevents the constraint '(Show a0)' from being solved.
dramforever 2017-03-01 03:39:52
Screw you printf
mauke 2017-03-01 03:40:20
> printf "%f" (67824/1024^3) :: String
lambdabot 2017-03-01 03:40:23
"0.00006316602230072021"
dramforever 2017-03-01 03:40:33
Yes that
dramforever 2017-03-01 03:40:52
I admit that I didn't really read the error message...
zipper 2017-03-01 03:41:04
mauke: Thanks
MarcelineVQ 2017-03-01 03:41:18
if you're working from bytes consider using integrals, in which case you'd use div instead of /
dramforever 2017-03-01 03:41:20
zipper: You likely want like 2 decimal places or something
dramforever 2017-03-01 03:41:27
> printf "%.2f" (67824/1024^3) :: String
lambdabot 2017-03-01 03:41:36
mueval-core: Time limit exceeded
lambdabot 2017-03-01 03:41:36
mueval: ExitFailure 1
mauke 2017-03-01 03:41:38
:t showFFloat
lambdabot 2017-03-01 03:41:42
RealFloat a => Maybe Int -> a -> ShowS
Detrumi 2017-03-01 03:41:44
kubunto: I'm not sure what you're asking
dramforever 2017-03-01 03:41:45
That's not how it works, lambdabot
zipper 2017-03-01 03:41:46
dramforever: That's exactly what I wanted thank you :)
dramforever 2017-03-01 03:41:48
> printf "%.2f" (67824/1024^3) :: String
lambdabot 2017-03-01 03:41:53
"0.00"
mauke 2017-03-01 03:41:59
> showFFloat Nothing (67824/1024^3) ""
lambdabot 2017-03-01 03:42:02
"0.00006316602230072021"
dramforever 2017-03-01 03:42:06
Docs is your friend :)
mauke 2017-03-01 03:42:11
> showFFloat (Just 4) (67824/1024^3) ""
lambdabot 2017-03-01 03:42:14
"0.0001"
dramforever 2017-03-01 03:42:22
Even better, never knew that
kubunto 2017-03-01 03:42:34
Detrumi: i think it wouldnt work if i gave sentence a node of Node "h" []
dramforever 2017-03-01 03:42:44
I'm thinking, #haskell is a bit like bittorrent
robertkennedy 2017-03-01 03:42:45
:i showFFloat
mauke 2017-03-01 03:43:06
there is no :i in lambdabot
robertkennedy 2017-03-01 03:43:20
Darn. What module is that in?
zipper 2017-03-01 03:43:22
hmmm `showFFloat` seems great
MarcelineVQ 2017-03-01 03:43:27
Numeric
mauke 2017-03-01 03:43:28
@hoogle showFFloat
Detrumi 2017-03-01 03:43:31
kubunto: Yeah, you'll need at least 3 cases if you do it this way
lambdabot 2017-03-01 03:43:32
Numeric showFFloat :: (RealFloat a) => Maybe Int -> a -> ShowS
lambdabot 2017-03-01 03:43:32
Numeric showFFloatAlt :: (RealFloat a) => Maybe Int -> a -> ShowS
lambdabot 2017-03-01 03:43:32
Numeric.Compat showFFloatAlt :: RealFloat a => Maybe Int -> a -> ShowS
dramforever 2017-03-01 03:44:41
:t intersperse
lambdabot 2017-03-01 03:44:44
a -> [a] -> [a]
mauke 2017-03-01 03:44:50
:t intercalate
lambdabot 2017-03-01 03:44:54
[a] -> [[a]] -> [a]