Adapted from Pascal Rigaux's syntax-across-languages
# | Theme | Category | Criterion | BourneShell | CoffeeScript | Julia | Perl | PHP | Python | Ruby | YAML | C++ | Java | JavaScript | Matlab | Visual Basic | CSS | HTML |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Mathematics | type name | integers | integer | int, long(124) | Integer, FixNum, BigNum | short, int, long | Int, Integer, Int8, Int16, Int32, Int64 | ||||||||||
2 | Mathematics | type name | floating point | Number | float | float, decimal.Decimal | Float | float, double | Number | |||||||||
3 | Mathematics | numbers syntax | integers | 1000 | 1000 | 1000 | 1000 | 1000 | 1000 | 1000 | 1000 | 1000 | 1000 | 1000 | 1000, 1000. | |||
4 | Mathematics | numbers syntax | integers in base 2, octal and hexadecimal | 7 | 07, 0xf | 0b1, 0o7, 0xf | 07, 0xf | 0b1, 07, 0xf(126) | 07, 0xf | 07, 0xf | 0xf | #2r1, #8r7, #16rf | ||||||
5 | Mathematics | numbers syntax | integer thousand-separator | 1_000, 10_00, 100_0 | 1_000, 10_00, 100_0 | |||||||||||||
6 | Mathematics | numbers syntax | floating point | 1000, 1000.0, 1E3(127) | 1000, 1000.0, 1E3(127) | 1000.0, 1E3 | 1000.0, 1E3 | 1000., 1E3 | 1000., 1E3 | 1000., 1E3 | 1000., 1E3 | |||||||
7 | Mathematics | numbers syntax | addition / subtraction / multiplication / division | + / - / * / / | + / - / * / / | + / - / * / / | + / - / * / / | + / - / * / / | + / - / * / / | + / - / * / / | + / - / * / / | + / - / * / / | + / - / * / / | |||||
8 | Mathematics | numbers syntax | exponentiation (power) | ^ | pow | ** | pow | pow | ** | ** | pow | pow | pow | **, ^ and ^^(130) | ||||
9 | Mathematics | numbers syntax | negation | - | - | - | - | - | - | - | - | - | - | - | - | |||
10 | Mathematics | numbers syntax | random number | Random value | mt_rand | rand | rand | Random ran = new Random();\nran.Next(...); | Random value | |||||||||
11 | Mathematics | numbers syntax | seed the pseudo random generator | Random setSeed | srand | srand | srand | Random setSeed | ||||||||||
12 | Mathematics | operator priorities and associativities | addition vs multiplication | mathematical | mathematical | mathematical | mathematical | mathematical | mathematical | mathematical | mathematical | mathematical | ||||||
13 | Mathematics | operator priorities and associativities | exponentiation vs negation (is -3^2 equal to 9 or -9) | mathematical | mathematical | mathematical | ||||||||||||
14 | Mathematics | operator priorities and associativities | square root / e-exponential / absolute value | sqrt / exp / | sqrt / exp / abs | sqrt / exp / abs | sqrt / exp / abs | sqrt / exp / abs | sqrt,isqrt / exp / abs | sqrt / exp / abs | sqrt / exp / abs | sqrt / exp / abs | ||||||
15 | Mathematics | trigonometry | basic | sin / cos / | sin / cos / tan | sin / cos / tan | sin / cos / tan | sin / cos / tan | sin / cos / tan | sin / cos / tan | sin / cos / tan | sin / cos / tan | ||||||
16 | Mathematics | trigonometry | inverse | asin / acos / atan(134) | asin / acos / atan(134) | asin / acos / atan(134) | asin / acos / atan(134) | asin / acos / atan(134) | asin / acos / atan(134) | asin / acos / atan(134) | ||||||||
17 | Mathematics | logarithm | base e | log | log | log | log | log | log | log | log | log | ||||||
18 | Mathematics | logarithm | base 10 | log10 | log10 | log10 | log10 | log10 | log10 | log10 | ||||||||
19 | Mathematics | logarithm | base 2 | log-10 / log-2 | math.Log2 | |||||||||||||
20 | Mathematics | logarithm | euclidean division (both quotient and modulo) | divmod | divMod | |||||||||||||
21 | Mathematics | logarithm | modulo of -3 / 2 is 1 | % | modulo | % | ||||||||||||
22 | Mathematics | logarithm | modulo of -3 / 2 is -1 | rem | % | mod | % | % | % | % | ||||||||
23 | Mathematics | logarithm | truncate / round / floor / ceil | int / round / floor / ceil | / round / floor / ceil | to_i, Integer() / round / floor / ceil | / round / floor / ceiling | trunc / round / floor / ceil | / round / floor / ceil | int / round / floor / ceil | ||||||||
24 | Mathematics | bitwise operators | and / or / xor | & / | / ^ | & / | / ^ | & / | / ^ | & / | / ^ | & / | / ^ | & / | / ^ | & / | / ^ | ||||||||
25 | Mathematics | bitwise operators | bitwise inversion | ~ | ~ | ~ | ~ | ~ | ||||||||||
26 | Mathematics | bitwise operators | left shift / right shift / unsigned right shift | << / >> / >>> | << / >> | << / >> | << / >> | << / >> / >>> | << / >> / >>> | |||||||||
27 | Threads# | Threads | thread definition | class class_name(threading.Thread) {[override run method] } | class class_name(threading.Thread) {[override run method] } | class class_name extends Thread {[override run method] } | ||||||||||||
28 | Threads# | Threads | thread creation | Thread createThread(...) | set t [thread create {code}] | |||||||||||||
29 | Threads# | Threads | thread object creation | class_name MyThread = new class_name() | ||||||||||||||
30 | Threads# | Threads | starting / stopping threads | thread send $t {script} | start() / stop()(141) | |||||||||||||
31 | Threads# | Threads | passing data directly between threads | common variables are copied at thread creation, in abscence of a share statement | call any public method | |||||||||||||
32 | Threads# | Threads | terminating thread communication due to a time-out | |||||||||||||||
33 | Thread Synchronization# | Thread Synchronization | Defining a Synchronized Shared Resource | thread::mutex | synchronize (this){ ... } | |||||||||||||
34 | Thread Synchronization# | Thread Synchronization | Synchronized Writing to a shared resource | Object_Name.SetMethod(Parms) | ||||||||||||||
35 | Thread Synchronization# | Thread Synchronization | Synchronized Reading of a Shared Resource | Object_Name.GetMethod() | ||||||||||||||
36 | Thread Synchronization# | Thread Synchronization | Monitor Syntax | |||||||||||||||
37 | Joining Another Thread# | Joining Another Thread | Suspending a thread until another thread completes | OtherThread.join() | OtherThread.join() | |||||||||||||
38 | Joining Another Thread# | Joining Another Thread | Suspending a Thread Until Another Thread Establishes An Internal State | |||||||||||||||
39 | Thread Prioritization# | Thread Prioritization | Selecting a Prioritization Model | |||||||||||||||
40 | Thread Prioritization# | Thread Prioritization | Establishing a base thread priority | |||||||||||||||
41 | Thread Prioritization# | Thread Prioritization | Changing Thead Priority | setPriority(newPriority); | ||||||||||||||
42 | Thread-safe sharing of data without synchronization# | Thread-safe sharing of data without synchronization | Ensuring access is atomic | |||||||||||||||
43 | Thread-safe sharing of data without synchronization# | Thread-safe sharing of data without synchronization | Ensuring access is always via a local copy of the shared data | |||||||||||||||
44 | Various | commenting | until end of line | # | # | # | # | // | # | # | # | // | // | // | % | ' | ||
45 | Various | commenting | nestable | #= ... =# | #[ ... ] | |||||||||||||
46 | Various | commenting | non nestable | /* ... */ | /* ... */ | /* ... */ | /* ... */ | <!-- ... --> | ||||||||||
47 | Various | documentation comment | until end of line | /// | /// | |||||||||||||
48 | Various | documentation comment | non nestable | /** ... */(3) | /** ... */(3) | /** ... */(3) | ||||||||||||
49 | Various | documentation comment | information about the current line and file | __LINE__ __FILE__ | __LINE__ __FILE__ | __LINE__ __FILE__ | Thread.currentThread().getStackTrace()[1].getLineNumber();\nThread.currentThread().getStackTrace()[1].getFileName(); | Thread.currentThread().getStackTrace()[1].getLineNumber();\nThread.currentThread().getStackTrace()[1].getFileName(); | ||||||||||
50 | Various | tokens | case-sensitivity (keywords, variable identifiers...) | case-sensitive | case-sensitive | case-sensitive | case-sensitive | case-sensitive: variables\ncase-insensitive: keywords, functions, constants... | case-sensitive | case-sensitive | case-sensitive | case-sensitive | case-sensitive | case-sensitive | case-insensitive | case-insensitive | ||
51 | Various | tokens | what is the standard way for scrunching together multiple words | camelCase | CamelCase or camelCase | CamelCase for modules, ALL_CAPS for constants, unclear for functions / variables | CamelCase for modules, ALL_CAPS for constants, unclear for functions / variables | CamelCase for classes, underscores for methods | CamelCase for modules and classes, ALL_CAPS for constants, underscores for functions, variables, ... | CamelCase or camelCase | usually underscores | CamelCase or camelCase | CamelCase or camelCase | |||||
52 | Various | tokens | variable identifier regexp | [_a-zA-Z0-9]+ | [$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]* | [_a-zA-Z0-9]+ | [_a-zA-Z][_a-zA-Z0-9]* | [_a-zA-Z][_a-zA-Z0-9]* | [_a-z][_a-zA-Z0-9]* | [a-zA-Z][_a-zA-Z0-9]* | [_a-zA-Z][_a-zA-Z0-9]* | [_a-zA-Z$][_a-zA-Z0-9$]* | [$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]* | anything without a space and is not a number | [_a-z][_a-zA-Z0-9']* | |||
53 | Various | tokens | function identifier regexp (if different from variable identifier regexp) | [A-Z][_a-zA-Z0-9]*(7) | ||||||||||||||
54 | Various | tokens | keyword regexp (if different from variable identifier regexp) | |||||||||||||||
55 | Various | tokens | type regexp (if different from variable identifier regexp) | |||||||||||||||
56 | Various | tokens | constant regexp (if different from variable identifier regexp) | |||||||||||||||
57 | Various | tokens | breaking lines (useful when end-of-line and/or indentation has a special meaning) | \ | \ | nothing needed | nothing needed | \ | nothing needed | nothing needed | nothing needed | nothing needed | nothing needed | |||||
58 | Various | variable assignment or declaration | assignment | = | = | = | = | is | = | = | = | = | _(8) | set | ||||
59 | Various | variable assignment or declaration | declaration | var | my / our / temp | global v1, v2 | global v1, v2 | t v | t v | var | flet labels defun defmethod defvar defparameter defsetf .. | |||||||
60 | Various | variable assignment or declaration | both | := | = | set, variable | := | |||||||||||
61 | Various | variable assignment or declaration | grouping expressions | ( ... ) | ( ... ) | ( ... ) | ( ... ) | ( ... ) | begin ... end | ( ... ) | ( ... ) | ( ... ) | ( ... ) | ( ... ) | ||||
62 | Various | variable assignment or declaration | block (grouping statements, especially when statements are not expressions) | ( ... )(13) | indentation | { ... }(13) | { ... } | indentation | foo ... end where foo in { if, do, ... } | ... | { ... }(13) | { ... }(13) | { ... } | indentation | indentation(13) | |||
63 | Various | variable assignment or declaration | use a block as a return value (when statements are not expressions) | do | ||||||||||||||
64 | Various | equality / inequality | shallow | Err:510 | Err:510 | Err:510 | Err:510 | is / is not | Err:510 | Err:510 | Err:510 | eq, eql | ||||||
65 | Various | equality / inequality | deep | Err:510 | Err:510 | eqv | Err:510 | Err:510 | Err:510 | equals | ||||||||
66 | Various | equality / inequality | comparison | -lt -gt -le -ge | < > <= >= | < > <= >= | lt gt le ge | < > <= >= | < > <= >= | < > <= >= | < > <= >= | < > <= >= | < > <= >= | < > <= >= | < > <= >= | |||
67 | Various | equality / inequality | returns 3 values (i.e. inferior, equal or superior) | cmp | strcmp | cmp | a <=> b | string compare | compareTo | compareTo | ||||||||
68 | Various | equality / inequality | returns 4 values (i.e. inferior, equal, superior or not comparable) | compare | ||||||||||||||
69 | Various | equality / inequality | min / max (binary or more) | min / max | min minstr / max maxstr(22) | min / max | min / max | min / max | ||||||||||
70 | Various | equality / inequality | runtime evaluation | CoffeeScript.eval(23) | eval | eval | exec | eval | [...] | |||||||||
71 | Various | manual memory allocation | allocation | |||||||||||||||
72 | Various | manual memory allocation | deallocation | |||||||||||||||
73 | Various | manual memory allocation | force garbage collection | VM.garbageCollect() | incremental garbage collection => not needed | GC.start | System.GC.Collect() | System.gc() | VM.garbageCollect() | |||||||||
74 | Functions# | Functions | function call | f a b ... | f a, b, ... | f(a,b,...) | f a, b, ... | f(a,b,...) | f(a,b,...) | f[a,b,...] or f.call(a,b,...) | <xsl:call-template name=f>\n <xsl:with-param name=a select=a/>\n <xsl:with-param name=b select=b/>\n</xsl:call-template> | f(a,b,...) | f(a,b,...) | f(a,b,...) | f a b ... | f(a,b,...) | ||
75 | Functions# | Functions | with no parameter | f | f() | f() | &$f or $f->() | f() | f() | f[] or f.call | <xsl:call-template name=f>/ | f() | f() | f() | f | |||
76 | Functions | partial application (in the examples below, a normal call is f(a,b)) | ||||||||||||||||
77 | Functions | partial application (in the examples below, a normal call is f(a,b)) | give the first argument | &f.assuming(var_name => a) | interp alias {} f_a {} f a | |||||||||||||
78 | Functions | partial application (in the examples below, a normal call is f(a,b)) | give the second argument | &f.assuming(b => b) | ||||||||||||||
79 | Functions | partial application (in the examples below, a normal call is f(a,b)) | give the first argument to operator > | (>) a | ||||||||||||||
80 | Functions | partial application (in the examples below, a normal call is f(a,b)) | give the second argument to operator > | (> a) | ||||||||||||||
81 | Functions | partial application (in the examples below, a normal call is f(a,b)) | function definition | f : procedure\n ...\nreturn retval | sub f { ... } | /f { ... } def | <xsl:template name=f>\n <xsl:param name=para1/>\n <xsl:param name=para2/>\n ...\n</xsl:template> | |||||||||||
82 | Functions | partial application (in the examples below, a normal call is f(a,b)) | procedures | |||||||||||||||
83 | Functions | partial application (in the examples below, a normal call is f(a,b)) | variable number of arguments | (args...) -> ... | one can use overloading on different number of arguments | one can use overloading on different number of arguments | ||||||||||||
84 | Functions | partial application (in the examples below, a normal call is f(a,b)) | predicates | |||||||||||||||
85 | Functions | partial application (in the examples below, a normal call is f(a,b)) | anonymous function | |||||||||||||||
86 | Functions | function return value | breaks the control flow | return(42) | return(42) | return(42) | return(42) | return(42) | return(42) | Exit Function / Exit Sub | return(42) | return(42) | return(42) | return-from xxx | ||||
87 | Functions | function return value | function body is the result | no syntax needed(44) | no syntax needed(44) | no syntax needed(44) | no syntax needed(44) | |||||||||||
88 | Functions | function return value | setting the result | |||||||||||||||
89 | Functions | function return value | function called when a function is not defined (in dynamic languages) | __noSuchMethod__(45) | AUTOSCALAR, AUTOMETH, AUTOLOAD... | method_missing | unknown | TryInvokeMember(46) | ||||||||||
90 | Functions | function return value | runtime inspecting the caller information | call | caller | caller | info level | call | ||||||||||
91 | Functions | function return value | function composition | ~ | ||||||||||||||
92 | Functions | function return value | identity function | |||||||||||||||
93 | Control Flow# | Control Flow | sequence | end-of-line | end-of-line | end-of-line | ; | ; | end-of-line | end-of-line | end-of-line | ; | ; | end-of-line | end-of-line | (progn ...) (prog1 ...) (prog2 ...) | >> | |
94 | Control Flow# | Control Flow | if_then | if c; then ... fi | if c\n ... | if (c) ... | c and ... | if (c): ... endif | if c: ... | if c\n ...\nend | <xsl:if test=c>...</xsl:if> | if (c) ... | if (c) ... | if (c) ... | (if c ...) | |||
95 | Control Flow# | Control Flow | if_then_else | if c; then b1; elif c2; then b2; else b3; fi | if c\n b1\nelse if c2\n b2\nelse\n b3 | c ? b1 : b2 | c ? b1 : b2 | c ? b1 : b2 | if c: \n b1 \nelif c2:\n b2 \nelse: \n b3 | if c\n b1\nelsif c2\n b2\nelse\n b3\nend | <xsl:choose>\n <xsl:when test=c> b1 </xsl:when>\n <xsl:when test=c2> b2 </xsl:when>\n <xsl:otherwise> b3 </xsl:otherwise>\n</xsl:choose> | c ? b1 : b2 | c ? b1 : b2 | c ? b1 : b2 | (cond (c b1) (c2 b2) (t b3)) | |||
96 | Control Flow# | Control Flow | ifnot_then (unless) | if(c) not then(...) | ||||||||||||||
97 | Control Flow# | Control Flow | multiple selection (switch) | select\n when v1 ...\n when v2 | v3 ...\n otherwise ...\nend | use Switch;\nswitch ($val) {\n case v1 { ... }\n case v2 { ... }\n else ...\n})(49) | switch (val) { \n case v1: ...; break; \n case v2: case v3: ...; break; \n default: ...;\n } | Select val\n Case v1\n ...\n Case v2, v3\n ...\n Case Else\n ...\nEnd Select | switch (val) { \n case v1: ...; break; \n case v2: case v3: ...; break; \n default: ...;\n } | switch (val) { \n case v1: ...; break; \n case v2: case v3: ...; break; \n default: ...;\n } | switch (val) { \n case v1: ...; break; \n case v2: case v3: ...; break; \n default: ...;\n } | (case val\n ((v1) ...)\n ((v2) ...)\n (otherwise ...)) | case val of\n v1 -> ...\n v2 -> ...\n _ -> ... | ||||||
98 | Control Flow | loop | forever loop | loop(...) | LOOP ... END | loop | loop(...) | |||||||||||
99 | Control Flow | loop | while condition do something | while c; do ...; done | while c ... | while (c) ... | while (c) ... | while c: ... | while (c) ... | Do While c \n ...\nLoop | while (c) ... | while (c) ... | while (c) ... | (loop while c do ...) | ||||
100 | Control Flow | loop | do something until condition | loop (# until ::< (# do c -> value #) do ... #) | do ... until c | do ... while (!c) | do ... while (!c) | |||||||||||
101 | Control Flow | loop | for each value in a numeric range, 1 increment (see also the entries about ranges) | for (i = 1; i <= 10; i++) ... | for (i = 1; i <= 10; i++) ... | for ($i = 1; $i <= 10; $i++) ... | 1.upto(10) {|i| ... } | For i = 1 To 10 ... Next | for (int i = 1; i <= 10; i++) ... | 1 to(10) foreach(...) | ||||||||
102 | Control Flow | loop | for each value in a numeric range, 1 decrement | for i in `seq 10 -1 1`; do ...; done | for i in [10..1] ... | for (i = 10; i >= 1; i--) ... | for ($i = 10; $i >= 1; $i--) ... | 10.downto(1) {|i| ... } | For i = 10 To 1 Step -1 ... Next | for (int i = 10; i >= 1; i--) ... | 10 to(1) foreach(...) | |||||||
103 | Control Flow | loop | for each value in a numeric range, free increment | for (i = 1; i <= 10; i += 2) ... | for (i = 1; i <= 10; i += 2) ... | for ($i = 1; $i <= 10; $i += 2) ... | (1..10).step(2) {|i| ... } | For i = 1 To 10 Step 2 ... Next | for (int i = 1; i <= 10; i += 2) ... | 1 to (9,2) foreach(...) | ||||||||
104 | Control Flow | loop | for a la C (while + initialisation) | for ((x = 0; x < 10; x++)); do ...; done | for | for | for | for | for | for | ||||||||
105 | Control Flow | breaking control flow | returning a value | return(42) | return(42) | return(42) | return(42) | return(42) | return(42) | Exit Function / Exit Sub | return(42) | return(42) | return(42) | return-from xxx | ||||
106 | Control Flow | breaking control flow | goto (unconditional jump) | goto | goto | goto | go throw | |||||||||||
107 | Control Flow | breaking control flow | continue / break | restart / leave | continue / break | continue / break | continue / break | next / break(51) | / Exit Do, Exit For | continue / break | continue / break | continue / break | ||||||
108 | Control Flow | breaking control flow | redo / retry | redo / retry | redo/ | |||||||||||||
109 | Control Flow | exception | throwing | throw | die | die | raise | raise | return -code | throw | throw | throw | error | |||||
110 | Control Flow | exception | catching | try a catch (exn) ... | try { a CATCH exn { ... } } | try: a except exn: ... | rescue | catch | try a catch (exn) ... | try a catch (exn) ... | try a catch (exn) ... | try\n a\ncatch\n ...\nend | ||||||
111 | Control Flow | exception | cleanup: code executed before leaving | ensure | finally | finally | ||||||||||||
112 | Control Flow | exception | retrying: after catching an exception, tell the snippet to be re-run | |||||||||||||||
113 | Control Flow | exception | resume execution where the exception took place | |||||||||||||||
114 | Control Flow | exception | call-with-current-continuation | |||||||||||||||
115 | Types# | Types | declaration | type n = t | n = t | n = t | typedef t n | newtype n = t | ||||||||||
116 | Types# | Types | annotation (or variable declaration) | : | t v | t v | t v | t v | t v | |||||||||
117 | Types | cast | upcast | static_cast<t>(e) | (t) e | (t) e | ||||||||||||
118 | Types | cast | downcast (need runtime checking) | dynamic_cast<t>(e) | (t) e | |||||||||||||
119 | Types | cast | computed conversion (calls an internal or a user-defined function) | t(e) | make t e / to t e | |||||||||||||
120 | Types | mutability, constness | type of a mutable value | mutability is the default | mutability is the default | mutability is the default | ||||||||||||
121 | Types | mutability, constness | type of a constant value | constness is the default | ||||||||||||||
122 | Types | mutability, constness | special cases | readonly fields(57) | final fields, parameters, local variables(57) | |||||||||||||
123 | Object Oriented & Reflexivity# | Object Oriented & Reflexivity | method invocation | object.method(para) | object->method(para) | object->method(para) | object.method(para) | object.method(para) | object.method(para) | object->method(para) | object.method(para) | |||||||
124 | Object Oriented & Reflexivity# | Object Oriented & Reflexivity | with no parameter | object.method() | object->method | object.method | object.method() | object.method | object.method() | object.method() | ||||||||
125 | Object Oriented & Reflexivity# | Object Oriented & Reflexivity | object creation | new class_name(...) | class_name(...) | class_name.new(...) | class_name v(...) | new class_name(...) | ||||||||||
126 | Object Oriented & Reflexivity# | Object Oriented & Reflexivity | object cloning | o.clone() | $o2 = $o | o.clone(60) | o2 = o(62) | o.clone() | ||||||||||
127 | Object Oriented & Reflexivity# | Object Oriented & Reflexivity | manually call an object's destructor | del, __del__ | delete | |||||||||||||
128 | Object Oriented & Reflexivity# | Object Oriented & Reflexivity | class declaration | class | class | class | struct | class | ||||||||||
129 | Object Oriented & Reflexivity# | Object Oriented & Reflexivity | testing class membership | is_a | isinstance | is_a? kind_of? | dynamic_cast | instanceof | ||||||||||
130 | Object Oriented & Reflexivity# | Object Oriented & Reflexivity | get the type/class corresponding to an object/instance/value | typeof | get_class | class | typeid | typeof | ||||||||||
131 | Object Oriented & Reflexivity# | Object Oriented & Reflexivity | methods available | getMethods | get_class_methods | methods | getMethods | |||||||||||
132 | Object Oriented & Reflexivity# | Object Oriented & Reflexivity | inheritance | class child extends parent | class child is parent { ... } | class child < parent end | class child : parent | class child extends parent | ||||||||||
133 | Object Oriented & Reflexivity# | Object Oriented & Reflexivity | has the method | hasSlot | can | respond_to? | ||||||||||||
134 | Object Oriented & Reflexivity# | Object Oriented & Reflexivity | current instance | this | this | first parameter(68) | self | this | this | |||||||||
135 | Object Oriented & Reflexivity# | Object Oriented & Reflexivity | accessing parent method | super | $o.SUPER::method(...) | super | base | super | ||||||||||
136 | Object Oriented & Reflexivity# | Object Oriented & Reflexivity | accessing child method | |||||||||||||||
137 | Package | Package, Module | package scope | ' | :: | : | :: | . | . | |||||||||
138 | Package | Package, Module | declare | module P ... end | <node xmlns=namespace> ... </node> | namespace p { ... } | package p; | package p; | ||||||||||
139 | Package | Package, Module | selective export | append_features | namespace export name1 | attached to each name (public, private...) | attached to each name (public, private...) | |||||||||||
140 | Package | import | everything into current namespace | using namespace p; | include or even extend | namespace import p * | using namespace p; | import p.* | ||||||||||
141 | Package | import | selectively | from p import name1, name2, ... | namespace import p name1 | import p.name1; import p.name2 | ||||||||||||
142 | Package | import | package (ie. load the package) | require p | package require p | automatically done(74) | automatically done(74) | |||||||||||
143 | Strings# | Strings | type name | String | string | string | str | String | string | String | String | |||||||
144 | Strings# | Strings | character type name | char | Char | char | Char | |||||||||||
145 | Strings# | Strings | character z | z | 'z' | 'z' | 'z' | #\z | ||||||||||
146 | Strings | strings | with no interpolation of variables | <<'MARK' ... MARK | '...' | ... | q(...(...)...), q[...], q{...}, q<...>, q/.../ | '...' | '''...''' | %q(...(...)...), %q[...], %q{...}, %q<...>, %q/.../ | ... | ... | ... | ... | ||||
147 | Strings | strings | with interpolation of variables | ... #{v} ... ... #$v ... ... #@v ... ... #@@v ... | ... #{v} ... interpolate | qq(...(... $v ...)...), qq[...], qq{...}, qq<...>, qq/.../ | <<<MARK ... $v ... MARK | %Q(...(... #{v} ...)...), %Q[...], %Q{...}, %Q<...>, %Q/.../ | ... $v ... | |||||||||
148 | Strings | strings | end-of-line (without writing the real CR or LF character) | \n | \n | \n | \n | vb_nl | \n | \n | \n | ~%(78) | ||||||
149 | Strings | strings | multi-line | ...,\n... | all strings allow multi-line strings | all strings allow multi-line strings | ..., {...} | @... | all strings allow multi-line strings | |||||||||
150 | Strings | strings | convert something to a string (see also string interpolation) | + e | . e | (string) e | str, `e`, repr | to_s, to_str, inspect, String() | string | ToString | + e | + e | ||||||
151 | Strings | strings | serialize (marshalling) | serialize | Marshal.dump | |||||||||||||
152 | Strings | strings | unserialize (un-marshalling) | doString | Marshal.load | |||||||||||||
153 | Strings | strings | sprintf-like | putFormat | Storable::retrieve | sprintf | % | format | sprintf | format | format | sprintf | ||||||
154 | Strings | simple print | on strings | echo(84) | display | writeln | console | echom | println(83) | writeln | echom | |||||||
155 | Strings | simple print | on simple objects | say(83) | puts -nonewline | |||||||||||||
156 | Strings | simple print | on any objects | writeln(83) | puts(85) | WriteLine | ||||||||||||
157 | Strings | simple print | printf-like | putFormat | printf | printf | printf | |||||||||||
158 | Strings | simple print | string equality & inequality | Err:510 | Err:510 | Err:510 | eq ne | Err:510 | Err:510 | equal? | Err:510 | Err:510 | equals | Err:510 | ||||
159 | Strings | simple print | string size | ${#v} | length | length | strlen | len | size | string-length | size | length | length | |||||
160 | Strings | simple print | string concatenation | $a$b | + | + | . | . | + | + | concat | + | + | + | ++ | |||
161 | Strings | simple print | duplicate n times | repeated | x | str_repeat | * | * | string repeat | repeated | ||||||||
162 | Strings | simple print | upper / lower case character | upCase / lowCase | toUpperCase / toLowerCase | strtoupper / strtolower | upper / lower(90) | upcase / downcase | string toupper / string tolower | toupper / tolower | toUpperCase / toLowerCase | toUpperCase / toLowerCase | ||||||
163 | Strings | simple print | uppercase / lowercase / capitalized string | makeLC / makeUC | toUpperCase / toLowerCase | strtoupper / strtolower | upcase / downcase | UCase / LCase | ToUpper / ToLower | toUpperCase / toLowerCase | toUpperCase / toLowerCase | |||||||
164 | Strings | simple print | ascii to character | fromCharCode | chr | chr | chr | chr$ | (char) c | (char) c | fromCharCode | |||||||
165 | Strings | simple print | character to ascii | charCodeAt | ord | ord | s[0] | asc | (int) c | (int) c | charCodeAt | |||||||
166 | Strings | simple print | accessing n-th character | charAt | s[n] | s[n] | s[n] | at(91) | charAt | charAt | aref | |||||||
167 | Strings | simple print | extract a substring | mid$ | substr | s[n:m+1] | s[n,len] | substring | substr | substring | mid$ | |||||||
168 | Strings | simple print | locate a substring | indexOf | strpos | index | string first | find | indexOf | indexOf | ||||||||
169 | Strings | simple print | locate a substring (starting at the end) | strrpos | rindex | string last | rfind | lastIndexOf | lastIndexOf | |||||||||
170 | Booleans# | Booleans | type name | boolean | bool | logic! | bool | boolean | boolean | |||||||||
171 | Booleans# | Booleans | false value | exit status different from 0 | '' | () | array() | {} | nil | off | '\0' | false | nil | |||||
172 | Booleans# | Booleans | true value | exit status 0 | on | true | anything not false | true | anything not false | anything not false | on | anything not false | true | true | anything not false | |||
173 | Booleans# | Booleans | logical not | not(94) | ! | not(94) | ! | not(94) | not(94) | not(94) | ! | ! | ! | not(94) | not(94) | |||
174 | Booleans | logical or / and | short circuit | | / & | || / && | or / and | or / and | or / and | or / and | || / && | || / && | || / && | || / && | or / and | ||||
175 | Booleans | logical or / and | non short circuit (always evaluates both arguments) | ?| / | | / & | | / & | ||||||||||||
176 | Bags and Lists# | Bags and Lists | type name | List | array | list | list | vector | List | |||||||||
177 | Bags and Lists# | Bags and Lists | list concatenation | concat | , | + | + | appendSeq | ||||||||||
178 | Bags and Lists | list flattening | one level depth | flatten | Flatten | {*}$l | ||||||||||||
179 | Bags and Lists | list flattening | recursive | |||||||||||||||
180 | Bags and Lists | list flattening | list constructor | Array(a, b, c)(100) | ( a, b, c ) | array(a, b, c) | [ a, b, c ](97) | - a\n - b\n - c | { a, b, c }(98) | list(a, b, c) | ||||||||
181 | Bags and Lists | list flattening | list/array indexing | a[i] | a[i] | a[i] | a[i] | a[i] | slice | node[i] | at(102) | a[i] | a[i] | aref | ||||
182 | Bags and Lists | adding an element at the beginning (list cons) | return the new list (no side-effect) | | | [e l] | |||||||||||||
183 | Bags and Lists | adding an element at the beginning (list cons) | side-effect | unshift | array_unshift | |||||||||||||
184 | Bags and Lists | adding an element at index | return the new list (no side-effect) | linsert l i e | ||||||||||||||
185 | Bags and Lists | adding an element at index | side-effect | a insertAt(e, i) | a.insert(i, e) | |||||||||||||
186 | Bags and Lists | adding an element at the end | return the new list (no side-effect) | arrayByAddingObject | linsert l end e | |||||||||||||
187 | Bags and Lists | adding an element at the end | side-effect | push | array_push | append | push | lappend | add | push | ||||||||
188 | Bags and Lists | adding an element at the end | first element | first | first | |||||||||||||
189 | Bags and Lists | adding an element at the end | iterator | |||||||||||||||
190 | Bags and Lists | adding an element at the end | all but the first element | l[1:] | lrange l 1 end | tail | ||||||||||||
191 | Bags and Lists | adding an element at the end | last element | last | a[-1] | a[-1] | node[last()] | last | ||||||||||
192 | Bags and Lists | adding an element at the end | all but the last element | |||||||||||||||
193 | Bags and Lists | adding an element at the end | get the first element and remove it | shift | shift | array_shift | ||||||||||||
194 | Bags and Lists | adding an element at the end | get the last element and remove it | pop | pop | array_pop | pop | |||||||||||
195 | Bags and Lists | adding an element at the end | for each element do something | for v in l; do ...; done | for v in l ... | for (var v in l) { ... } | foreach | for v in l: ... | for v in l ... | For Each v in l ... Next | for_each | l foreach(v, ...) | ||||||
196 | Bags and Lists | adding an element at the end | transform a list (or bag) in another one | map | map | collect | ||||||||||||
197 | Bags and Lists | adding an element at the end | transform two lists in parallel | map | ||||||||||||||
198 | Bags and Lists | adding an element at the end | find an element | indexOf | first(22) | detect | lsearch -exact | |||||||||||
199 | Bags and Lists | keep elements | matching | selectInPlace | grep | grep | select | |||||||||||
200 | Bags and Lists | keep elements | non matching | |||||||||||||||
201 | Bags and Lists | keep elements | partition a list: elements matching, elements non matching | Partition | ||||||||||||||
202 | Bags and Lists | split a list | in 2 based on a predicate | |||||||||||||||
203 | Bags and Lists | split a list | into sublists delimited by elements matching a predicate | |||||||||||||||
204 | Bags and Lists | split a list | into a list of lists of same value | |||||||||||||||
205 | Bags and Lists | split a list | into sublists based on a predicate | |||||||||||||||
206 | Bags and Lists | split a list | is an element in the list | in | Member | include? | ||||||||||||
207 | Bags and Lists | split a list | is the predicate true for an element | detect | Some | any? | ||||||||||||
208 | Bags and Lists | split a list | is the predicate true for every element | All | all? | |||||||||||||
209 | Bags and Lists | split a list | smallest / biggest element | min / max | min minstr / max maxstr(22) | min / max | min / max | min / max | ||||||||||
210 | Bags and Lists | split a list | join a list of strings in a string using a glue string | l.join(s) | implode(s, l) | l * s | join l s | String.Join(s, l) | join | |||||||||
211 | Bags and Lists | split a list | list size | length | scalar @l | count | len | length | count | size | length | length | ||||||
212 | Bags and Lists | split a list | iterate with index | a foreach(i, e, ...) | forAllInd | each_with_index | a foreach(i, e, ...) | |||||||||||
213 | Bags and Lists | split a list | remove duplicates | unique(106) | uniq | array_unique | uniq! | lsort -unique | ||||||||||
214 | Bags and Lists | split a list | sort | asort | sort(107) | sort(107) | sort(107) | sort_by | sort(107) | sort(107) | sort(107) | |||||||
215 | Bags and Lists | split a list | reverse | reverse | reverse | array_reverse | reverse | reverse_copy | reverse | |||||||||
216 | Bags and Lists | split a list | list of couples from 2 lists | combine | zip | transpose | ||||||||||||
217 | Bags and Lists | split a list | 2 lists from a list of couples | split | transpose | |||||||||||||
218 | Bags and Lists | split a list | lookup an element in a association list | |||||||||||||||
219 | Bags and Lists | split a list | list out of a bag | to_list | to_a | array get | toArray | |||||||||||
220 | Bags and Lists | split a list | f(... f(f(init, e1), e2) ..., en) | reduce(109) | reduce(109) | reduce(109) | inject | |||||||||||
221 | Bags and Lists | split a list | f(e1, f(e2, ... f(en, init) ...)) | reverseReduce | FoldR | |||||||||||||
222 | Various Data Types# | Various Data Types | tuple type | typ1 * ... * typn | tuple! | |||||||||||||
223 | Various Data Types# | Various Data Types | tuple constructor | ( a, b, c ) | a, b, c | |||||||||||||
224 | Various Data Types | computable tuple (these are a kind of immutable lists playing a special role in parameter passing) | empty tuple | () | () | [] | ||||||||||||
225 | Various Data Types | computable tuple (these are a kind of immutable lists playing a special role in parameter passing) | 1-uple | (a) | a, | a or [a] | ||||||||||||
226 | Various Data Types | computable tuple (these are a kind of immutable lists playing a special role in parameter passing) | using a tuple for a function call | t | *t | |||||||||||||
227 | Various Data Types | reference (pointer) | creation | :> :>> | & | newSTRef | & | |||||||||||
228 | Various Data Types | reference (pointer) | dereference | ->(113) | readSTRef | ->(113) | ||||||||||||
229 | Various Data Types | reference (pointer) | assigning (when dereferencing doesn't give a lvalue) | |||||||||||||||
230 | Various Data Types | optional value | null value | null | nil | 0(114) | null | |||||||||||
231 | Various Data Types | optional value | value | v | *v(114) | v | ||||||||||||
232 | Various Data Types | optional value | type name | |||||||||||||||
233 | Various Data Types | optional value | null coalescing | || | ?? | |||||||||||||
234 | Various Data Types | record | type declaration | data Typ = N0 { n1, n2 :: typ1, n3 :: typ3, ... } | ||||||||||||||
235 | Various Data Types | record | selector | r[field] | . | . | . | -> | . | r[field] | ||||||||
236 | Various Data Types | record | union type declaration | |||||||||||||||
237 | Various Data Types | record | enumerated type declaration | enum typ { n1; n2; ... }(118) | enum typ { n1; n2; ... }(118) | |||||||||||||
238 | Various Data Types | dictionary | type name | HashTable | array | dict | Hash | HashTable | HashTable | |||||||||
239 | Various Data Types | dictionary | constructor | array( a => b, c => d ) | Hash[ a, b, c, d ] | new t { {a, b}, {c, d} } | fromList | |||||||||||
240 | Various Data Types | dictionary | access: read/write | h[k] | h[k] | h[k] | h[k] | h[k] | h[k] | h[k] | ||||||||
241 | Various Data Types | dictionary | access: read | get | fetch | get | ||||||||||||
242 | Various Data Types | dictionary | access: write | put | put | |||||||||||||
243 | Various Data Types | dictionary | has the key ? | in | k in h | isset(h[k]), array_key_exists(k, h) | k not in h | has_key?, include?, key?, member? | find(120) | containsKey | k in h | |||||||
244 | Various Data Types | dictionary | remove by key | delete | unset(h[k]) | delete | erase | remove | delete | |||||||||
245 | Various Data Types | dictionary | list of keys | keySet | array_keys | keys | AllKeys | keySet | ||||||||||
246 | Various Data Types | dictionary | list of values | values | array_values | values | values | |||||||||||
247 | Various Data Types | dictionary | merge | update(121) | putAll(121) | |||||||||||||
248 | Various Data Types | range | inclusive .. inclusive | [ a .. b ] | Range with | a .. b | Range with | |||||||||||
249 | Various Data Types | range | inclusive .. exclusive | a ... b |