Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: bug: not able to convert integer variable with to-binary

From: carl:cybercraft at: 28-May-2002 0:58

On 28-May-02, tmo wrote:
> hi. > to-binary [255] works...=> #{FF} > but when i use a integer variable, for example this: > mavar: 255 > to-binary [mavar] or to-binary [:mavar] > => it doesnt work !!! > So how can convert my integer variable into binary ?
Your problem is that the 'mavar in the block is a word, not an integer...
>> mavar: 255
== 255
>> type? first [mavar]
== word! The solution is to reduce the word...
>> type? first reduce [mavar]
== integer! So...
>> to-binary reduce [mavar]
== #{FF} -- Carl Read