Looking for operator or function names? Well have a look at the following and remember using existing one may ease the transition :)
You know one language and want to find the corresponding operator or function in another language
Want to know the various ways people invented for commenting/assigning/...?
This is of course incomplete. I welcome contributions!
You may also have a look at this information sorted by languages.
until end of line
| # | Awk, E, Icon, Maple, merd, Perl, Perl6, PHP, Pliant, Python, Ruby, sh, Tcl, YAML |
| // | BCPL, C#, C++, C99, Dylan, Java, JavaScript, PHP, Pike, YCP, Yorick |
| -- | Ada, Cecil, Eiffel, Haskell, Lua, Sather, Simula, SQL92 |
| ; | Assembler, Common Lisp, Emacs Lisp, Logo, MUMPS, Rebol, Scheme |
| % | Erlang, Matlab, Mercury, Oz, PostScript, Prolog, TeX |
| rem | Basic |
| ' | Visual Basic |
| \ | Forth |
| ! | Assembler, Fortran90 |
| C or * in column 1 | Fortran |
nestable
| (* ... *) | Beta, Modula-3, OCaml, Pascal, SML |
| %( ... %) | Matlab |
| /* ... */ | Classic REXX, Dylan, Oz, SQL99 |
| { ... } | Pascal |
| {- ... -} | Haskell |
| #| ... |# | Common Lisp |
| #if 0 ... #endif | C |
| comment { ... } | Rebol |
| comment [ ... ] | Rebol |
| { ... } or [ ... ] when unused | Rebol |
| --[[ ... ]] | Lua |
non nestable
| " ... " | Smalltalk |
| /* ... */ | B, C, C#, C++, Java, JavaScript, Mercury, PHP, Pike, PL/I, YCP, Yorick |
| <!-- ... --> | HTML, XML |
| ( ... ) | Forth |
until end of line
| /// | C#, Java |
| -- | | Haskell |
| -- ^ | Haskell |
non nestable
| /** ... */ (1) | C, C#, E, Java, PHP |
| {-| ... -} | Haskell |
| (** ... *) | OCaml |
| /* DOCUMENT ... */ | Yorick |
| indexing identifier: "..."; | Eiffel |
| rebol [ Note: "..." ] | Rebol |
| func ["..." arg] ... | Rebol |
class X: """... """ def x(): """... """(2) | Python |
| (define (f para1 para2) "..." ...) | Scheme |
| (defun f (para1 para2) "..." ...) | Common Lisp, Emacs Lisp |
=pod ... =cut(3) | Perl, Perl6 |
=begin ... =end | Ruby |
function MYFUNCTION %MYFUNCTION the very first comment line is displayed in the help table of contents % % the remaining lines are displayed when getting help for MYFUNCTION % | Matlab |
| __LINE__ __FILE__ | C, C++, Perl, PHP, Pike, Ruby |
| $?LINE $?FILE | Perl6 |
| inspect.stack()[0][2] inspect.stack()[0][1] | Python |
(new System.Diagnostics.StackFrame(true)).GetFileLineNumber() (new System.Diagnostics.StackFrame(true)).GetFileName() | C# |
| system/script/header/file (4) | Rebol |
| SOURCELINE() / parse source OS . SOURCENAME | Classic REXX |
case-sensitivity (keywords, variable identifiers...)
| case-sensitive | Awk, B, C, C#, C++, Haskell, Java, JavaScript, Lua, Maple, Matlab, merd, Modula-3, OCaml, Perl, Perl6, Pike, Pliant, Prolog, Python, Ruby, sh, Smalltalk, Tcl, XML, YAML |
| case-insensitive | Ada, Assembler, Classic REXX, Common Lisp, Eiffel, Forth, HTML, Logo, Pascal, PL/I, Rebol, Scheme, SGML, SQL92, Visual Basic |
| case-sensitive: variables case-insensitive: keywords, functions, constants... | PHP |
| case-sensitive: identifiers case-insensitive: keywords | E |
| case-sensitive: identifiers case-insensitive: commands | MUMPS |
if case sensitive, what is the standard way for scrunching together multiple words
| CamelCase | C#, E, Haskell, Java, JavaScript, Pascal, Smalltalk, Tcl, Visual Basic |
| underscores | merd |
| dots | Logo |
| hyphens | Common Lisp, Emacs Lisp, Rebol |
| underscores for functions, unclear for modules / types / constructors | OCaml |
| UPPER_CASE | sh |
| lowercasenoseparator | Matlab |
| underscores, UPPER_CASE for class names | Eiffel |
| CamelCase for classes, underscores for methods | Python |
| CamelCase for types, underscores for functions, variables, ... | Pliant |
| CamelCase for modules and classes, ALL_CAPS for constants, underscores for functions, variables, ... | Ruby |
| CamelCase for modules and classes, ALLCAPS for macros, underscores for methods, constants and variables | Pike |
| CamelCase for modules, ALL_CAPS for constants, unclear for functions / variables | Perl, Perl6 |
| CamelCase for variables, underscores for predicates | Prolog |
| usually lowercase or underscores, ALL_CAPS for macros | C |
| usually underscores | C++ |
| Camel_Case | Ada |
variable identifier regexp
| [a-zA-Z][a-zA-Z0-9]* | PL/I, Smalltalk |
| [a-zA-Z][_a-zA-Z0-9]* | Eiffel, Matlab |
| [a-zA-Z](_?[a-zA-Z0-9])* | Ada |
| [_a-zA-Z][_a-zA-Z0-9]* | Awk, B, C, C#, C++, E, Maple, Perl, Perl6, PHP, Python, sh, Tcl |
| [_a-zA-Z][_a-zA-Z0-9]* or '[^']*' | Pliant |
| [_a-zA-Z$][_a-zA-Z0-9$]* | Java, JavaScript |
| [a-zA-Z%][a-zA-Z0-9]* | MUMPS |
| [_a-z][_a-zA-Z0-9]* | Ruby |
| [_a-z][_a-zA-Z0-9]*[!?']* | merd |
| [_a-z][_a-zA-Z0-9']* | Haskell, OCaml, SML |
| [_A-Z][_a-zA-Z0-9]* | Mercury, Prolog |
| [_a-zA-Z!0&*/:<=>?^][_a-zA-Z!0&*/:<=>?^0-9.+-]* | Scheme |
| [a-zA-Z!?@#][a-zA-Z0-9!?@#]* | Classic REXX |
| [_a-zA-Z?!.'+*&|=~-][_a-zA-Z0-9?!.'+*&|=~-]* or
[^0-9[](){}":;/][^ \n\t[](){}":;/]* | Rebol |
| \S+ | Forth |
function identifier regexp (if different from variable identifier regexp)
| [_a-zA-Z][_a-zA-Z0-9]*[!?]? | Ruby |
| [_a-z][_a-zA-Z0-9]* | Mercury, Prolog |
| [^ \t\n\r\f]+ | Tcl |
keyword regexp (if different from variable identifier regexp)
| [A-Z]+ | Modula-3 |
type regexp (if different from variable identifier regexp)
| [_A-Z][_a-zA-Z0-9']* | Haskell |
| [_a-z][_a-zA-Z0-9']* | Mercury, OCaml |
constant regexp (if different from variable identifier regexp)
| [A-Z][_a-zA-Z0-9]* | Ruby |
| [_A-Z][_a-zA-Z0-9']* | Haskell, OCaml |
| [_a-z][_a-zA-Z0-9']* | Mercury |
| nothing needed | Ada, B, C, C#, C++, Common Lisp, Eiffel, Emacs Lisp, Forth, Java, JavaScript, Maple, OCaml, Oz, Pascal, Perl, Perl6, PostScript, Rebol, Scheme, Smalltalk, SML, XSLT, YCP |
| \ | Awk, E, Python, Ruby, sh, Tcl |
| _ | Visual Basic |
| , | Classic REXX |
| ~ | Logo |
| ... | Matlab |
assignment
| = | Awk, B, Basic, C, C#, C++, Classic REXX, Erlang, Icon, Java, JavaScript, Lua, Matlab, Oz, Perl, Perl6, PHP, Pike, sh, YCP, Yorick |
| := | Ada, BCPL, Cecil, Dylan, E, Eiffel, Maple, Modula-3, Pascal, Pliant, Sather, Simula, Smalltalk |
| <- | OCaml |
| _ (5) | Squeak |
| : | BCPL, Rebol |
| -> (6) | Beta |
| def | PostScript |
| setq | Emacs Lisp |
| setf setq set | Common Lisp |
| set | Rebol |
| SET v=... | MUMPS |
| set! | Scheme |
| is | Prolog |
| make "v e | Logo |
declaration
| = | Haskell, Mercury, Prolog, SML |
| <- | Haskell |
| :- | Prolog |
| let v = e in | OCaml |
| let v = e | BCPL |
| def v := e / var v := e | E |
| my / our / local / use vars | Perl |
| my / our / temp | Perl6 |
| define | Dylan |
| define let let* letrec fluid-let | Scheme |
| let let* flet labels defun defmethod defvar defparameter defsetf .. | Common Lisp |
| local V1 = e V2 = e2 in ... end | Oz |
| global | Python |
| global v1 v2 | Matlab |
| :@ | Beta |
| NEW v | MUMPS |
| v: t | Ada, Eiffel, Pascal |
| | v1 v2 | | Smalltalk |
| auto v1, v2; extrn v3, v4; | B |
| var | JavaScript |
| var gvar | Pliant |
| variable v (7) | Forth |
| <xsl:variable name="v" select="e"/> | XSLT |
both
| = | merd, Python, Ruby |
| := | merd |
| set, variable | Tcl |
| ( ... ) | Ada, Awk, B, BCPL, Beta, C, C#, C++, Classic REXX, E, Eiffel, Haskell, Java, JavaScript, Logo, Lua, Maple, Matlab, merd, Modula-3, MSH, MUMPS, OCaml, Oz, Pascal, Perl, Perl6, PHP, Pike, Pliant, Prolog, Python, Rebol, Ruby, Smalltalk, SML, SQL92, Tcl, XPath, YCP, Yorick |
| [ ... ] | Rebol |
| indentation | merd |
| $ ... | Haskell |
| begin ... end | OCaml, Ruby |
| BEGIN ... END | Modula-3 |
| space (8) | merd |
| { ... } | Awk, JavaScript, PHP, Pike, sh, Tcl, Yorick |
| { ... } (9) | B, C, C#, C++, E, Haskell, Java, Modula-3, Perl, Perl6, YCP |
| ( ... ) (9) | sh |
| [ ... ] | Logo |
| [ x. y. ... ] | Smalltalk |
| begin ... end (9) | Ada, Pascal |
| do ... end | Classic REXX |
| do ... end (9) | Lua, PL/I |
| indentation | MUMPS, Pliant, Python |
| indentation (9) | Haskell, merd |
| foo ... end where foo in { if, do, ... } | Modula-2, Ruby |
| foo ... end where foo in { if, for, while, ... } | Matlab |
| foo ... end where foo in { if, loop, ... } | Eiffel |
| foo ... end foo where foo in { if, do, ... } | Ada, Fortran90 |
| (* ... *) (10) | BCPL |
| (# ... #) | Beta |
| valof | BCPL |
| do | Perl, Perl6 |
| proc() .. end proc | Maple |
shallow
| == != | Awk, B, C, C++, Java, OCaml, Perl, Perl6, Pike, Tcl, Yorick |
| = /= | Eiffel, Fortran90 |
| = <> | Logo, Maple, Pliant, Rebol |
| = # | Modula-3 |
| = != | sh |
| = <> # (11) | Modula-2 |
| == === != !== (12) | JavaScript, PHP |
| === !== | PHP5 |
| == ~= | Lua |
| == ~~ | Smalltalk |
| == ~== | Dylan |
| = '= | MUMPS |
| = ~= neqv (10) | BCPL |
| is_equal (13) | Eiffel |
| equal? | Scheme |
| eq ne | Emacs Lisp, PostScript |
| eq, eql | Common Lisp |
| eq? eqv? | Scheme |
| .EQ. .NE. | Fortran |
| is / is not | Python |
deep
| == != | Awk, C#, C++, E, merd, PHP5, Python, Ruby, YCP |
| == <> | Python |
| == /= | Haskell |
| == \= | Oz |
| == \== | Classic REXX |
| = /= | Ada |
| = != | XPath |
| = <> | Beta, OCaml, Pascal, Rebol, SML, SQL92, Visual Basic |
| = ~= | Dylan, Smalltalk |
| == ~= eq ne isequal isequalwithequalnans | Matlab |
| == \== / =@= \=@= / = \= / =:= =\= (14) | Prolog |
| .eq | Logo |
| equal? | Scheme |
| equals | Java |
| equal | Emacs Lisp |
| equal, !equal | Pike |
| equal, equalp | Common Lisp |
| deep_is_equal | Eiffel |
| isEqual | Objective-C |
| < > <= >= | Ada, Awk, Awk, B, Beta, C, C#, C++, Classic REXX, Common Lisp, Dylan, E, Eiffel, Emacs Lisp, Haskell, Java, JavaScript, Logo, Lua, Maple, Matlab, merd, Modula-3, OCaml, Pascal, Perl, Perl6, PHP, Pike, Pliant, Python, Rebol, Ruby, Scheme, Smalltalk, SML, SQL92, Tcl, Visual Basic, XPath, YCP, Yorick |
| < > =< >= | Mercury, Oz |
| < > '> '< | MUMPS |
| << >> <<= >>= (15) | Classic REXX |
| @< / @=< / @> / @>= | Prolog |
| lt gt le ge | Perl, Perl6, PostScript |
| -lt -gt -le -ge | MSH, sh |
| .LT. .GT. .LE. .GE. | Fortran |
returns 3 values (i.e. inferior, equal or superior)
| a <=> b | merd, Perl, Perl6, Ruby |
| cmp | Perl, Perl6, Python |
| compare | Haskell, Mercury, OCaml, Pliant, Prolog, Smalltalk |
| strcmp | PHP |
| three_way_comparison | Eiffel |
| string compare | Tcl |
| compareTo | Java |
returns 4 values (i.e. inferior, equal, superior or not comparable)
| compare | Pliant |
| compareTo | E |
min / max (binary or more)
| min / max | Ada, Beta, C++, Common Lisp, Dylan, E, Eiffel, Haskell, Java, Lua, Maple, Matlab, merd, OCaml, Pike, Pliant, Prolog, Python, Rebol, Scheme, Smalltalk, SQL92 |
| min minstr / max maxstr (16) | Perl |
| Min / Max | Oz |
| MIN / MAX | Classic REXX, Modula-3 |
| measure-object -min / measure-object -max | MSH |
| eval | Common Lisp, Emacs Lisp, JavaScript, Matlab, Perl, Perl6, PHP, Python, Ruby, Scheme, Tcl, YCP |
| dostring | Lua |
| Compiler evaluate: | Smalltalk |
| runtime_compile / compile + execute | Pliant |
| Compiler.evalExpression or Compiler.parseOzVirtualString | Oz |
| compile_string | Pike |
| interpret | Classic REXX |
| run | Logo |
| XECUTE | MUMPS |
| do / reduce / compose / load | Rebol |
| [...] | Tcl |
| `...` | sh |
| =.. (17) | Prolog |
| doGC | Beta |
| GC.start | Ruby |
| gc | Logo |
| gc() | Maple, Pike |
| System.gc() | Java |
| System.gcDo | Oz |
| System.GC.Collect() | C# |
| gc.collect() | Python |
| full_collect | Eiffel |
| garbage_collect | Mercury, Prolog |
| collectgarbage | Lua |
| VM.garbageCollect() | JavaScript |
| Gc.full_major() | OCaml |
| Smalltalk garbageCollect | Smalltalk |
| incremental garbage collection => not needed | Perl, Perl6 |
| recycle | Rebol |
| interp.gc() | E |
| (ext:gc) | Common Lisp |
| f(a,b,...) | Ada, Awk, Awk, B, C, C#, C++, Dylan, E, Eiffel, Erlang, Java, JavaScript, Lua, Maple, Matlab, Mercury, merd, Modula-3, Pascal, Perl, Perl6, PHP, Pike, Prolog, Python, Ruby, XPath, YCP, Yorick |
| f a b ... | Haskell, Logo, Matlab, MSH, OCaml, Pliant, Rebol, sh, SML, Tcl |
| f(a,b,...f) or f[a,b,...] depending on the version | BCPL |
| (f a b ...) (apply f l) | Scheme |
| (f a b ...) (apply f l) (funcall f a b ...) | Common Lisp, Emacs Lisp |
| {f a b} | Oz |
| f[a,b,...] or f.call(a,b,...) | Ruby |
| &$f(a,b,...) or $f->(a,b,...) | Perl |
| $f.(a,b,...) | Perl6 |
| f a, b, ... | Perl |
| f, a, b, ... (18) | Yorick |
| v = f(a, b, ...) or call f a, b, ... | Classic REXX |
| a b ... f | Forth, PostScript |
| a f | Smalltalk |
| a f: b g: ... (19) | Smalltalk |
| (a,b,...)->&f or (a,b,...)->f | Beta |
| f:a | FL |
| f:a (20) | Pliant |
| .. [ f, A, B, ...] | Prolog |
<xsl:call-template name="f">
<xsl:with-param name="a" select=a/>
<xsl:with-param name="b" select=b/>
</xsl:call-template> | XSLT |
with no parameter
| f | Ada, Eiffel, Haskell, Logo, Matlab, Mercury, MSH, Pascal, Perl, Perl6, Pliant, PostScript, Prolog, Rebol, Ruby, sh, Tcl |
| f() | Awk, C, C#, C++, E, Erlang, Java, JavaScript, Lua, Maple, Perl, Pike, Python, YCP |
| f() (21) | merd, OCaml, SML |
| (f) | Scheme |
| (f) (funcall f) | Common Lisp, Emacs Lisp |
| {f} | Oz |
| f[] or f.call | Ruby |
| &$f or $f->() | Perl |
| $f.() | Perl6 |
| v = f() or call f | Classic REXX |
| f value (22) | Smalltalk |
| <xsl:call-template name="f">/ | XSLT |
| call f | Fortran |
give the first argument
| f a | Haskell, OCaml, SML |
| f(a) | Mercury |
| f(a,) | merd |
| &f.assuming(var_name => a) | Perl6 |
| functools.partial(f, a) | Python |
give the second argument
| f(,b) | merd |
| &f.assuming(b => b) | Perl6 |
give the first argument to operator ">"
| (a >) | Haskell, merd |
| (>) a | OCaml |
give the second argument to operator ">"
| (> a) | Haskell, merd |
| sub f { ... } | Perl, Perl6 |
| sub f($para1, $para2, ...) { ... } | Perl6 |
| def f(para1, para2, ...): ... | Python |
| def f(para1, para2, ...) ... end | Ruby |
| def f(para1, para2, ...) ... { ... } | E |
| f para1 para2 = ... | Haskell |
| let f para1 para2 = ... | OCaml |
| f(para1, para2, ...) = valof $( ... $) | BCPL |
| f(para1, para2, ...) = ... | merd |
| f ... or f: para1 ... | Smalltalk |
| f: func [para1 para2 ...] ... | Rebol |
| /f { ... } def | PostScript |
| f := (para1, para2, ...) -> ... | Maple |
| func f(a, b, c...) { ... } | Yorick |
| typ0 f(typ1 para1, typ2 para2, ...) { ... } | C, C#, C++, Pike, YCP |
| function f(para1, para2) { ... } | Awk, JavaScript |
| function f(para1, para2) ... code ... end | Lua |
| function f { param(para1, [typ2]para2, ...) ... } | MSH |
| (define (f para1 para2) ...) | Scheme |
| (defun f (para1 para2) ...) | Common Lisp, Emacs Lisp |
| fun { F Para1 Para2 } ... end | Oz |
| proc f {para1 para2} { ... } | Tcl |
function retval = f(para1, para2) retval = ... | Matlab |
:- func f(typ1, typ2, ...) = typ0. f(Para1, Para2, ...) = ... | Mercury |
function f(para1 : type1; para2 : typ2; ...) return retval is begin ... end f; | Ada |
function f para1 para2 -> retval arg typ1 para1; arg typ2 para2; arg rettyp retval; ... | Pliant |
function f(para1 : typ1, para2 : typ2, ...) : retval; var retval : typ0; begin ... end | Pascal |
f (para1 : typ1; para2, para3 : typ2; ...) : rettyp is do ... end | Eiffel |
<xsl:template name="f">
<xsl:param name="para1"/>
<xsl:param name="para2"/>
...
</xsl:template> | XSLT |
| Function f(para1, para2) ... End Function | Visual Basic |
| : f ... ; | Forth |
| f() { ... } | sh |
f : procedure ... return retval | Classic REXX |
to f :para1 :para2 ... end | Logo |
procedures
procedure f(para1 : typ1, para2 : typ2); begin ... end | Pascal |
f (para1 : typ1; para2, para3 : typ2; ...) is do ... end | Eiffel |
procedure f(para1 : typ1; para2 : MODE type2; ...) is begin ... end f; MODE ::= | OUT | IN OUT | Ada |
| void f(typ1 para1, typ2 para2, ...) { ... } | C, C#, C++, Pike |
| let f(para1, para2, ...) be $( ... $) | BCPL |
| proc { F Para1 Para2 } ... end | Oz |
| f := proc(para1, para2, ...) ... end proc | Maple |
| Sub f(para1, para2) ... End Sub | Visual Basic |
function f(para1, para2) ... | Matlab |
f : procedure ... return | Classic REXX |
predicates
| f(Para1, Para2, ....) :- ... . | Prolog |
| sub { my ($a, $b) = @_; ... } | Perl |
| { my ($a, $b) = @_; ... } (23) | Perl |
| { ... } (arguments are in the stack | PostScript |
| [ ... ] | Logo |
| { param(para1, [typ2]para2, ...) ... } | MSH |
| {|a, b| ... } (24) | Ruby |
| [:a :b| ... ] | Smalltalk |
| lambda a, b: ... | Python |
| lambda(typ1 para1, typ2, para2, ...) { ... }; | Pike |
| (a, b) => ... | C#3 |
| (a, b) -> ... | Maple |
| a, b -> ... | merd |
| -> $a, $b { ... } | Perl6 |
| \a b -> ... | Haskell |
| fn (a, b) => ... | SML |
| fun a b -> ... | OCaml |
| (func(A, B) = C :- ...) | Mercury |
| function(a, b) ... | JavaScript |
| function(a, b) ... end | Lua |
| fun(a, b) -> ... end | Erlang |
| fun {$ A B} ... end (25) | Oz |
| func [a b ...] ... | Rebol |
| def _(para1, para2, ...) ... { ... } | E |
| proc {|a, b| ...} | Ruby |
| lambda {|a, b| ...} | Ruby |
| (lambda (a b) ...) | Common Lisp, Emacs Lisp, Scheme |
| inline('...x...y...') (26) | Matlab |
| method(a, b) ... end method (27) | Dylan |
| create_function(',','...') | PHP |
| delegate(ta a, tb b) { ... } | C#2 |
breaks the control flow
| return | Ada, Awk, B, C, C#, C++, Classic REXX, E, Java, JavaScript, Maple, Perl, Perl6, PHP, Pike, Pliant, Python, Rebol, Ruby, sh, Tcl, YCP, Yorick |
| return (28) | Lua |
| return (29) | Matlab |
| Return | Visual Basic |
| RETURN | Modula-3 |
| resultis / return (30) | BCPL |
| return from xxx / return | Common Lisp |
| ^ | Smalltalk |
| Exit Function / Exit Sub | Visual Basic |
| output | Logo |
function body is the result
| no syntax needed | Common Lisp, Dylan, Emacs Lisp, Erlang, Haskell, Maple, OCaml, Oz, Perl, Perl6, Rebol, Ruby, Scheme, SML |
| no syntax needed (31) | Matlab |
setting the result
| Result := val | Eiffel |
| <function name> = val | Visual Basic |
| <function name> := val | Pascal |
| <retvar name> = val; | Matlab |
| AUTOLOAD | Perl |
| AUTOSCALAR, AUTOMETH, AUTOLOAD... | Perl6 |
| __getattr__ | Python |
| method_missing | Ruby |
| doesNotUnderstand | Smalltalk |
| unknown | Tcl |
| no-applicable-method | Common Lisp |
| doesNotRecognizeSelector | Objective-C |
| match [name, args] { ... } | E |
| the predicate fail | Prolog |
| caller | Perl, Perl6, Ruby |
| inspect.stack()[1] | Python |
| backtrace | Pike |
| trace 'I' | Classic REXX |
| evalin('caller', expression) | Matlab |
| current_predicate | Prolog |
| where(2) | Maple |
| . | Haskell |
| ~ | merd |
| o | SML |
| @ | Maple |
| compose | Dylan |
| id | Haskell |
| identity | Common Lisp |
| yourself | Smalltalk |
| , | C, C++, JavaScript, Matlab, Perl, Pike, Prolog |
| . | Smalltalk |
| ; | Ada, Awk, B, Beta, C, C#, C++, E, Haskell, Java, JavaScript, Maple, Matlab, merd, Modula-3, OCaml, Pascal, Perl, Perl6, PHP, Pike, PL/I, Pliant, Python, Ruby, sh, SML, Tcl, YCP |
| : | Maple |
| nothing, optionally ; | Classic REXX, Lua |
| space | Eiffel, Rebol |
| end-of-line | Assembler, Awk, Basic, E, Fortran, Haskell, JavaScript, Lua, Matlab, merd, Pliant, Python, Ruby, sh, Tcl |
| (begin ...) | Scheme |
| (progn ...) (prog1 ...) (prog2 ...) | Common Lisp, Emacs Lisp |
| >> | Haskell |
| if c then b | merd, OCaml, Pascal |
| if c then b end | Eiffel, Lua, Oz, Ruby |
| if c then b end if | Ada, Maple |
| if c then b fi | Maple |
| if c; then b; fi | sh |
| if (c) then b end | Dylan |
| if c do b | BCPL |
| IF c THEN b END | Modula-2, Modula-3 |
| if (c) b | Awk, B, C, C#, C++, Java, JavaScript, PHP, Pike, YCP |
| if c: b | Python |
| if c b | Pliant, Rebol, Tcl |
| if (c): b endif | PHP |
| if c {b} | Perl6 |
| if c [b] | Logo |
| if (c) {b} | E, Perl, Yorick |
| IF c b | MUMPS |
| c -> b | FL |
| c b if | PostScript |
| b if c | Perl, Ruby |
| c if b1 then | Forth |
| (if c b) | Common Lisp, Scheme |
| (when c b) | Emacs Lisp |
| c ifTrue: b | Smalltalk |
| <xsl:if test="c">b</xsl:if> | XSLT |
| If c Then b | Visual Basic |
If c b End If | Visual Basic |
| if c; b end | Ruby |
| if c, b, end | Matlab |
if c b end | Matlab, Ruby |
if c then ; b if c then b if c then do b ... end | Classic REXX |
| if c then b1 else b2 | Haskell, merd, OCaml, SML |
| if c then b1 else b2 end | Eiffel, Lua, Ruby |
| if c then b1 elsif c2 then b2 else b3 end if | Ada |
| if c then b1 elseif c2 then b2 else b3 end | Eiffel, Oz |
| if (c) then b1 elseif (c2) then b2 else b3 end | Dylan |
| IF c THEN b1 ELSIF c2 THEN b2 ELSE b3 END | Modula-3 |
| If c Then b1 ElseIf c2 Then b2 Else b3 End If | Modula-2 |
| if (c) b1 else b2 | Awk, B, C, C#, C++, Java, JavaScript, Pike, YCP |
| if c ?then? b1 elsif c2 ?then? b2 ?else? b3 | Tcl |
| if c then begin b1 end else begin b2 end | Pascal |
| if c b1 eif c2 b2 else b3 | Pliant |
| if c then b1 elif c2 then b2 else b3 end if | Maple |
| if c; then b1; elif c2; then b2; else b3; fi | sh |
| if c1, b1, elseif c2, b2, else, b3, end | Matlab |
| if (c) b1 elseif (c2) b2 else b3 | PHP |
| if (c): b1 elseif (c2): b2 else: b3 endif | PHP |
| if (c) {b1} elsif (c2) {b2} else {b3} | Perl |
| if (c) {b1} else {b2} | E, Yorick |
| (if c b1 b2) | Common Lisp, Scheme |
| (if c then b1 else b2) | Mercury |
| (c -> b1 ; c2 -> b2 ; b3) | Mercury |
| c -> b1 ; b2 | FL |
| c ifTrue: b1 ifFalse: b2 | Smalltalk |
| ifelse c [b1] [b2] | Logo |
| shunt c b1 c2 b2 b3 | Pliant |
| either c b1 b2 / if/else c b1 b2 | Rebol |
| (cond (c b1) (c2 b2) (t b3)) | Common Lisp, Emacs Lisp |
| (cond (c b1) (c2 b2) (else b3)) | Scheme |
| c -> b1 ; c2 -> b2 ; b3 | Prolog |
| case when c; b1 when c2; b2 else b3 end | Ruby |
| test c then b1 or b2 | BCPL |
| e | c = b1 | c2 = b2 | otherwise = b3 (32) | Haskell |
| c b1 b2 ifelse | PostScript |
| c if b1 else b2 then | Forth |
| c ? b1 : b2 | Awk, B, C, C#, C++, Java, JavaScript, Perl, PHP, Ruby, YCP, Yorick |
| c ?? b1 :: b2 | Perl6 |
| b1 if c else b2 | Python |
| $SELECT(c:b1,c2:b2,1:b3) | MUMPS |
| c -> b1, b2 | BCPL |
| (if c then b1 else b2 fi) | Beta |
<xsl:choose>
<xsl:when test="c"> b1 </xsl:when>
<xsl:when test="c2"> b2 </xsl:when>
<xsl:otherwise> b3 </xsl:otherwise>
</xsl:choose> | XSLT |
| If c Then b1 Else b2 | Visual Basic |
If c b1 Else b2 End If | Visual Basic |
if c: b1 elif c2: b2 else: b3 | Python |
if c b1 elsif c2 b2 else b3 end | Ruby |
if c b1 elseif c2 b2 else b3 end | Matlab |
if c then ; b1 ; else ; b2 if c then b1 else b2 if c then do b1 ... end else do b2 ... end | Classic REXX |
IF c b ELSE b | MUMPS |
| unless | Emacs Lisp, Perl |
switch (val) {
case v1: expr1; break;
case v2: case v3: expr23; break;
default: expr_else;
} | C, C++, Java, JavaScript, PHP, Pike |
switch val {
case v1: expr1; goto done;
case v2: case v3: expr23; goto done;
}
expr_else;
done:
| B |
switch (val) {
case v1: expr1; break;
case v2: case v3: expr23; break;
default: expr_else; break;
} (33) | C# |
switch (val) {
match v1 { expr1 }
match v2 { expr2 }
match _ { expr_else }
} | E |
switchon val case v1: expr1 case v2: expr2 default: expr_else | BCPL |
switch val
case v1
expr1
case {v2,v3}
expr2
otherwise
expr3
end | Matlab |
case val of v1 : expr1; v2, v3 : expr23 else expr_else end | Pascal |
case val in v1) statement1 ;; v2|v3) statement23 ;; *) statement_else ;; esac | sh |
(if val
// v1 then expr1
// v2 then expr2
else expr_else
if) | Beta |
match val with | v1 -> expr1 | v2 | v3 -> expr23 | _ -> expr_else | OCaml |
case val of v1 => expr1 | v2 => expr2 | _ => expr_else | SML |
CASE val OF v1 => expr1 | v2 => expr2 ELSE => expr_else END | Modula-3 |
case val of v1 -> expr1 v2 -> expr2 _ -> expr_else | Haskell |
val. v1 -> expr1 v2 -> expr2 _ -> expr_else | merd |
(case val ((v1) expr1) ((v2) expr2) (otherwise expr_else)) | Common Lisp |
(case val ((v1) expr1) ((v2) expr2) (else expr_else)) | Scheme |
case val is when v1 => expr1 when v2 | v3 => expr23 when others => expr_else end case; | Ada |
case val when v1; expr1 when v2, v3; expr23 else expr_else end | Ruby |
inspect val when v1 then statement1 when v2, v3 => statement23 else statement_else end | Eiffel |
select (val); when (v1) statement1; when (v2, v3) statement23; otherwise statement_else; end; | PL/I |
X = val, (X = v1, expr1 ; X = v2, expr2 ; expr_else) | Mercury, Prolog |
my %case = (
v1 => sub { expr1 },
v2 => sub { expr2 },
);
if ($case{val}) { $case{val}->() } else { expr_else } | Perl |
use Switch;
switch ($val) {
case v1 { expr1 }
case v2 { expr2 }
else expr_else
}) (34) | Perl |
given $val {
when v1 { expr1 }
when v2 { expr2 }
default { expr_else }
} | Perl6 |
Select val
Case v1
expr1
Case v2, v3
expr2
Case Else
expr_else
End Select | Visual Basic |
switch (val) {
v1 { expr1 }
v2 { expr2 }
default { expr_else }
} | MSH |
switch val [
v1 [expr1]
v2 [expr2]
]
switch/default [
v1 [expr1]
v2 [expr2]
][expr_else] | Rebol |
| val caseOf: {[v1]->[expr1]. [v2]->[expr2]} otherwise: expr_else | Squeak |
select when v1 expr1 when v2 | v3 expr23 otherwise expr_else end | Classic REXX |
CASE val
WHEN v1 THEN expr1
WHEN v2 THEN expr2
ELSE expr_else
END | SQL92 |
forever loop
| loop | merd, PostScript, Ruby |
| loop expr end loop | Ada |
| LOOP expr END | Modula-3 |
| (loop do expr) | Common Lisp |
| cycle (# do ... #) | Beta |
| repeat | Squeak |
| forever | Logo, Rebol |
Do
expr
Loop | Visual Basic |
do forever ... end | Classic REXX |
while condition do something
| while (cond) expr | Awk, B, C, C#, C++, E, Java, JavaScript, Perl, Perl6, PHP, Pike, Python, Ruby, YCP, Yorick |
| while cond expr | Tcl |
| while cond loop expr end loop | Ada |
| while cond do expr | BCPL, Pascal, SML |
| while cond do expr done | OCaml |
| while cond do expr end do | Maple |
| WHILE cond DO expr end | Lua |
| while cond; do expr; done | sh |
| while cond, expr, end | Matlab |
| while [cond][expr] | Rebol |
| while cond [expr] | Logo |
| do.while [expr] cond | Logo |
| cond whileTrue: expr | Smalltalk |
| (loop while cond do expr) | Common Lisp |
| loop (# while ::< (# do cond -> value #) do expr #) | Beta |
| begin cond while expr repeat | Forth |
| from until not cond loop expr end | Eiffel |
while cond
expr | Pliant |
Do While cond
expr
Loop | Visual Basic |
do while cond ... end | Classic REXX |
do something until condition
| do expr until cond | Perl6 |
| do {expr} until cond | Perl |
| do {expr} while (!cond) | Awk, C, C#, C++, Java, JavaScript, Pike, Yorick |
| begin expr end until cond | Ruby |
| REPEAT expr UNTIL cond | Modula-3 |
| loop (# until ::< (# do cond -> value #) do expr #) | Beta |
| loop expr exit when cond end loop | Ada |
| (loop do expr until cond) | Common Lisp |
| expr repeatuntil cond | BCPL |
| repeat expr until cond | Lua, Pascal |
| repeat expr until (35) | YCP |
| repeat, expr, cond | Prolog |
| until [expr cond] | Rebol |
| until cond [expr] | Logo |
| do.while [expr] cond | Logo |
| [expr . cond] whileFalse | Squeak |
Do expr Loop Until cond | Visual Basic |
for each value in a numeric range, 1 increment (see also the entries about ranges)
| for (int i = 1; i <= 10; i++) expr | C, C# |
| foreach my $i (1 .. 10) { expr } | Perl |
| foreach ($i in 1..10) { expr } | MSH |
| for (1 .. 10) -> $i { expr } | Perl6 |
| for i = 1:10, expr, end | Matlab |
| for i := 1 to 10 do expr | Pascal |
| for i = 1 to 10 do expr done | OCaml |
| For i = 1 To 10 expr Next | Visual Basic |
| for i in 1 .. 10 loop ... end loop | Ada |
| for i in range(1, 11) | Python |
| for i in `seq 1 10`; do expr; done | sh |
| FOR I=1:1:10 expr | MUMPS |
| for i from 1 to 10 do expr end do | Maple |
| for [i 1 10 +1] [expr] | Logo |
| 1 1 10 expr for | PostScript |
| (1..10).each {|i| expr } | Ruby |
| 1.upto(10) {|i| expr } | Ruby |
do i = 1 for 10 ... end | Classic REXX |
for each value in a numeric range, 1 decrement
| for X := 10 downto 1 do expr | Pascal |
| for i = 10 downto 1 do expr done | OCaml |
| for i in reverse 1 .. 10 loop ... end loop | Ada |
| for (int i = 10; i >= 1; i--) expr | C, C# |
| for (my $i = 10; $i >= 1; $i--) { expr } | Perl |
| loop (my $i = 10; $i >= 1; $i--) { expr } | Perl6 |
| from i := 10 until i < 1 loop expr i := i - 1 end | Eiffel |
| for i = 10:-1:1, expr, end | Matlab |
| for i in range(10, 0, -1) | Python |
| for i in `seq 10 -1 1`; do expr; done | sh |
| for i from 10 to 1 by -1 do expr end do | Maple |
| for [i 1 10 -1] [expr] | Logo |
| FOR I=10:-1:1 expr | MUMPS |
| 10 -1 1 expr for | PostScript |
| 10.downto(1) {|i| expr } | Ruby |
do i = 10 to 1 by -1 ... end | Classic REXX |
for each value in a numeric range, free increment
| for (int i = 1; i <= 10; i += 2) expr | C, C#, Pike |
| for (i = 1; i <= 10; i += 2) expr | Awk |
| for (my $i = 1; $i <= 10; $i += 2) { expr } | Perl |
| loop (my $i = 1; $i <= 10; $i += 2) { expr } | Perl6 |
| from i := 1 until i > 10 loop expr i := i + 2 end | Eiffel |
| for i = 1:3:10, expr, end | Matlab |
| for i in range(1, 11, 2) | Python |
| for ((x = 1; x <= 10; x += 2)); do ...; done | sh |
| for i from 1 to 10 by 2 do expr end do | Maple |
| for [i 1 10 2] [expr] | Logo |
| FOR I=1:2:10 expr | MUMPS |
| 1 2 10 expr for | PostScript |
| (1..10).step(2) {|i| expr } | Ruby |
do i = 1 to 10 by 2 ... end | Classic REXX |
for "a la C" (while + initialisation)
| for | Awk, C, C#, C++, Java, JavaScript, MSH, Perl, PHP, Pike, Tcl, Yorick |
| loop | Perl6 |
| for ((x = 0; x < 10; x++)); do ...; done | sh |
| from init_code until cond loop ... incr_statement end | Eiffel |
returning a value
| return | Ada, Awk, B, C, C#, C++, Classic REXX, E, Java, JavaScript, Maple, Perl, Perl6, PHP, Pike, Pliant, Python, Rebol, Ruby, sh, Tcl, YCP, Yorick |
| return (28) | Lua |
| return (29) | Matlab |
| Return | Visual Basic |
| RETURN | Modula-3 |
| resultis / return (30) | BCPL |
| return from xxx / return | Common Lisp |
| ^ | Smalltalk |
| Exit Function / Exit Sub | Visual Basic |
| output | Logo |
goto (unconditional jump)
| goto | Ada, B, Basic, BCPL, C, C#, C++, Cobol, Fortran, Logo, MUMPS, Pascal, Perl, Yorick |
| go throw | Common Lisp |
| signal | Classic REXX |
continue / break
| continue / break | Awk, C, C#, C++, E, Java, JavaScript, Matlab, PHP, Pike, Python, YCP, Yorick |
| next / last | Perl, Perl6 |
| next / break | Maple |
| next / break (36) | Ruby |
| / break | BCPL, Lua |
| / break/return | Rebol |
| / exit | Ada, PostScript |
| / stop | Logo |
| restart / leave | Beta, Pliant |
| / Exit Do, Exit For | Visual Basic |
| / return from xxx or return | Common Lisp |
| iterate / leave | Classic REXX |
redo / retry
| redo/ | Perl, Perl6 |
| redo / retry | Ruby |
throwing
| raise | Ada, Eiffel, merd, OCaml, Python, Ruby, Scheme-SRFI34, SML |
| RAISE | Modula-3 |
| raise ... end | Oz |
| throw | C#, C++, E, Erlang, Haskell, Java, JavaScript, Logo, Pike, Prolog, Rebol |
| throw/name | Rebol |
| die | Perl, Perl6 |
| return -code | Tcl |
| error | Common Lisp, Dylan, Emacs Lisp, Lua, Lua, Maple, Matlab, Pliant |
| signal | Common Lisp, Dylan, Smalltalk |
| signal predefined_condition_name | Classic REXX |
| cerror warn | Common Lisp |
| [NSException raise:name ...] | Objective-C |
catching
| try: a except exn: b | Python |
| try a with exn -> b | OCaml |
| try a catch (exn) b | C#, C++, Java, JavaScript |
| try a catch exn then b end | Oz |
| try a catch exn: b end try | Maple |
| try { a CATCH exn { b } } | Perl6 |
| TRY a EXCEPT exn => b END | Modula-3 |
| a handle exn => b | SML |
| a on: exception_name do: [:exn | b] | Smalltalk |
| ifCurtailed | Smalltalk |
| rescue | Eiffel, Ruby |
| eval {a}; if ($@) b | Perl |
| exception when exception_name => | Ada |
| catch a (\exn -> b) | Haskell |
| catch | Erlang, Logo, Prolog, Rebol, Tcl |
| catch/name | Rebol |
| catch(expr) or catch { ... }; | Pike |
| pcall | Lua |
| with-exception-handler or guard | Scheme-SRFI34 |
| block a exception(exn) b end | Dylan |
| ?, shy, safe | Pliant |
| handler-bind handler-case ignore-errors | Common Lisp |
| NS_DURING a NS_HANDLER b NS_ENDHANDLER | Objective-C |
try a catch b end | Matlab |
signal on predefined_condition_name ... predefined_condition_name : ... | Classic REXX |
cleanup: code executed before leaving
| ensure | Ruby, Smalltalk |
| finally | C#, Java, Maple, Python |
| FINALLY | Modula-3 |
| unwind-protect | Common Lisp, Emacs Lisp |
| cleanup | Dylan |
| dynamic-wind | Scheme |
retrying: after catching an exception, tell the snippet to be re-run
| retry | Eiffel, Ruby, Smalltalk |
| restart | Dylan |
| continue | Python |
resume execution where the exception took place
| resume | Smalltalk |
| call-with-current-continuation (37) | Scheme |
| callcc | Ruby, SML-NJ |
| typedef t n | C, C++, Pike |
| type n is t | Ada |
| type n ... | Pliant |
| type n = t | Haskell, OCaml, Pascal, SML |
| TYPE n = t | Modula-3 |
| using n = ... | C# |
| data n = t | Haskell |
| datatype n = t | SML |
| newtype n = t | Haskell |
| n = t | merd |
| n : t | Beta |
| (deftype n () 't) | Common Lisp |
| : | Ada, E, Eiffel, Modula-3, OCaml, SML |
| :: | Dylan, Haskell, Mercury |
| !! | merd |
| t v | C, C#, C++, Java, Perl6, Pike, Pliant, YCP |
| (declare (v t)) | Common Lisp |
| v :@ t | Beta |
upcast
| (t) e | C, C#, C++, Java, PHP |
| t(e) | Ada, Pascal |
| [t] e | Pike |
| static_cast<t>(e) | C++ |
| e :> t | OCaml |
| CAST(e as t) | SQL92 |
| typecast(e,t) | Matlab |
downcast (need runtime checking)
| (t) e | Java |
| t(e) | Ada |
| e : t | E |
| [t] e | Pike |
| dynamic_cast<t>(e) | C++ |
| e as t | C# |
| v ?= e (38) | Eiffel |
| NARROW(e, t) | Modula-3 |
| typecast(e,t) | Matlab |
computed conversion (calls an internal or a user-defined function)
| (t) e | C++, Pike |
| [t] e | MSH |
| t(e) | C++, Matlab |
| e : t | E |
| cast e t | Pliant |
| expr cast t | Pliant |
| make t e / to t e | Rebol |
type of a mutable value
| it is the default | Ada, C, C#, C++, Java, Matlab |
| val x: T | Pascal |
| T ref | OCaml, SML |
| STRef a T | Haskell |
type of a constant value
| const T | C++, C99 |
| constant T | Ada |
| const x: T | Pascal |
| it is the default | Haskell, OCaml, SML |
special cases
| "readonly" fields (39) | C# |
| "final" fields, parameters, local variables (39) | Java |
| object.method(para) | Beta, C#, C++, Cecil, Delphi-Kylix, E, Eiffel, Icon, Java, JavaScript, merd, Modula-3, MSH, Perl6, Python, Ruby, Sather, Visual Basic |
| object#method para | OCaml |
| object:method(para) | Lua |
| object method para | Pliant, Tcl |
| object method: para1 method_continuation: para2 | Smalltalk |
| object <- method(para) (40) | E |
| [ object method: para ] | Objective-C |
| object->method(para) | C++, Perl, PHP, Pike |
| object["method"](para) | Pike |
| object/method para | Rebol |
| method object para | Haskell, Mercury |
| (method object para) | Common Lisp |
| method(object, para) | Ada, Dylan, Matlab |
| para->method | Beta |
| (send object method para) | MzScheme |
with no parameter
| object.method | Eiffel, merd, Perl6, Ruby |
| object.property (41) | C# |
| object.method() | C#, C++, E, Java, JavaScript, Python |
| object#method | OCaml |
| object:method | Pliant |
| object->method | Perl |
| object->method() | Pike |
| object/method | Rebol |
| object["method"]() | Pike |
| object method | Smalltalk |
| [ object method ] | Objective-C |
| method object | Haskell, Mercury |
| (method object) | Common Lisp |
| method(object) | Ada, Dylan, Matlab |
| (send object method) | MzScheme |
| new | Ada, PHP, Pliant, Simula |
| new class_name(...) | C#, C++, Java, JavaScript, Perl, Visual Basic |
| new class_name ... | OCaml |
| class_name.new(...) | Perl6, Ruby |
| class_name new | Smalltalk |
| class_name(...) | Matlab, Pike, Python |
| class_name v(...) | C++ |
| class_name.Create | Delphi-Kylix |
| !class_name!constructor_name(...) | Eiffel |
| & | Beta |
| make-object | MzScheme |
| (make-instance class_name ...) | Common Lisp |
| [class_name alloc] | Objective-C |
| make class_name! ... | Rebol |
| def object_name { ... } | E |
| o.clone | Perl6 |
| o.clone (42) | Eiffel, Ruby |
| o.deep_clone | Eiffel |
| o.clone() | Java |
| o.Clone() | C# |
| clone / copy or deepCopy | Smalltalk |
| dclone | Perl |
| [o copy] | Objective-C |
| copy.copy(o) (43) | Python |
| purecopy | Emacs Lisp |
| {< >} or Oo.copy o | OCaml |
| o2 = o (44) | C++, Matlab, PHP |
| o2.all := o.all | Ada |
| make o [] | Rebol |
| delete | C++, JavaScript |
| destroy | Pike |
| DESTROY | Perl |
| dealloc | Objective-C |
| Dispose | C# |
| __del__ | Python |
| Requires instantiation of Ada.Unchecked_Deallocation | Ada |
| class | C#, C++, Haskell, Java, Matlab, MzScheme, OCaml, Perl6, PHP, Pike, Python, Ruby |
| class c inherit p1 p2 ... feature decl decl ... end | Eiffel |
| defclass defstruct | Common Lisp |
| subclass | Smalltalk |
| type | Pliant |
| type c is tagged record ... end record | Ada |
| @interface c { ... } ... @end | Objective-C |
| : | Beta |
| isa | Matlab, Perl |
| is_a? kind_of? | Ruby |
| o.meta.isa | Perl6 |
| isKindOf | Smalltalk |
| isKindOfClass | Objective-C |
| dynamic_cast | C++ |
| instanceof | Java, JavaScript |
| isinstance | Python |
| in | Ada |
| is | C# |
| is_a | PHP |
| Program.inherits or Program.implements | Pike |
| entry_type | Pliant |
| typep | Common Lisp |
| ISTYPE | Modula-3 |
| object## < classname## | Beta |
| type.accepts(object) / object =~ v : type | E |
| var ?= val (45) | Eiffel |
| class | Matlab, Objective-C, Ruby, Smalltalk |
| __class__ | Python |
| getClass | Java |
| typeid | C++ |
| typeof | C#, JavaScript |
| type-of | Common Lisp |
| ref | Perl |
| generator | Eiffel |
| meta | Perl6 |
| object_program | Pike |
| getAllegedType | E |
| methods | Matlab, Ruby |
| get_class_methods | PHP |
| getMethods | Java |
| get-member | MSH |
| indices | Pike |
| o.meta.getmethods | Perl6 |
| o.__class__.__dict__ (46) | Python |
| o class selectors / o class allSelectors | Smalltalk |
| o.__getAllegedType().getMessageTypes() | E |
| child :< parent | Beta |
| class child : parent | C#, C++ |
| class child < parent end | Ruby |
| class child is parent { ... } | Perl6 |
| class child extends parent | Java |
| class child(parent): | Python |
| class child inherit parent end | Eiffel |
| parent subclass: child | Smalltalk |
| make parent ... | Rebol |
| inherit | OCaml, Pike |
| def child extends makeSuperObject(parent, ...) { ... } | E |
| type child is new parent with record ... end record | Ada |
| (defclass child (parent) ...) | Common Lisp |
| @interface child : parent { ... } ... @end | Objective-C |
| @ISA = qw(parent1 parent2) | Perl |
| can | Perl, Perl6 |
| respond_to? | Ruby |
| respondsTo | E, Smalltalk |
| respondsToSelector | Objective-C |
| hasattr(obj, "meth") (47) | Python |
| object->method | Pike |
| all [in object 'method function? get in object 'method] | Rebol |
| find-method | Common Lisp |
| ismethod | Matlab |
| this | Beta, C#, C++, Java, JavaScript, PHP, Pike |
| THIS | Simula |
| self | Objective-C, Rebol, Ruby, Smalltalk |
| object_name if defined as: def object_name { ... } | E |
| Current | Eiffel |
| first parameter | Matlab, Perl, Pliant, Python |
| first parameter (48) | Python |
| dispatching parameter | Ada, Common Lisp |
| Me | Visual Basic |
| . | Perl6 |
| super | E, Java, Objective-C, Ruby, Smalltalk |
| super(Class, self).meth(args) | Python |
| base | C# |
| Precursor | Eiffel |
| $o.SUPER::method(...) | Perl6 |
| $o->SUPER::method(...) | Perl |
| method(parent(dispatching-parameter)) | Ada |
| call-next-method | Common Lisp |
| inner | Beta |
| . | Ada, C#, E, Haskell, Java, Modula-3, OCaml, Pascal, Python, Ruby, SML |
| : | XML |
| :: | C++, merd, Perl, Tcl, YCP |
| : :: (49) | Common Lisp |
| :- | Maple |
| ' | Perl |
| __ | Mercury |
| / | Matlab |
| package p; | Java, Perl |
| namespace p { ... } | C#, C++ |
| module p where ... | Haskell |
| module P ... end | Ruby |
| module P = struct ... end | OCaml |
| { module "p"; ... } | YCP |
| :- module(p) | Prolog |
| p = module() ... end module | Maple |
| (defpackage p ...) | Common Lisp |
| automatically done based on the file name | OCaml, Python |
| package declare (50) | Matlab |
| <node xmlns="namespace"> ... </node> | XML |
package p is -- Declare public package members here private -- Declare private package members here end p; package body p is ... -- Define package implementation here end p; | Ada |
selective export
| module p (name1, name2, ...) where ... | Haskell |
| @ISA = qw(Exporter); @EXPORT = qw(name1 name2 ...); | Perl |
| package p is ... end; package body p is ... end; | Ada |
| p = module() export name1, name2, ...; ... end module | Maple |
| (export 'name1 'name2) | Common Lisp |
| attached to each name (public, private...) | Java, Pike |
| append_features | Ruby |
module type PType = sig val name1 : type1 ... end module P : PType = struct ... end | OCaml |
| all files in package directory are exported. files in /private sub-directory are not exported, but can be used by the package itself | Matlab |
everything into current namespace
| use p (51) | Perl |
| uses p | Pascal |
| using p | C# |
| using namespace p; | C++ |
| (use-package 'p) | Common Lisp |
| open p | OCaml |
| import | Pike |
| import p | Haskell |
| IMPORT p; | Modula-2 |
| import p.* | Java |
| import "p" | YCP |
| from p import * | Python |
| with p; use p; | Ada |
| with(p) | Maple |
| inherit c export {NONE} all end | Eiffel |
| include or even extend | Ruby |
| do | Rebol |
| addpath | Matlab |
selectively
| import p (name1, name2, ...) | Haskell |
| import p.name1; import p.name2 | Java |
| (import '(p:name1 p:name2)) | Common Lisp |
| use p qw(name1 name2 ...) | Perl |
| from p import name1, name2, ... | Python |
| FROM p IMPORT name1, name2, ...; | Modula-2 |
| using p::name1; using p::name2; ... | C++ |
| with p; use type p.type1; ... | Ada |
| with(p[name1, name2,]) | Maple |
| def name := <import:p.name> | E |
| :- use_module(name1, name2, ...) | Prolog |
package (ie. load the package)
| import p | Python |
| use p; (52) | Perl |
| require p | Perl |
| require "p" | Ruby |
| require, "p" | Yorick |
| (require 'p) (53) | Common Lisp |
| with p; | Ada |
| automatically done (54) | Java, OCaml |
| char[] | C |
| char const[] | C++ |
| string | C#, C++, Maple, OCaml, Pascal, Pike, YCP |
| string! | Rebol |
| String | Ada, C#, Haskell, Java, JavaScript, merd, Smalltalk, Visual Basic |
| STRING | Eiffel |
| str | YAML |
| Str | Perl6, Pliant |
| NSString * | Objective-C |
| CHAR, VARCHAR(size) | SQL92 |
| char | C, C#, C++, OCaml |
| char! | Rebol |
| Char | Haskell, merd, Perl6 |
| Character | Ada, Smalltalk |
| CHARACTER | Eiffel |
| 'z' | Ada, B, C, C#, C++, Classic REXX, E, Eiffel, Haskell, Matlab, OCaml, Pascal, Pike, Prolog |
| "z" | Classic REXX, Maple, merd, sh |
| "z | Logo |
| $z | Smalltalk |
| #\z | Common Lisp, Scheme |
| #"z" | Rebol |
| &z | Oz |
| ?z | Emacs Lisp, Ruby |
| 'z' "z" | Prolog |
verbatim
| '...' | Beta, Classic REXX, JavaScript, Lua, Matlab, Pascal, Perl, Perl6, PHP, Prolog, Python, Ruby, sh, Smalltalk, SQL92, YAML |
| "..." | Ada, Awk, C, C#, C++, Classic REXX, Common Lisp, Dylan, E, Eiffel, Emacs Lisp, FL, Haskell, Java, JavaScript, Lua, Maple, Modula-3, MUMPS, OCaml, Oz, Pike, Pliant, Prolog, Python, Rebol, Scheme, SML, YAML, YCP |
| "... | Logo |
| "..." or '...' | XPath |
| '''...''', """...""" | Python |
| [[ ... ]] | Lua |
| <<'MARK' ... MARK | Perl, Ruby, sh |
| {...{...}...} | Tcl |
| (...) | PostScript |
| q(...(...)...), q[...], q{...}, q<...>, q/.../ | Perl, Perl6 |
| %q(...(...)...), %q[...], %q{...}, %q<...>, %q/.../ | Ruby |
| q(...(...)...) | merd |
| @"...""..." | C# |
| @"..." | Objective-C |
with interpolation
| "... $v ..." | Perl, Perl6, PHP, sh, Tcl |
| "... {v} ..." | merd |
| "... #{v} ..." "... #$v ..." "... #@v ..." "... #@@v ..." | Ruby |
| <<MARK ... $v ... MARK | Perl, sh |
| <<MARK ... #{v} ... MARK | Ruby |
| <<<MARK ... $v ... MARK | PHP |
| [ subst {...{... $v ...}...} ] | Tcl |
| qq(...(... $v ...)...), qq[...], qq{...}, qq<...>, qq/.../ | Perl, Perl6 |
| %Q(...(... #{v} ...)...), %Q[...], %Q{...}, %Q<...>, %Q/.../ | Ruby |
| qq(...(... {v} ...)...) | merd |
| "... %(v)s ..." % vars() | Python |
end-of-line (without writing the real CR or LF character)
| "\n" | C, C#, C++, Java, JavaScript, Lua, Maple, OCaml, Perl, Perl6, Pike, Python, Ruby, YCP, Yorick |
| "*n" | B, BCPL |
| "%N" | Eiffel |
| "^/" | Rebol |
| "~%" (55) | Common Lisp |
| "[lf]" | Pliant |
| vb_nl | Visual Basic |
| all strings allow multi-line strings | Common Lisp, E, Emacs Lisp, Maple, OCaml, Pascal, Perl, Perl6, Ruby, Scheme, YCP |
| @"..." | C# |
| '''...''', """...""" | Python |
| [[ ... ]] | Lua |
| {...} | Rebol |
"...\n" "...\n" | C |
... "...\n\
\...\n" | Haskell |
"...", "..." | Classic REXX |
"...%N% %...%N" | Eiffel |
| show | Haskell |
| to_s, to_str, inspect, String() | Ruby |
| to_string | merd, Pliant |
| tostring | Lua, YCP |
| toString | Java, JavaScript |
| ToString | C# |
| String | JavaScript |
| perl | Perl6 |
| Dumper | Perl |
| "" . e | Perl |
| "" ~ e | Perl6 |
| "" + e | E, Java, JavaScript |
| string | Pliant |
| str, `e`, repr | Python |
| out | Eiffel |
| cvs | PostScript |
| 'Image | Ada |
| asString printString | Smalltalk |
| as(<string>, e) | Dylan |
| (string) e | Pike |
| convert(e,string) | Maple |
| (coerce e 'string) | Common Lisp |
| prin1-to-string | Emacs Lisp |
| to string! / to-string / to "" | Rebol |
| description | Objective-C |
| export-clixml | MSH |
| Marshal.to_string | OCaml |
| Marshal.dump | Ruby |
| import-clixml | MSH |
| Marshal.from_string | OCaml |
| Marshal.load | Ruby |
| sprintf | Awk, C, C++, Maple, Matlab, merd, OCaml, Perl, Perl6, PHP, Pike, Ruby |
| % | Python, Ruby |
| format (56) | Common Lisp, Erlang, Scheme-SRFI28 |
| Format | C# |
| putFormat | Beta |
| stringWithFormat | Objective-C |
on strings
| puts | C, Dylan |
| Awk, Basic, Java, Maple, merd, PHP, SML | |
| write | JavaScript, Pascal, Pike, Yorick |
| putStr | Haskell |
| print_string | OCaml |
| console | Pliant |
| writeln | JavaScript, Pascal |
| write-string | Common Lisp |
| putStrLn | Haskell |
| Put_Line | Ada |
| display | Cobol |
| message | Emacs Lisp |
| put_string | Eiffel |
| show | Smalltalk |
| print_endline (57) | OCaml |
| println (57) | Java, merd |
| put_chars | Erlang |
| echo | PHP |
| echo (57) | sh |
| emit | Forth |
| putText | Beta |
| say | Classic REXX |
on simple objects
| Perl, Perl6 | |
| say (57) | Perl6 |
| puts (57) | Tcl |
on any objects
| Logo, Ruby | |
| print (57) | Dylan, Haskell, Python, Rebol |
| prin | Rebol |
| display write | Scheme |
| Put | Ada |
| p (57) | Ruby |
| puts (58) | Ruby |
| write | Prolog |
| write prin1 princ print | Common Lisp |
| princ prin1 | Emacs Lisp |
| WriteLine | C# |
| nothing - just remove ";" at the end of the expression, and it will print it | Matlab |
| disp | Matlab |
printf-like
| printf | Awk, C, C++, Maple, Matlab, merd, OCaml, Perl, PHP, Ruby |
| write | Pike |
| WriteLine | C# |
| putFormat | Beta |
| format (56) | Common Lisp, Prolog |
| eq ne | Perl, Perl6, Tcl |
| strcmp | C, Matlab |
| == != | JavaScript, Pike |
| isEqualToString (59) | Objective-C |
| = \= | Prolog |
| == != | Awk, C#, C++, E, merd, Python, Ruby, YCP |
| == /= | Haskell |
| == \= | Oz |
| = != | Maple, sh, XPath |
| = /= | Ada |
| = \= | Classic REXX |
| = <> | Beta, OCaml, Pliant, SML, Visual Basic |
| = ~= | Dylan, Smalltalk |
| == \== or = <> \= | Classic REXX |
| == ~= | Matlab |
| equal? | Ruby, Scheme |
| equals | Java |
| equal, equalp | Common Lisp |
| is_equal | Eiffel |
| isEqual | Objective-C |
| length | Awk, Beta, C++, Common Lisp, Eiffel, Haskell, Java, JavaScript, Maple, Matlab, Objective-C, OCaml, Perl, PostScript, Ruby |
| LENGTH | Classic REXX |
| 'Length | Ada |
| length? | Rebol |
| size | C++, E, Ruby, Smalltalk, SML, YCP |
| Length | C#, Modula-3, Oz, Pascal |
| len | Pliant, Python, Visual Basic |
| strlen | C, PHP |
| string-length | Scheme, XPath |
| sizeof | Pike |
| count | Eiffel, Logo |
| bytes chars | Perl6 |
| CHARACTER_LENGTH | SQL92 |
| + | C#, C++, E, Eiffel, Java, JavaScript, merd, MSH, Pascal, Pike, Pliant, Python, Ruby, YCP |
| . | Perl, PHP |
| , | Smalltalk |
| .. | Lua |
| ~ | Perl6 |
| & | Ada, Modula-3, Visual Basic |
| ^ | OCaml, SML |
| _ | MUMPS |
| || | Cecil, Classic REXX, Icon, Maple, PL/I, SQL92 |
| ++ | Haskell |
| $a$b | sh, Tcl |
| concatenate | Common Lisp, Dylan |
| string-append | Scheme |
| cat | Maple |
| Cat | Modula-3 |
| strcat | C |
| concat | XPath |
| append | Beta, Prolog, Rebol |
| stringByAppendingString | Objective-C |
| Awk, Classic REXX | |
| [string1 string2] | Matlab |
| word | Logo |
| * | Ada, E, Pike, Python, Ruby |
| x | Perl, Perl6 |
| times | merd |
| repeat | Pliant |
| str_repeat | PHP |
| string repeat | Tcl |
| strrep | Lua |
| repmat | Matlab |
| insert/dup | Rebol |
| COPIES | Classic REXX |
| upcase / downcase | Emacs Lisp, Ruby |
| uc / lc | Perl, Perl6 |
| upper / lower | Matlab, Pliant, Python |
| toUpper / toLower | Haskell |
| to_upper / to_lower | Eiffel |
| To_Upper / To_Lower | Ada |
| toUpperCase / toLowerCase | E, Java, JavaScript |
| upper_case / lower_case | Pike |
| uppercase / lowercase | Logo, OCaml |
| strupper / strlower | Lua |
| upper / lower (60) | Lua |
| ToUpper / ToLower | C#, Oz |
| toupper / tolower | Awk, C, C++ |
| string toupper / string tolower | Tcl |
| asLowercase / asUppercase | Smalltalk |
| upCase / lowCase | Beta |
| uppercase form / lowercase form | Rebol |
| char-upcase / char-downcase | Common Lisp, Scheme |
| StringTools[UpperCase] / StringTools[LowerCase] | Maple |
| upcase / downcase | Emacs Lisp, Ruby |
| upper / lower | Matlab, Python, SQL92 |
| uppercase/lowercase | Logo, OCaml, Rebol |
| upcase_atom/downcase_atom | Prolog |
| toUpperCase / toLowerCase | E, Java, JavaScript |
| ToUpper / ToLower | C# |
| to_upper / to_lower | Ada, Eiffel |
| toupper / tolower | Awk, YCP |
| uc / lc | Perl, Perl6 |
| UpperCase / LowerCase | Pascal |
| uppercaseString / lowercaseString / capitalizedString | Objective-C |
| UCase / LCase | Visual Basic |
| strtoupper / strtolower | PHP |
| strupper / strlower | Lua |
| string toupper / string tolower | Tcl |
| string-upcase / string-downcase | Common Lisp, Scheme |
| asLowercase / asUppercase | Smalltalk |
| makeLC / makeUC | Beta |
| parse upper var in_var out_var / parse lower var in_var out_var | Classic REXX |
| chr | Haskell, OCaml, Pascal, Perl, Perl6, PHP, Python, Ruby, SML |
| chr$ | Visual Basic |
| char | Matlab |
| format %c $c | Tcl |
| toChar | E |
| strchar | Lua |
| from_integer | Eiffel |
| fromCharCode | JavaScript |
| character | Pliant |
| Character value: c | Smalltalk |
| code-char | Common Lisp |
| integer->char | Scheme |
| 'Val | Ada |
| (char) c | C, C#, C++, Java |
| to char! / to-char | Rebol |
| X2C, D2C | Classic REXX |
| $CHAR(s) | MUMPS |
| char_code | Prolog |
| ascii | Logo |
| StringTools[Char] | Maple |
| ord | Haskell, Pascal, Perl, Perl6, PHP, Python, SML |
| asc | Visual Basic |
| getNumericValue | Java |
| charCodeAt | JavaScript |
| asciiValue | Smalltalk |
| code | Eiffel, OCaml |
| char-code | Common Lisp |
| char->integer | Scheme |
| s[0] | Ruby |
| s 0 get | PostScript |
| scan $s %c | Tcl |
| strbyte | Lua |
| toInteger | E |
| 'Pos | Ada |
| number | Pliant |
| (int) c | C, C#, C++, Java |
| to integer! / to-integer | Rebol |
| C2X, C2D | Classic REXX |
| $ASCII(s) | MUMPS |
| (done automatically when applying mathematical operations on char, such as +) | Matlab |
| char | Logo |
| char_code | Prolog |
| StringTools[Ord] | Maple |
| s[n] | C, C#, C++, E, Maple, PHP, Pike, Python, Ruby |
| s(n) | Ada, Matlab |
| s:n | Pliant |
| s.[n] | OCaml |
| s !! n | Haskell |
| s @ n | Eiffel |
| s/:n | Rebol |
| string index s n | Tcl |
| sub | SML |
| char, aref, schar, svref | Common Lisp |
| GetChar | Modula-3 |
| at | Smalltalk |
| at (61) | C++ |
| aref | Common Lisp |
| char(s, i) | B |
| charAt | Java, JavaScript |
| characterAtIndex | Objective-C |
| n -> s.inxGet | Beta |
| string-ref | Scheme |
| $EXTRACT(s, n) | MUMPS |
| item | Logo |
| s[n..m] | Maple, Pike, Ruby |
| s(n..m) | Ada |
| s(n:m) | Matlab |
| s(n,m+1) | E |
| s[n:m+1] | Python |
| s[n,len] | Ruby |
| s n len | Pliant |
| strndup(s + n, len) | C |
| substring | Eiffel, Java, Scheme, SML, XPath, YCP |
| Substring | C# |
| substr | C++, Perl, Perl6, PHP |
| SUBSTR | Classic REXX |
| sub | OCaml |
| SUB | Modula-3 |
| subseq | Common Lisp |
| slice | JavaScript |
| mid$ | JavaScript |
| range | Tcl |
| copy/part at s n len | Rebol |
| copy/part at s n at s m | Rebol |
| s copyFrom: n to: m | Smalltalk |
| (n,m)->s.sub | Beta |
| [s substringWithRange:NSMakeRange(n, len)] | Objective-C |
| SUBSTRING(s FROM n len) | SQL92 |
| $EXTRACT(s, n, m) | MUMPS |
| sub_string / sub_atom | Prolog |
| index | Perl, Perl6, Ruby |
| indexOf | Java, JavaScript |
| IndexOf | C# |
| startOf | E |
| search | Common Lisp, Pike, PostScript |
| StringTools[Search] | Maple |
| strstr / strchr / index | C |
| find | Logo, Rebol, YCP |
| find / index | Python |
| strfind | Matlab |
| $FIND | MUMPS |
| index / index_non_blank / find_token | Ada |
| substring_index | Eiffel |
| rangeOfString | Objective-C |
| POS | Classic REXX |
| POSITION(needle IN s) | SQL92 |
| sub_string / sub_atom | Prolog |
| rindex | OCaml, Perl, Perl6, Ruby |
| rfind | C++ |
| rfind / rindex | Python |
| find/last | Rebol |
| / strrchr / rindex | C |
| index(Going => Backward) | Ada |
| lastStartOf | E |
| lastIndexOf | Java, JavaScript |
| last_index_of (62) | Eiffel |
| LastIndexOf | C# |
| (search substring string :from-end t) | Common Lisp |
| [string rangeOfString:substring options:NSBackwardsSearch] | Objective-C |
| LASTPOS | Classic REXX |
| t=strfind(s,p), t(end) | Matlab |
| StringTools[SearchAll](s,p)[-1] | Maple |
| Bool | Haskell, Perl6, Pliant |
| bool | C#, C++, C99, OCaml, Python, YAML |
| Boolean | Ada, Lua, Pascal, Smalltalk, Visual Basic |
| boolean | Common Lisp, Java, Maple, YCP |
| BOOLEAN | Eiffel |
| logic! | Rebol |
| logical | Matlab |
| nil | Common Lisp, Emacs Lisp, Lua |
| undef / 0 / "0" / "" / () | Perl, Perl6 |
| False / None / 0 / "" / () / [] / {} | Python |
| false / 0 / "" | PHP |
| NULL / 0 / '\0' | C |
| NULL / 0 / '\0' / false | C++, C99 |
| 0 / "0" / "" | Awk |
| 0 / NaN / "" / false() | XPath |
| 0 | Classic REXX, MUMPS |
| 0 (63) | B, Pike |
| 0 / False | Visual Basic |
| 0 / 0.0 / [] / {} / '' / false / array containing at least one false value | Matlab |
| false / none | Rebol |
| false / null / undefined / 0 / NaN / "" | JavaScript |
| false / no / off / 0 | Tcl |
| false / no / off / n | YAML |
| false / nil | Lua, Ruby |
| false | Ada, BCPL, Beta, C#, E, FL, Java, Logo, OCaml, Oz, Pascal, Pliant, PostScript, Smalltalk, SML, YCP |
| False | Eiffel, Haskell, merd |
| FALSE | Modula-3, SQL92 |
| false / exit status different from 0 | sh |
| false / FAIL | Maple |
| No / fail | Prolog |
| #f | Dylan, Scheme |
| anything not false | Awk, B, C, Matlab, Perl, Perl6, Pike |
| true / anything not false | C++, C99, JavaScript, Lua, PHP, Ruby |
| true / anything not false | Rebol |
| True / anything not false | Python |
| true() / anything not false | XPath |
| #t / anything not false | Dylan, Scheme |
| t / anything not false | Common Lisp, Emacs Lisp |
| 1 / anything not false | MUMPS |
| yes / on / true / non zero number | Tcl |
| yes / on / true / y | YAML |
| True | Eiffel, Haskell, merd |
| non-zero-numbers / True | Visual Basic |
| TRUE | Modula-3, SQL92 |
| true | Ada, BCPL, Beta, C#, E, FL, Java, Logo, Maple, OCaml, Oz, Pascal, PHP, Pliant, PostScript, Smalltalk, SML, YCP |
| true / exit status 0 | sh |
| Yes / true | Prolog |
| 1 | Classic REXX |
| ! | Awk, B, C, C#, C++, E, Java, JavaScript, Perl, Perl6, PHP, Pike, Ruby, Tcl, YCP |
| not | Ada, Beta, Common Lisp, Eiffel, Emacs Lisp, Forth, Haskell, Logo, Lua, Maple, merd, OCaml, Pascal, Perl, Perl6, Pliant, PostScript, Prolog, Python, Rebol, Ruby, Scheme, Smalltalk, SML, XPath |
| Not | Oz, Visual Basic |
| NOT | Modula-3 |
| ~ | BCPL, Dylan, Matlab, PL/I |
| ^ | PL/I |
| ' | MUMPS |
| \ | Classic REXX |
short circuit
| || / && | Awk, C, C#, C++, E, Haskell, Java, JavaScript, Matlab, merd, OCaml, Perl, Perl6, PHP, Pike, Ruby, Tcl, YCP |
| | / & | B, BCPL, Dylan |
| or / and | Common Lisp, Emacs Lisp, Logo, Lua, Maple, Modula-2, Perl, Perl6, PHP, Pliant, Python, Ruby, Scheme, Smalltalk |
| or / & | OCaml |
| or / and & (64) | Modula-2 |
| OR / AND | Modula-3 |
| any / all | Rebol |
| orelse / andalso | SML |
| orelse / andthen | Oz |
| or else / and then | Ada, Eiffel |
| ; / , | Prolog |
| & / ! | MUMPS |
non short circuit (always evaluates both arguments)
| | / & | C#, Classic REXX, Java, Matlab, Smalltalk |
| or / and | Ada, Beta, Eiffel, Forth, Pascal, PostScript, Rebol, SML, XPath |
| Or / And | Visual Basic |
| Or / And (65) | Oz |
| \/ / /\ (10) | BCPL |
| ?| / | Perl6 |
| seq | YAML |
| a list | OCaml |
| [a] | Haskell |
| a[] | C# |
| list | Maple |
| List | Pliant |
| Array or List | Perl6 |
| ARRAY or LINKED_LIST | Eiffel |
| cell | Matlab |
| + | E, Eiffel, merd, Pike, Python, Ruby |
| , | Maple, Matlab, Smalltalk |
| , (66) | Perl |
| @ | OCaml, SML |
| ++ | Haskell |
| ||| | Icon |
| array_merge | PHP |
| merge | YCP |
| concat | JavaScript, Tcl |
| concatenate | Dylan |
| append nconc | Common Lisp, Emacs Lisp |
| append | Beta, Prolog, Rebol, Scheme |
| Append | Oz |
| arrayByAddingObjectsFromArray | Objective-C |
| sentence | Logo |
one level depth
| concat | Haskell, Mercury, SML |
| flatten | merd, OCaml, Prolog, YCP |
| Flatten | Oz |
| eval concat | Tcl |
| ListTools[FlattenOnce] | Maple |
recursive
| flatten | Pike, Ruby |
| ListTools[Flatten] | Maple |
| [ a, b, c ] | E, Haskell, JavaScript, Maple, Matlab, merd, Perl, Perl6, PostScript, Prolog, Python, Ruby, SML, YAML, YCP |
| ( a, b, c ) | Perl, Perl6 |
| { a, b, c } (67) | C, C++, Lua |
| #(a, b, c) | Dylan |
| #(a b c) (68) | Smalltalk |
| { a. b. c } | Squeak |
| [ a ; b ; c ] | OCaml |
| [ a b c ] | Logo, Oz, Rebol |
| ({ a, b, c }) | Pike |
| '(a b c) | Common Lisp, Emacs Lisp, Scheme |
| << a, b, c >> | Eiffel |
| list | Common Lisp, Dylan, Emacs Lisp, Scheme, Tcl |
| new t[] { a, b, c } | C# |
| new[] { a, b, c } | C#3 |
| new List<t> { a, b, c} | C#3 |
| Array(a, b, c) (69) | JavaScript |
| [NSArray arrayWithObjects:a, b, c, nil] | Objective-C |
- a - b - c | YAML |
| a[i] | B, C, C#, C++, Dylan, E, Java, JavaScript, Lua, Maple, merd, Modula-3, MSH, Pascal, Perl, Perl6, PHP, Pike, Python, Ruby |
| a*[i] or a!i or a*(i) depending on the version | BCPL |
| a[i]:default | YCP |
| a(i) | Ada, Matlab |
| a:i | Pliant |
| a/:i | Rebol |
| a.(i) | OCaml |
| a !! i | Haskell, Mercury |
| a @ i | Eiffel |
| a i get (70) | PostScript |
| at (71) | Smalltalk |
| at (61) | C++ |
| lindex | Tcl |
| nth | OCaml |
| Nth | Oz |
| nth / aref | Common Lisp, Emacs Lisp |
| nth0 / nth1 | Prolog |
| list-ref / vector-ref | Scheme |
| element | Dylan |
| slice | Ruby |
| node[i] | XPath |
| objectAtIndex | Objective-C |
| item | Logo |
return the new list (no side-effect)
| : | Haskell, merd |
| :: | OCaml, SML |
| | | Oz |
| [ e | l ] | Erlang, Prolog |
| [e l[]] | Maple |
| [e l] | Matlab |
| cons | Common Lisp, Emacs Lisp, Scheme |
| pair | Dylan |
| fput | Logo |
side-effect
| unshift | JavaScript, Perl, Perl6, Ruby |
| prepend | YCP |
| push_front | C++ |
| addFirst | Smalltalk |
| insert | Rebol |
| put_first | Eiffel |
| push | Common Lisp |
| array_unshift | PHP |
return the new list (no side-effect)
side-effect
| [a insertObject:e atIndex:i] | Objective-C |
| a.insert(i, e) | Ruby |
return the new list (no side-effect)
| push | merd |
| arrayByAddingObject | Objective-C |
| lput | Logo |
side-effect
| push | JavaScript, Perl, Perl6, Ruby |
| push_back | C++ |
| append | Pliant, Python, Rebol |
| += | Pliant |