Jump to content

Recommended Posts

Posted

Oi 🙂

Deparei-me com este exercício:

Defina uma função que recebe 2 pontos que são os vértices da diagonal de um rectângulo paralelo aos eixos e controi uma lista com os 4 pontos desse retangulo.

Então, pensei assim:

(a,b) A +-------------+ B
        |             |
        |             |
      C +-------------+ D (c,d)

Então, B (c, b) e C (a,d)

No sublime, coloquei:

type Ponto = (Float,Float)
pontos_retangulo :: Ponto -> Ponto -> [Ponto]
pontos_retangulo (a,b) (c,d) = [(a,b), (c,b), (a,d), (c,d)]

Tenho de acrescentar o meu raciocínio ou posso deixar assim?

 

Obrigadaaaaa 👍

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.