Re: Need help with lists !



We can't do your assignments for you. The assignment you posted is
about the most simplistic Prolog assignment you'll find. Read your
Prolog book. Look at various examples online.

Hint: For the assignment above, you will need to learn how to take
apart and put a list together, you will need to learn recursion, you
will need to learn to use unification (the most basic Prolog technique
there is), and read up on the use of the "is" construct, because you
will probably need that for any math.

You will need to use trace early on to figure out what your code is
doing. I recommend taking an extremely basic, piecemeal approach.
Learn each basic thing separately. Write the most basic recursion
program you can write as a "test," and observe the behavior. Same for
taking lists apart and putting them together. In the end, you can put
everything you've learned together to solve the problems.

Hope this helps.

.



Relevant Pages

  • Re: XML based event processing.
    ... Please help me in development of a Prolog program with the following ... Develop a set the most recent assignment to an attribute of ... data problem you're trying to solve and you think Prolog is the best ...
    (comp.lang.prolog)
  • Re: Value Assignment Operator
    ... but this does not compile under both Sicstus Prolog and SWI ... expressions can be unified, and succeeds by effectively ... bound to expressions that cannot be unified. ... X = Y to succeed by "changing" the assignment of X. ...
    (comp.lang.prolog)
  • Re: how to make this in prolog
    ... Prolog does not have loops, but it does have recursion. ... Prolog has assignment, ...
    (comp.lang.prolog)
  • Re: Collections of non-arbitrary objects ?
    ... Here, I have changed b, without an explicit assignment. ... Not only could the app crash if an incorrect item where inserted into ... Which makes "typed" lists totally useless anyway. ... would restrict a collection to only allow certain types. ...
    (comp.lang.python)
  • Re: A Logical Model for Lists as Relations
    ... The only imperative operations in an RDBMS map to relation ... variable assignment. ... Lists, if you have them at all, are necessarily ... I'm not convinced that "there is only assignment" is the right design. ...
    (comp.databases.theory)