dojosp / participant-s-projects

This is a space for projects that maybe did or didn't start at a Dojo session and the participants continued developing.

Dojo (author)
Mon Jun 22 19:44:58 -0700 2009
commit  9a787ec3cd3e532cb890c37ae261794b0d1777c6
tree    1cff1c2aba885eb76fec62566aa09cb2617f7773
parent  feb0f4307a2d14abea28b3bdfaecd07de80755eb parent  32cf703a82fe153f34e0ee8c314c0c63f04de401
participant-s-projects / 50-haskell(2) / Sanduiche.hs
100755 19 lines (15 sloc) 0.494 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Sanduiche where
 
{-montaMatriz [x:xs] =
let
matrizResto = montaMatriz xs
a1Vezesa2an = [x*ai | ai <- xs]
matrizSemAPrimeiraColuna = a1Vezesa2an : matrizResto
listaToda = x:xs
primeiraColuna = [x*ai | ai <- listaToda]
matrizToda = [ a:b | a <- primeiraColuna, b
-}
 
juntaListas [p] [[x]] = [[p, x]]
 
montaMatriz [x,y,z] = [[x*x,x*y,x*z],[x*y,y*y,y*z],[x*z,z*y,z*z]]
montaMatriz [x,y] = [[x*x,x*y],[x*y,y*y]]
montaMatriz [x] = [[x*x]]
 
achataMatriz l = [a*b | a <- l, b <- l]