was my bug... I wanted to parenthesize full left of ,:

a better version of brx (just converts integers above 2^31)

brxinv =: ([: (x: inv ^:([: (+./^:_) 9223372036854775809 >: |)^:(64 = 3!:0) 
(L:0)^:IF64) (3!:2)) 
  
brx =: (1 (3!:1) x:^:([: (+./^:_) 2147483647 <: |)^:(4 = 3!:0) (L:0)) :. brxinv 




----- Original Message -----
From: 'Pascal Jasmin' via Programming <[email protected]>
To: Programming forum <[email protected]>
Cc: 
Sent: Tuesday, April 21, 2015 4:16 PM
Subject: [Jprogramming] :. puzzle (bug?)



brxinv =: ([: (x: inv :: ] (L:0)^:IF64) (3!:2)) 

brx =: 1 (3!:1) x: :: ] (L:0) :. brxinv

intent is to get portable 32bit representation of non-extended data

on 64 bit machine, brx looks right (ie :. rightside looks the same)

brx 
(1) 3!:1 x: ::]L:0 :.([: (x:^:_1 ::]L:0^:1) 3!:2) 
brxinv 
[: (x:^:_1 ::]L:0^:1) 3!:2 


  brxinv brx 'asdf'; (i.2 3);89192739123719823 
┌────┬─────┬─────────────────┐ 
│asdf│0 1 2│89192739123719823│ 
│    │3 4 5│                 │ 
└────┴─────┴─────────────────┘but

  brx inv brx 'asdf'; (i.2 3);89192739123719823 
|domain error 
|       brx inv brx'asdf';(i.2 3);89192739123719823
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to