9/16/2016
syntax across languages (One Big Page)
Introduction
What's this about?
Language Designers:
Looking for operator or function names? Well have a look at the following and remember using existing one may ease the transition :)
Language Users:
You know one language and want to find the corresponding operator or function in another language
Language lovers:
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.
Light Version
Same content split into multiple html files
Categories
Various commenting
Functions function call partial application (in the examples below, a normal call is "f(a,b)") function definition anonymous function function return value function called when a function is not defined (in dynamic languages) runtime inspecting the caller information function composition identity function
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
1/112
9/16/2016
syntax across languages (One Big Page)
Control Flow sequence
if_then if_then_else ifnot_then (unless) multiple selection (switch) loop breaking control flow exception callwithcurrentcontinuation
Types
declaration annotation (or variable declaration) cast mutability, constness
Object Oriented & Reflexivity method invocation object creation object cloning manually call an object's destructor class declaration testing class membership get the type/class corresponding to an object/instance/value methods available inheritance has the method current instance accessing parent method accessing child method
Package, Module package scope declare import
Strings type name character type name character "z" strings multiline convert something to a string (see also string interpolation) serialize (marshalling) unserialize (unmarshalling) sprintflike simple print string equality & inequality string size string concatenation duplicate n times upper / lower case character uppercase / lowercase / capitalized string ascii to character character to ascii accessing nth character extract a substring
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
2/112
9/16/2016
syntax across languages (One Big Page)
locate a substring
locate a substring (starting at the end)
Booleans
type name
false value
true value
logical not
logical or / and
Bags and Lists
type name
list concatenation
list flattening
list constructor
list/array indexing
adding an element at the beginning (list cons)
adding an element at index
adding an element at the end
first element
all but the first element
last element
all but the last element
get the first element and remove it
get the last element and remove it
for each element do something
transform a list (or bag) in another one
transform two lists in parallel
find an element
keep elements
partition a list: elements matching, elements non matching
split a list
is an element in the list
is the predicate true for an element
is the predicate true for every element
smallest / biggest element
join a list of strings in a string using a glue string
list size
iterate with index
remove duplicates
sort
reverse
list of couples from 2 lists
2 lists from a list of couples
lookup an element in a association list
list out of a bag
|
f( f(f(init, e1), e2) |
en) |
||
|
, |
|||
|
f(e1, f(e2, f(en, init) |
)) |
||
Various Data Types
tuple type
tuple constructor
computable tuple (these are a kind of immutable lists playing a special role in parameter passing)
reference (pointer)
optional value
record
union type declaration
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
3/112
9/16/2016
syntax across languages (One Big Page)
|
enumerated type declaration |
|
dictionary |
|
range |
Mathematics type name numbers syntax addition / subtraction / multiplication / division exponentiation (power) negation random operator priorities and associativities square root / eexponential / absolute value trigonometry logarithm euclidian division (both quotient and modulo) modulo truncate / round / floor / ceil bitwise operators
Threads thread definition thread creation thread object creation starting / stopping threads passing data directly between threads terminating thread communication due to a timeout Thread Synchronization Joining Another Thread Thread Prioritization Threadsafe sharing of data without synchronization
Various
commenting
until end of line
|
# |
Awk, BourneShell, CoffeeScript, E, FishShell, GNUbc, GNUsed, Icon, Io, Maple, merd, Perl, Perl6, PHP, Pliant, Python, Ruby, Tcl, YAML |
|
// |
BCPL, C#, C++, C99, Dylan, F#, Io, Java, JavaScript, PHP, Pike, Scilab, 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 |
|
NB. |
J |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
4/112
9/16/2016
syntax across languages (One Big Page)
|
C |
or * in |
Fortran |
|
column 1 |
||
nestable
|
(* |
*) |
Beta, F#, Mathematica, Modula3, OCaml, Pascal, SML |
|
|
%( |
%) |
Matlab |
|
|
/* |
*/ |
Classic REXX, Dylan, Io, Oz, SQL99 |
|
|
{ |
} |
Pascal, Rebol |
|
|
{‐ |
‐} |
Haskell |
|
|
#| |
|#(1) |
Common Lisp, Scheme |
|
|
#[ |
] |
Perl6 |
|
|
#if 0 |
#endif C |
||
|
comment { |
} |
Rebol |
|
|
comment [ |
] |
Rebol |
|
|
[ |
](2) |
Rebol |
|
|
‐‐[[ |
]] |
Lua |
|
non nestable
|
" |
" |
Smalltalk |
|
|
/* |
*/ |
B, C, C#, C++, CSS, GNUbc, Java, JavaScript, Mercury, PHP, Pike, PL/I, YCP, Yorick |
|
|
<!‐‐ |
‐‐> HTML, XML |
||
|
( |
) |
Forth |
|
|
### |
|||
|
CoffeeScript |
|||
|
### |
|||
documentation comment
until end of line
/// C#, F#, Java
‐‐ | Haskell
‐‐ ^ Haskell
non nestable
|
/** |
*/(3) C, C#, E, Java, PHP |
||
|
(** |
*) |
F# |
|
|
{‐| |
‐} |
Haskell |
|
|
(** |
*) |
OCaml |
|
|
/* DOCUMENT |
*/ |
Yorick |
|
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
5/112
9/16/2016
syntax across languages (One Big Page)
information about the current line and file
|
LINE |
FILE |
C, C++, Perl, PHP, Pike, Ruby |
|
LINE |
SOURCE_FILE |
F# |
|
$?LINE $?FILE |
Perl6 |
|
|
file |
Python |
|
|
(new System.Diagnostics.StackFrame(true)).GetFileLineNumber() (new System.Diagnostics.StackFrame(true)).GetFileName() |
C# |
|
|
Thread.currentThread().getStackTrace()[1].getLineNumber(); |
Java |
|
|
Thread.currentThread().getStackTrace()[1].getFileName(); |
||
|
system/script/header/file(6) |
Rebol |
|
|
SOURCELINE() / parse source OS . SOURCENAME |
Classic REXX |
|
|
info frame 0 |
Tcl8.5 |
|
|
thisContext lineNumber / thisContext method source |
Smalltalk |
|
tokens
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
6/112
9/16/2016
syntax across languages (One Big Page)
casesensitivity (keywords, variable identifiers )
|
case‐sensitive |
Awk, B, BourneShell, C, C#, C++, CoffeeScript, F#, FishShell, Haskell, Io, Java, JavaScript, Lua, Maple, Mathematica, Matlab, merd, Modula3, OCaml, Perl, Perl6, Pike, Pliant, Prolog, Python, Ruby, Smalltalk, Tcl, XML, YAML, Yorick |
|
case‐insensitive Ada, Assembler, Classic REXX, Common Lisp, CSS, Eiffel, Forth, HTML, Logo, Pascal, PL/I, Rebol, SGML, SQL92, Visual Basic |
|
|
case‐sensitive: |
|
|
variables |
|
|
case‐insensitive: |
|
|
keywords, |
PHP |
|
functions, |
|
|
constants |
|
|
case‐sensitive: |
|
|
identifiers |
|
|
case‐insensitive: |
E |
|
keywords |
|
|
case‐sensitive: |
|
|
identifiers |
MUMPS |
|
case‐insensitive: |
|
|
commands |
|
|
case‐sensitive: |
|
|
upper case |
GNUbc |
|
disallowed |
|
what is the standard way for scrunching together multiple words
|
camelCase |
CoffeeScript, JavaScript |
|
CamelCase or camelCase |
C#, E, Haskell, Io, Java, JavaScript, Mathematica, Pascal, Smalltalk, Tcl, Visual Basic |
|
underscores |
FishShell, GNUbc, merd |
|
dots |
Logo |
|
hyphens |
Common Lisp, Emacs Lisp, Rebol, Scheme |
|
underscores for functions / types, unclear for modules / constructors |
OCaml |
|
UPPER_CASE |
BourneShell |
|
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 methods, types and modules, underscore for functions |
F# |
|
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 |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
7/112
9/16/2016
syntax across languages (One Big Page)
|
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]* |
FishShell, Mathematica, 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, PHP, Python, Tcl |
|
[_a‐zA‐Z0‐9]+ |
BourneShell, Perl, Perl6 |
|
[a‐zA‐Z0‐9]+ |
FishShell |
|
[_a‐zA‐Z][_a‐zA‐Z0‐9]* or '[^']*' |
Pliant |
|
[_a‐zA‐Z$][_a‐zA‐Z0‐9$]* |
Java |
|
[$A‐Za‐z_\x7f‐\uffff][$\w\x7f‐\uffff]* |
CoffeeScript, 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‐zA‐Z][_a‐zA‐Z0‐9']* |
F# |
|
[_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 |
|
[a‐z][a‐z0‐9_]* |
GNUbc |
|
anything without a space and is not a number |
Common Lisp, 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 |
|
[^ \t\n\r\f/]+ |
FishShell |
keyword regexp (if different from variable identifier regexp)
[A‐Z]+
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
8/112
9/16/2016
syntax across languages (One Big Page)
Modula3
type regexp (if different from variable identifier regexp)
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 |
|
breaking lines (useful when endofline and/or indentation has a special meaning)
|
nothing |
Ada, B, C, C#, C++, Common Lisp, Eiffel, Emacs Lisp, F#, Forth, Haskell, Java, JavaScript, Maple, Mathematica, OCaml, Oz, Pascal, Perl, Perl6, PHP, PostScript, Rebol, Scheme, Smalltalk, SML, XSLT, YCP |
|
needed |
|
|
\ |
Awk, BourneShell, C, CoffeeScript, E, FishShell, GNUbc, Io, Python, Ruby, Tcl |
|
Visual Basic |
|
|
_ |
|
|
, |
Classic REXX |
|
~ |
Logo |
|
Matlab |
|
variable assignment or declaration
assignment
|
Awk, B, Basic, BourneShell, C, C#, C++, Classic REXX, Erlang, Icon, Io, Java, JavaScript, Lua, |
|
|
= |
Mathematica, Matlab, Oz, Perl, Perl6, PHP, Pike, YCP, Yorick |
|
:= |
Ada, BCPL, Cecil, Dylan, E, Eiffel, Maple, Mathematica, Modula3, Pascal, Pliant, Sather, Simula, Smalltalk, SML |
|
<‐ |
F#, OCaml |
|
_(7) Squeak |
|
|
: |
BCPL, Rebol |
|
‐>(8) Beta |
|
|
def PostScript |
|
|
setq Common Lisp, Emacs Lisp |
|
|
setf Common Lisp |
|
|
set Common Lisp, FishShell, Rebol |
|
|
SET |
|
|
v= |
MUMPS |
|
set! Scheme |
|
|
is |
Prolog |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
9/112
9/16/2016
syntax across languages (One Big Page)
|
make |
|
|
"v |
e Logo |
|
e |
v ! Forth |
declaration
|
= |
Haskell, Mercury, Prolog |
|||||
|
<‐ |
Haskell |
|||||
|
:‐ |
Prolog |
|||||
|
:= |
Io |
|||||
|
let v = e in |
F#, OCaml |
|||||
|
let val v = e in |
SML |
|||||
|
let v = e(9) |
BCPL, F# |
|||||
|
def v := e / var v := e |
E |
|||||
|
my / our / local / use vars |
Perl |
|||||
|
my / our / temp |
Perl6 |
|||||
|
define |
Dylan, Scheme |
|||||
|
let let* |
Common Lisp, Scheme |
|||||
|
letrec |
Scheme |
|||||
|
flet labels defun defmethod defvar defparameter defsetf |
Common Lisp |
|||||
|
local V1 = e V2 = e2 in |
end |
Oz |
||||
|
global v1, v2 |
Python |
|||||
|
global v1 v2 |
Matlab, Scilab |
|||||
|
:@ |
Beta |
|||||
|
NEW v |
MUMPS |
|||||
|
v: t |
Ada, Eiffel, Pascal |
|||||
|
t |
v |
C, C#, C++, Java |
||||
|
| |
v1 v2 | |
Smalltalk |
||||
|
auto v1, v2; extrn v3, v4; |
B |
|||||
|
auto |
GNUbc |
|||||
|
var |
JavaScript, Pliant |
|||||
|
gvar |
Pliant |
|||||
|
variable v(10) |
Forth |
|||||
|
e |
value v |
Forth |
||||
|
Module[{x, y = v}, |
] |
Mathematica |
||||
|
Block[{x, y = v}, ] |
Mathematica |
|||||
|
With[{c1 = v1, c2 = v2, |
}, |
] |
Mathematica |
|||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
10/112
9/16/2016
syntax across languages (One Big Page)
<xsl:variable name="v" select="e"/>
XSLT
both
|
= |
CoffeeScript, GNUbc, merd, Python, Ruby |
|
:= |
merd |
|
set, variable Tcl |
|
grouping expressions
|
( |
) |
Ada, Awk, B, BCPL, Beta, C, C#, C++, Classic REXX, CoffeeScript, E, Eiffel, F#, GNU bc, Haskell, Io, Java, JavaScript, Logo, Lua, Maple, Mathematica, Matlab, merd, Modula 3, MSH, MUMPS, OCaml, Oz, Pascal, Perl, Perl6, PHP, Pike, Pliant, Prolog, Python, Rebol, Ruby, Scilab, Smalltalk, SML, SQL92, Tcl, XPath, YCP, Yorick |
|
[ |
] |
Rebol |
|
indentation merd |
||
|
$ |
Haskell |
|
|
begin |
F#, FishShell, OCaml, Ruby |
|
|
end |
||
|
space(11) |
merd |
|
block (grouping statements, especially when statements are not expressions)
|
{ |
} |
Awk, BCPL, BourneShell, GNUbc, GNUsed, JavaScript, PHP, Pike, Tcl, Yorick |
||
|
{ |
}(12) |
B, C, C#, C++, E, Haskell, Java, Modula3, Perl, Perl6, YCP |
||
|
( |
)(12) |
BourneShell |
||
|
[ |
](13) |
Logo, Smalltalk |
||
|
" |
" |
Tcl |
||
|
begin |
end(12) |
Ada, Pascal |
||
|
(begin |
) |
Scheme |
||
|
BEGIN |
END |
Modula3 |
||
|
do |
end |
Classic REXX |
||
|
do |
end(12) |
Lua, PL/I |
||
|
indentation |
CoffeeScript, F#, MUMPS, Pliant, Python |
|||
|
indentation(12) |
Haskell, merd |
|||
|
foo |
end where foo in { if, do, |
Modula2, Ruby |
||
|
} |
||||
|
foo |
end where foo in { if, for, } |
|||
|
while, |
Matlab, Scilab |
|||
|
foo |
end where foo in { if, loop, |
Eiffel |
||
|
} |
||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
11/112
9/16/2016
syntax across languages (One Big Page)
|
foo |
end foo where foo in { if, } |
Ada, Fortran90 |
|
do, |
||
|
(* |
*)(14) |
BCPL |
|
(# |
#) |
Beta |
use a block as a return value (when statements are not expressions)
|
valof |
BCPL |
|
do |
Perl, Perl6 |
|
proc() |
end proc Maple |
equality / inequality
shallow
|
== != |
Awk, B, C, C++, CoffeeScript, F#, Io, Java, OCaml, Perl, Perl6, Pike, Yorick |
|
|
= /= |
Eiffel, Fortran90 |
|
|
= <> |
Forth, Logo, Maple, Modula2, Pliant, Rebol |
|
|
= #(15) |
Modula2, Modula3 |
|
|
= != |
BourneShell, FishShell |
|
|
== === != !==(16) JavaScript, PHP |
||
|
=== !== |
Perl6, PHP5 |
|
|
== ~= |
Lua |
|
|
== ~~ |
Smalltalk |
|
|
== ~== |
Dylan |
|
|
= '= |
MUMPS |
|
|
= ~= neqv(14) |
BCPL |
|
|
f= f<> |
Forth |
|
|
is_equal(17) |
Eiffel |
|
|
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, Tcl, YCP |
|
== <> |
Python |
|
== /= |
Haskell |
|
== \= |
Oz |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
12/112
9/16/2016
syntax across languages (One Big Page)
|
== \== |
Classic REXX, Prolog |
|
|
= /= |
Ada |
|
|
= != |
Maple, XPath |
|
|
= <> |
Beta, F#, OCaml, Pascal, Rebol, SML, SQL92, Visual Basic |
|
|
= |
~= |
Dylan, Smalltalk |
|
== ~= eq ne isequal isequalwithequalnans |
Matlab |
|
|
== ~= eq ne isequal |
Scilab |
|
|
=@= \=@= / = \= / =:= =\=(18) |
Prolog |
|
|
=== =!= / == !=(19) |
Mathematica |
|
|
.eq |
Logo |
|
|
equal? |
Scheme |
|
|
equals |
Java |
|
|
equal |
Common Lisp, Emacs Lisp, Pike |
|
|
equalp |
Common Lisp |
|
|
eqv |
Perl6 |
|
|
deep_is_equal |
Eiffel |
|
|
isEqual |
ObjectiveC |
|
comparison
|
Ada, Awk, Awk, B, Beta, C, C#, C++, Classic REXX, CoffeeScript, Common Lisp, Dylan, E, |
|
|
< > <= |
Eiffel, Emacs Lisp, F#, Forth, Haskell, Io, Java, JavaScript, Logo, Lua, Maple, Mathematica, Matlab, merd, Modula3, OCaml, Pascal, Perl, Perl6, PHP, Pike, Pliant, Python, Rebol, Ruby, Scheme, Scilab, Smalltalk, SML, SQL92, Tcl, Visual Basic, XPath, YCP, Yorick |
|
>= |
|
|
< > =< |
|
|
>= |
Mercury, Oz |
|
< > '> |
|
|
'< |
MUMPS |
|
<< >> |
|
|
<<= >>= |
Classic REXX |
|
(20) |
|
|
@< / @= |
|
|
< / @> |
Prolog |
|
/ @>= |
|
|
lt gt le ge Perl, Perl6, PostScript |
|
|
‐lt ‐gt ‐le ‐ge BourneShell, FishShell, MSH |
|
|
.LT. |
|
|
.GT. |
Fortran |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
13/112
9/16/2016
syntax across languages (One Big Page)
|
.LE. |
|
|
.GE. |
|
|
u< u> |
|
|
u<= |
u>= Forth |
|
f< f> |
Forth |
returns 3 values (i.e. inferior, equal or superior)
|
a <=> b |
merd, Perl, Perl6, Ruby |
|
cmp |
Perl, Perl6, Python |
|
compare |
F#, Forth, Haskell, Mercury, OCaml, Pliant, Prolog, Smalltalk |
|
strcmp |
C, 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 |
Beta, C++, Common Lisp, Dylan, E, Eiffel, F#, Forth, Haskell, Io, Java, Lua, Maple, Matlab, merd, OCaml, PHP5, Pike, Pliant, Prolog, Python, Rebol, Scheme, Scilab, Smalltalk, SQL92, Tcl8.5, Yorick |
|
min minstr / max |
Perl |
|
maxstr(21) |
|
|
Min / Max |
Mathematica, Oz |
|
MIN / MAX |
Classic REXX, Modula3 |
|
measure‐object ‐ min / measure‐ object ‐max |
MSH |
|
fmin / fmax |
Forth |
|
Integer'min / |
Ada |
|
Integer'max |
runtime evaluation
|
eval |
BourneShell, Common Lisp, Emacs Lisp, FishShell, JavaScript, Matlab, Perl, Perl6, PHP, Python, Ruby, Scheme, Tcl, YCP |
|
CoffeeScript.eval(22) |
CoffeeScript |
|
exec |
Python |
|
evstr / execstr |
Scilab |
|
dostring |
Lua |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
14/112
9/16/2016
syntax across languages (One Big Page)
|
doString |
Io |
|
|
evaluate |
Forth |
|
|
Compiler evaluate: |
Smalltalk |
|
|
runtime_compile / compile + execute |
Pliant |
|
|
Compiler.evalExpression or Compiler.parseOzVirtualString |
Oz |
|
|
compile_string |
Pike |
|
|
interpret |
Classic REXX |
|
|
ToExpression |
Mathematica |
|
|
run |
Logo |
|
|
XECUTE |
MUMPS |
|
|
do / reduce / compose / load |
Rebol |
|
|
[ |
] |
Tcl |
|
= |
(23) |
Prolog |
manual memory allocation
allocation
|
malloc |
C |
|
allocate throw Forth |
|
|
new |
Ada |
deallocation
|
free |
C |
|
free throw Forth |
|
force garbage collection
|
doGC |
Beta |
|
GC.start |
Ruby |
|
gc |
Logo, Maple, Pike |
|
System.gc() |
Java |
|
System.gcDo |
Oz |
|
System.GC.Collect() |
C#, F# |
|
gc.collect() |
Python |
|
gc_collect_cycles(24) |
PHP5 |
|
full_collect |
Eiffel |
|
garbage_collect |
Mercury, Prolog |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
15/112
9/16/2016
syntax across languages (One Big Page)
|
collectgarbage |
Lua |
|
Collector collect |
Io |
|
VM.garbageCollect() |
JavaScript |
|
Gc.full_major() |
OCaml |
|
Smalltalk garbageCollect |
Smalltalk |
|
System.Mem.performGC |
Haskell |
|
incremental garbage collection => not needed Perl, Perl6 |
|
|
recycle |
Rebol |
|
interp.gc() |
E |
|
(ext:gc) |
Common Lisp |
Functions
function call
|
f(a,b, |
) |
Ada, Awk, Awk, B, C, C#, C++, CoffeeScript, CSS, Dylan, E, Eiffel, Erlang, Io, Java, JavaScript, Lua, Maple, Matlab, Mercury, merd, Modula3, Pascal, Perl, Perl6, PHP, Pike, Prolog, Python, Ruby, XPath, YCP, Yorick |
|||||||
|
f |
a b |
BourneShell, F#, FishShell, Haskell, Logo, Matlab, MSH, OCaml, Pliant, Rebol, SML, Tcl |
|||||||
|
f(a,b, |
f) |
or f[a,b, |
] |
depending on |
BCPL |
||||
|
the version |
|||||||||
|
(f a b |
) |
(apply f l) |
Common Lisp, Emacs Lisp, Scheme |
||||||
|
(funcall f a b |
) |
Common Lisp, Emacs Lisp |
|||||||
|
{f a b} |
Oz |
||||||||
|
[apply f a b] |
Tcl8.5 |
||||||||
|
f[a,b, |
] |
Mathematica |
|||||||
|
f[a,b, |
] |
or f.call(a,b, |
) |
Ruby |
|||||
|
&$f(a,b, |
) |
or $f‐>(a,b, |
) |
Perl |
|||||
|
$f.(a,b, |
) |
Perl6 |
|||||||
|
f |
a, b, |
CoffeeScript, Perl |
|||||||
|
f, a, b, |
(25) |
Yorick |
|||||||
|
v = f(a, b, |
) or call f a, b, |
Classic REXX |
|||||||
|
a b |
f |
Forth, PostScript |
|||||||
|
(a,b, |
)‐>&f or (a,b, |
)‐>f |
Beta |
||||||
|
f:a(26) |
FL |
||||||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
16/112
9/16/2016
syntax across languages (One Big Page)
|
f@a(27) |
Mathematica |
|
|
a // f(27) |
Mathematica |
|
|
a ~ f ~ b(28) |
Mathematica |
|
|
[ f, A, B, |
] |
Prolog |
|
<xsl:call‐template name="f"> |
||
|
<xsl:with‐param name="a" select=a/> <xsl:with‐param name="b" select=b/> |
XSLT |
|
|
</xsl:call‐template> |
||
with no parameter
|
f |
Ada, BourneShell, Eiffel, Forth, Haskell, Io, Logo, Matlab, Mercury, MSH, Pascal, Perl, Perl6, Pliant, PostScript, Prolog, Rebol, Ruby, Tcl, Yorick |
|
|
f() |
Awk, C, C#, C++, CoffeeScript, E, Erlang, F#, Java, JavaScript, Lua, Maple, merd, OCaml, Perl, PHP, Pike, Python, SML, YCP |
|
|
(f) |
Common Lisp, Emacs Lisp, Scheme |
|
|
(funcall f) |
Common Lisp, Emacs Lisp |
|
|
{f} |
Oz |
|
|
f[] |
Mathematica |
|
|
f[] or f.call |
Ruby |
|
|
&$f or $f‐>() |
Perl |
|
|
$f.() |
Perl6 |
|
|
v |
= f() |
Classic REXX |
|
call f |
Classic REXX, Fortran |
|
|
f |
value(29) |
Smalltalk |
|
<xsl:call‐ |
||
|
template |
XSLT |
|
|
name="f">/ |
||
partial application (in the examples below, a normal call is "f(a,b)")
give the first argument
|
f |
a |
F#, Haskell, OCaml, SML |
|
f(a) |
Mercury |
|
|
f(a,) |
merd |
|
|
&f.assuming(var_name => a) Perl6 |
||
|
functools.partial(f, a)(30) Python |
||
|
interp alias {} f_a {} f a |
Tcl |
|
give the second argument
|
f(,b) |
merd |
|
&f.assuming(b => b) Perl6 |
|
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
17/112
9/16/2016
syntax across languages (One Big Page)
flip f b(31)
Haskell
give the first argument to operator ">"
|
(a |
>) Haskell, merd |
|
(>) a F#, OCaml |
|
give the second argument to operator ">"
(> a) Haskell, merd
function definition
|
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 = |
F#, OCaml |
||||||||||||||||
|
f(para1, para2, |
) |
= valof $( |
$) |
BCPL |
|||||||||||||
|
f(para1, para2, |
) |
= |
merd |
||||||||||||||
|
f[para1_, para2_, |
] |
:= |
para1 |
Mathematica |
|||||||||||||
|
f |
or f: para1 |
Smalltalk |
|||||||||||||||
|
f: func [para1 para2 |
] |
Rebol |
|||||||||||||||
|
/f { } def |
PostScript |
||||||||||||||||
|
f |
:= (para1, para2, |
) |
‐> |
Maple |
|||||||||||||
|
f |
:= method(para1, para2, |
, |
code) |
Io |
|||||||||||||
|
func f(a, b, c |
) |
{ |
} |
Yorick |
|||||||||||||
|
typ0 f(typ1 para1, typ2 para2, |
) |
{ |
} |
C, C#, C++, Pike, YCP |
|||||||||||||
|
function f(para1, para2) { |
} |
Awk, JavaScript, PHP5 |
|||||||||||||||
|
function f(para1, para2) |
code |
end |
Lua |
||||||||||||||
|
function f; |
; |
end |
FishShell |
||||||||||||||
|
function f { |
} |
KornShell |
|||||||||||||||
|
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 |
|||||||||||||||
|
fun f para1 para2 = |
SML |
||||||||||||||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
18/112
9/16/2016
syntax across languages (One Big Page)
|
proc f {para1 para2} { |
} |
Tcl |
||||||||||
|
function retval = f(para1, para2) retval = |
Matlab, Scilab |
|||||||||||
|
:‐ func f(typ1, typ2, |
) |
= typ0. |
Mercury |
|||||||||
|
f(Para1, Para2, |
) |
= |
||||||||||
|
function f(para1 : type1; para2 : typ2; |
) |
return retval is |
||||||||||
|
begin |
Ada |
|||||||||||
|
end f; |
||||||||||||
|
function f para1 para2 ‐> retval arg typ1 para1; arg typ2 para2; arg rettyp retval; |
Pliant |
|||||||||||
|
function f(para1 : typ1, para2 : typ2, var retval : typ0; |
) |
: retval; |
||||||||||
|
begin |
Pascal |
|||||||||||
|
end |
||||||||||||
|
f |
(para1 : typ1; para2, para3 : typ2; |
) |
: rettyp is |
|||||||||
|
do |
Eiffel |
|||||||||||
|
end |
||||||||||||
|
<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() { |
} |
BourneShell, KornShell |
||||||||||
|
f |
: procedure |
|||||||||||
|
return retval |
Classic REXX |
|||||||||||
|
to f :para1 :para2 |
||||||||||||
|
end |
Logo |
|||||||||||
procedures
|
procedure f(para1 : typ1; para2, para3 : typ2); |
||||||||
|
begin |
Pascal |
|||||||
|
end |
||||||||
|
f |
(para1 : typ1; para2, para3 : typ2; |
) |
is |
|||||
|
do |
Eiffel |
|||||||
|
end |
||||||||
|
procedure f(para1 : typ1; para2 : MODE type2; |
) |
is |
||||||
|
begin |
||||||||
|
end f; |
Ada |
|||||||
|
MODE ::= | OUT | IN OUT |
||||||||
|
void f(typ1 para1, typ2 para2, ) |
{ |
} |
C, C#, C++, Pike |
|||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
19/112
9/16/2016
syntax across languages (One Big Page)
|
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, Scilab |
||||
|
f |
: procedure |
||||
|
return |
Classic REXX |
||||
variable number of arguments
|
one can use overloading on different number of arguments C++, Java |
|||||||||
|
sub f { |
@_ } |
Perl |
|||||||
|
sub f; |
$argv; end |
FishShell |
|||||||
|
f() { |
$@ } |
BourneShell |
|||||||
|
f |
:= |
## & |
Mathematica |
||||||
|
f[params |
] |
:= |
params |
Mathematica |
|||||
|
function f(varargin) for i=1:nargin (varargin{i}) |
Matlab |
||||||||
|
end |
|||||||||
|
function f(varargin) for e=varargin (e) |
Scilab |
||||||||
|
end |
|||||||||
|
(args |
) |
‐> |
CoffeeScript |
||||||
|
(lambda x |
) |
or(32) |
Scheme |
||||||
|
predicates |
|||||||||
|
f(Para1, Para2, |
) |
:‐ |
Prolog |
||||||
anonymous function
|
sub { my ($a, $b) = @_; |
} |
Perl |
|||||
|
{ |
my ($a, $b) = @_; |
}(33) |
Perl |
||||
|
{ |
} (arguments are in the stack |
PostScript |
|||||
|
[ |
] |
Logo |
|||||
|
{ |
param(para1, [typ2]para2, |
) |
} |
MSH |
|||
|
{|a, b| |
}(34) |
Ruby |
|||||
|
[:a :b| |
] |
Smalltalk |
|||||
|
[list {a b} { |
}] |
Tcl8.5 |
|||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
20/112
9/16/2016
syntax across languages (One Big Page)
|
lambda a, b: |
Python |
||||||||||||
|
lambda(typ1 para1, typ2, para2, |
) |
{ }; Pike |
|||||||||||
|
(a, b) => |
C#3, CoffeeScript |
||||||||||||
|
(a, b) ‐> |
CoffeeScript, Maple |
||||||||||||
|
a, b ‐> |
merd |
||||||||||||
|
‐> $a, $b { |
} |
Perl6 |
|||||||||||
|
\a b ‐> |
Haskell |
||||||||||||
|
:noname |
Forth |
||||||||||||
|
fn (a, b) => |
SML |
||||||||||||
|
fun a b ‐> |
F#, OCaml |
||||||||||||
|
(func(A, B) = C :‐ |
) |
Mercury |
|||||||||||
|
function(a, b) { |
} |
JavaScript, PHP5 |
|||||||||||
|
function(a, b) use (&$v1, $v2) { |
}(35) |
PHP5 |
|||||||||||
|
function(a, b) |
end |
Lua |
|||||||||||
|
Function[{a, b}, |
](36) |
Mathematica |
|||||||||||
|
fun(a, b) ‐> |
end |
Erlang |
|||||||||||
|
fun {$ A B} |
end(37) |
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 |
')(38) |
Matlab |
|||||||||
|
method(a, b, |
) |
Io |
|||||||||||
|
method(a, b) |
end method(39) |
Dylan |
|||||||||||
|
create_function(',',' |
') |
PHP |
|||||||||||
|
delegate(ta a, tb b) { |
} |
C#2 |
|||||||||||
|
[](ta a, tb b) { |
} |
C++0x |
|||||||||||
|
[](ta a, tb b) ‐> typ { |
} |
C++0x |
|||||||||||
function return value
breaks the control flow
|
return(40) |
Ada, Awk, B, BCPL, BourneShell, C, C#, C++, Classic REXX, CoffeeScript, Common Lisp, E, FishShell, Io, Java, JavaScript, Lua, Maple, Matlab, Perl, Perl6, PHP, Pike, Pliant, Python, Rebol, Ruby, Tcl, YCP, Yorick |
|
Return |
Mathematica, Visual Basic |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
21/112
9/16/2016
syntax across languages (One Big Page)
|
RETURN |
Modula3 |
|
resultis(41) BCPL |
|
|
return‐from |
|
|
xxx |
Common Lisp |
|
^ |
Smalltalk |
|
Exit |
|
|
Function / |
Visual Basic |
|
Exit Sub |
|
|
exit |
Forth |
|
output |
Logo |
function body is the result
no syntax
needed(42)
CoffeeScript, Common Lisp, Dylan, Emacs Lisp, Erlang, F#, Haskell, Io, Maple, Mathematica, Matlab, OCaml, Oz, Perl, Perl6, Rebol, Ruby, Scheme, SML, Tcl
setting the result
|
Result := val |
Eiffel |
|
<function name> = val Visual Basic |
|
|
<function name> := val Pascal |
|
|
<retvar name> = val; |
Ada, Matlab |
function called when a function is not defined (in dynamic languages)
|
AUTOLOAD |
Perl |
|
|
AUTOSCALAR, AUTOMETH, AUTOLOAD |
Perl6 |
|
|
autoload |
PHP5 |
|
|
getattr |
Python |
|
|
method_missing |
Ruby |
|
|
doesNotUnderstand |
Smalltalk |
|
|
noSuchMethod (43) |
CoffeeScript, JavaScript |
|
|
unknown |
Tcl |
|
|
no‐applicable‐method |
Common Lisp |
|
|
doesNotRecognizeSelector |
ObjectiveC |
|
|
TryInvokeMember(44) |
C# |
|
|
match [name, args] { |
} |
E |
|
the predicate fail |
Prolog |
|
|
forward |
Io |
|
runtime inspecting the caller information
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
22/112
9/16/2016
syntax across languages (One Big Page)
|
caller |
Perl, Perl6, Ruby |
|
|
call |
Io |
|
|
inspect.stack()[1] |
Python |
|
|
backtrace |
Pike |
|
|
debug_backtrace |
PHP5 |
|
|
trace 'I' |
Classic REXX |
|
|
evalin('caller', |
) |
Matlab |
|
current_predicate |
Prolog |
|
|
thisContext sender |
Smalltalk |
|
|
where(2) |
Maple |
|
|
info level |
Tcl |
|
function composition
|
. |
Haskell |
|
~ |
merd |
|
o |
SML |
|
@ |
Maple |
|
compose |
Dylan |
|
Composition |
Mathematica |
|
<< |
F# |
|
>> |
F# |
identity function
|
id |
Haskell |
|
identity Common Lisp |
|
|
Identity Mathematica |
|
|
yourself Smalltalk |
|
Control Flow
sequence
|
, |
C, C++, JavaScript, Matlab, Perl, Pike, Prolog, Scilab |
|
. |
Smalltalk |
|
Ada, Awk, B, Beta, BourneShell, C, C#, C++, E, F#, FishShell, GNUsed, Haskell, Io, |
|
|
; |
Java, JavaScript, Maple, Mathematica, Matlab, merd, Modula3, OCaml, Pascal, Perl, |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
23/112
9/16/2016
syntax across languages (One Big Page)
|
Perl6, PHP, Pike, PL/I, Pliant, Python, Ruby, SML, Tcl, YCP |
||
|
: |
Maple |
|
|
nothing, optionally ; Classic REXX, Lua |
||
|
space |
Eiffel, Rebol |
|
|
end‐of‐line Assembler, Awk, Basic, BourneShell, CoffeeScript, E, F#, FishShell, Fortran, GNUsed, Haskell, Io, JavaScript, Lua, Matlab, merd, Pliant, Python, Ruby, Tcl |
||
|
(begin |
) |
Scheme |
|
(progn |
) |
|
|
(prog1 |
) |
Common Lisp, Emacs Lisp |
|
(prog2 |
) |
|
|
>> |
Haskell |
|
|
if_then |
||||||
|
if c then |
CoffeeScript, F#, merd, OCaml, Pascal, Tcl |
||||||
|
if c then |
end |
Eiffel, Lua, Oz, Ruby |
|||||
|
if c then |
end if |
Ada, Maple |
|||||
|
if c then |
fi |
Maple |
|||||
|
if c; then |
fi |
BourneShell |
|||||
|
if (c) then |
end |
Dylan |
|||||
|
if c do |
BCPL |
||||||
|
IF c THEN |
END |
Modula2, Modula3 |
|||||
|
if (c) |
Awk, B, C, C#, C++, Java, JavaScript, PHP, Pike, YCP |
||||||
|
if c: |
Python |
||||||
|
if c |
Pliant, Rebol, Tcl |
||||||
|
if (c): |
endif |
PHP |
|||||
|
if c { |
} |
Perl6 |
|||||
|
if c [ |
] |
Logo |
|||||
|
if (c) { |
} |
E, Perl, Yorick |
|||||
|
IF c |
MUMPS |
||||||
|
c |
‐> |
FL |
|||||
|
c |
if |
PostScript |
|||||
|
if c |
Perl, Ruby |
||||||
|
c |
if b1 then |
Forth |
|||||
|
(if c |
) |
Common Lisp, Scheme |
|||||
|
(when c |
) |
Emacs Lisp |
|||||
|
c |
and |
Perl, Ruby |
|||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
24/112
9/16/2016
syntax across languages (One Big Page)
|
if(c, |
) |
Io |
||||
|
If[c, |
] |
Mathematica |
||||
|
if(c) then( |
) |
Io |
||||
|
c |
ifTrue( |
) |
Io |
|||
|
c |
ifTrue: |
Smalltalk |
||||
|
<xsl:if test="c"> |
</xsl:if> |
XSLT |
||||
|
If c Then |
Visual Basic |
|||||
|
If c |
||||||
|
End If |
Visual Basic |
|||||
|
if c; |
end |
Ruby |
||||
|
if c; |
; |
end |
FishShell |
|||
|
if c, |
, |
end |
Matlab |
|||
|
if c |
||||||
|
end |
Matlab, Ruby |
|||||
|
if c then ; |
||||||
|
if c then |
||||||
|
if c then do |
Classic REXX |
|||||
|
end |
||||||
|
c |
and |
Perl |
||||
|
t |
label |
GNUsed |
||||
|
if c |
CoffeeScript |
|||||
if_then_else
|
if c then b1 else b2 |
CoffeeScript, F#, 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 |
Modula3 |
|
If c Then b1 ElseIf c2 Then b2 Else b3 End If |
Modula2 |
|
if (c) b1 else b2 |
Awk, B, C, C#, C++, Java, JavaScript, Pike, YCP |
|
if c b1 elsif c2 b2 b3 |
Tcl |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
25/112
9/16/2016
syntax across languages (One Big Page)
|
if c then b1 elseif c2 then b2 else b3 |
Tcl |
|
|
if c then begin b1 end else begin b2 |
Pascal |
|
|
end |
||
|
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 |
BourneShell |
|
|
if c; b1; else b2; end |
FishShell |
|
|
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 |
PHP |
|
|
endif |
||
|
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 |
|
if(c, b1, b2) |
Io |
|
|
If[c, b1, b2] |
Mathematica |
|
|
if(c) then(b1) else(b2) |
Io |
|
|
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 |
|
|
Which[c, b1, c2, b2, True, b3] |
Mathematica |
|
|
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 = |
Haskell |
|
b3(45) |
||
|
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, Tcl, YCP, Yorick |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
26/112
9/16/2016
syntax across languages (One Big Page)
|
c |
?? b1 !! b2 |
Perl6 |
|
b1 if c else b2(30) |
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> |
XSLT |
|
|
<xsl:otherwise> b3 </xsl:otherwise> |
||
|
</xsl:choose> |
||
|
If c Then b1 Else b2 |
Visual Basic |
|
|
If c |
||
|
b1 |
||
|
Else |
Visual Basic |
|
|
b2 |
||
|
End If |
||
|
if c: |
||
|
b1 |
||
|
elif c2: |
Python |
|
|
b2 |
||
|
else: |
||
|
b3 |
||
|
if c |
||
|
b1 |
||
|
elsif c2 |
||
|
b2 |
Ruby |
|
|
else |
||
|
b3 |
||
|
end |
||
|
if c |
||
|
b1 |
||
|
elseif c2 |
||
|
b2 |
Matlab |
|
|
else |
||
|
b3 |
||
|
end |
||
|
if c then ; b1 ; else ; b2 |
||
|
if c then |
||
|
b1 |
||
|
else |
||
|
b2 |
||
|
if c then do |
Classic REXX |
|
|
b1 |
||
|
end |
||
|
else do |
||
|
b2 |
||
|
end |
||
|
IF c |
||
|
ELSE |
MUMPS |
|
|
if c |
||
|
b1 |
||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
27/112
9/16/2016
syntax across languages (One Big Page)
|
else if c2 |
CoffeeScript |
|
b2 |
|
|
else |
|
|
b3 |
ifnot_then (unless)
|
unless |
CoffeeScript, Emacs Lisp, Perl |
|
|
ifFalse |
Smalltalk |
|
|
if(c) not then( |
) |
Io |
multiple selection (switch)
|
switch (val) { case v1: |
; |
break; |
|||
|
case v2: case v3: |
; |
break; |
C, C++, Java, JavaScript, PHP, Pike |
||
|
default: |
; |
||||
|
} |
|||||
|
switch val { case v1: |
; |
goto done; |
|||
|
case v2: case v3: |
; goto done; |
||||
|
} |
B |
||||
|
; |
|||||
|
done: |
|||||
|
switch (val) { case v1: |
; |
break; |
|||
|
case v2: case v3: |
; break; |
||||
|
default: |
; |
break; |
C# |
||
|
} |
|||||
|
(46) |
|||||
|
switch (val) { match v1 { match v2 { match _ { |
} |
||||
|
} |
E |
||||
|
} |
|||||
|
} |
|||||
|
switchon val |
|||||
|
case v1: |
BCPL |
||||
|
case v2: |
|||||
|
default: |
|||||
|
switch val |
|||||
|
case v1 |
|||||
|
case v2 v3 |
|||||
|
case '*' |
FishShell |
||||
|
end |
|||||
|
switch val |
|||||
|
case v1 |
|||||
|
case {v2,v3} |
Matlab |
||||
|
otherwise |
|||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
28/112
9/16/2016
syntax across languages (One Big Page)
|
end |
||||||
|
case val of v1 : ; |
||||||
|
v2, v3 : |
Pascal |
|||||
|
else |
||||||
|
end |
||||||
|
switch val { |
||||||
|
v1 { |
} |
|||||
|
v2 ‐ v3 { default { } } |
Tcl |
|||||
|
} |
||||||
|
case val in v1) statement1 ;; v2|v3) statement23 ;; *) statement_else ;; esac |
BourneShell |
|||||
|
(if val // v1 then // v2 then else if) |
Beta |
|||||
|
match val with |
||||||
|
| |
v1 ‐> |
F#, OCaml |
||||
|
| |
v2 | v3 ‐> |
|||||
|
| |
_ ‐> |
|||||
|
case val of v1 => |
SML |
|||||
|
| |
v2 => |
|||||
|
| |
_ => |
|||||
|
CASE val OF v1 => |
Modula3 |
|||||
|
| v2 => ELSE => |
END |
|||||
|
case val of v1 ‐> v2 ‐> |
Haskell |
|||||
|
‐> |
||||||
|
_ |
||||||
|
val case |
||||||
|
v1 of |
endof |
|||||
|
v2 of |
endof |
|||||
|
endcase |
Forth |
|||||
|
val. |
||||||
|
v1 ‐> |
merd |
|||||
|
v2 ‐> |
||||||
|
‐> |
||||||
|
_ |
||||||
|
(case val |
||||||
|
((v1) |
) |
Common Lisp |
||||
|
((v2) |
) |
|||||
|
(otherwise |
)) |
|||||
|
(case val |
||||||
|
((v1) |
) |
Scheme |
||||
|
((v2) |
) |
|||||
|
(else |
)) |
|||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
29/112
9/16/2016
syntax across languages (One Big Page)
|
case val is when v1 => when v2 | v3 => when others => end case; |
Ada |
||||||||
|
case val when v1; when v2, v3; 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, |
; X = v2, |
; |
) |
Mercury, Prolog |
|||||
|
my %case = ( v1 => sub { v2 => sub { |
}, |
||||||||
|
}, |
Perl |
||||||||
|
); if ($case{val}) { $case{val}‐>() } else { |
} |
||||||||
|
use Switch; switch ($val) { case v1 { case v2 { else }) |
} |
||||||||
|
} |
|||||||||
|
Perl |
|||||||||
|
(47) |
|||||||||
|
given $val { when v1 { when v2 { default { |
} |
||||||||
|
} |
Perl6 |
||||||||
|
} |
|||||||||
|
} |
|||||||||
|
Select val |
|||||||||
|
Case v1 |
|||||||||
|
Case v2, v3 |
|||||||||
|
Case Else |
Visual Basic |
||||||||
|
End Select |
|||||||||
|
switch (val) { |
|||||||||
|
v1 { |
} |
||||||||
|
v2 { |
} |
MSH |
|||||||
|
default { |
} |
||||||||
|
} |
|||||||||
|
switch val [ |
|||||||||
|
v1 [ |
] |
||||||||
|
v2 [ |
] |
||||||||
|
] |
Rebol |
||||||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
30/112
9/16/2016
syntax across languages (One Big Page)
|
switch/default [ |
||||||||||
|
v1 [ |
] |
|||||||||
|
v2 [ |
] |
|||||||||
|
][ |
] |
|||||||||
|
val caseOf: {[v1]‐>[ |
]. |
[v2]‐>[ |
]} |
otherwise: |
Squeak |
|||||
|
Switch[val, v1, , |
v2, |
, |
_, |
] |
Mathematica |
|||||
|
select when v1 when v2 | v3 otherwise end |
Classic REXX |
|||||||||
|
CASE val WHEN v1 THEN WHEN v2 THEN ELSE |
SQL92 |
|||||||||
|
END |
||||||||||
|
loop |
|||||||||
forever loop
|
loop |
CoffeeScript, merd, Perl6, PostScript, Ruby |
||
|
loop( |
) |
Io |
|
|
loop |
end loop |
Ada |
|
|
LOOP |
END |
Modula3 |
|
|
(loop do |
) |
Common Lisp |
|
|
cycle (# do #) Beta |
|||
|
repeat |
Squeak |
||
|
begin |
again |
Forth |
|
|
forever |
Logo, Rebol |
||
|
Do |
|||
|
Visual Basic |
|||
|
Loop |
|||
|
do forever |
|||
|
Classic REXX |
|||
|
end |
|||
while condition do something
|
while (c) |
Awk, B, C, C#, C++, E, Java, JavaScript, Perl, PHP, Pike, Ruby, YCP, Yorick |
|
|
while c |
CoffeeScript, Perl6, Tcl |
|
|
while c loop |
end loop |
Ada |
|
while c do |
BCPL, Pascal, SML |
|
|
while c do |
done |
F#, OCaml |
|
while c do |
end do |
Maple |
|
while c do |
end |
Lua |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
31/112
9/16/2016
syntax across languages (One Big Page)
|
WHILE c DO |
END |
Modula3 |
||||||
|
while c: |
Python |
|||||||
|
while c; do |
; |
done |
BourneShell |
|||||
|
while c; |
; |
end |
FishShell |
|||||
|
while c, |
, |
end |
Matlab |
|||||
|
while [c][ |
] |
Rebol |
||||||
|
while c [ |
] |
Logo |
||||||
|
while(c, |
) |
Io |
||||||
|
While[c, |
] |
Mathematica |
||||||
|
do.while [ |
] |
c |
Logo |
|||||
|
c whileTrue: |
Smalltalk |
|||||||
|
(loop while c do |
) |
Common Lisp |
||||||
|
loop (# while ::< (# do c ‐> value #) |
Beta |
|||||||
|
do |
#) |
|||||||
|
begin c while |
repeat |
Forth |
||||||
|
from until not c loop |
end |
Eiffel |
||||||
|
while c |
Pliant |
|||||||
|
while c do |
F# |
|||||||
|
Do While c |
||||||||
|
Visual Basic |
||||||||
|
Loop |
||||||||
|
do while c |
||||||||
|
Classic REXX |
||||||||
|
end |
||||||||
|
do something until condition |
||||||||
|
do |
until c |
Perl6 |
||||||
|
do { |
} until c |
Perl |
||||||
|
do |
while (!c) |
Awk, C, C#, C++, Java, JavaScript, Pike, Yorick |
||||||
|
begin |
end until c |
Ruby |
||||||
|
begin |
c until |
Forth |
||||||
|
REPEAT |
UNTIL c |
Modula3 |
||||||
|
loop (# until ::< (# do c ‐> value #) do #) Beta |
||||||||
|
loop |
exit when c; end loop |
Ada |
||||||
|
(loop do |
until c) |
Common Lisp |
||||||
|
repeatuntil c |
BCPL |
|||||||
|
repeat |
until c |
Lua, Pascal |
||||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
32/112
9/16/2016
syntax across languages (One Big Page)
|
repeat |
until (c) |
YCP |
||||
|
repeat, |
, |
c |
Prolog |
|||
|
until [ |
c] |
Rebol |
||||
|
until c [ |
] |
Logo |
||||
|
do.while [ |
] |
c |
Logo |
|||
|
While[ |
; |
c] |
Mathematica |
|||
|
[ |
] whileFalse: [c] |
Smalltalk |
||||
|
Do |
||||||
|
Loop Until c |
Visual Basic |
|||||
for each value in a numeric range, 1 increment (see also the entries about ranges)
|
for (int i = 1; i <= 10; i++) |
C, C#, C++ |
|||||||
|
for (i = 1; i <= 10; i++) |
Awk, JavaScript |
|||||||
|
for ($i = 1; $i <= 10; $i++) |
PHP |
|||||||
|
foreach my $i (1 |
10) { |
} |
Perl |
|||||
|
foreach ($i in 1 |
10) { |
} |
MSH |
|||||
|
for (1 10) ‐> $i { } |
Perl6 |
|||||||
|
for i = 1:10, |
, |
end |
Matlab |
|||||
|
for i = 1, 10 do |
end |
Lua |
||||||
|
for i := 1 to 10 do |
Pascal |
|||||||
|
for i = 1 to 10 do |
done |
F#, OCaml |
||||||
|
For i = 1 To 10 |
Next |
Visual Basic |
||||||
|
for i in 1 |
10 loop |
end loop |
Ada |
|||||
|
for i in 1 |
10 do |
done |
F# |
|||||
|
for i in [1 |
10] |
CoffeeScript |
||||||
|
for i in xrange(1, 11) |
Python |
|||||||
|
for i in (seq 10); |
; end |
FishShell |
||||||
|
FOR I=1:1:10 |
MUMPS |
|||||||
|
for i from 1 to 10 do |
end do |
Maple |
||||||
|
for [i 1 10 +1] [ |
] |
Logo |
||||||
|
for {set i 1} {$i <= 10} {incr i} { |
} |
Tcl |
||||||
|
1 |
1 10 for |
PostScript |
||||||
|
11 1 do |
loop |
Forth |
||||||
|
(1 |
10).each |
{|i| |
} |
Ruby |
||||
|
1.upto(10) {|i| |
} |
Ruby |
||||||
|
1 |
to(10) foreach( |
) |
||||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
33/112
9/16/2016
syntax across languages (One Big Page)
|
Io |
||||
|
1 to: 10 do: [ |
] |
Smalltalk |
||
|
(loop for i from 1 to 10 do |
) |
Common Lisp |
||
|
do label i = 1, 10 |
Fortran |
|||
|
Do[ |
, {i, 1, 10}](48) |
Mathematica |
||
|
do i = 1 for 10 |
||||
|
end |
Classic REXX |
|||
for each value in a numeric range, 1 decrement
|
for X := 10 downto 1 do |
Pascal |
|||||||||||
|
for i = 10 downto 1 do |
done |
F#, OCaml |
||||||||||
|
for i in reverse 1 |
10 loop |
end loop |
Ada |
|||||||||
|
for i in 10 ‐1 |
1 do |
done |
F# |
|||||||||
|
for (int i = 10; i >= 1; i‐‐) |
C, C#, C++ |
|||||||||||
|
for (my $i = 10; $i >= 1; $i‐‐) { |
} |
Perl |
||||||||||
|
loop (my $i = 10; $i >= 1; $i‐‐) { |
} |
Perl6 |
||||||||||
|
for (i = 1; i <= 10; i‐‐) |
Awk, JavaScript |
|||||||||||
|
for ($i = 1; $i <= 10; $i‐‐) |
PHP |
|||||||||||
|
from i := 10 until i < 1 loop |
i := i ‐ 1 end Eiffel |
|||||||||||
|
for i = 10:‐1:1, |
, |
end |
Matlab |
|||||||||
|
for i = 10, 1, ‐1 do |
end |
Lua |
||||||||||
|
For i = 10 To 1 Step ‐1 |
Next |
Visual Basic |
||||||||||
|
for i in xrange(10, 0, ‐1) |
Python |
|||||||||||
|
for i in `seq 10 ‐1 1`; do |
; |
done |
BourneShell |
|||||||||
|
for i in (seq 10 ‐1 1); |
; |
end |
FishShell |
|||||||||
|
for i from 10 to 1 by ‐1 do |
end do |
Maple |
||||||||||
|
for [i 1 10 ‐1] [ |
] |
Logo |
||||||||||
|
FOR I=10:‐1:1 |
MUMPS |
|||||||||||
|
for {set i 10} {$i >= 1} {incr i ‐1} { |
} |
Tcl |
||||||||||
|
10 |
‐1 1 |
for |
PostScript |
|||||||||
|
1 |
10 do |
‐1 +loop |
Forth |
|||||||||
|
1 |
to: 10 by: ‐1 do: [ |
] |
Smalltalk |
|||||||||
|
10 |
to(1) foreach( |
) |
Io |
|||||||||
|
10.downto(1) {|i| |
} |
Ruby |
||||||||||
|
(loop for i from 1 to 10 by ‐1 do |
) |
Common Lisp |
||||||||||
|
do label i = 10, 1, ‐1 |
||||||||||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
34/112
9/16/2016
syntax across languages (One Big Page)
|
Fortran |
|||
|
Do[ |
, {i, 10, 1, ‐1}] |
Mathematica |
|
|
do i = 10 to 1 by ‐1 |
|||
|
end |
Classic REXX |
||
|
for i in [10 |
1] |
CoffeeScript |
|
for each value in a numeric range, free increment
|
for (int i = 1; i <= 10; i += 2) |
C, C#, C++, Pike |
|||||||||||
|
for (i = 1; i <= 10; i += 2) |
Awk, JavaScript |
|||||||||||
|
for ($i = 1; $i <= 10; $i += 2) |
PHP |
|||||||||||
|
for (my $i = 1; $i <= 10; $i += 2) { |
} |
Perl |
||||||||||
|
loop (my $i = 1; $i <= 10; $i += 2) { |
} |
Perl6 |
||||||||||
|
from i := 1 until i > 10 loop |
i := i + 2 end Eiffel |
|||||||||||
|
for i = 1:3:10, |
, |
end |
Matlab |
|||||||||
|
for i = 1, 10, 2 do |
end |
Lua |
||||||||||
|
For i = 1 To 10 Step 2 |
Next |
Visual Basic |
||||||||||
|
for i in 1 |
2 |
10 do |
done |
F# |
||||||||
|
for i in xrange(1, 11, 2) |
Python |
|||||||||||
|
for i in (seq 1 2 10); |
; |
end |
FishShell |
|||||||||
|
for i from 1 to 10 by 2 do |
end do |
Maple |
||||||||||
|
for [i 1 10 2] [ |
] |
Logo |
||||||||||
|
FOR I=1:2:10 |
MUMPS |
|||||||||||
|
for {set i 0} {$i <= 10} {incr i 2} { |
} |
Tcl |
||||||||||
|
1 |
2 10 |
for |
PostScript |
|||||||||
|
11 1 do |
2 +loop |
Forth |
||||||||||
|
1 |
to: 10 by: 2 do: [ |
] |
Smalltalk |
|||||||||
|
(1 |
10).step(2) |
{|i| |
} |
Ruby |
||||||||
|
1 |
to (9,2) foreach( |
) |
Io |
|||||||||
|
(loop for i from 1 to 10 by 2 do |
) |
Common Lisp |
||||||||||
|
do label i = 1, 10, 2 |
Fortran |
|||||||||||
|
Do[ |
, {i, 1, 10, 2}] |
Mathematica |
||||||||||
|
do i = 1 to 10 by 2 |
||||||||||||
|
Classic REXX |
||||||||||||
|
end |
||||||||||||
|
for i in [1 |
10] |
by 2 |
CoffeeScript |
|||||||||
for "a la C" (while + initialisation)
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
35/112
9/16/2016
syntax across languages (One Big Page)
|
for |
Awk, C, C#, C++, Java, JavaScript, Mathematica, MSH, Perl, PHP, Pike, Tcl, Yorick |
|||
|
loop |
Perl6 |
|||
|
for ((x = 0; x < 10; x++)); do |
; |
done |
BourneShell |
|
|
from init_code until c loop incr_statement end |
Eiffel |
|||
|
(loop with VAR = INITIAL‐VALUE CONDITION finally INCREMENT |
) |
while |
Common Lisp |
|
breaking control flow
returning a value
|
return(40) |
Ada, Awk, B, BCPL, BourneShell, C, C#, C++, Classic REXX, CoffeeScript, Common Lisp, E, FishShell, Io, Java, JavaScript, Lua, Maple, Matlab, Perl, Perl6, PHP, Pike, Pliant, Python, Rebol, Ruby, Tcl, YCP, Yorick |
|
Return |
Mathematica, Visual Basic |
|
RETURN |
Modula3 |
|
resultis(41) BCPL |
|
|
return‐from |
|
|
xxx |
Common Lisp |
|
^ |
Smalltalk |
|
Exit |
|
|
Function / |
Visual Basic |
|
Exit Sub |
|
|
exit |
Forth |
|
output |
Logo |
goto (unconditional jump)
|
goto |
Ada, B, Basic, BCPL, C, C#, C++, Cobol, Fortran, Logo, MUMPS, Pascal, Perl, PHP5, Yorick |
|
Goto |
Mathematica |
|
go throw Common Lisp |
|
|
signal |
Classic REXX |
|
b |
GNUsed |
|
b, bra, |
Assembler |
|
jmp |
|
continue / break
|
continue / break |
Awk, C, C#, C++, CoffeeScript, E, FishShell, Io, Java, JavaScript, Matlab, PHP, Pike, Python, Tcl, YCP, Yorick |
|
Continue / Break |
Mathematica |
|
next / last |
Perl, Perl6 |
|
next / break(49) |
Maple, Ruby |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
36/112
9/16/2016
syntax across languages (One Big Page)
|
/ |
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 |
||
|
/ |
leave |
Forth |
|
redo / retry
|
redo/ |
Perl, Perl6 |
|
redo / retry Io, Ruby |
|
exception
throwing
|
raise |
Ada, Eiffel, F#, merd, OCaml, Python, Ruby, SchemeSRFI34, SML |
|
|
RAISE |
Modula3 |
|
|
raise |
end |
Oz |
|
Exception raise |
Io |
|
|
throw |
C#, C++, CoffeeScript, E, Erlang, Forth, Haskell, Java, JavaScript, Logo, PHP5, Pike, Prolog, Rebol |
|
|
Throw |
Mathematica |
|
|
throw/name |
Rebol |
|
|
die |
Perl, Perl6 |
|
|
return ‐code |
Tcl |
|
|
error |
Common Lisp, Dylan, Emacs Lisp, Lua, Lua, Maple, Matlab, Pliant, Yorick |
|
|
signal |
Common Lisp, Dylan, Smalltalk |
|
|
signal predefined_condition_name Classic REXX |
||
|
cerror warn |
Common Lisp |
|
|
[NSException raise:name ] |
ObjectiveC |
|
catching
|
try: a except exn: |
Python |
|
try a with exn ‐> |
F#, OCaml |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
37/112
9/16/2016
syntax across languages (One Big Page)
|
try a catch (exn) |
C#, C++, Java, JavaScript |
||||||
|
try a |
|||||||
|
catch exn |
CoffeeScript |
||||||
|
try { |
} catch(t $v) { |
} |
PHP5 |
||||
|
try a catch exn then |
end |
Oz |
|||||
|
try a catch exn: |
end try |
Maple |
|||||
|
try(a) ; catch( |
) |
Io |
|||||
|
try { a CATCH exn { |
} } |
Perl6 |
|||||
|
TRY a EXCEPT exn => |
END |
Modula3 |
|||||
|
a handle exn => |
SML |
||||||
|
a on: exception_name do: [:exn | |
] |
Smalltalk |
|||||
|
ifCurtailed |
Smalltalk |
||||||
|
rescue |
Eiffel, Ruby |
||||||
|
eval {a}; if ($@) |
Perl |
||||||
|
exception when exception_name => |
Ada |
||||||
|
catch a (\exn ‐> |
) |
Haskell |
|||||
|
catch |
Erlang, Forth, Logo, Prolog, Rebol, Tcl |
||||||
|
Catch |
Mathematica |
||||||
|
catch/name |
Rebol |
||||||
|
catch( |
) or catch { |
}; |
Pike |
||||
|
if (catch(exn)) { |
} a |
Yorick |
|||||
|
pcall |
Lua |
||||||
|
with‐exception‐handler or guard |
SchemeSRFI34 |
||||||
|
block a exception(exn) |
end |
Dylan |
|||||
|
?, shy, safe |
Pliant |
||||||
|
handler‐bind handler‐case ignore‐errors Common Lisp |
|||||||
|
NS_DURING a NS_HANDLER |
NS_ENDHANDLER ObjectiveC |
||||||
|
try |
|||||||
|
a |
|||||||
|
catch |
Matlab |
||||||
|
end |
|||||||
|
signal on predefined_condition_name |
|||||||
|
predefined_condition_name : |
Classic REXX |
||||||
cleanup: code executed before leaving
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
38/112
9/16/2016
syntax across languages (One Big Page)
|
ensure |
Ruby, Smalltalk |
|
finally |
C#, F#, Java, Maple, Python |
|
FINALLY |
Modula3 |
|
unwind‐protect Common Lisp, Emacs Lisp |
|
|
cleanup |
Dylan |
|
dynamic‐wind |
Scheme |
retrying: after catching an exception, tell the snippet to be rerun
resume execution where the exception took place
resume Smalltalk
callwithcurrentcontinuation
|
call‐with‐current‐continuation(50) Scheme |
|
|
callcc |
Ruby, SMLNJ |
Types
declaration
|
typedef t n |
C, C++, Pike |
||
|
type n is t |
Ada |
||
|
type n |
Pliant |
||
|
type n = t |
F#, Haskell, OCaml, Pascal, SML |
||
|
TYPE n = t |
Modula3 |
||
|
using n = |
C# |
||
|
data n = t |
Haskell |
||
|
datatype n = t |
SML |
||
|
newtype n = t |
Haskell |
||
|
n |
= t |
merd, Python |
|
|
n |
: |
t |
Beta |
|
(deftype n () 't) Common Lisp |
|||
annotation (or variable declaration)
:
Ada, E, Eiffel, F#, Modula3, OCaml, Pascal, SML
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
39/112
9/16/2016
syntax across languages (One Big Page)
|
:: |
Dylan, Haskell, Mercury |
|
|
!! |
merd |
|
|
t |
v |
C, C#, C++, Java, Perl6, Pike, Pliant, YCP |
|
(declare (t v)) Common Lisp |
||
|
v |
:@ t |
Beta |
|
_t(51) |
Mathematica |
|
cast
upcast
|
(t) |
e |
C, C#, C++, Java, PHP |
|
|
t(e) |
Ada, Pascal |
||
|
[t] |
e |
Pike |
|
|
static_cast<t>(e) C++ |
|||
|
e |
:> t |
OCaml |
|
|
e |
: |
t |
F# |
|
upcast e |
F# |
||
|
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# |
|
|
e |
:?> t |
F# |
|
|
downcast e(52) |
F# |
||
|
v |
?= e(53) |
Eiffel |
|
|
NARROW(e, t) |
Modula3 |
||
|
typecast(e,t) |
Matlab |
||
computed conversion (calls an internal or a userdefined function)
|
(t) |
e |
C++, Pike |
|
|
[t] |
e |
MSH |
|
|
t(e) |
C++, Matlab, Python |
||
|
t |
e |
||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
40/112
9/16/2016
syntax across languages (One Big Page)
|
F# |
|||
|
e |
: |
t |
E |
|
e |
:: t |
Haskell |
|
|
cast e t |
Pliant |
||
|
cast t |
Pliant |
||
|
make t e / to t e Rebol |
|||
mutability, constness
type of a mutable value
|
mutability is the default C, C#, C++, Java, Matlab |
||
|
val x: T |
Pascal |
|
|
T |
ref |
F#, OCaml, SML |
|
STRef a T |
Haskell |
|
|
in out T(54) |
Ada |
|
type of a constant value
|
const T |
C++, C99 |
|
constant T |
Ada |
|
const x: T |
Pascal |
|
constness is the default F#, Haskell, OCaml, SML |
|
special cases
|
"readonly" fields(55) |
C# |
|
"final" fields, parameters, local variables(55) Java |
|
Object Oriented & Reflexivity
method invocation
|
object.method(para) |
Ada, Beta, C#, C++, Cecil, CoffeeScript, DelphiKylix, E, Eiffel, F#, Icon, Java, JavaScript, merd, Modula3, MSH, Perl6, Python, Ruby, Sather, Visual Basic |
|
object#method para |
OCaml |
|
object:method(para) |
Lua |
|
object method(para) |
Io |
|
object method para |
Pliant, Tcl |
|
object method: para1 |
|
|
method_continuation: |
Smalltalk |
|
para2 |
|
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
41/112
9/16/2016
syntax across languages (One Big Page)
|
object <‐ method(para) |
E |
|
|
(56) |
||
|
[ |
object method: para |
ObjectiveC |
|
] |
||
|
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 |
Ada, Eiffel, F#, merd, Perl6, Ruby |
|
|
object.property(57) C# |
||
|
object.method() |
C#, C++, CoffeeScript, E, Java, JavaScript, Python |
|
|
object#method |
OCaml |
|
|
object:method |
Pliant |
|
|
object‐>method |
Perl |
|
|
object‐>method() |
PHP5, Pike |
|
|
object/method |
Rebol |
|
|
object["method"]() |
Pike |
|
|
object method |
Io, Smalltalk |
|
|
[ |
object method ] |
ObjectiveC |
|
method object |
Haskell, Mercury |
|
|
(method object) |
Common Lisp |
|
|
method(object) |
Ada, Dylan, Matlab |
|
|
(send object method) MzScheme |
||
object creation
|
new |
PHP, Pliant, Simula |
|
|
new class_name( |
) |
C#, C++, CoffeeScript, F#, Java, JavaScript, Perl, PHP, Visual Basic |
|
new class_name |
CoffeeScript, OCaml |
|
|
class_name.new( |
) |
Perl6, Ruby |
|
class_name new |
Smalltalk |
|
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
42/112
9/16/2016
syntax across languages (One Big Page)
|
class_name( |
) |
|
F#, Matlab, Pike, Python |
|||||
|
class_name v( |
) |
C++ |
|||||||
|
v |
: class_name |
Ada |
|||||||
|
class_name.Create |
DelphiKylix |
||||||||
|
!class_name!constructor_name( |
) |
Eiffel |
|||||||
|
& |
Beta |
||||||||
|
make‐object |
MzScheme |
||||||||
|
(make‐instance class_name |
) |
Common Lisp |
|||||||
|
[class_name alloc] |
ObjectiveC |
||||||||
|
make class_name! |
Rebol |
||||||||
|
def object_name { |
} |
E |
|||||||
|
object cloning |
|||||||||
|
o.clone |
Perl6 |
||||||||
|
o.clone(58) |
Eiffel, Ruby |
||||||||
|
o.deep_clone |
Eiffel |
||||||||
|
o.clone() |
Java |
||||||||
|
o.Clone() |
C# |
||||||||
|
clone $o |
PHP5 |
||||||||
|
o |
clone |
Io |
|||||||
|
clone / copy or deepCopy Smalltalk |
|||||||||
|
Storable::dclone |
Perl |
||||||||
|
[o copy] |
ObjectiveC |
||||||||
|
copy.copy(o)(59) |
Python |
||||||||
|
purecopy |
Emacs Lisp |
||||||||
|
{< >} or Oo.copy o |
OCaml |
||||||||
|
o2 = o(60) |
C++, Matlab, PHP |
||||||||
|
$o2 = $o |
PHP |
||||||||
|
o2.all := o.all |
Ada |
||||||||
|
make o [] |
Rebol |
||||||||
|
o_ : T'Class := o(61) |
Ada |
||||||||
manually call an object's destructor
|
delete |
C++, JavaScript |
|
destroy |
Pike |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
43/112
9/16/2016
syntax across languages (One Big Page)
|
DESTROY |
Perl |
|
|
dealloc |
ObjectiveC |
|
|
Dispose |
C#, F# |
|
|
del, |
del |
Python |
|
destruct |
PHP5 |
|
|
Requires instantiation of Ada.Unchecked_Deallocation Ada |
||
class declaration
|
class |
C#, C++, CoffeeScript, Haskell, Java, Matlab, MzScheme, OCaml, Perl6, PHP, Pike, Python, Ruby |
||||
|
class c inherit p1 p2 |
feature |
Eiffel |
|||
|
decl decl |
end |
||||
|
defclass defstruct |
Common Lisp |
||||
|
subclass |
Smalltalk |
||||
|
struct |
C++ |
||||
|
type |
Pliant |
||||
|
type c is tagged record |
end |
Ada |
|||
|
record(62) |
|||||
|
@interface c { |
} |
@end |
ObjectiveC |
||
|
: |
Beta |
||||
|
type c() = class |
end |
F# |
|||
|
type c() = |
F# |
||||
testing class membership
|
isa |
Matlab, Perl |
|
is_a? kind_of? |
Ruby |
|
o.meta.isa |
Perl6 |
|
isKindOf(63) |
Smalltalk |
|
isKindOfClass |
ObjectiveC |
|
dynamic_cast |
C++ |
|
instanceof |
CoffeeScript, Java, JavaScript, PHP5 |
|
isinstance |
Python |
|
in |
Ada |
|
is |
C# |
|
is_a |
PHP |
|
:? |
F# |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
44/112
9/16/2016
syntax across languages (One Big Page)
|
Program.inherits or Program.implements |
Pike |
|
entry_type |
Pliant |
|
typep |
Common Lisp |
|
ISTYPE |
Modula3 |
|
object## < classname## |
Beta |
|
type.accepts(object) / object =~ v : type E |
|
|
var ?= val(64) |
Eiffel |
get the type/class corresponding to an object/instance/value
|
class |
Matlab, ObjectiveC, Ruby, Smalltalk |
|
class |
Python |
|
getClass |
Java |
|
get_class |
PHP |
|
GetType |
F# |
|
typeid |
C++ |
|
typeof |
C#, CoffeeScript, JavaScript |
|
type‐of |
Common Lisp |
|
type |
Io |
|
ref |
Perl |
|
generator |
Eiffel |
|
meta |
Perl6 |
|
object_program Pike |
|
|
getAllegedType E |
|
methods available
|
methods |
Matlab, Ruby |
|
get_class_methods |
PHP |
|
getMethods |
Java |
|
get‐member |
MSH |
|
indices |
Pike |
|
o.meta.getmethods |
Perl6 |
|
dir |
Python |
|
slotNames |
Io |
|
o.GetType().GetMethods() |
F# |
|
o class selectors / o class allSelectors Smalltalk |
|
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
45/112
9/16/2016
syntax across languages (One Big Page)
o
getAllegedType().getMessageTypes()
E
inheritance
|
child :< parent |
Beta |
||||||||
|
class child : parent |
C#, C++ |
||||||||
|
class child < parent end |
Ruby |
||||||||
|
class child is parent { |
} |
Perl6 |
|||||||
|
class child extends parent |
CoffeeScript, Java, PHP5 |
||||||||
|
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 |
|||||||
|
type child = inherit parent |
F# |
||||||||
|
(defclass child (parent) |
) |
Common Lisp |
|||||||
|
@interface child : parent { |
} |
@end |
ObjectiveC |
||||||
|
@ISA = qw(parent1 parent2) |
Perl |
||||||||
|
clone , setProtos, setProto, prependProto, appendProto Io |
|||||||||
|
instance Parent Child where |
Haskell |
||||||||
|
has the method |
|||||||||
|
can |
Perl, Perl6 |
||||||||
|
respond_to? |
Ruby |
||||||||
|
respondsTo |
E, Smalltalk |
||||||||
|
respondsToSelector |
ObjectiveC |
||||||||
|
hasattr(obj, "meth")(65) |
Python |
||||||||
|
object‐>method |
Pike |
||||||||
|
all [in object 'method function? get in object 'method] Rebol |
|||||||||
|
find‐method |
Common Lisp |
||||||||
|
ismethod |
Matlab |
||||||||
|
hasSlot |
Io |
||||||||
|
try obj.GetType().GetMethod("meth") with |
F# |
||||||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
46/112
9/16/2016
syntax across languages (One Big Page)
|
obj.meth? instanceof Function |
CoffeeScript |
|
method_exists |
PHP5 |
current instance
|
Beta, C#, C++, CoffeeScript, Java, JavaScript, PHP, |
|
|
this |
Pike |
|
THIS |
Simula |
|
self |
Io, ObjectiveC, Rebol, Ruby, Smalltalk |
|
object_name if defined as: def object_name { } |
E |
|
Current |
Eiffel |
|
first parameter(66) |
Matlab, Perl, Pliant, Python |
|
the object variable |
F# |
|
dispatching parameter |
Ada, Common Lisp |
|
Me |
Visual Basic |
|
. |
Perl6 |
accessing parent method
|
super |
CoffeeScript, E, Java, ObjectiveC, Ruby, Smalltalk |
||
|
super(Class, self).meth(args) |
Python |
||
|
base |
C# |
||
|
resend |
Io |
||
|
Precursor |
Eiffel |
||
|
$o.SUPER::method( |
) |
Perl6 |
|
|
$o‐>SUPER::method( |
) |
Perl |
|
|
method(parent(dispatching‐parameter)) Ada |
|||
|
parent(dispatching‐parameter).method Ada |
|||
|
parent::method |
PHP5 |
||
|
call‐next‐method |
Common Lisp |
||
|
type foo2 = inherit foo as parent |
F# |
||
|
member |
= |
parent.meth |
|
accessing child method
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
47/112
9/16/2016
syntax across languages (One Big Page)
Package, Module
package scope
|
Ada, C#, CoffeeScript, E, F#, Haskell, Java, Modula3, OCaml, Pascal, Python, Ruby, SML, |
||
|
. |
Squeak |
|
|
: |
XML |
|
|
:: |
C++, merd, Perl, Ruby, Squeak, Tcl, YCP |
|
|
: |
:: |
|
|
(67) |
Common Lisp |
|
|
:‐ |
Maple |
|
|
' |
Perl |
|
|
` |
Mathematica |
|
|
Mercury |
||
|
/ |
Matlab |
|
declare
|
package p; |
Java, Perl |
|||||
|
namespace p { |
} |
C#, C++ |
||||
|
namespace p |
F# |
|||||
|
namespace P; |
PHP5 |
|||||
|
namespace eval p |
Tcl |
|||||
|
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, Tcl8.5 |
|||||
|
package declare(68) |
Matlab |
|||||
|
Begin["p`"] |
End[] |
Mathematica |
||||
|
BeginPackage["p`"] |
EndPackage[] |
Mathematica |
||||
|
<node xmlns="namespace"> |
</node> |
XML |
||||
|
package p is ‐‐ Declare public package members here private ‐‐ Declare private package members here end p; |
Ada |
|||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
48/112
9/16/2016
syntax across languages (One Big Page)
package body p is ‐‐ Define package implementation here end p;
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 |
|||||||||
|
Common |
||||||||||||
|
(export 'name1 'name2) |
Lisp |
|||||||||||
|
Java, |
||||||||||||
|
attached to each name (public, private |
) |
Pike |
||||||||||
|
namespace export name1 |
Tcl |
|||||||||||
|
namespace p val name1 : type1 |
F# |
|||||||||||
|
append_features |
Ruby |
|||||||||||
|
module type PType = sig val name1 : type1 |
end |
OCaml |
||||||||||
|
module P : PType |
= struct |
end |
||||||||||
|
all files in package directory are exported. files in /private sub‐directory are not exported, but can be used by the package itself |
Matlab |
|||||||||||
|
all |
= |
[ |
] |
Python |
||||||||
|
import |
|||||||||||
everything into current namespace
|
use p(69) |
Perl |
|
uses p |
Pascal |
|
using p |
C# |
|
using namespace p; |
C++ |
|
(use‐package 'p) |
Common Lisp |
|
open p |
F#, OCaml |
|
import |
Pike |
|
import p |
Haskell |
|
IMPORT p; |
Modula2 |
|
import p.* |
Java |
|
import "p" |
YCP |
|
from p import * |
Python |
|
with p; use p; |
Ada |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
49/112
9/16/2016
syntax across languages (One Big Page)
|
namespace import p * |
Tcl |
|||||
|
inherit c export {NONE} all end Eiffel |
||||||
|
include or even extend |
Ruby |
|||||
|
do |
Rebol |
|||||
|
addpath |
Matlab |
|||||
|
. |
p |
BourneShell |
||||
|
source p |
BourneShell |
|||||
|
builtin ‐f /path/to/lib.so |
KornShell |
|||||
|
<< p` |
Mathematica |
|||||
|
Get["p`"] |
Mathematica |
|||||
|
Needs["p`"] |
Mathematica |
|||||
|
use P1\P; |
PHP5 |
|||||
|
use P1\P as Q; |
PHP5 |
|||||
|
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, |
; |
Modula2 |
||||
|
namespace import p name1 |
Tcl |
|||||
|
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;(70) |
Perl |
|
require p |
Perl |
|
require "p" |
Ruby |
|
require, "p" |
Yorick |
|
(require 'p)(71) |
Common Lisp |
|
with p; |
Ada |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
50/112
9/16/2016
syntax across languages (One Big Page)
|
with(p) |
Maple |
|
package require p |
Tcl |
|
automatically done(72) Java, OCaml |
|
Strings
type name
|
char[] |
C |
|
char const[] |
C++ |
|
string |
C#, C++, F#, Maple, OCaml, Pascal, PHP, Pike, SML, YCP |
|
string! |
Rebol |
|
String |
Ada, C#, CoffeeScript, Haskell, Java, JavaScript, merd, Ruby, Smalltalk, Visual Basic |
|
STRING |
Eiffel |
|
str |
Python, YAML |
|
Str |
Perl6, Pliant |
|
NSString * |
ObjectiveC |
|
CHAR, |
SQL92 |
|
VARCHAR(size) |
|
|
Sequence |
Io |
character type name
|
char |
C, C#, C++, F#, OCaml, SML |
|
char! |
Rebol |
|
Char |
Haskell, merd, Perl6 |
|
Character Ada, Smalltalk |
|
|
CHARACTER Eiffel |
|
character "z"
|
'z' |
Ada, B, C, C#, C++, Classic REXX, E, Eiffel, F#, Haskell, Matlab, OCaml, Pascal, Pike |
|
"z" |
BourneShell, Classic REXX, Maple, merd |
|
"z |
Logo |
|
$z |
Smalltalk |
|
#\z |
Common Lisp, Scheme |
|
#"z" |
Rebol, SML |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
51/112
9/16/2016
syntax across languages (One Big Page)
|
&z |
Oz |
|
?z |
Emacs Lisp, Ruby |
|
char z, [char] |
Forth |
|
z(73) |
strings
with no interpolation of variables
|
' |
' |
Beta, BourneShell, Classic REXX, CoffeeScript, CSS, FishShell, JavaScript, Lua, Matlab, Pascal, Perl, Perl6, PHP, Prolog, Python, Ruby, Smalltalk, SQL92, XPath, YAML |
|||||
|
" |
" |
Ada, Awk, C, C#, C++, Classic REXX, Common Lisp, CSS, Dylan, E, Eiffel, Emacs Lisp, F#, FL, Haskell, Io, Java, JavaScript, Lua, Maple, Mathematica, Modula3, MUMPS, OCaml, Oz, Pike, Pliant, Prolog, Python, Rebol, Scheme, SML, XPath, YAML, YCP |
|||||
|
" |
Logo |
||||||
|
''' |
''' |
Python |
|||||
|
""" |
""" |
Io, Python |
|||||
|
[[ |
]] |
Lua |
|||||
|
R"[ |
]" |
C++0x |
|||||
|
<<'MARK' |
|||||||
|
MARK |
BourneShell, Perl, Ruby |
||||||
|
<<<'MARK' |
|||||||
|
MARK(74) |
PHP5 |
||||||
|
{ |
{ |
} |
} |
Tcl |
|||
|
( |
) |
PostScript |
|||||
|
q( |
( |
) |
), |
||||
|
q[ |
], |
q{ |
}, |
Perl, Perl6 |
|||
|
q< |
>, |
q/ |
/ |
||||
|
%q( |
|||||||
|
( |
) |
), |
|||||
|
%q[ |
], |
Ruby |
|||||
|
%q{ |
}, |
||||||
|
%q< |
>, |
||||||
|
%q/ |
/ |
||||||
|
q( |
( |
) |
) |
merd |
|||
|
@" |
"" |
" |
C# |
||||
|
s" |
" |
Forth |
|||||
|
@" |
" |
ObjectiveC |
|||||
with interpolation of variables
|
(75) |
Tcl |
||
|
" |
$v |
" |
BourneShell, FishShell, Perl, Perl6, PHP, Tcl |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
52/112
9/16/2016
syntax across languages (One Big Page)
|
" |
{v} |
" |
merd |
||||||||||||||||
|
" |
#{v} |
" |
" |
#$v |
" |
" |
#@v |
" |
" |
#@@v |
CoffeeScript, Ruby |
||||||||
|
" |
|||||||||||||||||||
|
<<MARK |
$v |
MARK |
BourneShell, Perl |
||||||||||||||||
|
<<MARK |
#{v} |
MARK |
Ruby |
||||||||||||||||
|
<<<MARK |
$v |
MARK |
PHP |
||||||||||||||||
|
qq( |
( |
$v |
) |
), |
qq[ |
], |
qq{ |
}, |
qq< |
>, |
Perl, Perl6 |
||||||||
|
qq/ |
/ |
||||||||||||||||||
|
%Q( |
( |
#{v} |
) |
), |
%Q[ |
], |
%Q{ |
}, |
%Q< |
>, |
Ruby |
||||||||
|
%Q/ |
/ |
||||||||||||||||||
|
qq( |
( |
{v} |
) |
) |
merd |
||||||||||||||
|
" |
#{v} |
" |
interpolate |
Io |
|||||||||||||||
|
" |
%(v)s |
" % vars() |
Python |
||||||||||||||||
endofline (without writing the real CR or LF character)
|
\n |
Tcl |
|
"\n" |
C, C#, C++, CoffeeScript, FishShell, Haskell, Io, Java, JavaScript, Lua, Maple, Mathematica, OCaml, Perl, Perl6, PHP, Pike, Python, Ruby, YCP, Yorick |
|
"*n" |
B, BCPL |
|
"%N" |
Eiffel |
|
"^/" |
Rebol |
|
"~%"(76) Common Lisp |
|
|
"[lf]" |
Pliant |
|
vb_nl |
Visual Basic |
|
<N>(77) Smalltalk |
|
multiline
|
all strings allow multi‐line strings |
BourneShell, Common Lisp, E, Emacs Lisp, F#, FishShell, Io, Maple, Mathematica, OCaml, Pascal, Perl, Perl6, PHP, Ruby, Scheme, Smalltalk, YCP |
|||
|
" |
", |
{ |
} |
Tcl |
|
@" |
" |
C# |
||
|
''' |
''', |
Python |
||
|
""" |
""" |
|||
|
[[ |
]] |
Lua |
||
|
{ |
} |
Rebol |
||
|
" |
\n" |
C |
||
|
" |
\n" |
|||
|
" \n\ |
Haskell |
|||
|
\ \n" |
||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
53/112
9/16/2016
syntax across languages (One Big Page)
|
" |
", |
Classic REXX |
|
|
" |
" |
||
|
" |
%N% |
Eiffel |
|
|
% |
%N" |
||
|
""" |
""" |
CoffeeScript |
|
convert something to a string (see also string interpolation)
|
show |
Haskell |
|
|
to_s, to_str, inspect, String() Ruby |
||
|
to_string |
merd, Pliant |
|
|
tostring |
Lua, YCP |
|
|
toString |
CoffeeScript, Java, JavaScript |
|
|
ToString |
C#, F#, Mathematica |
|
|
String |
CoffeeScript, JavaScript |
|
|
perl |
Perl6 |
|
|
Dumper |
Perl |
|
|
"" . |
e |
Perl |
|
"" ~ e |
Perl6 |
|
|
"" + e |
CoffeeScript, E, Java, JavaScript |
|
|
string |
Pliant |
|
|
str, `e`, repr |
Python |
|
|
out |
Eiffel |
|
|
cvs |
PostScript |
|
|
T'Image(e)(78) |
Ada |
|
|
asString |
Io, Smalltalk |
|
|
printString |
Smalltalk |
|
|
as(<string>, e) |
Dylan |
|
|
(string) e |
PHP, Pike |
|
|
convert(e,string) |
Maple |
|
|
(coerce e 'string) |
Common Lisp |
|
|
prin1‐to‐string |
Emacs Lisp |
|
|
to string! / to‐string / to "" |
Rebol |
|
|
description |
ObjectiveC |
|
|
pr1 |
Yorick |
|
|
unneeded, all values are strings Tcl |
||
serialize (marshalling)
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
54/112
9/16/2016
syntax across languages (One Big Page)
|
export‐clixml |
MSH |
|
|
serialize |
Io, PHP |
|
|
Marshal.to_string |
OCaml |
|
|
Marshal.dump |
Ruby |
|
|
Data.Binary.encode |
Haskell |
|
|
BinaryFormatter.Serialize |
F# |
|
|
storeBinaryOn |
Smalltalk |
|
|
Storable::store |
Perl |
|
|
pickle.dump(79) |
Python |
|
|
(with‐standard‐io‐syntax (write obj stream)) Common Lisp |
||
|
T'Output(78) |
Ada |
|
|
unserialize (unmarshalling) |
||
|
import‐clixml |
MSH |
|
|
unserialize |
PHP |
|
|
Marshal.from_string |
OCaml |
|
|
Marshal.load |
Ruby |
|
|
Data.Binary.decode |
Haskell |
|
|
BinaryFormatter.Deserialize |
F# |
|
|
readBinaryFrom |
Smalltalk |
|
|
pickle.load |
Python |
|
|
(with‐standard‐io‐syntax (read obj stream)) Common Lisp |
||
|
Storable::store |
Perl |
|
|
doString |
Io |
|
|
T'Input(78) |
Ada |
|
sprintflike
|
sprintf |
Awk, C, C++, F#, Maple, Matlab, merd, OCaml, Perl, Perl6, PHP, Pike, Ruby |
|
printf |
Haskell |
|
% |
Python, Ruby |
|
format |
Java, Lua, Tcl |
|
format(80) |
Common Lisp, Erlang, SchemeSRFI28 |
|
Format |
C#, F# |
|
putFormat |
Beta |
|
stringWithFormat |
ObjectiveC |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
55/112
9/16/2016
syntax across languages (One Big Page)
|
expandMacrosWith(80) Smalltalk |
|
|
Storable::retrieve |
Perl |
|
simple print |
|
|
on strings |
|
|
puts |
C, Dylan, Tcl |
|
|
Awk, Basic, Java, Maple, merd, PHP, SML |
|
write |
JavaScript, Pascal, Pike, Yorick |
|
putStr |
Haskell |
|
print_string |
F#, 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(81) OCaml |
|
|
println(81) |
Java, merd |
|
put_chars |
Erlang |
|
echo(82) |
BourneShell, FishShell, PHP |
|
type |
Forth |
|
putText |
Beta |
|
say |
Classic REXX |
|
p or i |
GNUsed |
on simple objects
|
|
Perl, Perl6 |
|
say(81) |
Perl6 |
|
puts(81) |
Tcl |
|
puts ‐nonewline Tcl |
|
on any objects
Io, Logo, Lua, Ruby
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
56/112
9/16/2016
syntax across languages (One Big Page)
|
print(81) |
Dylan, Haskell, Python, Rebol |
|
|
Mathematica |
|
print e, |
Python |
|
println(81) |
Io |
|
prin |
Rebol |
|
Put |
Ada |
|
p(81) |
Ruby |
|
puts(83) |
Ruby |
|
display |
Scheme |
|
write |
Common Lisp, Io, Prolog, Scheme |
|
writeln(81) |
Io |
|
|
Common Lisp |
|
printOn |
Smalltalk |
|
princ prin1 |
Common Lisp, Emacs Lisp |
|
print_any |
F# |
|
WriteLine |
C#, F# |
|
nothing ‐ just remove ";" at the end of the expression, and it will print it |
Matlab |
|
disp |
Matlab |
printflike
|
printf |
Awk, C, C++, F#, Haskell, KornShell, Maple, Matlab, merd, OCaml, Perl, PHP, Ruby |
|
write |
Pike |
|
WriteLine C# |
|
|
putFormat Beta |
|
|
format(80) Common Lisp, Prolog |
|
string equality & inequality
|
eq ne |
Perl, Perl6, Tcl |
|
strcmp |
C, Matlab |
|
== != |
CoffeeScript, JavaScript, Pike |
|
== !== |
PHP |
|
== ~= |
Lua |
|
= \= |
Prolog |
|
isEqualToString(84) ObjectiveC |
|
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
57/112
9/16/2016
syntax across languages (One Big Page)
|
== != |
Awk, C#, C++, E, Io, merd, Python, Ruby, YCP |
|
== <> |
Python |
|
== /= |
Haskell |
|
== \= |
Oz |
|
= != |
BourneShell, FishShell, Maple, XPath |
|
= /= |
Ada |
|
= \= |
Classic REXX |
|
= <> |
Beta, F#, OCaml, Pliant, SML, Visual Basic |
|
= ~= |
Dylan, Smalltalk |
|
== \== or = <> \= |
Classic REXX |
|
=== =!= / == !=(19) Mathematica |
|
|
== ~= |
Matlab |
|
equal? |
Ruby, Scheme |
|
equals |
Java |
|
equal, equalp |
Common Lisp |
|
is_equal |
Eiffel |
|
isEqual |
ObjectiveC |
string size
|
length |
Awk, Beta, C++, CoffeeScript, Common Lisp, Eiffel, F#, Haskell, Java, JavaScript, Maple, Matlab, ObjectiveC, OCaml, Perl, PostScript, Prolog, Ruby |
|
LENGTH |
Classic REXX |
|
'Length |
Ada |
|
length? |
Rebol |
|
size |
C++, E, Io, Ruby, Smalltalk, SML, YCP |
|
Length |
C#, F#, Modula3, Oz, Pascal |
|
len |
Pliant, Python, Visual Basic |
|
strlen |
C, PHP |
|
string length |
Tcl |
|
string‐length |
Scheme, XPath |
|
StringLength |
Mathematica |
|
sizeof |
Pike |
|
count |
Eiffel, Logo |
|
bytes chars |
Perl6 |
|
CHARACTER_LENGTH SQL92 |
|
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
58/112
9/16/2016
syntax across languages (One Big Page)
|
atom_length |
Prolog |
|
wc ‐c |
FishShell |
|
# |
Lua |
|
${#v} |
BourneShell |
|
dup(85) |
Forth |
string concatenation
|
+ |
C#, C++, CoffeeScript, E, Eiffel, F#, Java, JavaScript, merd, MSH, Pascal, Pike, Pliant, Python, Ruby, YCP |
|
. |
Perl, PHP |
|
Io, Lua |
|
|
, |
Smalltalk |
|
~ |
Perl6 |
|
& |
Ada, Modula3, Visual Basic |
|
^ |
F#, OCaml, SML |
|
MUMPS |
|
|
_ |
|
|
|| |
Cecil, Classic REXX, Icon, Maple, PL/I, SQL92 |
|
++ |
Haskell |
|
$a$b |
BourneShell, FishShell, Tcl |
|
concatenate |
Common Lisp, Dylan |
|
string‐append |
Scheme |
|
StringJoin |
Mathematica |
|
cat |
Maple |
|
Cat |
Modula3 |
|
strcat |
C |
|
concat |
XPath |
|
append |
Beta, Prolog, Rebol |
|
stringByAppendingString ObjectiveC |
|
|
Awk, Classic REXX |
|
|
[string1 string2] |
Matlab |
|
word |
Logo |
duplicate n times
|
* |
Ada, E, Pike, Python, Ruby |
|
x |
Perl, Perl6 |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
59/112
9/16/2016
syntax across languages (One Big Page)
|
times |
merd |
|
repeat |
Pliant |
|
repeated |
Io |
|
str_repeat |
PHP |
|
string repeat |
Tcl |
|
strrep |
Lua |
|
repmat |
Matlab |
|
insert/dup |
Rebol |
|
COPIES |
Classic REXX |
|
cat(s$n) |
Maple |
|
concat $ replicate Haskell |
|
upper / lower case character
|
upcase / downcase |
Emacs Lisp, Ruby |
|
uc / lc |
Perl, Perl6 |
|
upper / lower(86) |
Lua, Matlab, Pliant, Python |
|
toUpper / toLower |
Haskell |
|
to_upper / to_lower |
Eiffel |
|
To_Upper / To_Lower |
Ada |
|
toUpperCase / toLowerCase |
CoffeeScript, E, Java, JavaScript |
|
upper_case / lower_case |
Pike |
|
uppercase / lowercase |
F#, Logo, OCaml |
|
strupper / strlower |
Lua |
|
strtoupper / strtolower |
PHP |
|
ToUpper / ToLower |
C#, F#, Oz |
|
toupper / tolower |
Awk, C, C++ |
|
string toupper / string tolower |
Tcl |
|
asLowercase / asUppercase |
Io, Smalltalk |
|
upCase / lowCase |
Beta |
|
uppercase form / lowercase form |
Rebol |
|
char‐upcase / char‐downcase |
Common Lisp, Scheme |
|
char_type(C_, to_upper(C)), char_type(C_, to_lower(C)) Prolog |
|
|
\U / \L / \C |
GNUsed |
uppercase / lowercase / capitalized string
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
60/112
9/16/2016
syntax across languages (One Big Page)
|
upcase / downcase |
Emacs Lisp, Ruby |
|
upper / lower |
Matlab, SQL92 |
|
upper / lower / capitalize |
Python |
|
uppercase/lowercase |
F#, Logo, OCaml, Rebol |
|
upcase_atom/downcase_atom |
Prolog |
|
toUpperCase / toLowerCase |
CoffeeScript, E, Java, JavaScript |
|
ToUpperCase / ToLowerCase |
Mathematica |
|
ToUpper / ToLower |
C#, F# |
|
to_upper / to_lower |
Ada, Eiffel |
|
toupper / tolower |
Awk, YCP |
|
uc / lc |
Perl, Perl6 |
|
UpperCase / LowerCase |
Pascal |
|
StringTools[UpperCase] / StringTools[LowerCase] / StringTools[Capitalize] |
Maple |
|
uppercaseString / lowercaseString / capitalizedString |
ObjectiveC |
|
UCase / LCase |
Visual Basic |
|
strtoupper / strtolower |
PHP, Yorick |
|
strupper / strlower |
Lua |
|
string toupper / string tolower / string totitle |
Tcl |
|
string‐upcase / string‐downcase |
Common Lisp, Scheme |
|
asLowercase / asUppercase / asUppercaseFirst |
Smalltalk |
|
asLowercase / asUppercase / makeFirstCharacterUppercase |
Io |
|
upcase_atom / downcase_atom |
Prolog |
|
makeLC / makeUC |
Beta |
|
parse upper var in_var out_var / parse lower var in_var out_var |
Classic REXX |
ascii to character
|
chr |
F#, 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 |
CoffeeScript, JavaScript |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
61/112
9/16/2016
syntax across languages (One Big Page)
|
FromCharacterCode |
Mathematica |
|
character |
Pliant |
|
Character value: c Smalltalk |
|
|
asCharacter |
Io |
|
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 |
|
character to ascii
|
ord |
F#, Haskell, Pascal, Perl, Perl6, PHP, Python, SML |
|
|
asc |
Visual Basic |
|
|
getNumericValue |
Java |
|
|
charCodeAt |
CoffeeScript, JavaScript |
|
|
asciiValue |
Smalltalk |
|
|
code |
Eiffel, OCaml |
|
|
char‐code |
Common Lisp |
|
|
char‐>integer |
Scheme |
|
|
s[0] |
Ruby |
|
|
s |
0 get |
PostScript |
|
s |
at(0) |
Io |
|
scan $s %c |
Tcl |
|
|
strbyte |
Lua |
|
|
toInteger |
E |
|
|
'Pos |
Ada |
|
|
number |
Pliant |
|
|
(int) c |
C, C#, C++, Java |
|
|
to integer! / to‐integer |
Rebol |
|
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
62/112
9/16/2016
syntax across languages (One Big Page)
|
ToCharacterCode |
Mathematica |
|
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 |
accessing nth character
|
s[n] |
C, C#, C++, E, Maple, PHP, Pike, Python, Ruby |
|
|
s(n) |
Ada, Matlab |
|
|
s:n |
Pliant |
|
|
s.[n] |
F#, OCaml |
|
|
s |
!! n |
Haskell |
|
s @ n |
Eiffel |
|
|
s/:n |
Rebol |
|
|
string index s n |
Tcl |
|
|
sub |
SML |
|
|
char, aref, schar, svref Common Lisp |
||
|
GetChar |
Modula3 |
|
|
s |
at(n) |
Io |
|
at(87) |
C++, Smalltalk |
|
|
aref |
Common Lisp |
|
|
char(s, i) |
B |
|
|
charAt |
CoffeeScript, Java, JavaScript |
|
|
characterAtIndex |
ObjectiveC |
|
|
n |
‐> s.inxGet |
Beta |
|
string‐ref |
Scheme |
|
|
StringTake[s, {n}] |
Mathematica |
|
|
$EXTRACT(s, n) |
MUMPS |
|
|
item |
Logo |
|
|
over n chars + c@ |
Forth |
|
|
s/.{n}(.).*/\1/ |
GNUsed |
|
extract a substring
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
63/112
9/16/2016
syntax across languages (One Big Page)
|
s[n |
m] |
CoffeeScript, Maple, Pike, Ruby |
|
s.[n |
m] |
F# |
|
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 |
F#, Lua, OCaml |
|
|
SUB |
Modula3 |
|
|
subseq |
Common Lisp |
|
|
slice |
CoffeeScript, Io, JavaScript |
|
|
mid$ |
JavaScript |
|
|
string range |
Tcl |
|
|
StringTake[s, {n, m}] |
Mathematica |
|
|
strpart(s, n, m) |
Yorick |
|
|
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)] ObjectiveC |
||
|
SUBSTRING(s FROM n len) |
SQL92 |
|
|
$EXTRACT(s, n, m) |
MUMPS |
|
|
sub_string / sub_atom |
Prolog |
|
|
(take len . drop n) s |
Haskell |
|
|
over n chars + len |
Forth |
|
|
s/.{n}(.{len}).*/\1/ |
GNUsed |
|
locate a substring
index
Ada, Perl, Perl6, Python, Ruby
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
64/112
9/16/2016
syntax across languages (One Big Page)
|
indexOf |
|
CoffeeScript, Java, JavaScript |
|
IndexOf |
C#, F# |
||
|
indexOfString |
Smalltalk |
||
|
startOf |
E |
||
|
search |
Common Lisp, Pike, PostScript |
||
|
StringTools[Search] |
Maple |
||
|
StringPosition |
Mathematica |
||
|
strstr strchr |
C |
||
|
find |
C++, Logo, Lua, Python, Rebol, YCP |
||
|
findSeq |
Io |
||
|
findSubstring |
Haskell |
||
|
strfind |
Matlab, Yorick |
||
|
strpos |
PHP |
||
|
$FIND |
MUMPS |
||
|
index_non_blank / find_token Ada |
|||
|
substring_index |
Eiffel |
||
|
rangeOfString |
ObjectiveC |
||
|
POS |
Classic REXX |
||
|
POSITION(needle IN s) |
SQL92 |
||
|
sub_string / sub_atom |
Prolog |
||
|
string first |
Tcl |
||
locate a substring (starting at the end)
|
rindex |
OCaml, Perl, Perl6, Python, Ruby |
|
rfind |
C++, Python |
|
find/last |
Rebol |
|
strrchr |
C |
|
index(Going => Backward) |
Ada |
|
lastStartOf |
E |
|
lastIndexOf |
CoffeeScript, Java, JavaScript |
|
last_index_of(88) |
Eiffel |
|
LastIndexOf |
C#, F# |
|
lastIndexOfString |
Smalltalk |
|
string last |
Tcl |
|
(search substring string :from‐end t) |
Common Lisp |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
65/112
9/16/2016
syntax across languages (One Big Page)
|
[string rangeOfString:substring options:NSBackwardsSearch] ObjectiveC |
||
|
LASTPOS |
Classic REXX |
||
|
t=strfind(s,p), t(end) |
Matlab |
||
|
strrpos |
PHP |
||
|
StringTools[SearchAll](s,p)[‐1] |
Maple |
||
Booleans
type name
|
Bool |
Haskell, Perl6, Pliant |
|
bool |
C#, C++, C99, F#, OCaml, PHP, Python, SML, YAML |
|
Boolean Ada, Lua, Pascal, Smalltalk, Visual Basic |
|
|
boolean CoffeeScript, Common Lisp, Java, JavaScript, Maple, PHP, YCP |
|
|
BOOLEAN Eiffel |
|
|
logic! Rebol |
|
|
logical Matlab |
|
false value
|
false |
Ada, BCPL, Beta, BourneShell, C#, C++, C99, CoffeeScript, E, F#, FL, Forth, Io, Java, JavaScript, Logo, Lua, Maple, Matlab, OCaml, Oz, Pascal, PHP, Pliant, PostScript, Rebol, Ruby, Smalltalk, SML, Tcl, YAML, YCP |
|
False |
Eiffel, Haskell, Mathematica, merd, Python, Visual Basic |
|
FALSE |
Modula3, SQL92 |
|
false() |
XPath |
|
#f |
Dylan, Scheme |
|
n |
YAML |
|
nil |
Common Lisp, Emacs Lisp, Io, Lua, Ruby |
|
no |
CoffeeScript, Tcl, YAML |
|
No |
Prolog |
|
none |
Rebol |
|
None |
Python |
|
null |
CoffeeScript, JavaScript |
|
NULL |
C, C++, C99, PHP |
|
off |
CoffeeScript, Tcl, YAML |
|
undef |
Perl, Perl6 |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
66/112
9/16/2016
syntax across languages (One Big Page)
|
undefined |
CoffeeScript, JavaScript |
|
fail |
Prolog |
|
FAIL |
Maple |
|
array |
|
|
containing at |
Matlab |
|
least one false |
|
|
value |
|
|
exit status |
|
|
different from |
BourneShell |
|
0 |
|
|
0(89) |
Awk, B, C, C++, C99, Classic REXX, CoffeeScript, Forth, JavaScript, Matlab, MUMPS, Perl, Perl6, PHP, Pike, Python, Tcl, Visual Basic, XPath, Yorick |
|
0.0 |
Matlab, Perl, PHP |
|
NaN |
CoffeeScript, JavaScript, XPath |
|
"" |
Awk, CoffeeScript, JavaScript, Perl, Perl6, PHP, Python, XPath |
|
"0" |
Awk, Perl, Perl6, PHP |
|
'' |
CoffeeScript, Matlab, Perl |
|
'\0' |
C, C++, C99 |
|
() |
Perl, Perl6, Python |
|
[] |
Matlab, Python |
|
{} |
Matlab, Python |
|
array() |
PHP |
true value
|
TRUE |
Modula3, SQL92 |
|
True |
Eiffel, Haskell, Mathematica, merd, Python, Visual Basic |
|
Ada, BCPL, Beta, BourneShell, C#, C++, CoffeeScript, E, F#, FL, Forth, Io, Java, |
|
|
true |
JavaScript, Logo, Maple, OCaml, Oz, Pascal, PHP, Pliant, PostScript, Prolog, Rebol, Ruby, Smalltalk, SML, Tcl, YAML, YCP |
|
true() |
XPath |
|
t |
Common Lisp, Emacs Lisp |
|
#t |
Dylan, Scheme |
|
y |
YAML |
|
yes |
CoffeeScript, Tcl, YAML |
|
Yes |
Prolog |
|
on |
CoffeeScript, Tcl, YAML |
|
exit status 0 BourneShell |
|
|
anything |
Awk, B, C, C++, Common Lisp, Dylan, Emacs Lisp, Matlab, MUMPS, Perl, Perl6, Pike, |
|
not |
|
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
67/112
9/16/2016
syntax across languages (One Big Page)
|
false |
Python, Rebol, Ruby, Scheme, XPath, Yorick |
|
1 |
Classic REXX, MUMPS |
|
non zero |
|
|
number |
Tcl |
|
non‐ |
|
|
zero‐ |
Visual Basic |
|
numbers |
|
|
‐1 |
Forth |
logical not
|
! |
Awk, B, C, C#, C++, CoffeeScript, E, Java, JavaScript, Mathematica, Perl, Perl6, PHP, Pike, Ruby, Tcl, YCP, Yorick |
|
not(90) |
Ada, Beta, CoffeeScript, Common Lisp, Eiffel, Emacs Lisp, F#, Haskell, Io, Logo, Lua, Maple, merd, OCaml, Pascal, Perl, Perl6, Pliant, PostScript, Prolog, Python, Rebol, Ruby, Scheme, Smalltalk, SML, XPath |
|
Not |
Oz, Visual Basic |
|
NOT |
Modula3 |
|
~ |
BCPL, Dylan, Matlab, PL/I |
|
^ |
PL/I |
|
' |
MUMPS |
|
\ |
Classic REXX |
|
=0 |
Forth |
logical or / and
short circuit
|
|| / && |
Awk, C, C#, C++, CoffeeScript, E, F#, Haskell, Java, JavaScript, Mathematica, Matlab, merd, OCaml, Perl, Perl6, PHP, Pike, Ruby, Tcl, YCP, Yorick |
||
|
| |
/ & |
B, BCPL, Dylan |
|
|
or / and |
CoffeeScript, Common Lisp, Emacs Lisp, Io, Logo, Lua, Modula2, Perl, Perl6, PHP, Pliant, Python, Ruby, Scheme, Smalltalk |
||
|
OR / AND |
Modula3 |
||
|
or / &(91) Modula2 |
|||
|
any / all |
Rebol |
||
|
orelse / |
SML |
||
|
andalso |
|||
|
orelse / |
Oz |
||
|
andthen |
|||
|
or else / and then |
Ada, Eiffel |
||
|
; |
/ |
, |
Prolog |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
68/112
9/16/2016
syntax across languages (One Big Page)
&
/
!
MUMPS
non short circuit (always evaluates both arguments)
|
| |
/ & |
C#, Classic REXX, Java, Matlab, Smalltalk |
|
or / and |
Ada, Beta, Eiffel, Maple, Pascal, PostScript, Rebol, SML, XPath |
|
|
Or / And(92) Oz, Visual Basic |
||
|
\/ / /\(14) |
BCPL |
|
|
?| / |
Perl6 |
|
Bags and Lists
type name
|
seq |
YAML |
|
|
a |
list |
F#, OCaml, SML |
|
[a] |
Haskell |
|
|
a[] |
C# |
|
|
list |
Maple, Python |
|
|
List |
Io, Mathematica, Pliant |
|
|
Array or List |
Perl6 |
|
|
ARRAY or LINKED_LIST |
Eiffel |
|
|
Array or OrderedCollection |
Smalltalk |
|
|
ARRAY |
Perl |
|
|
array |
PHP |
|
|
cell |
Matlab |
|
|
vector |
C++ |
|
|
Containers.Vectors.Vector or Ada.Containers.Doubly_Linked_Lists.List Ada |
||
list concatenation
|
+ |
E, Eiffel, merd, PHP, Pike, Python, Ruby |
|
, |
Maple, Matlab, Perl, Smalltalk |
|
@ |
F#, OCaml, SML |
|
& |
Ada |
|
++ |
Haskell |
|
||| |
Icon |
|
array_merge |
PHP |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
69/112
9/16/2016
syntax across languages (One Big Page)
|
merge |
YCP |
|
concat |
CoffeeScript, JavaScript, Tcl |
|
concatenate |
Dylan |
|
nconc |
Common Lisp, Emacs Lisp |
|
append |
Beta, Common Lisp, Emacs Lisp, Prolog, Rebol, Scheme |
|
Append |
Oz |
|
appendSeq |
Io |
|
arrayByAddingObjectsFromArray ObjectiveC |
|
|
sentence |
Logo |
|
Join |
Mathematica |
list flattening
one level depth
|
concat |
F#, Haskell, Mercury, SML |
|
|
flatten |
F#, Io, merd, OCaml, Prolog, YCP |
|
|
Flatten |
Oz |
|
|
eval concat |
Tcl |
|
|
ListTools[FlattenOnce] Maple |
||
|
{*}$l |
Tcl8.5 |
|
|
"$l" |
FishShell |
|
|
recursive |
||
|
flatten |
Pike, Ruby |
|
|
ListTools[Flatten] Maple |
||
|
Flatten |
Mathematica |
|
list constructor
|
[ |
a, b, c ](93) |
CoffeeScript, E, Haskell, JavaScript, Maple, Matlab, merd, Perl, Perl6, PHP5, PostScript, Prolog, Python, Ruby, SML, YAML, YCP |
|||||
|
( |
a, |
b, |
c |
) |
Perl, Perl6 |
||
|
{ |
a, b, c }(94) |
C, C++, Lua, Mathematica |
|||||
|
#(a, b, c) |
Dylan |
||||||
|
#(a b c)(95) |
Smalltalk |
||||||
|
{ |
a. b. c } |
Squeak |
|||||
|
[ |
a |
; |
b |
; |
c |
] |
F#, OCaml |
|
[ |
a |
b |
c |
] |
Logo, Oz, Rebol |
||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
70/112
9/16/2016
syntax across languages (One Big Page)
|
({ a, b, c }) |
Pike |
|
'(a b c) |
Common Lisp, Emacs Lisp, Scheme |
|
<< a, b, c >> |
Eiffel |
|
list(a, b, c) |
Io |
|
list |
Common Lisp, Dylan, Emacs Lisp, Scheme, Tcl |
|
array(a, b, c) |
PHP |
|
new t[] { a, b, c } |
C# |
|
new[] { a, b, c } |
C#3 |
|
new List<t> { a, b, c} |
C#3 |
|
Array(a, b, c)(96) |
JavaScript |
|
[NSArray arrayWithObjects:a, b, c, nil] |
ObjectiveC |
|
set l a b c |
FishShell |
|
‐ a |
|
|
‐ b |
YAML |
|
‐ c |
|
list/array indexing
|
a[i] |
B, BourneShell, C, C#, C++, CoffeeScript, Dylan, E, FishShell, Java, JavaScript, KornShell, Lua, Maple, merd, Modula3, MSH, Pascal, Perl, Perl6, PHP, Pike, Python, Ruby |
|
|
a*[i] or a!i or a*(i) depending on the |
BCPL |
|
|
version |
||
|
a[[i]] |
Mathematica |
|
|
a[i]:default |
YCP |
|
|
a(i) |
Ada, Matlab |
|
|
a:i |
Pliant |
|
|
a/:i |
Rebol |
|
|
a.(i) |
F#, OCaml |
|
|
a.[i] |
F# |
|
|
a |
!! i |
Haskell, Mercury |
|
a @ i |
Eiffel |
|
|
a i get(97) |
PostScript |
|
|
a at(i) |
Io |
|
|
at(98) |
C++, Smalltalk |
|
|
lindex |
Tcl |
|
|
nth |
Common Lisp, Emacs Lisp, OCaml |
|
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
71/112
9/16/2016
syntax across languages (One Big Page)
|
Nth |
Oz |
|
aref |
Common Lisp, Emacs Lisp |
|
nth0 / nth1 |
Prolog |
|
list‐ref / vector‐ref Scheme |
|
|
element |
Dylan |
|
slice |
Ruby |
|
node[i] |
XPath |
|
objectAtIndex |
ObjectiveC |
|
item |
Logo |
|
a i cells + @ (for write access: o a i cells + ! |
Forth |
adding an element at the beginning (list cons)
return the new list (no sideeffect)
|
: |
Haskell, merd |
|
|
:: |
F#, OCaml, SML |
|
|
| |
Oz |
|
|
[ e | l ] Erlang, Prolog |
||
|
[e |
l[]] |
Maple |
|
[e |
l] |
Matlab |
|
cons |
Common Lisp, Emacs Lisp, Scheme |
|
|
pair |
Dylan |
|
|
fput |
Logo |
|
|
Prepend Ada, Mathematica |
||
sideeffect
|
unshift |
CoffeeScript, JavaScript, Perl, Perl6, Ruby |
|
prepend |
YCP |
|
push_front |
C++ |
|
addFirst |
Smalltalk |
|
insert |
Rebol |
|
put_first |
Eiffel |
|
push |
Common Lisp, Io |
|
array_unshift PHP |
|
|
PrependTo |
Mathematica |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
72/112
9/16/2016
syntax across languages (One Big Page)
adding an element at index
return the new list (no sideeffect)
|
linsert l i e Tcl |
|
|
Insert |
Ada, Mathematica |
sideeffect
|
[a |
insertObject:e atIndex:i] |
ObjectiveC |
|
a.insert(i, e) |
Python, Ruby |
|
|
a insertAt(e, i) |
Io |
|
|
a add: e beforeIndex: i / a add: e afterIndex: i Smalltalk |
||
|
splice(@a, $i, 0, $e) |
Perl |
|
adding an element at the end
return the new list (no sideeffect)
|
[l |
e] |
Matlab |
|
push |
merd |
|
|
arrayByAddingObject ObjectiveC |
||
|
lput |
Logo |
|
|
linsert l end e |
Tcl |
|
|
Append |
Ada, Mathematica |
|
sideeffect
|
push |
CoffeeScript, JavaScript, Perl, Perl6, Ruby |
|
push_back C++ |
|
|
append |
Io, Pliant, Python, Rebol |
|
AppendTo Mathematica |
|
|
lappend |
Tcl |
|
+= |
Pliant |
|
add |
Java, Smalltalk, YCP |
|
put_last |
Eiffel |
|
array_push PHP |
|
|
addObject ObjectiveC |
|
first element
|
head |
Haskell |
|
Head |
F# |
|
hd |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
73/112
9/16/2016
syntax across languages (One Big Page)
|
F#, OCaml |
|
|
car |
Common Lisp, Emacs Lisp, Scheme |
|
first |
Eiffel, Io, Logo, Pliant, Rebol, Smalltalk |
|
First(99) |
Mathematica |
|
First_Element Ada |
|
all but the first element
|
tail |
Haskell |
|
Tail |
F# |
|
tl |
F#, OCaml |
|
cdr |
Common Lisp, Emacs Lisp, Scheme |
|
Rest |
Mathematica |
|
butfirst |
Logo |
|
allButFirst |
Smalltalk |
|
l[1:] |
Python |
|
a(2:end) |
Matlab |
|
L = [_|ButFirst] Prolog |
|
|
lrange l 1 end |
Tcl |
last element
|
last |
E, Eiffel, Haskell, Io, Logo, Pliant, Prolog, Rebol, Scheme, Smalltalk |
|
Last |
Mathematica, Oz |
|
lastObject |
ObjectiveC |
|
a[‐1] |
Perl, Pike, Python, Ruby |
|
a(end) |
Matlab |
|
node[last()] |
XPath |
|
(car (last l)) Common Lisp, Emacs Lisp |
|
|
lindex l end |
Tcl |
|
Last_Element |
Ada |
iterator
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
74/112
9/16/2016
syntax across languages (One Big Page)
Most Mathematica
get the first element and remove it
|
shift |
CoffeeScript, JavaScript, Perl, Perl6, Ruby |
|
shift! |
merd |
|
pop |
Common Lisp, Logo |
|
removeFirst Io, Smalltalk |
|
|
array_shift PHP |
|
get the last element and remove it
|
pop |
CoffeeScript, E, Io, JavaScript, Perl, Perl6, Python, Ruby |
|
pop! |
merd |
|
array_pop PHP |
|
|
removeLast Io, Smalltalk |
|
|
dequeue |
Logo |
for each element do something
|
each |
merd, Pliant, Ruby |
|||
|
for v in l |
CoffeeScript, E, Maple, Ruby |
|||
|
for v in l: |
Python |
|||
|
for v in l; do |
; |
done |
BourneShell |
|
|
for v in l do |
F# |
|||
|
for v in l; |
; |
end |
FishShell |
|
|
for (v in l) |
Awk, Dylan |
|||
|
for (var v in l) { |
} |
JavaScript |
||
|
For Each v in l |
Next |
Visual Basic |
||
|
for v in range loop |
end loop |
Ada |
||
|
for |
Perl |
|||
|
foreach |
Logo, Lua, Perl, PHP, Pike, Rebol, Tcl |
|||
|
foreach (t v in l) |
C# |
|||
|
foreach (v in l) |
C#3 |
|||
|
foreach ($v in l) |
MSH |
|||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
75/112
9/16/2016
syntax across languages (One Big Page)
|
foreach(t v, l, { |
}) |
YCP |
|||||
|
l foreach(v, |
) |
Io |
|||||
|
for_each |
C++ |
||||||
|
for‐each |
Scheme |
||||||
|
forall |
PostScript, Prolog |
||||||
|
ForAll |
Oz |
||||||
|
iter |
F#, OCaml |
||||||
|
do |
Smalltalk |
||||||
|
do_all |
Eiffel |
||||||
|
app |
SML |
||||||
|
mapc |
Emacs Lisp |
||||||
|
mapM_ |
Haskell |
||||||
|
Scan |
Mathematica |
||||||
|
(dolist (v l) |
) (loop for v in l do |
) mapc Common Lisp |
|||||
|
list.iterate (# do current |
#) |
Beta |
|||||
|
l.Iterate( |
) |
F# |
|||||
|
Iterate |
Ada |
||||||
transform a list (or bag) in another one
|
map |
Dylan, F#, Haskell, Io, Maple, Mercury, merd, OCaml, Perl, Pike, Python, Ruby, Scheme, SML |
|
|
Map |
F#, Mathematica, Oz |
|
|
mapcar |
Common Lisp, Emacs Lisp |
|
|
maplist |
Prolog, YCP |
|
|
sublist |
Prolog |
|
|
map / map.se |
Logo |
|
|
for‐each |
XSLT |
|
|
foreach or selected |
MSH |
|
|
collect |
Ruby, Smalltalk |
|
|
transform |
C++ |
|
|
array_map |
PHP |
|
|
/@ |
Mathematica |
|
|
[ |
f x | x <‐ l ](100) |
Haskell |
|
[ |
f(x) for x in l ](100) |
Python |
|
magical: sin(x) computes sin on each element |
Matlab |
|
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
76/112
9/16/2016
syntax across languages (One Big Page)
transform two lists in parallel
|
map2 |
F#, OCaml |
|
zipWith |
Haskell |
|
Zip |
Maple, Oz |
|
map |
Dylan, Logo, Python, Scheme |
|
map.se |
Logo |
|
mapcar |
Common Lisp |
|
maplist2 |
Prolog |
|
l1 with: l2 collect: |
Smalltalk |
|
transform |
C++ |
|
ListPair.map |
SML |
|
magical: a binary function or operator is appliied on each element |
Matlab |
find an element
|
find |
C++, Common Lisp, F#, Haskell, merd, OCaml, Rebol, Ruby, SchemeSRFI1, SML, YCP |
|
Find |
Ada |
|
find_if |
C++ |
|
find‐if |
Common Lisp |
|
first(21) |
Perl |
|
detect |
Ruby, Smalltalk |
|
search |
Pike |
|
ListTools[Search] |
Maple |
|
lsearch ‐exact |
Tcl |
|
index |
Python |
|
indexOf |
Io |
|
indexOfObject, |
ObjectiveC |
|
indexOfObjectIdenticalTo |
|
|
find(a == 3) |
Matlab |
|
Position |
Mathematica |
keep elements
matching
|
find_all |
F#, OCaml, Ruby |
|
F#, Haskell, Mercury, merd, OCaml, Pike, Python, SchemeSRFI1, |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
77/112
9/16/2016
syntax across languages (One Big Page)
|
filter |
SML, YCP |
|
|
filter! |
SchemeSRFI1 |
|
|
Filter |
Oz |
|
|
grep |
Perl, Perl6 |
|
|
where |
MSH |
|
|
select |
Io, Maple, Ruby, Smalltalk |
|
|
Select / Case |
Mathematica |
|
|
selectInPlace |
Io |
|
|
remove‐if‐not delete‐if‐ not |
Common Lisp |
|
|
choose |
Dylan |
|
|
array_filter |
PHP5 |
|
|
[ |
x | x <‐ l, p x ](100) |
Haskell |
|
[ |
x for x in l if p(x) ] |
Python |
|
(100) |
||
|
a(a == 3) |
Matlab |
|
non matching
|
remove‐if delete‐if Common Lisp |
|
|
reject |
Ruby |
partition a list: elements matching, elements non matching
partition F#, Haskell, merd, OCaml, Ruby, SchemeSRFI1, SML
partition! SchemeSRFI1
Partition Oz
split a list
in 2 based on a predicate
into sublists delimited by elements matching a predicate
|
split‐sequence(101) Common Lisp |
|
|
ListTools[Split] |
Maple |
into a list of lists of same value
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
78/112
9/16/2016
syntax across languages (One Big Page)
into sublists based on a predicate
is an element in the list
|
member? |
Dylan, merd, Ruby |
|
include? |
Ruby |
|
mem |
F#, OCaml |
|
member |
Common Lisp, Prolog, Scheme |
|
Member |
Oz |
|
MemberQ |
Mathematica |
|
memq memv |
Scheme |
|
memberp / member? Logo |
|
|
contains |
E, Io, YCP |
|
containsObject |
ObjectiveC |
|
in |
CoffeeScript, JavaScript, Python, SQL92, Tcl8.5 |
|
in_array |
PHP |
|
includes |
Smalltalk |
|
elem |
Haskell, Mercury |
|
has |
Eiffel |
|
has_value |
Pike |
|
ismember |
Matlab |
|
/elt/ |
GNUsed |
is the predicate true for an element
|
any(30) |
Haskell, Matlab, Mercury, Python, SchemeSRFI1 |
|
any? |
Dylan, Ruby |
|
anySatisfy Smalltalk |
|
|
exists |
F#, OCaml, SML |
|
exists? |
merd |
|
some |
Common Lisp |
|
Some |
Oz |
|
ormap |
Maple |
|
detect |
Io |
is the predicate true for every element
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
79/112
9/16/2016
syntax across languages (One Big Page)
|
all(30) |
Haskell, Mercury, Python, SML |
|
All |
Oz |
|
all? |
merd, Ruby |
|
allSatisfy Smalltalk |
|
|
every |
Common Lisp, SchemeSRFI1 |
|
every? |
Dylan |
|
for_all |
F#, OCaml |
|
andmap |
Maple |
smallest / biggest element
|
min / max |
Common Lisp, Eiffel, Io, Java, Maple, Matlab, Perl6, PHP5, Pike, Prolog, Python, Ruby, Scheme, Smalltalk |
|
Min / Max |
Mathematica |
|
minimum / maximum Haskell, Mercury, merd |
|
|
minimum‐of / |
Rebol |
|
maximum‐of |
|
|
min minstr / max |
Perl |
|
maxstr(21) |
|
|
min_element / |
C++ |
|
max_element |
|
join a list of strings in a string using a glue string
|
join(s, l) |
Perl, Perl6, PHP |
|
|
String.Join(s, l) |
C# |
|
|
s.join(l) |
Python |
|
|
l.join(s) |
CoffeeScript, JavaScript, Perl6, Ruby |
|
|
l |
asStringWith: s |
Smalltalk |
|
join l s |
Tcl |
|
|
implode(s, l) |
PHP |
|
|
ListTools[Join] |
Maple |
|
|
rjoin |
E |
|
|
join |
Io |
|
|
concat |
F#, OCaml |
|
|
strcat |
Matlab |
|
|
concat_atom |
Prolog |
|
|
l |
* s |
Pike, Ruby |
|
(mapconcat 'identity l s) Emacs Lisp |
||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
80/112
9/16/2016
syntax across languages (One Big Page)
|
componentsJoinedByString |
ObjectiveC |
|
intercalate |
Haskell |
|
StringJoin @@ Riffle[l, s] Mathematica |
|
list size
|
size |
C++, Dylan, E, Io, Java, Matlab, merd, Pliant, Ruby, Scilab, Smalltalk, YCP |
|
sizeof Pike |
|
|
length |
C#, CoffeeScript, Common Lisp, Emacs Lisp, F#, Haskell, Java, JavaScript, Matlab, Mercury, OCaml, PostScript, Prolog, Ruby, Scheme, SML |
|
Length Ada, F#, Mathematica, Oz |
|
|
length? Rebol |
|
|
len |
Python |
|
llength Tcl |
|
|
$LENGTH MUMPS |
|
|
elems |
Perl6 |
|
getn |
Lua |
|
count Eiffel, FishShell, ObjectiveC, PHP, SQL92, XPath |
|
|
numel |
Matlab |
|
scalar |
|
|
@l |
Perl |
|
nops |
Maple |
|
# |
Lua |
iterate with index
|
each_with_index |
merd, Ruby |
|||
|
enumerate(l) |
Python |
|||
|
foreach($l as $i => $v) |
PHP |
|||
|
a foreach(i, e, |
) |
Io |
||
|
for i => v in l |
E |
|||
|
for (v in l, i from 0) |
end |
Dylan |
||
|
forAllInd |
Oz |
|||
|
foreachi |
Lua |
|||
|
foreach(l; typ0 i; typ1 v) { |
} |
Pike |
||
|
withIndexDo |
Squeak |
|||
|
iteri |
F#, OCaml |
|||
|
IterateIndexed |
F# |
|||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
81/112
9/16/2016
syntax across languages (One Big Page)
|
MapIndexed |
Mathematica |
|
|
(loop for v in l as i upfrom 0 do |
) |
Common Lisp |
|
for v,i in l |
CoffeeScript |
|
remove duplicates
|
uniq |
merd, Perl6, Pike, Ruby |
|
uniq! |
Ruby |
|
uniq2 |
Pike |
|
unique(102) |
C++, Io, Matlab, Rebol |
|
nub |
Haskell |
|
array_unique |
PHP |
|
ListTools[MakeUnique] Maple |
|
|
delete‐duplicates |
Common Lisp, SchemeSRFI1 |
|
delete‐duplicates! |
SchemeSRFI1 |
|
remove‐duplicates |
Common Lisp, Dylan |
|
lsort ‐unique |
Tcl |
|
toset |
YCP |
|
distinct |
SQL92 |
|
set |
Python |
|
Union |
Mathematica |
sort
|
sort(103) |
C#, C++, CoffeeScript, Common Lisp, E, Eiffel, F#, Haskell, Io, Java, JavaScript, Lua, Maple, Matlab, merd, OCaml, Perl, Perl6, PHP, Pike, Prolog, Python, Rebol, Ruby, Scheme, XSLT, YCP |
|
sort! |
Ruby |
|
sorted |
Python |
|
Sort |
Mathematica, Oz |
|
sort_by |
merd, Ruby |
|
sortBy |
Haskell, Io, Smalltalk |
|
order by |
SQL92 |
|
lsort |
Tcl |
|
asort |
Awk |
|
sort‐object |
MSH |
|
sortedArrayUsingSelector, |
ObjectiveC |
|
sortUsingSelector |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
82/112
9/16/2016
syntax across languages (One Big Page)
predsort / keysort / mergesort
Prolog
reverse
|
reverse |
C++, CoffeeScript, Common Lisp, Dylan, Emacs Lisp, Haskell, Io, Java, JavaScript, Logo, Mercury, merd, Perl, Perl6, Pike, Prolog, Python, Rebol, Ruby, Scheme |
|
Reverse |
C#, Mathematica, Oz |
|
reversed |
Python, Smalltalk |
|
reverse_copy |
C++ |
|
rev |
F#, OCaml, SML |
|
Reverse_Elements |
Ada |
|
lreverse |
Tcl8.5 |
|
array_reverse |
PHP |
|
ListTools[Reverse] Maple |
|
|
fliplr flipud |
Matlab |
|
l[::‐1] |
Python |
list of couples from 2 lists
|
combine |
F#, OCaml |
|
zip |
F#, Haskell, Maple, merd, Perl6, Python, Ruby, SchemeSRFI1, SML |
|
pairlis(104) Common Lisp |
|
|
transpose |
Ruby |
|
Transpose |
Mathematica |
|
[a b] |
Matlab |
2 lists from a list of couples
|
split |
F#, OCaml |
|
unzip |
F#, Haskell, merd, SML |
|
unzip2 |
SchemeSRFI1 |
|
transpose |
Ruby |
|
Transpose |
Mathematica |
|
zip(*l) |
Python |
|
a(1,:), a(2,:) Matlab |
|
lookup an element in a association list
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
83/112
9/16/2016
syntax across languages (One Big Page)
|
lookup |
Haskell |
|
assoc |
Common Lisp, Emacs Lisp, F#, OCaml, Ruby, Scheme |
|
assq |
Emacs Lisp, Scheme |
|
assv |
Scheme |
|
get_assoc Prolog |
|
|
select |
Rebol |
|
a.(e) |
Matlab |
|
a[e] |
Maple |
|
gprop |
Logo |
|
/. |
Mathematica |
list out of a bag
|
to_a |
Ruby |
||
|
toArray |
Java |
||
|
asArray |
Smalltalk |
||
|
to_list |
merd |
||
|
list |
Python |
||
|
map‐as(<list>, bag) Dylan |
|||
|
[a.(:)] |
Matlab |
||
|
array get |
Tcl |
||
|
f( f(f(init, e1), e2) |
, |
en) |
|
|
foldl |
Haskell, Maple, Mercury, merd, SML |
|
FoldL |
Oz |
|
fold_left |
OCaml |
|
fold |
F#, SchemeSRFI1 |
|
Fold |
Mathematica |
|
reduce(105) Common Lisp, Dylan, Io, Perl, Perl6, Pike, Python |
|
|
inject |
Ruby |
|
inject into Smalltalk |
|
f(e1, f(e2,
f(en, init) ))
|
foldr |
Haskell, Maple, Mercury, merd, SML |
|
FoldR |
Oz |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
84/112
9/16/2016
syntax across languages (One Big Page)
|
fold‐right |
SchemeSRFI1 |
|
|
fold_right |
OCaml |
|
|
foldBack |
F# |
|
|
rreduce |
Pike |
|
|
(reduce f '(e1 e2 init) |
en) :from‐right t :initial‐value |
Common Lisp |
|
reverseReduce |
Io |
|
Various Data Types
tuple type
|
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 |
||
tuple constructor
|
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 |
||||||
computable tuple (these are a kind of immutable lists playing a special role in parameter passing)
empty tuple
|
() |
merd, Perl, Perl6, Python |
|
[] |
Ruby |
|
{} |
Matlab, Smalltalk |
|
#() |
Smalltalk |
|
Nothing Prolog |
|
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
85/112
9/16/2016
syntax across languages (One Big Page)
1uple
|
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 |
reference (pointer)
creation
|
& |
B, C, C#, C++ |
|
\ |
Perl |
|
AddressOf |
Visual Basic |
|
addr(106) Pascal |
|
|
@(106) |
Pascal |
|
lv |
BCPL |
|
ref |
C#, F#, OCaml, SML |
|
newSTRef |
Haskell |
|
NewCell |
Oz |
|
variable |
Forth |
|
'access |
Ada |
|
:> :>> |
Pliant |
|
'' |
Maple |
dereference
|
*(107) |
B, C, C#, C++ |
|||||
|
$ @ % &(107) |
Perl |
|||||
|
‐>[ |
] |
‐>{ |
} |
‐>( |
)(108) |
Perl |
|
‐>(109) |
C, C++ |
|||||
|
^(108) |
Modula3, Pascal |
|||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
86/112
9/16/2016
syntax across languages (One Big Page)
|
!(107) |
|
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 |
optional value
null value
|
0(110) |
C++, Forth |
|
0 nullptr(110) |
C++0x |
|
NULL |
C, Maple, SQL92 |
|
nil |
Common Lisp, Emacs Lisp, Io, Lua, ObjectiveC, Ruby, Smalltalk |
|
null |
C#, CoffeeScript, Java, JavaScript |
|
Null(111) |
Ada, Mathematica |
|
undef |
Perl |
|
None |
F#, OCaml, Python |
|
NONE |
SML |
|
Nothing |
Haskell |
|
Void |
Eiffel |
|
#f () |
Emacs Lisp |
|
(empty) / ~ / null YAML |
|
value
|
Ada, C#, CoffeeScript, Common Lisp, Eiffel, Emacs Lisp, Java, JavaScript, Lua, Perl, Perl, |
|
|
v |
Python, Ruby, Scheme, Smalltalk |
|
*v(110) C, C++ |
|
|
Just v Haskell |
|
|
Some v F#, OCaml |
|
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
87/112
9/16/2016
syntax across languages (One Big Page)
SOME v
SML
type name
option F#, OCaml, SML
Maybe Haskell
null coalescing
|
COALESCE SQL92 |
|
|
?: |
PHP |
|
|| |
JavaScript, Perl, Ruby |
|
//(112) Perl |
|
|
?? |
C# |
|
if(a, b) Visual Basic |
|
|
or |
Python, Scheme |
record
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; |
Ada |
|
|
end record; |
||
selector
|
Ada, Beta, C, C#, C++, CoffeeScript, E, Eiffel, F#, Java, JavaScript, Lua, Matlab, |
|
|
. |
Modula2, Modula3, OCaml, Oz, Pascal, Python, Ruby |
|
:: |
XPath |
|
% |
Fortran90 |
|
'(113) |
Ada |
|
^ |
Mercury |
|
r { field } |
merd |
|
r:field |
Pliant |
|
field r |
Haskell |
|
‐> |
C, C++ |
|
r[field] |
Maple |
|
r["field"] JavaScript |
|
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
88/112
9/16/2016
syntax across languages (One Big Page)
|
#field r |
SML |
|
normal |
|
|
function |
Common Lisp, Dylan, Haskell, Io, Smalltalk |
|
call |
|
union type declaration
|
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 => |
Ada |
|
|
when others => |
||
|
end case; |
||
|
end record; |
||
enumerated type declaration
|
enum typ { n1; n2; |
}(114) C, C#, C++, Java |
||||
|
Enum typ |
|||||
|
n1 |
Visual Basic |
||||
|
n2 |
|||||
|
End Enum |
|||||
|
(n1, n2, |
) |
Pascal |
|||
|
type typ is(115) |
Ada |
||||
|
data Typ = N1 | N2 | |
Haskell |
||||
|
type typ = N1 | N2 | |
OCaml |
||||
|
datatype typ = N1 | N2 | |
SML |
||||
|
dictionary |
|||||
|
type name |
|||||
|
map |
YAML |
||||
|
Map |
F#, Io |
||||
|
std::map |
C++ |
||||
|
dict |
Python |
||||
|
Dictionary |
Pliant, Smalltalk |
||||
|
Hash |
Perl6, Ruby |
||||
|
HASH |
Perl |
||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
89/112
9/16/2016
syntax across languages (One Big Page)
|
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, 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] |
ObjectiveC |
|||||||
|
b |
||||||||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
90/112
9/16/2016
syntax across languages (One Big Page)
a:
c: d
YAML
access: read/write
|
h[k] |
Awk, C#, C++, CoffeeScript, Dylan, E, JavaScript, Lua, Maple, MSH, PHP, Python, Ruby |
|
$h{k} |
Perl |
|
%h{k} or |
Perl6 |
|
%h<s> |
|
|
h(k) |
Tcl |
|
h.[k] |
F# |
|
h.k |
CoffeeScript, JavaScript, Lua, Matlab |
|
h:k |
Pliant |
|
h["k"] or h‐ |
Pike |
|
>k |
|
|
(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 |
ObjectiveC |
|
|
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 |
|
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
91/112
9/16/2016
syntax across languages (One Big Page)
|
atPut |
Io |
|
|
h |
at: k put: o |
Smalltalk |
|
[h setObject:o forKey:k] ObjectiveC |
||
|
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 |
|
|
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(116) |
C++ |
|
|
h[k] |
Pike |
|
|
(gethash k h) |
Common Lisp |
|
|
maps |
E |
|
|
known |
PostScript |
|
|
isset(h[k]), array_key_exists(k, h) PHP |
||
remove by key
|
delete $h{k} |
Perl |
|
del h[k] |
Python |
|
unset(h[k]) |
PHP |
|
remove |
Eiffel, F#, Java, OCaml, YCP |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
92/112
9/16/2016
syntax across languages (One Big Page)
|
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 ObjectiveC |
|
|
undef |
PostScript |
|
rmfield |
Matlab |
list of keys
|
keys |
Haskell, Io, Maple, MSH, Perl, Perl6, Python, Ruby, Smalltalk |
|
dict keys |
Tcl8.5 |
|
keySet |
Java |
|
allKeys |
ObjectiveC |
|
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 |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
93/112
9/16/2016
syntax across languages (One Big Page)
|
${h[@]} |
KornShell |
|
merge |
|
|
merge(117) |
Ruby |
|
array_merge(117) PHP |
|
|
union(118) |
Haskell |
|
update(117) |
Python, Ruby |
|
putAll(117) |
Java |
|
insert(118) |
C++ |
|
(%h1, %h2)(117) Perl |
|
|
range |
|
|
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(119) |
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 |
||||
inclusive exclusive
|
a b CoffeeScript, Ruby |
|
|
a ! |
b E |
|
range |
Python |
Mathematics
type name
integers
short, int, long
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
94/112
9/16/2016
syntax across languages (One Big Page)
|
C, C# |
||||
|
int |
OCaml, PHP, SML, YAML |
|||
|
Int |
Perl6 |
|||
|
Int, uInt, Int8, Int16 |
Pliant |
|||
|
int, long(120) |
Python |
|||
|
integer |
Maple, PHP |
|||
|
INTEGER, INT, SMALLINT |
SQL92 |
|||
|
INTEGER, INTEGER_8, NATURAL_8 |
Eiffel |
|||
|
int8, uint8, int16, uint16, |
64 |
Matlab |
||
|
int8_t, uint8_t, int16_t, uint16_t, |
64 |
C99 |
||
|
int, int8, uint8, int16, uint16, int32, uint32, int64, uint64, bigint, bignum |
F# |
|||
|
Int, Integer, Int8, Int16, Int32, Int64 |
Haskell |
|||
|
Integer, FixNum, BigNum |
Ruby |
|||
|
Integer, SmallInteger, LargeInteger |
Smalltalk |
|||
|
Integer |
Mathematica |
|||
|
type T is range Low |
High; |
Ada |
||
floating point
|
float, double, long double |
C |
|
float, double |
C# |
|
float |
Maple, OCaml, PHP, SML, YAML |
|
Float |
Ruby |
|
float, float32 |
F# |
|
Float, Float32, Float64 |
Pliant |
|
NUMERIC, DECIMAL, DOUBLE PRECISION |
SQL92 |
|
Rat |
Perl6 |
|
DOUBLE, REAL |
Eiffel |
|
single, double |
Matlab |
|
Float, Double, Ratio |
Haskell |
|
Float, Double, Fraction, FixedPoint |
Smalltalk |
|
float, decimal.Decimal |
Python |
|
Real, Rational |
Mathematica |
|
Number |
Io |
|
type T is digits N range Low High; |
Ada |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
95/112
9/16/2016
syntax across languages (One Big Page)
type T is delta S digits N range Low
High;(121)
Ada
numbers syntax
integers
|
Awk, B, BourneShell, C, C#, C++, CoffeeScript, E, Eiffel, F#, Forth, Haskell, Io, Java, |
|
|
1000 |
JavaScript, Logo, Maple, Mathematica, merd, OCaml, Oz, Pascal, Perl, Perl6, PHP, Pike, Pliant, Prolog, Python, Rebol, Ruby, Scheme, Smalltalk, SQL92, Tcl, Yorick |
|
1000, |
Common Lisp, Emacs Lisp |
|
1000. |
|
|
1000, |
|
|
1000., |
Awk, Matlab |
|
1000.0 |
|
|
1000, '1000'D Classic REXX |
|
|
1000, |
Ada |
|
1E3 |
|
integers in base 2, octal and hexadecimal
|
0b1, 07, 0xf(122) CoffeeScript, Oz, Perl, PHP5, Pike, Ruby |
|
|
0b1, 0o7, 0xf |
F#, OCaml, Perl6 |
|
07, 0xf |
Awk, C, C++, JavaScript, Python, Tcl |
|
0xf |
C#, E, Io, Yorick |
|
07 |
B |
|
0o7, 0xf |
Haskell |
|
1b |
Eiffel |
|
2#1#, 8#7#, 16#f# Ada |
|
|
2#{1}, #{F} |
Rebol |
|
#b1, #o7, #xf |
Common Lisp, Emacs Lisp, Scheme |
|
2^^1, 8^^7, 16^^f Mathematica |
|
|
2r1, 8r7, 16rf |
Smalltalk |
|
#2r1, #8r7, #16rf Common Lisp, Emacs Lisp |
|
|
1b, Fh |
Pliant |
|
'1'B, 'F'X |
Classic REXX |
|
B'1', X'F' |
SQL92 |
|
$f |
Forth |
integer thousandseparator
|
1_000, 10_00, 100_0 Ada, E, Eiffel, OCaml, Perl, Perl6, Ruby |
|
|
1'000, 10'00, 100'0 Rebol |
|
|
1_000 |
merd |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
96/112
9/16/2016
syntax across languages (One Big Page)
floating point
|
1000., 1E3 |
C, C++, Classic REXX, CoffeeScript, E, F#, Java, JavaScript, Logo, Maple, OCaml, Python, Scheme, SQL92, Tcl |
|
1000., 1E3, 1,0 Rebol |
|
|
1000., 1.E3 |
Eiffel, Oz |
|
1000.0, 1E3 |
C#, Common Lisp, Emacs Lisp, PHP, Pike, Prolog, Ruby, Smalltalk |
|
1000.0, 1.0E3 |
Ada, Haskell |
|
1000, 1000.0, |
Awk, merd, Perl, Perl6 |
|
1E3(123) |
|
|
1000., 1*^3, |
Mathematica |
|
1000` |
|
|
1000e, 1e3 |
Forth |
addition / subtraction / multiplication / division
|
BourneShell, C, C#, C++, Classic REXX, CoffeeScript, Common Lisp, Eiffel, Emacs |
|||
|
+ |
‐ |
||
|
/ |
/ |
/ * / |
Lisp, F#, Forth, Haskell, Io, Java, JavaScript, Logo, Maple, Matlab, merd, MUMPS, Perl, Perl6, PHP, Pliant, Prolog, Python, Ruby, Scheme, Smalltalk, SQL92, Tcl, Yorick |
|
‐ nothing / / + / / * or |
Mathematica |
||
|
+ +. / ‐ ‐. |
|||
|
/ * *. / / |
OCaml |
||
|
/.(124) |
|||
|
sum / |
|||
|
difference / |
Logo |
||
|
product / |
|||
|
quotient |
|||
|
add / sub / mul / idiv |
PostScript |
||
|
div |
|||
|
f+ / f‐ / f* |
Forth |
||
|
/ |
f/ |
||
exponentiation (power)
|
** |
Ada, Classic REXX, E, F#, Fortran, Io, merd, OCaml, Perl, Perl6, PL/I, Prolog, Python, Rebol, Ruby, Tcl8.5 |
|
^ |
Awk, Dylan, Eiffel, Lua, Mathematica, Matlab, Pliant, Yorick |
|
*(125) |
APL |
|
**, ^ |
Maple |
|
**, ^ and |
Haskell |
|
^^(126) |
|
|
f** |
Forth |
|
pow |
C, C++, CoffeeScript, Java, JavaScript, PHP, Pike, Python, SML, Tcl |
|
Pow |
C#, Oz |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
97/112
9/16/2016
syntax across languages (One Big Page)
|
power |
DelphiKylix, Logo, Rebol |
|
exp |
PostScript |
|
expt |
Common Lisp, Emacs Lisp, Scheme |
|
raisedTo |
Smalltalk |
negation
|
Ada, Awk, B, BCPL, BourneShell, C, C#, C++, Classic REXX, CoffeeScript, Common Lisp, |
|
|
E, Eiffel, Emacs Lisp, F#, Haskell, Io, Java, JavaScript, Logo, Maple, Mathematica, Matlab, |
|
|
‐ |
merd, MUMPS, Perl, Perl6, PHP, Pike, Pliant, Prolog, Python, Rebol, Ruby, Scheme, Smalltalk, Tcl, Yorick |
|
‐ ‐. |
OCaml |
|
~ |
Oz, SML |
|
neg |
PostScript |
|
negate Forth, Rebol |
|
|
fnegate Forth |
|
|
minus |
Logo |
random
random number
|
rand |
C, Maple, Matlab, Perl, Perl6, PHP, Ruby, Tcl |
|
random |
Common Lisp, Logo, Prolog, Python, Yorick |
|
$RANDOM |
MUMPS |
|
randomR |
Haskell |
|
Random(127) |
Ada |
|
Random.int |
OCaml |
|
Random, RandomReal, RandomInteger Mathematica |
|
|
Random value |
Io |
|
Random new nextInteger |
Smalltalk |
|
r: RANDOM |
|
|
create r.make |
Eiffel |
|
r.start |
|
|
r.item |
|
|
Random ran = new Random(); ran.Next( ); |
C# |
|
let r = System.Random() r.Next() |
F# |
|
mt_rand |
PHP |
seed the pseudo random generator
srand
C, Perl, Perl6, PHP, Ruby, Tcl
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
98/112
9/16/2016
syntax across languages (One Big Page)
|
set_seed |
Eiffel |
|
|
random.seed |
Python |
|
|
Random setSeed |
Io |
|
|
Random.init, Random.self_init |
OCaml |
|
|
rand('state', |
) |
Matlab |
|
rerandom |
Logo |
|
|
RandomTools[MersenneTwister][SetState] Maple |
||
|
Random new setSeed |
Smalltalk |
|
|
SeedRandom |
Mathematica |
|
|
mkStdGen |
Haskell |
|
|
make‐random‐state |
Common Lisp |
|
|
Reset |
Ada |
|
operator priorities and associativities
addition vs multiplication
mathematical BourneShell, C, C#, C++, Classic REXX, Eiffel, F#, Haskell, Io, Java, Maple, Mathematica, Matlab, merd, Perl, Perl6, PHP, Python, Ruby, Tcl, Yorick
same
priorities MUMPS, Smalltalk
exponentiation vs negation (is 3^2 equal to 9 or 9)
|
mathematical |
Classic REXX, Eiffel, Haskell, Io, Maple, Mathematica, Matlab, Perl, Perl6, Python, Ruby |
|
negation |
F#, OCaml |
|
first |
square root / eexponential / absolute value
|
sqrt / exp / abs |
Ada, C, C++, CoffeeScript, Common Lisp, E, Eiffel, Emacs Lisp, F#, Haskell, Io, Java, JavaScript, Lua, Maple, OCaml, Pascal, Perl, Perl6, PHP, Prolog, Python, Ruby, Scheme, Smalltalk, SML, Tcl, Yorick |
|
|
sqrt realsqrt |
Matlab |
|
|
/ |
exp / abs |
|
|
sqrt / exp / |
Awk, Logo |
|
|
Sqrt / Exp / Abs |
C#, Mathematica, Oz |
|
|
sqrt / / abs |
PostScript |
|
|
Sqrt / / ABS |
Modula3 |
|
|
/ |
exp / abs |
Pliant |
|
sqrt / / |
Pike |
|
|
square‐root / |
||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
99/112
9/16/2016
syntax across languages (One Big Page)
|
exp / abs or absolute |
Rebol |
|
Sqrt / Exp / ABS |
Classic REXX |
|
sqrt,isqrt / exp / abs |
Tcl8.5 |
|
fsqrt / fexp / abs,fabs |
Forth |
trigonometry
basic
|
sin / cos |
Ada, C, C++, CoffeeScript, Common Lisp, E, Emacs Lisp, F#, Haskell, Io, Java, JavaScript, Lua, Maple, Matlab, OCaml, Pascal, Perl, Perl6, PHP, Pike, Pliant, Prolog, Python, Ruby, Scheme, Smalltalk, SML, Tcl, Yorick |
|
|
/ |
tan |
|
|
Sin / Cos |
C#, Classic REXX, Mathematica, Oz |
|
|
/ |
Tan |
|
|
sin / cos |
Awk, PostScript |
|
|
/ |
||
|
sine / |
||
|
cosine / |
Eiffel, Rebol |
|
|
tangent |
||
|
radsin / |
||
|
radcos / |
Logo |
|
|
radtan |
||
|
fsin / |
||
|
fcos / |
Forth |
|
|
ftan |
||
inverse
|
asin / acos / |
Ada, C, C++, CoffeeScript, Common Lisp, F#, Haskell, Io, JavaScript, Matlab, OCaml, Perl, Perl6, Pike, Pliant, Prolog, Python, Ruby, Scheme, Tcl, Yorick |
|
atan(128) |
|
|
Asin / Acos / Atan C#, Oz |
|
|
ASin / ACos / ATan Classic REXX |
|
|
arcsin / arccos / arctan |
Maple |
|
arcSin / arcCos / arcTan |
Smalltalk |
|
ArcSin / ArcCos / ArcTan |
Mathematica |
|
arcsine / |
|
|
arccosine / |
Rebol |
|
arctangent |
|
|
arc_sine / |
|
|
arc_cosine / |
Eiffel |
|
arc_tangent |
|
|
/ / atan |
PostScript |
|
/ / radarctan |
Logo |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
100/112
9/16/2016
syntax across languages (One Big Page)
|
fasin / facos / |
Forth |
|
fatan |
logarithm
base e
|
ln DelphiKylix, Logo, Maple, Pascal, PostScript, Smalltalk, SML |
|
|
log Awk, C, C++, CoffeeScript, Common Lisp, E, Eiffel, Emacs Lisp, F#, Io, Java, JavaScript, Lua, Maple, Matlab, OCaml, Perl, Perl6, PHP, Pike, Pliant, Prolog, Python, Ruby, Scheme, Tcl, Yorick |
|
|
Log Ada, C#, Classic REXX, Mathematica, Oz |
|
|
log |
Haskell |
|
10 |
|
|
log‐ |
Rebol |
|
e |
|
|
fln Forth |
|
base 10
|
log10 |
C, C++, DelphiKylix, Eiffel, F#, Io, Logo, Lua, Matlab, OCaml, Perl, Perl6, PHP, Pliant, Prolog, Python, Ruby, Tcl, Yorick |
|
Log10 |
C#, Classic REXX |
|
log |
PostScript, SML |
|
log: 10 |
Smalltalk |
|
log‐10 |
Rebol |
|
log[10] |
Maple |
|
Log[10, val] |
Mathematica |
|
logBase 10 |
Haskell |
|
Log(X => val, Base => 10.0) |
Ada |
|
(log x 10) |
Common Lisp |
|
flog |
Forth |
base 2
|
log2 |
Matlab |
|
log‐10 / log‐2 |
Rebol |
|
Log(X => val, Base => 2.0) Ada |
|
|
log(val, 2) |
Python |
|
Log[2, val] |
Mathematica |
|
frexp |
C |
euclidian division (both quotient and modulo)
divmod
Python, Ruby
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
101/112
9/16/2016
syntax across languages (One Big Page)
|
divMod
|
Haskell |
|
|
div |
ldiv lldiv C |
||
|
IntInf.quotrem SML |
|||
|
floor |
Common Lisp, Dylan |
||
|
/mod |
Forth |
||
modulo
modulo of 3 / 2 is 1
|
% |
Classic REXX, Perl, Perl6, Pike, Python, Ruby, Tcl |
|
%% |
E |
|
\\ |
Smalltalk |
|
mod Ada, Common Lisp, Emacs Lisp, Haskell, Matlab, Prolog, SML |
|
|
Mod Mathematica |
|
|
MOD |
Modula3 |
|
modulo Dylan, Logo, Ruby |
|
|
rem |
Prolog |
modulo of 3 / 2 is 1
|
% |
Awk, B, C, C#, C++, CoffeeScript, E, F#, Io, Java, JavaScript, PHP, Pliant, Yorick |
|
# |
MUMPS |
|
mod |
F#, Forth, Lua, OCaml, Oz, Pascal, PostScript, Prolog, XPath |
|
remainder Logo, Ruby, Scheme |
|
|
rem |
Ada, BCPL, Haskell, Matlab, Smalltalk |
|
// |
Classic REXX, Rebol |
|
\\ |
Eiffel |
truncate / round / floor / ceil
|
trunc / round / floor / ceil |
C, C++, Maple, Matlab |
|
|
truncate / round / floor / ceiling |
Common Lisp, Haskell, Perl6, PostScript, Prolog, Scheme |
|
|
int |
/ round / floor / ceil |
CoffeeScript, JavaScript, Pike, Python |
|
int |
/ round / / |
Logo |
|
to_i, Integer() / round / floor / ceil |
Ruby |
|
|
TRUNC / FORMAT / Floor / Ceil |
Classic REXX |
|
|
Float'Truncation / Float'Rounding / Float'Floor / |
Ada |
|
|
Float'Ceiling(129) |
||
|
/ round / floor / ceil |
E, Io, Java, Lua, PHP, SML, Tcl |
|
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
102/112
9/16/2016
syntax across languages (One Big Page)
|
/ Round / Floor / Ceiling
|
C# |
|
|
/ Round / Floor / Ceil |
Oz |
||
|
/ round / floor / ceiling |
Dylan, Emacs Lisp, PostScript, XPath |
||
|
/ ROUND / FLOOR / CEILING |
Modula3 |
||
|
/ rounded / floor / ceiling |
Eiffel, Smalltalk |
||
|
int / / floor / ceil |
F#, Perl |
||
|
int_of_float / / floor / ceil |
F#, OCaml |
||
|
/ |
/ floor / ceil |
Lua, Yorick |
|
|
IntegerPart / Round / Floor / Ceiling |
Mathematica |
||
|
/ |
Rounding / Floor / Ceiling |
Ada |
|
|
to‐integer / / / |
Rebol |
||
|
/ |
fround / / |
Forth |
|
bitwise operators
and / or / xor
|
& / |
| |
/ ^ |
C, C#, C++, CoffeeScript, E, Eiffel, Java, JavaScript, Perl, PHP, Pike, Python, Ruby, Tcl |
|
& / |
| |
/ ~ |
Yorick |
|
& / |
| |
YCP |
|
|
+& / +| / +^ |
Perl6 |
||
|
.&. / .|. / xor(130) |
Haskell |
||
|
&&& / ||| / ^^^ |
F# |
||
|
and / or / xor |
Ada, Forth, PostScript, Rebol |
||
|
land / lor / lxor |
F#, OCaml |
||
|
logand / logior / |
Common Lisp |
||
|
logxor(131) |
|||
|
bitand / bitor / bitxor |
Logo, Matlab |
||
|
BITAND / BITOR / BITXOR |
Classic REXX |
||
|
BitAnd / BitOr / BitXor |
Mathematica |
||
|
bitAnd / bitOr / bitXor |
Smalltalk |
||
|
bitwiseAnd / bitwiseOr / bitwiseXor |
Io |
||
|
/\ / \/ / xor |
Prolog |
||
bitwise inversion
|
C, C#, C++, CoffeeScript, Java, JavaScript, Perl, PHP, Pike, Python, Ruby, SML, |
|
|
~ |
Tcl, YCP |
|
~~~ |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
103/112
9/16/2016
syntax across languages (One Big Page)
|
F# |
|
|
not |
Ada, Eiffel, PostScript |
|
lnot |
F#, OCaml |
|
lognot(132) |
Common Lisp |
|
bitnot |
Eiffel, Logo |
|
BitNot |
Mathematica |
|
complement |
Haskell, Rebol |
|
bitcmp |
Matlab |
|
bitInvert |
Smalltalk |
|
bitwiseComplement Io |
|
|
invert |
Forth |
|
\ |
Prolog |
left shift / right shift / unsigned right shift
|
<< / >> / >>> |
CoffeeScript, Java, JavaScript |
|
<< / >> |
C, C#, C++, Perl, PHP, Pike, Prolog, Python, Ruby, Tcl, YCP |
|
<<< / >>> |
F# |
|
|<< / |>> |
Eiffel |
|
lsl / lsr or asr |
F#, OCaml |
|
bitshift |
Matlab, PostScript |
|
bitShift |
Smalltalk |
|
ashift lshift |
Logo |
|
lshift / rshift |
Forth |
|
shiftL / / shiftR |
Haskell |
|
shiftLeft / shiftRight |
Io |
|
Shift_Left / Shift_Right / Shift_Right_Arithmetic / Rotate_Left / Rotate_Right |
Ada |
|
(ash x positive‐integer) / (ash x negative‐integer) / |
Common Lisp |
Threads
thread definition
|
class class_name(threading.Thread) {[override run method] } |
Python |
|||||
|
task task_name is [entry entry_name[(parameter |
)] |
] end task_name |
Ada |
|||
|
task type task_type_name is [entry entry_name[(parameter task_type_name |
)] |
] |
end |
Ada |
||
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
104/112
9/16/2016
syntax across languages (One Big Page)
|
class class_name extends Thread {[override run method] } |
Java |
|
thread |
Pliant |
|
parallel [threads nb_threads] [mini mini_threshold] [maxi maxi_threshold] [active] |
|
|
task |
|
|
parallel_instructions |
Pliant |
|
[post |
|
|
sequential_instructions] |
|
|
Objective |
|
|
[NSThread detachNewThreadSelector:mainFunction toTarget:target withObject:obj] |
C |
thread creation
|
object t=Thread.Thread(f) |
Pike |
|
|
set t [thread create {code}] Tcl |
||
|
Thread createThread( |
) |
Io |
thread object creation
|
MyTask : task_type_name; |
Ada |
||
|
class_name MyThread = new class_name() Java |
|||
|
p |
:= [ |
] newProcess. |
Smalltalk |
|
p |
:= [ |
] fork.(133) |
Smalltalk |
starting / stopping threads
|
start() / stop()(134) |
Java |
|
resume / suspend / terminate |
Smalltalk |
|
Tasks are started when created / call Stop entry or "abort task‐object‐name" Ada |
|
|
thread send $t {script} |
Tcl |
passing data directly between threads
|
call an entry with parameters |
Ada |
|
call any public method |
Java |
|
common variables are copied at thread creation, in abscence of a "share" statement Pliant |
|
|
use messages, parameters or shared variables(135) |
Smalltalk |
terminating thread communication due to a timeout
select task_entry_call; or delay timeout_limit; end select; Ada
Thread Synchronization
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
105/112
9/16/2016
syntax across languages (One Big Page)
Defining a Synchronized Shared Resource
|
thread::mutex |
Tcl |
|||||
|
protected Object_Name is [entry entry_name(Parameter : [in out] is type [ |
]); |
|||||
|
procedure procedure_name(Parameter : [in out] is type [ function function_name return type; private shared data declaration end Object_Name; |
]); |
Ada |
||||
|
synchronize (this){ |
} |
Java |
||||
|
SharedQueue, Semaphore critical: [ |
], |
Future, LazyValue |
Smalltalk |
|||
Synchronized Writing to a shared resource
|
Object_Name.Entry_Name(Parms) Object_Name.Procedure_Name(Parms) Ada |
|
|
Object_Name.SetMethod(Parms) |
Java |
Synchronized Reading of a Shared Resource
|
Object_Name.Function_Name Ada |
|
|
Object_Name.GetMethod() |
Java |
Monitor Syntax
Objectg_Name.Entry_Name(Parms) Ada
Joining Another Thread
Suspending a thread until another thread completes
|
Call task entry serviced just before task termination Ada |
|
|
OtherThread.join() |
Java, Python |
Suspending a Thread Until Another Thread Establishes An Internal State
Call a task entry on the other thread Ada
Thread Prioritization
Selecting a Prioritization Model
pragma Locking_Policy(Ceiling_Locking); Ada
Establishing a base thread priority
pragma Priority(expression); Ada
Changing Thead Priority
|
Set_Priority(Priority_Value); Ada |
|
|
setPriority(newPriority); |
Java |
|
p priority: n |
Smalltalk |
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
106/112
9/16/2016
syntax across languages (One Big Page)
Threadsafe sharing of data without synchronization
Ensuring access is atomic
pragma Atomic(Object_Name); Ada
Ensuring access is always via a local copy of the shared data
pragma Volatile(Object_Name); Ada
Remarks
(1) introduced in Scheme in R6RS
(2) when unused
(3) for C, it is not a standard convention, but it is the more widespread
(4) any string literal would work
(5) see also =head1, =head2, =over, etc
(6) need "file: %scriptheader.r" in file header
(7) displayed < with a special character
(8) variable on the right
(9) F#: with indentation
(10) the variable behaves like a pointer
(11) cf
horizontal layout
(12) introduce scope
(13) Smalltalk: introduce scope
(14) ascii representation, original uses a special charset
(15) in Modula2, <> and # are synonyms
(16) === and !== differ from == and != when the objects' type differ
(17) for objects
(18) normal / structural / unification / arithmetic
(19) structural / mathematical
(20) deep comparison
(21) in List::Util
(22) just 'eval' evaluates JavaScript
(23) Univ operator
(24) starting with PHP 5.3
(25) procedure call
(26) in Pliant, special sugar for only one parameter
(27) only for one parameter
(28) only for two parameters
(29) f is a block
(30) Python >= 2.5
(31) it does not scale to 3rd argument
(32) lambda (x . y)
(33) when callee has special "&" prototype
(34) this is a block, not precisely a function, but it's alike
(35) manual declaration of local variables wanted in the closure
(36) see also: #1 + #2 &
(37) also works for procedures: proc {$ A B}
(38) x, y, z are the parameters
(39) method is optional
(40) in Lua, "return xxx" can only appear before a block end. in Matlab, only in inline(' ')
(41) "return" is used when there is no value to return
end
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
107/112
9/16/2016
syntax across languages (One Big Page)
(42) in Matlab, only for anonymous function
(43) firefox
(44) C#4, only for "dynamic" objects
(45) the result goes to "e"
(46) "break"s are mandatory, even for "default"!
(47) Perl >= 5.8.0
(48) 1 is optional in this example, since min is 1 by default
(49) in Ruby, see also catch/throw
(50) often provided in the abbreviated form call/cc
(51) matches an expression of type t
(52) type is infered
(53) expression "e" is cast to the type of "v"
(54) for parameters
(55) quite bad: only the reference is nonmutable whereas the object is still mutable
(56) eventual send
(57) properties are something alike attributes, but really are methods
(58) one level depth
(59) general deep copy function
(60) object cloning is the default, uses the copy constructor in C++
(61) or simply o_ := o for nonpolymorphic objects
(62) c'Class is the class rooted in c
(63) see also isMemberOf
(64) assignment attempt
(65) see also callable(obj.meth) for
unbound methods
(66) in Python, usually called self
(67) ":" is for external symbols only, recommended
(68) directory name is package name
(69) if names are exported using @EXPORT
(70) if names are not exported or are exported using @EXPORT_OK
(71) deprecated in ANSI Common Lisp, but used in ASDF
(72) using a correspondance from the package name to the file name
(73) inside a function
(74) since PHP 5.3
(75) no spaces
(76) when using format
(77) need expandMacros
(78) where T is the type of the value
(79) see also cPickle
(80) but not using the Clike %syntax
(81) adding an endofline
(82) in BourneShell, adding an endofline
(83) adding an endofline unless already newlineterminated
(84) faster than isEqual
(85) the string is represented on the stack as (addr len)
(86) in Lua >= 5.0
(87) in C++, is rangechecked whereas a[i] is not
(88) ESI dialect
(89) beware of 0.0 which is true in Pike!
(90) Smalltalk: postfix operator
(91) in Modula2, "&" and "and" are synonyms
(92) in Oz, simple functions, not operators
(93) new in PHP 5.4
(94) restricted to initialisation of a local variable in C and C++
(95) a b c must be constants
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
108/112
9/16/2016
syntax across languages (One Big Page)
(96) beware, if you give only one integer argument, it is the size!
(97) for write access: a i o put
(98) in C++, it is rangechecked whereas a[i] is not. in Smalltalk, for write access: a :at i :put o
(99) see also Head
(100) list comprehension
(101) not in standard
(102) in C++, it is done in place
(103) in Scheme, not standard, but nearly standard
(104) the result is not guaranteed to be the same as the order in the input
(105) in Perl, in List::Util
(106) Borland extension in Pascal
(107) prefix
(108) postfix
(109) infix
(110) optional value is only for pointers
(111) only for "access" types in Ada
(112) introduced in Perl 5.10
(113) attribute selector
(114) Java: introduced in 1.5
(115) n1, n2,
(116) returns an iterator
(117) rightbias
(118) leftbias
(119) jot on BSD
(120) long is a big integer
(121) fixed point
(122) 0b1 new in PHP 5.4
(123) integers are decimals
(124) with mathematical priorities
(125) APL uses a real multiplication sign for multiplication from a special character set
(126) for each various types
(127) from instances of Ada.Numerics.Float_Random or Ada.Numerics.Discrete_Random
(128) Ruby >= 1.7
(129) replace Float with whatever type you are using
(130) in module Data.Bits
(131) see also bitand / bitor / bitxor
(132) see also bitnot
(133) equivalent to newProcess + resume
(134) "stop" is now deprecated
(135) a thread is created from a block, which is a closure on the variables as seen by the block
Similar Pages
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
109/112
9/16/2016
syntax across languages (One Big Page)
References
Credits
Yoann 'Pad' Padioleau (Haskell additions, Beta, various fixes)
Jakub Travnik (Pascal, DelphiKylix)
Robert Feldt (Ruby additions)
Pascal Terjan (PHP)
Carlos 'angus' (PostScript)
Axel Kittenberger (various)
Guido van Rossum (block vs scoping)
Jeffrey Hobbs (Tcl)
MarkJason Dominus (SML, various)
Ash Searle (Java, PHP, JavaScript)
Mark S. Miller (
E)
Pete Jinks (various)
Steve Tolkin (various)
Franck Arnaud (Eiffel)
Tom Murphy (SML)
Guy Steele (Fortran, and many various)
Carl Gay (Dylan, CommonLisp)
Jay nop@nop.com (Lua)
Philippe Lhoste (Lua, JavaScript)
Jim Rogers (Ada, Java, Threads section)
Ketil Z. Malde (Haskell)
Mark Carroll (
Modula3)
Keith Wansbrough (Haskell and a few SML)
Remi Vanicat (OCaml)
Matthieu Villeneuve (CommonLisp)
Joachim Durchholz (Eiffel)
Walter Vannini (C, "breaking lines" idea)
Peter Lewerin (Tcl)
Patrice Ossona de Mendez (Pliant)
Bert Freudenberg (Smalltalk & Squeak additions corrections)
Dennis Haney (Perl, C#)
Fergus Henderson (Mercury)
Ralph Becket (Mercury)
Bill Thornton (Java)
Nik Crabtree (C#)
Neal Holtz (Python)
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
110/112
9/16/2016
syntax across languages (One Big Page)
Donald Chai (Python)
Fred Spiessens (Oz)
Martin Nilsson (Pike)
Theodore Eastman (VisualBasic)
George Herson (Eiffel)
Lee Denison (Tcl)
Anton Rolls (Rebol)
Pedro (Lua)
Nathan Sharfi (C99, C#, C++)
Dirk Gerrits (Common Lisp, Scheme, Emacs Lisp)
Tabitha Arrowny (Ruby, Python, Perl,
Péter Varga (BourneShell, Common Lisp,
Ian Henderson (Objective C)
Anthony Borla (Classic REXX, Prolog, Logo)
Paul McJones (Modula3 fixes)
Uwe Kolb (Smalltalk fixes)
Ciaran McNulty (PHP)
David B. Nagle (Yorick)
Michael Schaufelberger (Eiffel)
Samuel Charron (Erlang)
Kyle Ross (OCaml)
Damien Krotkine (Ruby)
Guillaume Cottenceau (Java)
David.Whitten (MUMPS)
Phil Howard (various)
Andrzej Zawadzki (Ruby)
Stuart Brady (VisualBasic)
Joris Gillis (Maple)
Garrett Wollman (Ruby, BourneShell, C )
Claus Gittinger (Smalltalk)
Bobby 'nneonneo' Xiao (Python)
Michael Schlenker (Tcl)
Alex Vondrak (Python)
Daniel Laberge (Pascal)
Daniel Wagner (Haskell)
Bob Bane (Common Lisp)
Alan Hogan (Java)
Steve Davison (C)
Konstantin Yegupov (PHP, Python )
Noé Rubinstein (Io, CoffeeScript)
Florentin Millour (Yorick)
Axel Liljencrantz (FishShell)
Sanghyeon Seo (Lua)
Szabolcs Horvát (Mathematica)
Laurent Le Brun (F#, GNUsed)
Julien Hall (Smalltalk)
Ian Osgood (Forth)
Dmitry A. Kazakov (Ada)
Peter Hermann (Ada)
Ian Jackson (Tcl, Perl, C, Assembler )
Steve Breese
Nils M Holm (Scheme,
Stas Malyshev (PHP5)
)
)
)
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
111/112
9/16/2016
syntax across languages (One Big Page)
Pixel This document is licensed under GFDL (GNU Free Documentation License). Generated from syntaxacrosslanguages.html.pl $Id: syntaxacrosslanguages.html.pl 408 20080829 08:32:23Z pixel $
http://rigaux.org/languagestudy/syntaxacrosslanguages.html
112/112
Mult mai mult decât documente.
Descoperiți tot ce are Scribd de oferit, inclusiv cărți și cărți audio de la editori majori.
Anulați oricând.