Simon Brooke on Nostr: SBCL #CommonLisp (nth 2 '(1 2 3 4 5 6)) 3 #Clojure (nth '(1 2 3 4 5 6) 2) 3 #Scheme ...
SBCL #CommonLisp
(nth 2 '(1 2 3 4 5 6))
3
#Clojure
(nth '(1 2 3 4 5 6) 2)
3
#Scheme
(list-ref '(1 2 3 4 5 6) 2)
;Value: 3
So, they differ on the name of the function and the order of the arguments, but they all agree on zero-indexing the first element of a list.
This seems perverse to me. Surely the index of the first element should be 1, the second, 2, and so on?
Argue against me -- and please give an argument which is not just **TRADITION!**
#Lisp
Published at
2026-02-23 15:04:58 UTCEvent JSON
{
"id": "9cbe752c8b717d527118d20174340f1d64e2bf8b2668af66622835f8a5f7699e",
"pubkey": "a231938f7a6241b94a9589f111bd7dbb0b7cee0c68821c3f6e635b688fd05aea",
"created_at": 1771859098,
"kind": 1,
"tags": [
[
"t",
"lisp"
],
[
"t",
"scheme"
],
[
"t",
"clojure"
],
[
"t",
"commonlisp"
],
[
"content-warning",
"Lisp semantics of nth"
],
[
"proxy",
"https://mastodon.scot/users/simon_brooke/statuses/116120557854281191",
"activitypub"
],
[
"client",
"Mostr",
"31990:6be38f8c63df7dbf84db7ec4a6e6fbbd8d19dca3b980efad18585c46f04b26f9:mostr",
"wss://relay.ditto.pub"
]
],
"content": "SBCL #CommonLisp \n(nth 2 '(1 2 3 4 5 6))\n3\n\n#Clojure\n(nth '(1 2 3 4 5 6) 2)\n3\n\n#Scheme \n(list-ref '(1 2 3 4 5 6) 2)\n;Value: 3\n\nSo, they differ on the name of the function and the order of the arguments, but they all agree on zero-indexing the first element of a list.\n\nThis seems perverse to me. Surely the index of the first element should be 1, the second, 2, and so on?\n\nArgue against me -- and please give an argument which is not just **TRADITION!**\n\n#Lisp",
"sig": "4645189184b87731aa956650ed7ec7196076c798a036526636e85d8c83c492772289ce756462622d502b08d17e3413d1956cffae3db1aa3858946724348171cb"
}