Array length: Difference between revisions
→Forth: use forth highlighting
(→K: add) |
(→Forth: use forth highlighting) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 733:
p ["apple", "orange"].length
</syntaxhighlight>
=={{header|Binary Lambda Calculus}}==
BLC has no arrays, so here's a function to compute the length of a given list (as a church numeral) instead, corresponding to https://github.com/tromp/AIT/blob/master/lists/length.lam :
<pre>010001101000000101100000000000011100101010111111110111111101111011010000010</pre>
=={{header|BQN}}==
Line 1,455 ⟶ 1,461:
{ "apple" "orange" } length
</syntaxhighlight>
=={{header|Fennel}}==
<syntaxhighlight lang="fennel">(length [:apple :orange])</syntaxhighlight>
=={{header|Forth}}==
Line 1,462 ⟶ 1,471:
The code is commented to explain what is going on for those unfamiliar with Forth.
<syntaxhighlight lang="
HERE OVER CHAR+ ALLOT PLACE ;
|