Array length: Difference between revisions

Add Uiua
imported>Tromp
(add BLC list length)
(Add Uiua)
(4 intermediate revisions by 3 users not shown)
Line 738:
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 :
 
</syntaxhighlightpre>010001101000000101100000000000011100101010111111110111111101111011010000010</syntaxhighlightpre>
 
=={{header|BQN}}==
Line 1,461:
{ "apple" "orange" } length
</syntaxhighlight>
 
=={{header|Fennel}}==
<syntaxhighlight lang="fennel">(length [:apple :orange])</syntaxhighlight>
 
=={{header|Forth}}==
Line 1,468 ⟶ 1,471:
The code is commented to explain what is going on for those unfamiliar with Forth.
 
<syntaxhighlight lang="textforth">: STRING, ( caddr len -- ) \ Allocate space & compile string into memory
HERE OVER CHAR+ ALLOT PLACE ;
 
Line 2,392 ⟶ 2,395:
2
</pre>
 
Modern way:
<syntaxhighlight lang="pascal">
// Array length. Mikhalkovich Stanislav: May 16, 2024
##
var a := |'apple','orange'|;
a.Length.Print;
</syntaxhighlight>
{{out}}
<pre>
2
</pre>
 
=={{header|Perl}}==
 
Line 3,041 ⟶ 3,057:
<pre>
2
2
</pre>
 
=={{header|Uiua}}==
{{works with|Uiua|0.11.1}}
It would be more accurate to say this is the number of ''rows'' in an array.
<syntaxhighlight lang="uiua">
⧻{"apple" "orange"}
</syntaxhighlight>
{{out}}
<pre>
2
</pre>
1,827

edits