Re: newbie - Prolog, lists, recursion

From: o (dcsmpayne_at_bigpond.com)
Date: 11/04/03


Date: Tue, 04 Nov 2003 10:13:29 GMT

This is an extension of my first post ...

I am also working on a predicate where I am trying to count the even numbers
(chars) in a number.
i.e. count_even(243,C) returns C = 2.

I can't think how to "loop" over the number char by char, that's why the
recusrion is needed - so I tried to work it out by saying the number is a
list, hence the first post.

Please note - I have used the Java forum extensively and those who seek help
with assignments are frowned upon - these q's are not assignments. I am
trying to create some teaching materials (high shcool level) and teach
myself some Prolog at the same time. I have found a few interesting
"questions" from various www sites and am now working on them, but I need
help (too entrenched in an imperative mindset).

yours thankfully
Darren



Relevant Pages

  • Re: casts and lvalues
    ... char *n; ... of that particular extension, and remove it. ... surprised by whatever bizarre interpretation some compiler-writer ... Reading email is like searching for food in the garbage, ...
    (comp.lang.c)
  • How to create Word Processing from scratch?
    ... This my first post and question. ... Handling unicode char in editing view (editing view is object that ... Handling unicode char/string in copy, cut, and paste operation. ... Can I view all char in a specify font? ...
    (microsoft.public.vc.language)
  • Re: struct problems
    ... char *color;}; ... These are not valid expressions of type "struct cat". ... (You should realize, of course, that these are pointer assignments, ...
    (comp.lang.c)
  • Re: Traditional COBOL environment
    ... UNION(INT, CHAR) x; ... putting values into an A68 union is automatic, ... I forget how PL/I & COBOL did this. ... Algol-68R has assignments: ...
    (comp.lang.cobol)
  • Re: Printing a decimal value stored in a char without converstion to int
    ... CBFalconer wrote: ... Hi, let me put it this way, when you convert a 'char' that has the most ... significant bit set to '1' to an int, a sign extension happens, so the sign ... the sign extension I have to & 0xff. ...
    (comp.lang.c)