Range: Difference between revisions

Jump to navigation Jump to search
63 bytes added ,  22:18, 10 September 2022
m
Text replacement - "</source>" to "</syntaxhighlight>"
m (Text replacement - "<source" to "<syntaxhighlight")
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
Line 1: Line 1:
:''This page is about the dyadic primitive function. "Range" refers to [[Unique]] in K and [[Index Generator]] in BQN.''
:''This page is about the dyadic primitive function. "Range" refers to [[Unique]] in K and [[Index Generator]] in BQN.''


{{Built-ins|Range|…|..}} or '''Sequence''' is a [[dyadic]] [[primitive function]] which creates a [[vector]] of consecutive integers based on the start and end values given by its [[argument|arguments]]. It serves as an [[index origin]]-agnostic alternative to [[Index Generator]] for creating a range of numbers. Range is currently implemented in [[NARS2000]] (using the digraph <syntaxhighlight lang=apl inline>..</source>), [[Extended Dyalog APL]], and [[dzaima/APL]].
{{Built-ins|Range|…|..}} or '''Sequence''' is a [[dyadic]] [[primitive function]] which creates a [[vector]] of consecutive integers based on the start and end values given by its [[argument|arguments]]. It serves as an [[index origin]]-agnostic alternative to [[Index Generator]] for creating a range of numbers. Range is currently implemented in [[NARS2000]] (using the digraph <syntaxhighlight lang=apl inline>..</syntaxhighlight>), [[Extended Dyalog APL]], and [[dzaima/APL]].


== Basic usage ==
== Basic usage ==
Line 14: Line 14:
       5…¯5
       5…¯5
5 4 3 2 1 0 ¯1 ¯2 ¯3 ¯4 ¯5
5 4 3 2 1 0 ¯1 ¯2 ¯3 ¯4 ¯5
</source>{{Works in|[[NARS2000]], [[Extended Dyalog APL]], [[dzaima/APL]]}}
</syntaxhighlight>{{Works in|[[NARS2000]], [[Extended Dyalog APL]], [[dzaima/APL]]}}


It should be noted that, since the exact definition of Range has never been standardised, a different implementation might as well choose to return <syntaxhighlight lang=apl inline>⍬</source> or even throw a [[DOMAIN ERROR]] for <syntaxhighlight lang=apl inline>X…Y</source> when <syntaxhighlight lang=apl inline>X>Y</source>.
It should be noted that, since the exact definition of Range has never been standardised, a different implementation might as well choose to return <syntaxhighlight lang=apl inline>⍬</syntaxhighlight> or even throw a [[DOMAIN ERROR]] for <syntaxhighlight lang=apl inline>X…Y</syntaxhighlight> when <syntaxhighlight lang=apl inline>X>Y</syntaxhighlight>.


== Extensions ==
== Extensions ==
Line 43: Line 43:
│2 7│2 5│2 3│
│2 7│2 5│2 3│
└───┴───┴───┘
└───┴───┴───┘
</source>{{Works in|[[NARS2000]]}}
</syntaxhighlight>{{Works in|[[NARS2000]]}}


In [[Extended Dyalog APL]], the extension is focused on making it easier to produce integer or character vector constants:
In [[Extended Dyalog APL]], the extension is focused on making it easier to produce integer or character vector constants:
Line 52: Line 52:
       'a'…'zA'…'Z'
       'a'…'zA'…'Z'
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
</source>{{Works in|[[Extended Dyalog APL]]}}
</syntaxhighlight>{{Works in|[[Extended Dyalog APL]]}}


== External links ==
== External links ==

Navigation menu