23 questions
0
votes
0
answers
27
views
WebFlux flux of Mono<webclient> same uri (restfull parameters) different parameter (it's a rest that call another rest for a massive load)
public Flux<Entity> getRatesFlux(String hash, String apiUrl) {
// url is a restfull parameters in path
return RatesReactiveRepository
.findAll()
.flatMap(rate -> {
...
2
votes
1
answer
84
views
Using zip in conjunction with zipWith in Haskell
I'm currently learning Haskell, and I am stuck with the following conundrum. What is wrong with the following construction?:
zip [1,2,3] [4,5,6]
Result: [(1,4),(2,5),(3,6)]
zipWith (+) [1,2,3] [4,5,6]...
0
votes
1
answer
166
views
What do I lose by setting up zipWithPadding like this? (alternate zipWith in Haskell)
This problem came up when I was trying to zip through lists of different length and I didn't want them to be cut by the shortest one. It was in a context where the list had integers that I wanted to ...
0
votes
1
answer
374
views
Haskell function to check differences between two lists
I want to write a function that checks if two lists are "almost" equal. The first parameter d is used for precision - the difference between the elements must not exceed d.
For example, ...
0
votes
2
answers
201
views
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 "...
3
votes
0
answers
135
views
Slow stream fusion in Data.Vector.Storable.ZipWith but fast in Data.Vector.Unboxed.ZipWith
Currently, I found some strange behavior in my function. I have a transformation function that transforms from (x,a,b) -> (x,y,z). I'm using Data.Vector.Storable since I'm communicating with some ...
2
votes
1
answer
79
views
Couldn't match expected type 'MultTree b' with '[MultTree b]'
I'm relatively new to Haskell.
I'm trying to create a function zipWithMult :: (a -> b -> c) -> MultTree a -> MultTree b -> MultTree c that behaves similar to the function zipWith for ...
1
vote
2
answers
106
views
Zipwith application in prolog
I have a hard time understanding this application of zipwith in Prolog and wondered if someone gets it. I already have an idea of what functor does, but I don't see how it applies in that case. I ...
0
votes
1
answer
3k
views
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 ...
6
votes
3
answers
710
views
Haskell zipWith
I want to sum a zipped list.
averageGrade :: [Float] -> [Int] -> Float
averageGrade [0.75 , 0.25] [6, 4] , result: 0,75*6 + 0.25*4 = 5.5
when I go to ghci and do the following:
sum(zipWith (*)...
2
votes
1
answer
993
views
How to define zipWith by using zip and list comprehension
I am trying to write zipWith function using zip and list comprehension. I need to zip the two lists after the function is applied. However I don't know where to use the list comprehension.
I tried ...
1
vote
2
answers
442
views
Elegant way in Haskell to output Fibonacci numbers using zipWith [duplicate]
I saw this implementation of the Fibonacci numbers in Haskell and I am still trying to figure out why this works properly. So apperently, the Fibonacci numbers can be written in a very compact way ...
4
votes
3
answers
2k
views
Can I use map function with 2 arrays?
I was wondering if any function exist that can do something like that
I already tried zipWith and some variations of the map, but no good results.
Only working solution to this is 2x ForEach, but I ...
1
vote
1
answer
207
views
How to use in Haskell zipWith correctly to create a [ [ int int ] ] list?
data Tegel = Teg Int Int
type RijTegels = [Tegel]
volleRijTegels :: RijTegels
volleRijTegels = ziptwee [21..36] (replicate 4 1 ++ replicate 4 2 ++ replicate 4 3 ++ replicate 4 4)
ziptwee :: [Int] -&...
0
votes
1
answer
402
views
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 :: [[...