From: 7stud -- Date: 2008-01-23T05:03:30+09:00 Subject: Re: Circular shift Zangief Ief wrote: > Hello everybody, > > I would like to write a simple implementation of *circular shift* > (http://en.wikipedia.org/wiki/Circular_shift). Thank you all for any > ideas :) num = 1234 str = num.to_s(2) puts str puts arr = str.split("") arr << arr.shift puts arr.join arr[0, 0] = arr.pop puts arr.join --output:--- 10011010010 00110100101 10011010010 -- Posted via http://www.ruby-forum.com/.