Moving with the 'extension function' for the list module (I spend a lot of time developing 'mapfold' - which likes an accumulator fold, but uses it as a parameter to create new values like the map - then found out that which is List.scan_left
)
To prepare test data, I needed to create a cross product of two lists, this is the same Came with me:
/// crossing the list of two lists, Return to Tupol crossproduct LA1L2 - product LCT v2 = list.map (fun v1 -> (v1 , V2)) lst List.map_concat (product l1) l2
P> Is this a good one, or is there a better way to do this than before? The same question for:
/// Produce cross-index of three lists, Return to duplicate crossproduct 3 L1 L2 L3 = Tuplest = Crosproduct L1 L Give 2 / make sure that this is the best way ... Product 3 lst2 v3 = list.map (funny (v1, v2) -> (v1, v2, v3)) lst2 List.map_concat (product3 tuplelist) l3
Another option is to use F # "sequence expression" and write something like this Is:
L1 L2 = seq {l For L1, make L2 in L2 in L1 to generate EL1; El2} ;; (In fact, it is similar to the things you wrote, because in the 'K .. K .. in' expression can be seen as map_concat). It works with (lazy) scenes, but if you want to work with lists, you can simply wrap the code inside the seq {...].
Comments
Post a Comment