Decode: Difference between revisions

Jump to navigation Jump to search
18 bytes added ,  22:17, 24 May 2021
m
Changed NuVoc link to dyadic section of page
No edit summary
m (Changed NuVoc link to dyadic section of page)
(2 intermediate revisions by 2 users 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>
Line 106: Line 106:
* [https://help.dyalog.com/latest/#Language/Primitive%20Functions/Decode.htm Dyalog]
* [https://help.dyalog.com/latest/#Language/Primitive%20Functions/Decode.htm Dyalog]
* [http://microapl.com/apl_help/ch_020_020_660.htm APLX]
* [http://microapl.com/apl_help/ch_020_020_660.htm APLX]
* J [https://www.jsoftware.com/help/dictionary/d401.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/numberdot NuVoc] (as <source lang=j inline>#.</source>)
* J [https://www.jsoftware.com/help/dictionary/d401.htm Dictionary], [https://code.jsoftware.com/wiki/Vocabulary/numberdot#dyadic NuVoc] (as <source lang=j inline>#.</source>)


{{APL built-ins}}[[Category:Primitive functions]]
{{APL built-ins}}[[Category:Primitive functions]]
11

edits

Navigation menu