This file contains hidden or 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
last pid: 3083; load averages: 0.15, 0.17, 0.09 up 0+02:17:10 07:58:24 | |
20 processes: 1 running, 19 sleeping | |
CPU: 0.8% user, 0.0% nice, 1.6% system, 1.6% interrupt, 96.1% idle | |
Mem: 73M Active, 59M Inact, 40M Wired, 1424K Cache, 34M Buf, 60M Free | |
Swap: 512M Total, 580K Used, 511M Free | |
PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND | |
2918 jaime 1 61 5 6588K 3872K select 0:00 0.00% ratpoison | |
3072 jaime 4 53 5 10616K 5216K ucond 0:00 0.00% cmus | |
2972 jaime 6 49 5 74068K 60104K ucond 0:20 0.00% /home/jaime/opera-dir/lib/opera/opera |
This file contains hidden or 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
----------------- por estilo --------------------- | |
import Prelude hiding ((/)) | |
infixl 7 / | |
(/) = quot | |
par = even | |
impar = odd | |
----------------- REFLEJOS --------------- |
This file contains hidden or 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
from os import system as run | |
def pars(x): return (x*"(" + "1" + x*")") | |
def programa(x): return "int main () { return " + pars(x) + "; }\n" | |
# rango seleccionado al tanteo, manipulando para encontrar el primero que falla | |
for i in range(2**16 + 2**15 + 2**13 + 2**10,2**17): | |
print "---------- " + str(i) + " ----------" | |
fh = open ("parens.c", "w") |
This file contains hidden or 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
----------------- por estilo --------------------- | |
import Prelude hiding ((/)) | |
infixl 7 / | |
(/) = quot | |
par = even | |
impar = odd | |
-------------------------------------------------- |
This file contains hidden or 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
type BiNodo = (Int,[(Integer,(Int,Integer))]) | |
nivelArbolBiLista :: BiNodo -> BiNodo | |
nivelArbolBiLista (k,xs) = (k+1,concatMap g xs) where | |
d = 2^k | |
g (x,(n,y)) = [izq,der] where | |
izq = (ii,(n,di)) | |
der = (id,(n+1,dd)) | |
(ii,id) = if even y then (x,x+d) else (x+d,x) | |
di = if even y |
This file contains hidden or 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
type Nodo = (Int, (Integer,Integer)) | |
nivelArbolLista xs = concatMap g xs where | |
g (n, y) = [izq,der] where | |
izq = (n, fizq y) | |
der = (n+1, fder y) | |
fizq x = if even x | |
then quot x 2 | |
else quot (x + 3^n) 2 | |
fder x = if odd x |
This file contains hidden or 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
type Nodo = ((Int,Integer),(Int,Integer)) | |
nivelGiros :: [(Int,Integer)] -> [(Int,Integer)] | |
nivelGiros xs = concatMap g xs where | |
g :: (Int,Integer) -> [(Int,Integer)] | |
g (n,x) = [(n,izq),(n+1,der)] where | |
izq = if even x then par else rimpar | |
der = if even x then rpar else impar | |
par = quot x 2 | |
impar = quot (3*x + 1) 2 |
This file contains hidden or 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 Data.List(findIndex,findIndices) | |
import Maybe(fromJust) | |
paso :: (Integral a) => (a -> a) -> a -> a | |
paso hazpar x = if odd x then div (hazpar x) 2 else div x 2 | |
serieInfinita :: (Integral a) => (a -> a) -> a -> [Bool] | |
serieInfinita f x = odd x : serieInfinita f siguiente where | |
siguiente = paso f x |
This file contains hidden or 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 Data.Array | |
data Op = DN | UP deriving (Show, Eq, Ord) | |
paso :: (Integral a) => (a -> a) -> a -> a | |
paso hazpar x = if odd x then div (hazpar x) 2 else div x 2 | |
serieInfinita :: (Integral a) => (a -> a) -> a -> [Op] | |
serieInfinita f x = (if odd x then UP else DN) : serieInfinita f siguiente where | |
siguiente = paso f x |
This file contains hidden or 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
-- medidor de beat | |
-- compilar: 'ghc --make beat.hs' | |
-- cuenta distancias en milisegundos entre clicks de teclado | |
-- salir con 'q' | |
import qualified Graphics.UI.SDL as SDL | |
import Graphics.UI.SDL.Keysym as K | |
import Graphics.UI.SDL.Time as T | |
import Data.Word(Word32) |