MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re:list of bits to string

  • To: mathgroup at
  • Subject: [mg28701] Re:[mg28688] list of bits to string
  • From: Ranko Bojanic <bojanic at>
  • Date: Thu, 10 May 2001 07:54:46 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Murray Eisenberg <murray at> wrote in [mg28688]:
>I have a list consisting of binary digits,of a given length,e.g.,{0,1,1,0,1}.
>I wish to convert this to a _string_ consisting of those digits:"01101".
>How can this be done?

There will be probably many answers to this question. Here is one:

g[{x_,y_,z___}] :=  { StringJoin[ToString[x], ToString[y]], z }
f[ lst_ ]:=Nest[g, lst, Length[lst]-1]

lst = {0,1,1,0,1}


Ranko Bojanic
bojanic at

  • Prev by Date: Permutations
  • Next by Date: RE: Auto Recalculation
  • Previous by thread: Re: list of bits to string
  • Next by thread: Re: list of bits to string