12.07.2015 Views

VIII Jornadas de Enseñanza Universitaria de la Informática Cáceres ...

VIII Jornadas de Enseñanza Universitaria de la Informática Cáceres ...

VIII Jornadas de Enseñanza Universitaria de la Informática Cáceres ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

sig (x, n) = (x-1, n)-- min :: (Int, Int) -> Boolmin (x, n) = (x == 1)-- no_divi<strong>de</strong> :: (Int, Int) -> Boolno_divi<strong>de</strong> (x, n) = (n `mod` x /= 0)2.2. Ejemplo 2: “Operaciones con Dígitos”a) “Determinar los anillos <strong>de</strong> un dígito”-- PROBLEMA : Determinar el número <strong>de</strong>anillos <strong>de</strong> un dígitoanillos_digito :: Int -> Intanillos_digito = <strong>de</strong>purar(pre,fun,post,name)where-- name :: Stringname = "anillos_digito"-- pre :: Int -> Boolpre (n) = n >= 0-- fun :: Int -> Intfun (n) = if (n == 8) then 2else if (n == 0 ||n == 6 ||n == 9) then 1else 0-- post :: Int -> Int -> Boolpost n resultado = resultado == anilloswhere anillos | (n == 8) = 2| (n == 0) ||(n == 6) ||(n == 9) = 1| otherwise = 0b) “Determinar los anillos <strong>de</strong> un número n∈ ”-- PROBLEMA : Determinar los anillos <strong>de</strong>un número Natural n.anillos_numero :: Int -> Intanillos_numero = <strong>de</strong>purar(pre,fun,post,name)where-- nombre :: Stringnombre = "anillos_numero"-- pre :: Int -> Boolpre (n) = n >= 0-- fun :: Int -> Intfun n = if (n < 10) thenanillos_digito (n)elseanillos_digito (n `mod` 10) +anillos_numero (n `div` 10)-- post :: Int -> Int -> Boolpost n resultado =resultado ==suma (inicial, siguiente, minimal)(\x -> True) anillos_digito_i (n)-- ini :: Int -> (Int, Int)ini (n) = (n, numDigitos(n))-- sig :: (Int, Int) -> (Int, Int)sig (n, i) = (n, i-1)-- min (Int,Int) -> Boolmin (n, i) = i == 03. Conclusiones y Trabajos FuturosEn este trabajo hemos presentado una propuesta<strong>de</strong> <strong>de</strong>puración <strong>de</strong> programas Haskell a partir <strong>de</strong> <strong>la</strong>sespecificaciones PRE/POST <strong>de</strong>scritas en Haskell.En el futuro, p<strong>la</strong>neamos mejorar <strong>la</strong> herramientaH4D2 con más facilida<strong>de</strong>s <strong>de</strong> <strong>de</strong>puración yelementos que hagan más amigable <strong>la</strong> <strong>de</strong>puración(trazas paso a paso, evaluación <strong>de</strong> elementos <strong>de</strong>lprograma, etc..).Referencias[1] Burgos, J.M., Galve, J., García, J. and SutilM.: Una Taxonomía <strong>de</strong> Problemas para <strong>la</strong>Enseñanza <strong>de</strong> <strong>la</strong> Programación, Actas <strong>de</strong>l <strong>VIII</strong>NFOREDU’2000, Mayo 2000, La Habana(Cuba).[2] Burgos, J.M., Galve, J., García, J. and SutilM.: Diseño <strong>de</strong> Soluciones Abstractasmediante el Refinamiento <strong>de</strong>Especificaciones. VII <strong>Jornadas</strong> sobre <strong>la</strong>Enseñanza <strong>Universitaria</strong> <strong>de</strong> <strong>la</strong> Informática(JENUI’01).[3] J.M. Burgos, J.Galve y J. García. FromProblems to Programs: A Pattern Languageto Go from Problem Requirements toSolution Schemas in ElementaryProgramming. Proceedings of the 5thEuroPLoP´2000.[4] Schmidt, D.R. Towards a c<strong>la</strong>ssificationapproach to <strong>de</strong>sign. In Proceedings of theFifth International Conference on AlgebraicMethodology and Software Technology,AMAST’96 (1996), vol. LNCS 1101,Springer-Ver<strong>la</strong>g, pp. 62-84.[5] http://www.haskell.org/[6] S. Peyton Jones and J. Hughes (editors).Standard libraries for the Haskell 98programming <strong>la</strong>nguage, February 1999.[7] E.Y.Shapiro. Algorithmic ProgramDebugging. MIT Press, Cambridge, MA,1983.[8] Grupo <strong>de</strong> Investigación <strong>de</strong> ProgramaciónDec<strong>la</strong>rativa Aplicada LSIIS. Herramientasmetodológicas e instrumentales para <strong>la</strong>enseñanza <strong>de</strong> <strong>la</strong> Programación. ProyectoFundación General <strong>de</strong> <strong>la</strong> UPM (FG-UPM-43700000190), 2000-2001. Grupo <strong>de</strong>Investigación <strong>de</strong> Programación Dec<strong>la</strong>rativaAplicada LSIIS. Herramientas

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!