Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Microcontroladores.hs #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion T.P. 1 - Microcontroladores/Microcontroladores.hs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ debug = filter (not.aBug)
aBug :: Instruccion -> Bool
aBug f = (==0).sum.(++ [a.f $ xt8088]).(++ [b.f $ xt8088]).memoria.f $ xt8088

memoriaOrdenada :: Micro -> Bool
memoriaOrdenada (Micro (x:xs) a b pc e p)
| emptyMemo.memoria = true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esta linea tiene 2 errores:

  1. memoria es una funcion que recibe un Micro y devuelve una lista, en este caso no le estas pasando ningun parametro.
  2. En el caso de que le pases un Micro tambien estaria mal porque emptyMemo recibe un Micro no una lista.

| xs < ultimo x = memoriaOrdenada (Micro x a b pc e p)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aca entiendo que lo que quisiste hacer es:
x < ultimo xs
de todas formas la funcion ultimo que definiste hace lo mismo que tail, si le queres dar un alias podrias hacer
ultimo = tail

El enunciado dice que las celdas de memoria tienen que ser menores o iguales, faltaria el caso de cuando son iguales.
ademas, en memoriaOrdenada estas comparando un elemento de la memoria con el siguiente, pero yo entiendo que hay que compararlo con todos los elementos que le siguen.

| otherwise = false

ultimo (x:xs) = xs

xt8088= Micro [] 0 0 0 "" []

fp20 = Micro [] 7 24 0 "" []
Expand All @@ -106,4 +114,4 @@ at8086 = Micro [1..20] 0 0 0 "" []

add22to10 = reverse [add, lodv 22, swap, lodv 10]

divide2by0 = reverse [divide, lod 1, swap, lod 2, str 2 0,str 1 2]
divide2by0 = reverse [divide, lod 1, swap, lod 2, str 2 0,str 1 2]