Unicode variable names: Difference between revisions

From Rosetta Code
Content added Content deleted
(Common lisp)
(More depth on Tcl solution)
Line 1: Line 1:
{{task}}
{{task|Unicode}}
# Describe, and give a pointer to documentation on your languages use of characters ''beyond'' those of the ASCII character set in the naming of variables.
# Describe, and give a pointer to documentation on your languages use of characters ''beyond'' those of the ASCII character set in the naming of variables.
# Show how to:
# Show how to:
Line 12: Line 12:
The earlier version of AutoHotkey (AutoHotkey Basic) will produce an error since it doesn't support Unicode. It is perfectly working in AutoHotkey_L Unicode (Lexikos Custom Build).
The earlier version of AutoHotkey (AutoHotkey Basic) will produce an error since it doesn't support Unicode. It is perfectly working in AutoHotkey_L Unicode (Lexikos Custom Build).
Documentation: http://www.autohotkey.net/~Lexikos/AutoHotkey_L/docs/Variables.htm
Documentation: http://www.autohotkey.net/~Lexikos/AutoHotkey_L/docs/Variables.htm

{{works with|AutoHotkey_L}}
{{works with|AutoHotkey_L}}

<lang ahk>Δ = 1
<lang ahk>Δ = 1
Δ++
Δ++
Line 22: Line 20:
C has limited support for Unicode in variable names, see Annex D of the [http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf C standard].
C has limited support for Unicode in variable names, see Annex D of the [http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf C standard].


=={{header|C sharp}}==
=={{header|C sharp|C#}}==
Section 2.4.2 of the [http://go.microsoft.com/fwlink/?LinkId=199552 C# Language Specification] gives rules for identifiers. They correspond exactly to those recommended by the [http://unicode.org/reports/tr31/ Unicode Standard Annex 31], except that underscore is allowed as an initial character (as is traditional in the C programming language), Unicode escape sequences are permitted in identifiers, and the "@" character is allowed as a prefix to enable keywords to be used as identifiers.
Section 2.4.2 of the [http://go.microsoft.com/fwlink/?LinkId=199552 C# Language Specification] gives rules for identifiers. They correspond exactly to those recommended by the [http://unicode.org/reports/tr31/ Unicode Standard Annex 31], except that underscore is allowed as an initial character (as is traditional in the C programming language), Unicode escape sequences are permitted in identifiers, and the "@" character is allowed as a prefix to enable keywords to be used as identifiers.
<lang csharp>class Program
<lang csharp>class Program
Line 33: Line 31:
}
}
}</lang>
}</lang>
{{out}}
Output:
<pre>2</pre>
<pre>2</pre>


=={{header|Common Lisp}}==
=={{header|Common Lisp}}==

<lang lisp>(let ((Δ 1))
<lang lisp>(let ((Δ 1))
(incf Δ))</lang>
(incf Δ))</lang>
{{out}}
Output:
<pre>2</pre>
<pre>2</pre>


Line 58: Line 55:
code points >= \u00A0 and < \uD800,
code points >= \u00A0 and < \uD800,
code points > \uDFFF.
code points > \uDFFF.

However, the following cannot be used:
However, the following cannot be used:
\u0024 ($),
\u0024 ($),
\u0040 (@) and
\u0040 (@) and
\u0060 (`).
\u0060 (`).

See:
See:
http://www.prowiki.org/wiki4d/wiki.cgi?DanielKeep/TextInD
http://www.prowiki.org/wiki4d/wiki.cgi?DanielKeep/TextInD
Line 96: Line 91:
=={{header|Forth}}==
=={{header|Forth}}==
Historically, Forth has worked only in ASCII (going so far as to reserve the eighth bit for symbol smudging), but some more modern implementations have extended character set support such as UTF-8.
Historically, Forth has worked only in ASCII (going so far as to reserve the eighth bit for symbol smudging), but some more modern implementations have extended character set support such as UTF-8.

{{works with|GNU Forth}} 0.7.0
{{works with|GNU Forth}} 0.7.0

<lang forth>variable ∆
<lang forth>variable ∆
5 ∆ !
5 ∆ !
Line 114: Line 107:
fmt.Println(Δ)
fmt.Println(Δ)
}</lang>
}</lang>
{{out}}
Output:
<pre>
<pre>
2
2
Line 123: Line 116:


