Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A lot of code from The Art of Prolog that used some form of accumulator data structure as a third argument to predicates.


Do you mean something like how you might define `append/3`

  append([], L, L).
  append([H|T], L2, [H|L3]) :- append(T, L2, L3).
Such that the computation can be run in any direction? Where it will produce the result of appending two lists, or the prefixes and suffixes of a list if the result (third parameter) is known, and so on?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: