Questions tagged [zipwith]

21 questions
0
votes
2 answers

Simplify zipWith and case using LambdaCase

With the following zipWith expression: zipWith3 (\foos bars bazs -> case (foos, bars, bazs) of (foo, bar, Just baz) -> Right "hell yeah" (foo, bar, Nothing) -> Left "tough luck" ) ["foo1", "foo2"] ["bar1", "bar2"] [Just "baz1", Just…
Jivan
  • 21,522
  • 15
  • 80
  • 131
0
votes
1 answer

Combine two Mono's together where the second mono is subscribed to the first one

I have recently been learning reactive programming using the reactor libraries in Java with the Spring framework and for the most part I have been able to get to grips with it. However, I've found myself in the same situation a couple of times and…
0
votes
1 answer

How to add two list of data type [[double]] using zipWith(+)?

I am doing this in Haskell. I am trying to add two lists to gather and I am using zipWith function to do this. But the data type won't match with my add function. this is what i have tried add :: [[Double]] -> [[Double]] -> [[Double]] add = zipWith…
user11239824
0
votes
3 answers

zipWithIndex and filter resulting in "Vector" string in output

I am still struggling a bit with these zipWithIndex and filter functions. I have this code statement , and added a test string to isolate from the rest of the code. val s = "012345678901234567890123456789012345678901234567890123456789" val l =…
0
votes
3 answers

Recursive sum columns of matrix to single row (with zipWith (+))

lstsAdder :: [[Integer]] -> [Integer] lstsAdder [] = [] lstsAdder (x:xs) = zipWith (+) x (lstsAdder xs) As the title says, I want it to recursively add this: [[a,b,c],[d,e,f]] like this: [a+d,b+e,c+f], and this with lists of lists of any finite…
majorTom
  • 57
  • 6
0
votes
1 answer

zip-like bucket aggregation

TL;DR: I want to do the equivalent of Haskell's zipWith with buckets in elasticsearch. I have an index with time and value "tuples", and each entry also has a head_id, pointing to meta information about a series of such tuples. It's the timeseries…
Felk
  • 7,720
  • 2
  • 35
  • 65
1
2