More on Increment in Prolog
From: gwizbmc (gwizbmc_at_hotmail.com)
Date: 02/24/04
- Previous message: Bill Spight: "Re: newbie question: recursion algorithm and iterative algorithm"
- Next in thread: Ray Reeves: "Re: More on Increment in Prolog"
- Reply: Ray Reeves: "Re: More on Increment in Prolog"
- Reply: Cesar Rabak: "Re: More on Increment in Prolog"
- Reply: N.F.: "Re: More on Increment in Prolog"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 24 Feb 2004 08:32:25 -0600
What if we're dealing with a small database of ,let's say, students information, and we're not looking for the simple :"look-for, unify, and write" thingy that is simple to do in Prolog, but instead we want to know the "Number" of students that we have in our database who satisfy certain conditions(i.e: older than 22, or completed more than 40 Credits, etc...)
How can we incorporate a counter in the function that searchs through each term by back-tracking, and get back the value stored in that counter , after all terms are searched, to be written on the output stream (i.e: the screen)?
Amzi Prolog has a : cntr_inc(Counter,Value) that should help out.
any example to clarify its usage and the nature of "Value" and "Counter" would be greatly appreciated.
thanks.
- Previous message: Bill Spight: "Re: newbie question: recursion algorithm and iterative algorithm"
- Next in thread: Ray Reeves: "Re: More on Increment in Prolog"
- Reply: Ray Reeves: "Re: More on Increment in Prolog"
- Reply: Cesar Rabak: "Re: More on Increment in Prolog"
- Reply: N.F.: "Re: More on Increment in Prolog"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]