Re: binary representation + operators

2010-03-13 Thread Scott
java to the rescue! Thanks to all for your suggestions Scott On Mar 13, 3:45 pm, Michał Marczyk wrote: > On 12 March 2010 23:26, Scott wrote: > > > How do I write a function 'bit' that converts an integer to binary > > representation: > > > (bit 0) -> 2r0 > > (bit 1) -> 2r1 > > (bit 2) -> 2r10

Re: binary representation + operators

2010-03-13 Thread Michał Marczyk
On 12 March 2010 23:26, Scott wrote: > How do I write a function 'bit' that converts an integer to binary > representation: > > (bit 0) -> 2r0 > (bit 1) -> 2r1 > (bit 2) -> 2r10 > (bit 3) -> 2r11 I understand that you want a way to obtain a string representation of a number in binary. I think you

Re: binary representation + operators

2010-03-12 Thread Brendan Ribera
Yes, yes - that's what I mean. Things get a little muddled on Friday afternoon. The reader converts the representation, and there's not a fast/easy way to get the original representation back and manipulate it. On Mar 12, 2010, at 4:53 PM, Kevin Downey wrote: uh, you are confusing represe

Re: binary representation + operators

2010-03-12 Thread Kevin Downey
uh, you are confusing representation of the thing with the thing. Integers don't have bases, bases are used when displaying them. The reader does not convert a "2r0" to a "base-10 Integer value" because there is no such thing. On Fri, Mar 12, 2010 at 4:23 PM, Brendan Ribera wrote: > Whenever you

Re: binary representation + operators

2010-03-12 Thread Brendan Ribera
Whenever you use the "2r0" format, the reader automatically converts it to its base-10 Integer value. This transformation happens at the reader level right now -- check out the 'matchNumber' method in LispReader.java for details. So (as far as I can tell) this means that there is no standalone bina