Size operator

The size operator $ returns the size of its argument.

The size of nil is 0.

Yewslip> print nil$
0

The size of any scalar value is 1.

Yewslip> print 0$
1

Yewslip> print 42$
1

Yewslip> print 2.7$
1

Yewslip> print inf$
1

The size of strings and lists is their number of characters or elements.

Yewslip> print "string"$
6

Yewslip> print [1, 2, 3]$, []$
3 0

Functions are evaluated before the size operator is applied.

Yewslip> print (func() return [1, 2])$
2

Objects may have any programmer-determined integer size.