[Haskell-cafe] Binary code
Valentin Gjorgjioski
valentin.gjorgjioski at ijs.si
Mon Nov 27 19:39:40 EST 2006
On 28.11.2006 01:20 J. Garrett Morris wrote:
> Hello,
>
> First, and forgive me if I'm making unwarranted assumptions, but
> http://haskell.org/haskellwiki/Homework_help might be useful.
>
> Second: div, mod, reverse, and the unfoldr function from Data.List
> will do what you want.
>
> /g
>
> On 11/25/06, escafia <escafia at gmail.com> wrote:
>>
>> Hi,
>>
>> i've one fuction receiving an int . The objective is return the
>> respective
>> binary code of that int.
>>
>> For example, if i receive 28 the fuction will return 011100.
>>
So, if it is really homework, and looks like, here is the start
binary :: Int->[Int]
binary 0 = [0]
binary x = binary....
div and mod are enough for start :)
More information about the Haskell-Cafe
mailing list