Prolog query: how does addition matter for recursive queries

前端 未结 0 1400
醉梦人生
醉梦人生 2020-11-22 13:41

I\'m trying to write a predicate to find the nth element of a list.

Initially I wrote something like this:

nth([X|_], 0, X).
nth([_|T],N,Z):- N > 0,         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题