Webprogramming-in-haskell/ch-05/7.hs Go to file Cannot retrieve contributors at this time 12 lines (9 sloc) 500 Bytes Raw Blame -- The scalar product of two lists of integers xs and ys … WebOct 16, 2016 · To get the cartesian product of the lists xs and ys, we just need to take the tuple (x,y) for each element x in xs and each element y in ys. This gives us the following list comprehension: cartProd xs ys = [ (x,y) x <- xs, y <- ys] Share Improve this answer edited …
find - Hoogle - Haskell
WebSep 24, 2024 · Prelude>scale (1.0,2.0)1.5(1.5,3.0) dot : This function performs a type of multiplication (product) on vectors. The returned value is a scalar real number. The dot product of two vectors is computed as follows. (x1, y1) * (x2, y2) = x1 * x2 + y1 * y2 Prelude>dot (2.5,5.6)(56.4,34.5)334.2 WebJun 29, 2012 · An APL library for Haskell. APL is an array language with a highly-functional flavour, and a rich set of carefully-thought-out array operations. It would be interesting to build a Haskell library that offered a Haskell rendering of APL's array algebra, possibly (though not definitely) bound to a mature implementation. mary beth carey
Cartesian product of 2 lists in Haskell - Stack Overflow
WebSince Haskell is a functional language, one would expect functions to play a major role, and indeed they do. In this section, we look at several aspects of functions in Haskell. First, consider this definition of a function which … WebJul 20, 2024 · We can give a geometric interpretation to the scalar product by writing the definition as. →A ⋅ →B = (Acos(θ))B. In this formulation, the term Acosθ is the projection of the vector →B in the direction of the vector →B. This projection is shown in Figure 13.10a. So the scalar product is the product of the projection of the length of ... WebIndiana University Bloomington mary beth carlson piano