janet-lang / janet

A dynamic language and bytecode vm
https://janet-lang.org
MIT License
3.38k stars 217 forks source link

`empty?` should be documented more clearly. #1383

Open amano-kenji opened 5 months ago

amano-kenji commented 5 months ago
repl:1:> (doc empty?)

    function
    boot.janet on line 117, column 1

    (empty? xs)

    Check if xs is empty.

What? Define empty. I thought nil was empty.

kenaryn commented 5 months ago

nil is derived from latin nihil which approximately stands for "no thing". There is no thing (pun intended) like emptyness. Even the cosmic void is filled with reversed Kasimir force (formerly known as dark matter then more recently as dark energy).

I think the Janet doc means "Check if xs has a null valence ( from latin ne ullus, "not one") if I were to use array theory terminology. I know Janet is not based on Array paradigm (unlike a language like Nial) so perhaps Check if xs has a zero dimensionality could be adopted in stead...

... or even "Check if xs has a null length".

amano-kenji commented 5 months ago

Define xs.