Also, Haskell does not allow mutable variables, so incrementing delta isn't possible. Instead lower case psi was used to store the incremented value of delta since tridents are cool.
Also, Haskell does not allow mutable variables, so incrementing delta isn't possible. Instead lower case psi was used to store the incremented value of delta since tridents are cool.

<lang Haskell>main = print ψ
<lang Haskell>main = print ψ
where δΔ = 1
where δΔ = 1
Line 143: Line 135:
Δ++;
Δ++;
System.out.println(Δ);</lang>
System.out.println(Δ);</lang>
{{out}}
Output:
<pre>
<pre>
2
2
Line 149: Line 141:


=={{header|Lua}}==
=={{header|Lua}}==
<lang Lua>
<lang Lua>local unicode = {}
local unicode = {}
unicode["Für"] = "for"
unicode["Für"] = "for"
print(unicode["Für"])
print(unicode["Für"])
Line 158: Line 149:


unicode["∆"]=1
unicode["∆"]=1
print(unicode["∆"])
print(unicode["∆"])</lang>

</lang>


=={{header|Mathematica}}==
=={{header|Mathematica}}==
Line 175: Line 164:
Requires Perl 5.8.1 at the minimum.
Requires Perl 5.8.1 at the minimum.
See http://perldoc.perl.org/utf8.html
See http://perldoc.perl.org/utf8.html

<lang perl>use utf8;
<lang perl>use utf8;
my $Δ = 1;
my $Δ = 1;
$Δ++;
$Δ++;
print $Δ;</lang>
print $Δ;</lang>

One can have Unicode in identifier names, but not in package/class or subroutine names. While some limited functionality towards this does exist as of Perl 5.8.0, that is more accidental than designed; use of Unicode for the said purposes is unsupported.
One can have Unicode in identifier names, but not in package/class or subroutine names. While some limited functionality towards this does exist as of Perl 5.8.0, that is more accidental than designed; use of Unicode for the said purposes is unsupported.


Line 189: Line 176:


See Perl 6 Synopsis 02. - http://perlcabal.org/syn/S02.html#Names
See Perl 6 Synopsis 02. - http://perlcabal.org/syn/S02.html#Names

<lang perl6>my $Δ = 1;
<lang perl6>my $Δ = 1;
$Δ++;
$Δ++;
say $Δ;</lang>
say $Δ;</lang>

Function and subroutine names can also use Unicode characters: (as can methods, classes, packages, whatever...)
Function and subroutine names can also use Unicode characters: (as can methods, classes, packages, whatever...)

<lang perl6>my @ᐁ = (0, 45, 60, 90);
<lang perl6>my @ᐁ = (0, 45, 60, 90);


Line 220: Line 204:
UTF-8 uses ASCII values for bytes which can be represented as ASCII and as result it's possible to insert <code>&lt;?php</code> mark at beginning. PHP sees your document as some 8-bit encoding (like ISO-8859-1), but it doesn't matter because UTF-8 doesn't use ASCII ranges for its values and calls to the variable are consistent.
UTF-8 uses ASCII values for bytes which can be represented as ASCII and as result it's possible to insert <code>&lt;?php</code> mark at beginning. PHP sees your document as some 8-bit encoding (like ISO-8859-1), but it doesn't matter because UTF-8 doesn't use ASCII ranges for its values and calls to the variable are consistent.


