Ellipsis (computer programming): Difference between revisions

Content deleted Content added
m Incomplete code: {{code}}
Zambyte (talk | contribs)
m Scheme: Added reference title
Tags: Mobile edit Mobile app edit Android app edit App section source
 
(2 intermediate revisions by 2 users not shown)
Line 13:
In [[Rust (programming language)|Rust]] the <code>..=</code> operator denotes an inclusive range for cases in matches and the <code>..</code> operator represents a range not including the end value.
 
Perl and Ruby [[Operator overloading|overload]] the ".." operator in scalar context as a [[flip-flop operator]] - a [[stateful]] [[bistability|bistable]] [[Boolean datatypedata type|Boolean]] test, roughly equivalent to "true while ''x'' but not yet ''y''", similarly to the "," operator in [[Sed (programming language)|sed]] and [[AWK programming language|AWK]].<ref>[http://perldoc.perl.org/perlop.html#Range-Operators-operator%2c-range-range-..-... perlop - perldoc.perl.org<!-- Bot generated title -->]</ref>
 
[[GNU Compiler Collection|GNU C]] compatible compilers have an extension to the C and C++ language to allow ''case ranges'' in [[switch statement]]s:
Line 95:
}
</syntaxhighlight>
 
== Scheme ==
The <code>syntax-rules</code> hygienic macro system originally introduced in [[Scheme (programming language)|R4RS]] uses <code>...</code> to specify that the proceeding pattern may be matched zero or more times. For example, the following code could be used to implement the standard <code>let*</code> form, recursively in terms of itself, and the more primitive <code>let</code>:
 
<syntaxhighlight lang="scheme">
(define-syntax let*
(syntax-rules ()
((let* () body1 body2 ...)
(let () body1 body2 ...))
((let* ((name1 val1) (name2 val2) ...) body1 body2 ...)
(let ((name1 val1))
(let* ((name2 val2) ...) body1 body2 ...)))))
</syntaxhighlight>
 
SRFI 46<ref>{{Cite web |url=https://srfi.schemers.org/srfi-46/srfi-46.html |title=SRFI 46}}</ref> was proposed to extend <code>syntax-rules</code> to allow the user to specify an ellipsis identifier. This is useful for disambiguating when ellipsis are use in nested macro definitions. This feature was later included in R7RS.
 
== Multiple dimensions ==