typ1 * ... * typn | F#, OCaml, SML |
(typ1, ..., typn) | Haskell |
typ1, ..., typn | merd |
tuple | Python |
tuple! | Rebol |
Tuple[Typ1, Typ2, Typ3] | E |
tuple< typ1, ..., typn > | C++-0x |
a, b, c | F#, Lua, merd, OCaml, Python, Ruby |
( a, b, c ) | Ada, C++-0x, Haskell, Perl, Prolog, SML |
{ a. b. c } | Smalltalk |
{ a, b, c } | Matlab |
[ a, b, c ] | E |
a . b . c | Rebol |
(cons a b) | Common Lisp |
empty tuple
() | merd, Perl, Perl6, Python |
[] | Ruby |
{} | Matlab, Smalltalk |
#() | Smalltalk |
Nothing | Prolog |
1-uple
a or [a] | Ruby |
a, | Perl6, Python |
tuple([a]) | Python |
(a) | Perl |
((a)) | merd |
{a} | Smalltalk |
using a tuple for a function call
t | merd, Perl |
*t | Python, Ruby |
t{:} | Matlab |
f @@ t | Mathematica |
L =.. [ F | Args ], call(L) | Prolog |
creation
& | B, C, C#, C++, Go |
\ | Perl |
AddressOf | Visual Basic |
addr(1) | Pascal |
@(1) | Pascal |
lv | BCPL |
ref | C#, F#, OCaml, SML |
newSTRef | Haskell |
NewCell | Oz |
variable | Forth |
'access | Ada |
:> :>> | Pliant |
'' | Maple |
dereference
*(2) | B, C, C#, C++, Go |
$ @ % &(2) | Perl |
->[...] ->{...} ->(...)(3) | Perl |
->(4) | C, C++ |
^(3) | Modula-3, Pascal |
!(2) | F#, OCaml, SML |
rv | BCPL |
readSTRef | Haskell |
Access | Oz |
.[all] | Ada |
@ | Forth |
eval | Maple |
(reg) | Assembler |
assigning (when dereferencing doesn't give a lvalue)
writeSTRef | Haskell |
Assign | Oz |
:= | F#, OCaml, SML |
! | Forth |
null value
0(5) | C++, Forth |
0 nullptr(5) | C++-0x |
NULL | C, Maple, SQL92 |
nil | Common Lisp, Emacs Lisp, Io, Lua, Objective-C, Ruby, Smalltalk |
null | C#, CoffeeScript, Java, JavaScript |
Null(6) | Ada, Mathematica |
undef | Perl |
None | F#, OCaml, Python |
NONE | SML |
Nothing | Haskell |
Void | Eiffel |
#f () | Emacs Lisp |
(empty) / ~ / null | YAML |
value
v | Ada, C#, CoffeeScript, Common Lisp, Eiffel, Emacs Lisp, Java, JavaScript, Lua, Perl, Perl, Python, Ruby, Scheme, Smalltalk |
*v(5) | C, C++ |
Just v | Haskell |
Some v | F#, OCaml |
SOME v | SML |
type name
option | F#, OCaml, SML |
Maybe | Haskell |
null coalescing
COALESCE | SQL92 |
?: | PHP |
|| | JavaScript, Perl, Ruby |
//(7) | Perl |
?? | C# |
if(a, b) | Visual Basic |
or | Python, Scheme |
type declaration
struct { typ1 n1; typ2 n2; ... } | C, C++ |
type typ = { n1 : typ1; n2 : typ2 } | OCaml, SML |
data Typ = N0 { n1, n2 :: typ1, n3 :: typ3, ... } | Haskell |
type Typ is record N1 : Typ1; N2 : Typ2 := default_val; ... end record; | Ada |
type typ struct{ n1 typ1; n2 typ2; } | Go |
selector
. | Ada, Beta, C, C#, C++, CoffeeScript, E, Eiffel, F#, Go, Java, JavaScript, Lua, Matlab, Modula-2, Modula-3, OCaml, Oz, Pascal, Python, Ruby |
:: | XPath |
% | Fortran90 |
'(8) | Ada |
^ | Mercury |
r { field } | merd |
r:field | Pliant |
field r | Haskell |
-> | C, C++ |
r[field] | Maple |
r["field"] | JavaScript |
#field r | SML |
normal function call | Common Lisp, Dylan, Haskell, Io, Smalltalk |
union { typ1 n1; typ2 n2; ... } | C, C++ |
data Typ = N1 typ1 | N2 typ2 | ... | Haskell |
type typ = N1 of typ1 | N2 of typ2 | ... | OCaml |
datatype typ = N1 of typ1 | N2 of typ2 | ... | SML |
type Typ (Choice : Discrete_Type) is record case Choice is when Choice_1 => N1 : Typ1; ... when Choice_2 | Choice_3 => ... when others => ... end case; end record; | Ada |
enum typ { n1; n2; ... }(9) | C, C#, C++, Java |
Enum typ n1 n2 End Enum | Visual Basic |
(n1, n2, ...) | Pascal |
type typ is(10) | Ada |
data Typ = N1 | N2 | ... | Haskell |
type typ = N1 | N2 | ... | OCaml |
datatype typ = N1 | N2 | ... | SML |
type name
map | Go, YAML |
Map | F#, Io |
std::map | C++ |
dict | Python |
Dictionary | Pliant, Smalltalk |
dictionary | Vimscript |
Hash | Perl6, Ruby |
HASH | Perl |
HASH_TABLE | Eiffel |
HashTable | Java |
Hashtbl | F# |
Hashtbl.t | OCaml |
struct | Matlab |
table | Maple |
array | PHP |
Data.Map, Data.HashTable | Haskell |
Containers.Ordered_Maps.Map | Ada |
constructor
[ a => b, c => d ] | E |
array( a => b, c => d ) | PHP |
{ a => b, c => d } | Perl, Perl6, Ruby |
{ a, b, c, d } | Perl, Ruby |
{ a: b, c: d } | CoffeeScript, JavaScript, Python, Vimscript, YAML |
{ a: b; c: d } | CSS |
$[ a: b, c: d ] | YCP |
{ a->b. c->d } | Squeak |
{ a = b, c = d } | Lua |
@{ a = b; c = d } | MSH |
([ a:b, c:d ]) | Pike |
([a]=b [c]=d) | KornShell |
<< a b c d >> | PostScript |
struct(a, b, c, d) | Matlab |
Hash[ a, b, c, d ] | Ruby |
Map.of_list [a, b; c, d] | F# |
Hashtbl.of_list [a, b; c, d] | F# |
table([a=b, c=d]) | Maple |
define table foo a => b; c => d end | Dylan |
dict create a b c d | Tcl8.5 |
new t { {a, b}, {c, d} } | C# |
fromList | Haskell |
[NSDictionary dictionaryWithObjectsAndKeys:b, a, d, c, nil] | Objective-C |
a: b c: d | YAML |
map[typ0]typ1{ a: b, c: d } | Go |
access: read/write
h[k] | Awk, C#, C++, CoffeeScript, Dylan, E, Go, JavaScript, Lua, Maple, MSH, PHP, Python, Ruby, Vimscript |
$h{k} | Perl |
%h{k} or %h<s> | Perl6 |
h(k) | Tcl |
h.[k] | F# |
h.k | CoffeeScript, JavaScript, Lua, Matlab |
h:k | Pliant |
h["k"] or h->k | Pike |
(gethash k h) | Common Lisp |
access: read
h k get | PostScript |
find | F#, OCaml |
fetch | Ruby |
get | Java |
dict get | Tcl8.5 |
at | Io, Smalltalk |
h@k or h.at(k) | Eiffel |
h[k]:default | YCP |
${h[k]} | KornShell |
h.get(k, returned_value_when_k_unfound) | Python |
objectForKey | Objective-C |
lookup | Haskell |
Element | Ada |
access: write
h k o put | PostScript |
put | Eiffel, Java |
add, replace | F#, OCaml |
store | Ruby |
dict set | Tcl8.5 |
h[k] | KornShell, YCP |
atPut | Io |
h at: k put: o | Smalltalk |
[h setObject:o forKey:k] | Objective-C |
insert | Haskell |
Replace_Element | Ada |
has the key ?
exists $h{k} | Perl |
exists | Perl6, Pliant |
dict exists | Tcl8.5 |
has | Eiffel |
haskey | YCP |
hasKey | Io |
has_key | Python, Vimscript |
has_key?, include?, key?, member? | Ruby |
Contains | Ada, C#, F# |
containsKey | Java |
includesKey | Smalltalk |
k in h | CoffeeScript, JavaScript, Python |
k not in h | Python |
in | Awk |
mem | F#, OCaml |
member | Haskell |
isfield | Matlab |
find(11) | C++ |
h[k] | Pike |
(gethash k h) | Common Lisp |
maps | E |
known | PostScript |
isset(h[k]), array_key_exists(k, h) | PHP |
v, exists := h[k] | Go |
remove by key
delete $h{k} | Perl |
del h[k] | Python |
unset(h[k]) | PHP |
remove | Eiffel, F#, Java, OCaml, YCP |
Remove | C#, F# |
dict remove | Tcl8.5 |
removeAt | Io |
removeKey | E, Smalltalk |
remhash | Common Lisp |
delete | CoffeeScript, Haskell, JavaScript, Perl6, Ruby |
Delete | Ada |
erase | C++ |
m_delete | Pike |
removeObjectForKey | Objective-C |
undef | PostScript |
rmfield | Matlab |
delete(h, k) | Go |
list of keys
keys | Haskell, Io, Maple, MSH, Perl, Perl6, Python, Ruby, Smalltalk |
dict keys | Tcl8.5 |
keySet | Java |
allKeys | Objective-C |
AllKeys | C# |
indices | Pike |
current_keys | Eiffel |
getKeys | E |
array_keys | PHP |
fieldnames | Matlab |
findall(Key, item(Key, _), Keys) | Prolog |
${!h[@]} | KornShell |
list of values
values | Io, Java, Perl, Perl6, Pike, Python, Ruby, Smalltalk |
dict values | Tcl8.5 |
getValues | E |
content | Eiffel |
array_values | PHP |
struct2cell | Matlab |
entries | Maple |
elems | Haskell |
${h[@]} | KornShell |
merge
merge(12) | Ruby |
array_merge(12) | PHP |
union(13) | Haskell |
update(12) | Python, Ruby |
putAll(12) | Java |
insert(13) | C++ |
(%h1, %h2)(12) | Perl |
inclusive .. inclusive
a .. b | Ada, E, merd, MSH, Pascal, Perl, Ruby |
a:b | Matlab |
[ a .. b ] | CoffeeScript, F#, Haskell |
to | Io, Smalltalk |
seq a b / jot - a b(14) | BourneShell, FishShell |
{a..b} | KornShell |
range | PHP |
range(from: a, to: b, by: step) | Dylan |
Range | Mathematica |
Range with | Io |
List.number A B Step | Oz |
numlist / between | Prolog |
iseq | Logo |
k, v := range h | Go |
inclusive .. exclusive
a ... b | CoffeeScript, Ruby |
a ..! b | E |
range | Python |