Documentation: [http://php.net/manual/en/mbstring.php4.req.php http://php.net/manual/en/mbstring.php4.req.php], [http://php.net/manual/en/language.variables.basics.php http://php.net/manual/en/language.variables.basics.php]
Documentation: [http://php.net/manual/en/mbstring.php4.req.php mbstring.php4.req], [http://php.net/manual/en/language.variables.basics.php language.variables.basics]

<lang php><?php
<lang php><?php
$Δ = 1;
$Δ = 1;
Line 235: Line 218:
<@ ACTICRVAR>Δ</@>
<@ ACTICRVAR>Δ</@>
<@ SAYVAR>Δ</@></lang>
<@ SAYVAR>Δ</@></lang>

Using what Google Translate says is the Traditional Chinese for 'delta'
Using what Google Translate says is the Traditional Chinese for 'delta'
<lang protium><@ LETVARLIT>三角洲|1</@>
<lang protium><@ LETVARLIT>三角洲|1</@>
Line 247: Line 229:


Identifiers are unlimited in length. Case is significant.
Identifiers are unlimited in length. Case is significant.

<lang python>>>> Δx = 1
<lang python>>>> Δx = 1
>>> Δx += 1
>>> Δx += 1
Line 256: Line 237:
=={{header|Retro}}==
=={{header|Retro}}==
This has been tested on Retro 11.0 running under OS X.
This has been tested on Retro 11.0 running under OS X.

<lang Retro>variable Δ
<lang Retro>variable Δ
1 !Δ
1 !Δ
Line 262: Line 242:
1 +Δ
1 +Δ
@Δ putn</lang>
@Δ putn</lang>

Function and variable names are stored as strings, and UTF-8 is usable, as long as the host system allows it.
Function and variable names are stored as strings, and UTF-8 is usable, as long as the host system allows it.


Line 274: Line 253:


The next example uses a magic comment to select the Big5 encoding. Then it creates a local variable named Δ.
The next example uses a magic comment to select the Big5 encoding. Then it creates a local variable named Δ.

{{works with|Ruby|1.9}}
{{works with|Ruby|1.9}}
<lang ruby># -*- coding: big5 -*-
<lang ruby># -*- coding: big5 -*-
Line 285: Line 263:
00000020 20 2b 3d 20 31 0a 70 75 74 73 20 a3 47 0a | += 1.puts Δ.|
00000020 20 2b 3d 20 31 0a 70 75 74 73 20 a3 47 0a | += 1.puts Δ.|
0000002e</pre>
0000002e</pre>

The output is <code>2</code>.
The output is <code>2</code>.

One can also use the non-ASCII characters in a method name. The next example selects the EUC-JP encoding, and creates a method named ≦, with a parameter named ♯♭♪. Because ≦ is an ordinary method, not an operator, so the program must use a dot to call the method.
One can also use the non-ASCII characters in a method name. The next example selects the EUC-JP encoding, and creates a method named ≦, with a parameter named ♯♭♪. Because ≦ is an ordinary method, not an operator, so the program must use a dot to call the method.

{{works with|Ruby|1.9}}
{{works with|Ruby|1.9}}
<lang ruby># -*- coding: euc-jp -*-
<lang ruby># -*- coding: euc-jp -*-
Line 304: Line 279:
(±5.last.≦ ∞),
(±5.last.≦ ∞),
(∞.≦ ∞)]</lang>
(∞.≦ ∞)]</lang>

<pre>00000000 23 20 2d 2a 2d 20 63 6f 64 69 6e 67 3a 20 65 75 |# -*- coding: eu|
<pre>00000000 23 20 2d 2a 2d 20 63 6f 64 69 6e 67 3a 20 65 75 |# -*- coding: eu|
00000010 63 2d 6a 70 20 2d 2a 2d 0a 0a 63 6c 61 73 73 20 |c-jp -*-..class |
00000010 63 2d 6a 70 20 2d 2a 2d 0a 0a 63 6c 61 73 73 20 |c-jp -*-..class |
Line 318: Line 292:
000000b0 e7 29 5d 0a |)].|
000000b0 e7 29 5d 0a |)].|
000000b4</pre>
000000b4</pre>

The output is <code>[true, true, true]</code> because the numbers -5, 5 and infinity are all less than or equal to infinity.
The output is <code>[true, true, true]</code> because the numbers -5, 5 and infinity are all less than or equal to infinity.


=={{header|Tcl}}==
=={{header|Tcl}}==
Tcl variable names can include any character (the <code>$var</code> syntax can't, but that's just a shorthand). Thus, this script is entirely legal:
Tcl variable names can include any character <!-- but the <tt>::</tt> sequence is special — it is the namespace separator — and there are restrictions when parentheses are involved, as they are used for associative arrays; these are not matters that are in the spirit of this task though, so this is a comment! --> (the <code>$var</code> syntax can't, but that's just a shorthand for the operationally-equivalent <code>[set var]</code>). Thus, this script is entirely legal:
<lang tcl>set Δx 1
<lang tcl>set Δx 1
incr Δx
incr Δx
puts [set Δx]</lang>
puts [set Δx]</lang>
However, this script only works smoothly if the “<tt>Δ</tt>” character is in the system's default encoding (thankfully more common than it used to be, as more and more systems use UTF-8 or UTF-16 as their default encodings) so normal Tcl practice is to stick to ASCII for identifier names.
However, this script only works smoothly if the “<tt>Δ</tt>” character is in the system's default encoding (thankfully more common than it used to be, as more and more systems use UTF-8 or UTF-16 as their default encodings) so normal Tcl practice is to stick to ASCII for identifier names.

