[Haskell-beginners] haskell Time

Brent Yorgey byorgey at gmail.com
Mon Dec 1 16:16:17 UTC 2014


Hi Claudia,

It sounds like you will find the mod and div functions helpful.  div does
integer division, that is, it rounds down to the nearest integer.  mod
gives the remainder after doing division.

For example:

  (58 + 33) `div` 60 = 1
  (58 + 33) `mod` 60 = 33

-Brent

On Mon, Dec 1, 2014 at 10:21 AM, Claudia Weber <kaetheweber at freenet.de>
wrote:

> Hi guys,
>
>
>
> I'm  new to Haskell and I'm just trying out some easy functions right now,
> but I'm having some trouble here..
>
>
>
> I want to display a clock
>
>
>
> type Time = (Int, Int)
>
>
>
> (hoursx,minutesy) x ={0,1,...,23} y={0,1,...,59} where I can add hours and
> minutes or set back time.
>
> If its 23,58 for example and I want to add 35 minutes, the clock has to
> set to 0,33 not 24,23.
>
>
>
> Because I'm just getting started with Haskell, I have nooo idea what to do.
>
> Would be great if someone could help me out with this :)
>
>
>
>
> ---
> Alle Postfächer an einem Ort Jetzt wechseln und E-Mail-Adresse mitnehmen! Rundum
> glücklich mit freenetMail <http://email.freenet.de/basic/Informationen>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20141201/330cf4b6/attachment.html>


More information about the Beginners mailing list