Академический Документы
Профессиональный Документы
Культура Документы
length C#, 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, Objective-C, 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#
MapIndexed Mathematica
(loop for v in l as i upfrom 0 do ...) Common Lisp
predsort / keysort /
mergesort Prolog
reverse
C++, Common Lisp, Dylan, Emacs Lisp, Haskell, Io, Java, JavaScript,
reverse 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_Elemen
ts Ada
lreverse Tcl8.5
array_reverse PHP
ListTools[Reve
rse] Maple
fliplr
flipud... Matlab
l[::-1] Python
reverseReduce Io
Remarks
(1) restricted to initialisation of a local variable in C and C++
(2) a b c must be constants
(3) beware, if you give only one integer argument, it is the size!
(4) for write access: a i o put
(5) in C++, it is range-checked whereas a[i] is not. in Smalltalk, for write access: a :at i :put o
(6) see also Head
(7) list comprehension
(8) in List::Util
(9) not in standard
(10) Python >= 2.5
(11) in C++, it is done in place
(12) in Scheme, not standard, but nearly standard
(13) the result is not guaranteed to be the same as the order in the input
(14) in Perl, in List::Util
Pixel
This document is licensed under GFDL (GNU Free Documentation License).
Generated from syntax-across-languages.html.pl
$Id: syntax-across-languages.html.pl 408 2008-08-29 08:32:23Z pixel $
abram
abram dedi parman
tukang sayur
abram dedi parman
tukang sayur
abram dedi parman
tukang sayur