System Function DR

From NARS2000
Revision as of 03:48, 8 May 2008 by Sudleyplace (talk | contribs) (New page: ==Monadic Function== <table border="1" cellpadding="5" cellspacing="0" rules="none" summary=""> <tr> <td> <table border="0" cellpadding="5" cellspacing="0" summary=""> <tr> ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Monadic Function

Z←⎕DR R returns the data representation of R.
R is an arbitrary array.
Z is a numeric scalar which represents the datatype of R.


The datatypes are encoded with a unique index in the low-order two digits, and the bits per element in the remaining digits:

  • Boolean: 100, one bit per element
  • Character: 1601, 16 bits per element
  • Integer: 6402, 64 bits per element
  • Floating Point: 6403, 64 bits per element (double precision)
  • Arithmetic Progression Array: 6404 64 bits each for the offset and multiplier
  • Heterogeneous: 3208, 32 bits per element (each is a pointer)
  • Nested: 3210, 32 bits per element (each is a pointer)

For example,

      ⎕DR 2 100⍴1
100
      ⎕dr ⌈/⍬
6403


Dyadic Function

Z←L ⎕DR R converts R to the datatype indicated by L.
R is an arbitrary array.
L is an integer scalar datatype (see the table above).
Z is R where each of the values are converted to the datatype indicated by L.


For example,

      1601 ⎕dr 65 49
A1