It is also possible to encode characters using a <tt>\u''XXXX''</tt> substitution (each <tt>''X''</tt> is a hexadecimal digit), thus the <code>Δx</code> could be replaced throughout above by <code>\u0394x</code>; the result is a variable with exactly the same name as before. Doing this allows a script to be written with just ASCII characters, which tends to maximize portability across platforms.


{{omit from|AWK}}
{{omit from|AWK}}
Line 340: Line 315:
{{omit from|UNIX Shell}}
{{omit from|UNIX Shell}}
{{omit from|ZX Spectrum Basic}}
{{omit from|ZX Spectrum Basic}}

[[Category:Unicode]]

Revision as of 09:20, 24 February 2012

Task
Unicode variable names
You are encouraged to solve this task according to the task description, using any language you may know.
  1. Describe, and give a pointer to documentation on your languages use of characters beyond those of the ASCII character set in the naming of variables.
  2. Show how to:
  • Set a variable with a name including the 'Δ', (delta character), to 1
  • Increment it
  • Print its value.
Cf.

AutoHotkey

The earlier version of AutoHotkey (AutoHotkey Basic) will produce an error since it doesn't support Unicode. It is perfectly working in AutoHotkey_L Unicode (Lexikos Custom Build). Documentation: http://www.autohotkey.net/~Lexikos/AutoHotkey_L/docs/Variables.htm

Works with: AutoHotkey_L

<lang ahk>Δ = 1 Δ++ MsgBox, % Δ</lang>

C

C has limited support for Unicode in variable names, see Annex D of the C standard.

C#

Section 2.4.2 of the C# Language Specification gives rules for identifiers. They correspond exactly to those recommended by the Unicode Standard Annex 31, except that underscore is allowed as an initial character (as is traditional in the C programming language), Unicode escape sequences are permitted in identifiers, and the "@" character is allowed as a prefix to enable keywords to be used as identifiers. <lang csharp>class Program {

   static void Main()
   {
       var Δ = 1;
       Δ++;
       System.Console.WriteLine(Δ);        
   }

}</lang>

Output:
2

Common Lisp

<lang lisp>(let ((Δ 1))

 (incf Δ))</lang>
Output:
2

D

D source files support four character encodings: ASCII, UTF-8, UTF-16 and UTF-32. <lang d>import std.stdio;

void main() {

   auto Δ = 1;
   Δ++;
   writeln(Δ);

}</lang> You can use any of the following:

   Letters,
   digits,
   underscore (_),
   code points >= \u00A0 and < \uD800,
   code points > \uDFFF.

