Homework 5

67 views
Skip to first unread message

Filip Boltuzic

unread,
Dec 11, 2017, 3:36:51 PM12/11/17
to Haskell-FER
Few questions about the homework part

1. In the example of instructions "RAALAL" how to end up in (9, 4) West. I keep ending up at (9, 5) West. My logic from start (7, 3) North
a) R -> (7, 4) East
b) A -> (7, 5) East
c) A -> (7, 6) East
d) L -> (8, 6) North
e) A -> (9, 6) North
f) L -> (9, 5) West

2. Some triangleTypes overlap. Triangles that are Degenerate can be also Isosceles (side lengths of 2 2 4), as well as Scalene (2 4 6). What to return in this case?

Nikola Bunjevac

unread,
Dec 11, 2017, 4:16:11 PM12/11/17
to Haskell-FER


Dana ponedjeljak, 11. prosinca 2017. u 21:36:51 UTC+1, korisnik Filip Boltuzic napisao je:
Few questions about the homework part

1. In the example of instructions "RAALAL" how to end up in (9, 4) West. I keep ending up at (9, 5) West. My logic from start (7, 3) North
a) R -> (7, 4) East
b) A -> (7, 5) East
c) A -> (7, 6) East
d) L -> (8, 6) North
e) A -> (9, 6) North
f) L -> (9, 5) West

When you turn left or right, you don't move, you just change your bearing.


I also have a question regarding second problem.
It says we have to create data type Triangle, but function triangleType doesn't accept Triangle, just numbers. Is that an error or do we have to write another function that accepts Triangle but delegates to triangleType?

Filip Boltuzic

unread,
Dec 12, 2017, 11:05:26 AM12/12/17
to Haskell-FER
I believe inputs to construct a triangle are side lengths. 

Bruno Gavranovic

unread,
Dec 12, 2017, 12:04:27 PM12/12/17
to haske...@googlegroups.com
Doesn't the Degenerate case take precedence? Because every degenerate triangle is either Isoceles or Scalene; them having precedence over Degenerate wouldn't really make sense.

--
You received this message because you are subscribed to the Google Groups "Haskell-FER" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-fer+unsubscribe@googlegroups.com.
To post to this group, send email to haske...@googlegroups.com.
Visit this group at https://groups.google.com/group/haskell-fer.
For more options, visit https://groups.google.com/d/optout.



--
Bruno Gavranović 

Faculty of electrical engineering and computing | Fakultet elektrotehnike i računarstva
Zagreb, Croatia

mobile phone:  +385 91 755 8798

Bruno Gavranovic

unread,
Dec 12, 2017, 12:25:54 PM12/12/17
to haske...@googlegroups.com
Doesn't the Degenerate case take precedence? Because every degenerate triangle is either Isoceles or Scalene; them having precedence over Degenerate wouldn't really make sense.

Jasmin Zukić

unread,
Dec 12, 2017, 4:08:05 PM12/12/17
to Haskell-FER
Nikola already answered the first question. When you turn your direction, you stay in the same place.

Second question: Degenerate triangles are the most precise description of that triangle. It takes a higher priority.

Jasmin Zukić

unread,
Dec 12, 2017, 4:09:37 PM12/12/17
to Haskell-FER
I made a mistake with the Triangle. It should be data TriangleType instead of data Triangle.
Reply all
Reply to author
Forward
0 new messages