Decode: Difference between revisions

Jump to navigation Jump to search
11 bytes added ,  05:46, 9 July 2020
no edit summary
No edit summary
No edit summary
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{Built-in|Decode|⊥}}, also called '''Base''', is a [[dyadic]] [[primitive function]] which evaluates the right [[argument]] in terms of the radix system defined by the left argument. Some implementations add [[monadic]] usage to this function, where the left argument defaults to the [[scalar]] 2. Decode is the [[inverse]] of [[Encode]] <source lang=apl inline>⊤</source> with the same left argument X, when X is a non-[[scalar]] array and the right argument is a valid representation of a number in the radix system defined by X.
{{Built-in|Decode|⊥}}, also called '''Base''', is a [[dyadic]] [[primitive function]] which evaluates the right [[argument]] in terms of the radix system defined by the left argument. Some implementations add [[monadic]] usage to this function, where the left argument defaults to the [[scalar]] 2. Decode is the [[inverse]] of [[Encode]] <source lang=apl inline>⊤</source> with the same left argument X, when X is a [[vector]] and the right argument is a valid representation of a number in the radix system defined by X.


== APL model ==
== APL model ==
Line 79: Line 79:
</source>
</source>


Decode has an important property with array [[index]]: Given an arbitrary array A with [[shape]] S, the index of an [[element]] in A can be decoded with S to obtain the corresponding index in the [[ravel]] of A. Decoding all indices given by [[Index Generator]] shows the ravel order of the elements of an array with the given shape. Note that <source lang=apl inline>⎕IO←0</source> is required for this to hold.
Decode has an important property with array [[index]]: Given an arbitrary array A with [[shape]] S, the index of an [[element]] in A can be decoded with S to obtain the corresponding index in the [[ravel]] of A. Decoding all indices given by [[Index Generator]] shows the ravel order of the elements of an array with the given shape. Note that [[index origin]] 0 (<source lang=apl inline>⎕IO←0</source>) is required for this to hold.


<source lang=apl>
<source lang=apl>
trusted
183

edits

Navigation menu