However, the following cannot be used:

   \u0024 ($),
   \u0040 (@) and
   \u0060 (`).

See: http://www.prowiki.org/wiki4d/wiki.cgi?DanielKeep/TextInD

Delphi

For more information about naming identifiers (including variables) visit: Identifiers in Delphi <lang Delphi>(* Compiled with Delphi XE *) program UnicodeVariableName;

{$APPTYPE CONSOLE}

uses

 SysUtils;

var

 Δ: Integer;

begin

 Δ:= 1;
 Inc(Δ);
 Writeln(Δ);
 Readln;

end.</lang>

DWScript

<lang Delphi>var Δ : Integer;

Δ := 1; Inc(Δ); PrintLn(Δ);</lang>

Forth

Historically, Forth has worked only in ASCII (going so far as to reserve the eighth bit for symbol smudging), but some more modern implementations have extended character set support such as UTF-8.

Works with: GNU Forth

0.7.0

<lang forth>variable ∆ 5 ∆ ! ∆ @ .</lang>

Go

Go source encoding is specified to be UTF-8. Allowable variable names are specified in the sections identifiers and Exported identifiers. <lang go>package main

import "fmt"

func main() {

   Δ := 1
   Δ++
   fmt.Println(Δ)

}</lang>

Output:
2

Haskell

Haskell variables must start with a lower case character, however Δ is an upper case delta. As such, lower case delta (δ) was used as the first character instead, followed by an upper case delta as the second character in the variable name.

Also, Haskell does not allow mutable variables, so incrementing delta isn't possible. Instead lower case psi was used to store the incremented value of delta since tridents are cool. <lang Haskell>main = print ψ

   where δΔ = 1
         ψ = δΔ + 1</lang>

J

Variable names must be comprised of ASCII characters.

From the Dictionary page Alphabet and Words:

"The alphabet is standard ASCII, comprising digits, letters (of the English alphabet), the underline (used in names and numbers), ..."
"Names ... begin with a letter and may continue with letters, underlines, and digits."

Java

<lang java>int Δ = 1; double π = 3.141592; String 你好 = "hello"; Δ++; System.out.println(Δ);</lang>

Output:
2

Lua

<lang Lua>local unicode = {} unicode["Für"] = "for" print(unicode["Für"])

unicode["garçon"] = "boy" print(unicode["garçon"])

unicode["∆"]=1 print(unicode["∆"])</lang>

Mathematica

<lang Mathematica>Δ = 1; Δ++; Print[Δ]</lang>

PARI/GP

GP accepts only ASCII in strings and variable names.

PARI supports Unicode variable names only insofar as C does.

Perl

Requires Perl 5.8.1 at the minimum. See http://perldoc.perl.org/utf8.html <lang perl>use utf8; my $Δ = 1; $Δ++; print $Δ;</lang> One can have Unicode in identifier names, but not in package/class or subroutine names. While some limited functionality towards this does exist as of Perl 5.8.0, that is more accidental than designed; use of Unicode for the said purposes is unsupported.

One reason of this unfinishedness is its (currently) inherent unportability: since both package names and subroutine names may need to be mapped to file and directory names, the Unicode capability of the filesystem becomes important-- and there unfortunately aren't portable answers.

Perl 6

Perl 6 is written in Unicode so, with narrow restrictions, nearly any Unicode letter can be used in identifiers.

See Perl 6 Synopsis 02. - http://perlcabal.org/syn/S02.html#Names <lang perl6>my $Δ = 1; $Δ++; say $Δ;</lang> Function and subroutine names can also use Unicode characters: (as can methods, classes, packages, whatever...) <lang perl6>my @ᐁ = (0, 45, 60, 90);

sub π { pi };

sub postfix:<°>($degrees) { $degrees * π / 180 };

for @ᐁ -> $ಠ_ಠ { say sin $ಠ_ಠ° };</lang>

PicoLisp

Variables are usually Internal Symbols, and their names may contain any UTF-8 character except null-bytes. White space, and 11 special characters (see the reference) must be escaped with a backslash. Transient Symbols are often used as variables too, they follow the syntax of strings in other languages. <lang PicoLisp>: (setq Δ 1) -> 1

Δ

-> 1

(inc 'Δ)

-> 2

Δ

-> 2</lang>

PHP

PHP is not made to support Unicode. UTF-16 (UCS-2) will not work because it adds null bytes before or after ASCII characters (depending on endianness of UTF-16). As every code has to start with <?php (ASCII) exactly, the parser doesn't find the match and just prints <?php mark.

UTF-8 uses ASCII values for bytes which can be represented as ASCII and as result it's possible to insert <?php mark at beginning. PHP sees your document as some 8-bit encoding (like ISO-8859-1), but it doesn't matter because UTF-8 doesn't use ASCII ranges for its values and calls to the variable are consistent.

Documentation: mbstring.php4.req, language.variables.basics <lang php><?php $Δ = 1; ++$Δ; echo $Δ;</lang>

Protium

This example is incomplete. Please ensure that it meets all task requirements and remove this message.

1. (working on it)

2. <lang protium><@ LETVARLIT>Δ|1</@> <@ ACTICRVAR>Δ</@> <@ SAYVAR>Δ</@></lang> Using what Google Translate says is the Traditional Chinese for 'delta' <lang protium><@ LETVARLIT>三角洲|1</@> <@ ACTICRVAR>三角洲</@> <@ SAYVAR>三角洲</@></lang>

Python

Within the ASCII range (U+0001..U+007F), the valid characters for identifiers are the same as in Python 2.x: the uppercase and lowercase letters A through Z, the underscore _ and, except for the first character, the digits 0 through 9.

Python 3.0 introduces additional characters from outside the ASCII range (see PEP 3131). For these characters, the classification uses the version of the Unicode Character Database as included in the unicodedata module.

Identifiers are unlimited in length. Case is significant. <lang python>>>> Δx = 1 >>> Δx += 1 >>> print(Δx) 2 >>> </lang>

Retro

This has been tested on Retro 11.0 running under OS X. <lang Retro>variable Δ 1 !Δ @Δ putn 1 +Δ @Δ putn</lang> Function and variable names are stored as strings, and UTF-8 is usable, as long as the host system allows it.

Ruby

This task requires Ruby 1.9. Multilingualization, or m17n, is a major new feature of Ruby 1.9. With m17n, the identifiers can use the non-ASCII characters. Ruby is a Code Set Independent (CSI) language, so there are many different character encodings.

  1. Any non-ASCII characters require a magic comment to select the encoding.
  2. Ruby source code must be ASCII compatible. For example, SJIS and UTF-8 are ASCII compatible, but ISO-2022-JP and UTF-16LE are not compatible. So one can write the source file in UTF-8, but not in UTF-16LE.

A more complete reference is The design and implementation of Ruby M17N.

The next example uses a magic comment to select the Big5 encoding. Then it creates a local variable named Δ.

Works with: Ruby version 1.9

<lang ruby># -*- coding: big5 -*- Δ = 1 Δ += 1 puts Δ</lang>

00000000  23 20 2d 2a 2d 20 63 6f  64 69 6e 67 3a 20 62 69  |# -*- coding: bi|
00000010  67 35 20 2d 2a 2d 0a a3  47 20 3d 20 31 0a a3 47  |g5 -*-.Δ = 1.Δ|
00000020  20 2b 3d 20 31 0a 70 75  74 73 20 a3 47 0a        | += 1.puts Δ.|
0000002e

The output is 2. One can also use the non-ASCII characters in a method name. The next example selects the EUC-JP encoding, and creates a method named ≦, with a parameter named ♯♭♪. Because ≦ is an ordinary method, not an operator, so the program must use a dot to call the method.

Works with: Ruby version 1.9

<lang ruby># -*- coding: euc-jp -*-

class Numeric

 def ≦(♯♭♪)
   self <= ♯♭♪
 end

end

∞ = Float::INFINITY ±5 = [-5, 5] p [(±5.first.≦ ∞),

  (±5.last.≦ ∞),
  (∞.≦ ∞)]</lang>
00000000  23 20 2d 2a 2d 20 63 6f  64 69 6e 67 3a 20 65 75  |# -*- coding: eu|
00000010  63 2d 6a 70 20 2d 2a 2d  0a 0a 63 6c 61 73 73 20  |c-jp -*-..class |
00000020  4e 75 6d 65 72 69 63 0a  20 20 64 65 66 20 a1 e5  |Numeric.  def ≦|
00000030  28 a2 f4 a2 f5 a2 f6 29  0a 20 20 20 20 73 65 6c  |(♯♭♪).    sel|
00000040  66 20 3c 3d 20 a2 f4 a2  f5 a2 f6 0a 20 20 65 6e  |f <= ♯♭♪.  en|
00000050  64 0a 65 6e 64 0a 0a a1  e7 20 3d 20 46 6c 6f 61  |d.end..∞ = Floa|
00000060  74 3a 3a 49 4e 46 49 4e  49 54 59 0a a1 de 35 20  |t::INFINITY.±5 |
00000070  3d 20 5b 2d 35 2c 20 35  5d 0a 70 20 5b 28 a1 de  |= [-5, 5].p [(±|
00000080  35 2e 66 69 72 73 74 2e  a1 e5 20 a1 e7 29 2c 0a  |5.first.≦ ∞),.|
00000090  20 20 20 28 a1 de 35 2e  6c 61 73 74 2e a1 e5 20  |   (±5.last.≦ |
000000a0  a1 e7 29 2c 0a 20 20 20  28 a1 e7 2e a1 e5 20 a1  |∞),.   (∞.≦ |
000000b0  e7 29 5d 0a                                       |)].|
000000b4

The output is [true, true, true] because the numbers -5, 5 and infinity are all less than or equal to infinity.

Tcl

Tcl variable names can include any character (the $var syntax can't, but that's just a shorthand for the operationally-equivalent [set var]). Thus, this script is entirely legal: <lang tcl>set Δx 1 incr Δx puts [set Δx]</lang> However, this script only works smoothly if the “Δ” character is in the system's default encoding (thankfully more common than it used to be, as more and more systems use UTF-8 or UTF-16 as their default encodings) so normal Tcl practice is to stick to ASCII for identifier names.

It is also possible to encode characters using a \uXXXX substitution (each X is a hexadecimal digit), thus the Δx could be replaced throughout above by \u0394x; the result is a variable with exactly the same name as before. Doing this allows a script to be written with just ASCII characters, which tends to maximize portability across platforms.