This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE TypeFamilies #-} | |
data Expr :: * -> * where | |
Int :: Int -> Expr Int | |
Bool :: Bool -> Expr Bool | |
IsZero :: Expr Int -> Expr Bool | |
-- Plus :: (* -> *) -> (* -> *) -> (* -> | |
If :: Expr Bool -> Expr a -> Expr a -> Expr a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- tests if an image is valid and, if it is, returns the resolution of the picture as a pair of the x-resolution and the y-resolution. An image is valid if all its pixels are valid and if all the rows have equally many columns. | |
ANTES | |
----------------------------- | |
validImage rows@(firstRow:nextRow:rrs) = | |
if (isValidRow firstRow && length firstRow == length nextRow && (isJust $ validImage (nextRow:rrs))) then | |
Just (length firstRow, length rows) | |
else | |
Nothing | |
validImage rows@(r:rs) = if isValidRow r && (isJust $ validImage rs) then Just (length r, length rows) else Nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- tests if an image is valid and, if it is, returns the resolution of the picture as a pair of the x-resolution and the y-resolution. An image is valid if all its pixels are valid and if all the rows have equally many columns. | |
ANTES | |
----------------------------- | |
validImage rows@(firstRow:nextRow:rrs) = | |
if (isValidRow firstRow && length firstRow == length nextRow && (isJust $ validImage (nextRow:rrs))) then | |
Just (length firstRow, length rows) | |
else | |
Nothing | |
validImage rows@(r:rs) = if isValidRow r && (isJust $ validImage rs) then Just (length r, length rows) else Nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XMonad | |
import Data.Monoid | |
import System.Exit | |
import XMonad.Config.Gnome | |
import XMonad.Util.Replace | |
import XMonad.Actions.Search | |
import qualified XMonad.Actions.Submap as SM | |
import qualified XMonad.StackSet as W |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Punto fijo, que avisa si la sucesion de numeros dada la ecuacion de recurrencia G(x) no es una contraccion, i.e. si | G'(x) | >= 1. Hay que mandarle la derivada de G(x), i.e. G_ en el parametro | |
def PuntoFijoAPruebaDeMuladas(G,G_,x0,e): | |
if abs(G_(x0)) >= 1: | |
print "Esta funcion G(x) esta tricky, la derivada evaluada en x=",x, " es mayor que 1, por lo que se podria salir de la recta f(x)=x y no converger" | |
else: | |
print "x_i: " , x0, " G(x_i): ", G(x0) | |
x0 = G(x0) | |
return x |
NewerOlder