05/01/2022, 14:55
(* comp : ('a * 'b) list -> ('b * 'c) list -> ('a * 'c) list *)
let rec comp l k = function
[],[] -> []
| (a, a')::b, (c, c')::d -> if c = a' then (a, c')::comp b d else comp b d;;
05/01/2022, 19:18
05/01/2022, 19:24
05/01/2022, 19:45
data Maybe a = Nothing | Just a
05/01/2022, 21:54
comp :: (a -> Maybe b) -> (b -> Maybe c) -> a -> Maybe c
comp f g = (g =<<) . f
08/01/2022, 00:26
comp f g =
let filtered b = filter (\(c, d) -> (c == b)) g
fun (a, b) = map (\(c, d) -> (a, d)) (filtered b)
in concatMap fun f
16/01/2022, 14:03
Skuola.net News è una testata giornalistica iscritta al Registro degli Operatori della Comunicazione.
Registrazione: n° 20792 del 23/12/2010.
©2000—
Skuola Network s.r.l. Tutti i diritti riservati. — P.I. 10404470014.
Powered by phpBB © phpBB Group - Privacy policy - Cookie privacy
phpBB Mobile / SEO by Artodia.