Tariq on Nostr: I need some #lisp help. I'm stuck on a recursion exercise - have been for 2 days! ...
I need some #lisp help.
I'm stuck on a recursion exercise - have been for 2 days!
We're given a at a structure a list of lists, where each such list is of the form (person mother father) .. and so a lot of these together create a family tree.
I want to write a function lineage x y which returns a list of ancestors from x to y ... eg x, mother of x, father of prev, y .... or NIL if y is not an ancestor of x.
I found this easy in #prolog (I wrote this
https://prologbyexample.blogspot.com/2023/02/introducing-recursion.html ) but not #lisp.
Published at
2025-03-16 20:41:36Event JSON
{
"id": "6ba7d38c15a97c7f7b17723a8d71ca623a4aece412dafbba49542e4f7824c0eb",
"pubkey": "340694a5c7115fe0918fe7ec9038786592e3804f1a0e457e3e09d03ecfdadc6b",
"created_at": 1742157696,
"kind": 1,
"tags": [
[
"t",
"lisp"
],
[
"t",
"prolog"
],
[
"proxy",
"https://mastodon.social/users/rzeta0/statuses/114174046800720867",
"activitypub"
]
],
"content": "I need some #lisp help.\n\nI'm stuck on a recursion exercise - have been for 2 days!\n\nWe're given a at a structure a list of lists, where each such list is of the form (person mother father) .. and so a lot of these together create a family tree.\n\nI want to write a function lineage x y which returns a list of ancestors from x to y ... eg x, mother of x, father of prev, y .... or NIL if y is not an ancestor of x.\n\nI found this easy in #prolog (I wrote this https://prologbyexample.blogspot.com/2023/02/introducing-recursion.html ) but not #lisp.",
"sig": "efcf561c8d52565dfae5c8b5056a87929d0b3fe3a160ddda949f5ed2bfb103d75c657caec82a5b77fb11b887c2bbae07acee629064d39a7f113f1ada49da6755"
}