hi again another haskell question for you. with this one im quite lost and dont even know if this is how you do it
anyway this is the question i have:
Write a function that takes as input a time as an integer number of seconds after midnight and
converts it to the number of hours, minutes and seconds written as a triple: (hours,
minutes, seconds). Call your function time.
For example, time 50004 should evaluate to (13, 53, 24).
and this is the code that i have written so far please dont laugh....
CODE
type Settings = (Int, Int, Int) -- (hours, Minutes, Seconds)
time :: Int -> Settings
time (_,_,x) = x/360
time (_,x,_) = (x `mod` 360)/60
time (x,_,_) = (x `mod` 60)
i would normally have a week to go over this and try and work it out more myself but i have my grandfathers funeral to go to on thursday so if you could point me in the right direction or even somewere that explains triples better than my teacher does that would be great.
also on a side note is there any easy way of finding out how many digits are in a number without using recursive x/10?
This post has been edited by hellhound: 10 Aug, 2009 - 06:34 PM