Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
- Clojure
- C++
- C#
- D
- Dart
- Go
- Groovy
- Haskell
- JS
- Java
- Lua
- PHP
- Pascal
- Perl
- Python
- Ruby
- Rust
- Scala
- Smalltalk
(def n (count mymap))
auto n = mymap.size();
n = mymap.Count;
const n = mymap.length;
length is one of the property of D builtin map type.
var n = mymap.length;
def n = mymap.size()
getMapSize :: Map.Map k v -> Int
getMapSize m = Map.size m
The eta-reduced version would simply be: getMapSize = Map.size
const n = mymap.size
mymap has type Map
int n = mymap.size();
local n=0
for _ in pairs(mymap) do n=n+1 end
The pairs() function is the only reliable way to get the length of a table in Lua, since #mymap only works for index based arrays.
n = len(mymap)
n = mymap.size
val n = mymap.size
n := mymap size.