Usage of the mode/2 directive

Help requests on developing Logtalk applications

Moderator: Paulo Moura

Post Reply
Parker
Posts: 33
Joined: Wed Feb 27, 2008 2:51 pm

Usage of the mode/2 directive

Post by Parker » Mon Apr 21, 2008 10:08 am

Hello Paolo,

mode(Mode, Number_of_solutions)

I have read the documentation for this directive in the reference manual but still have a few queries about usage:

* What is the complete list of mode prefixes allowed? {+,-,?,@} ?
* What types are permitted for mode arguments? Only primitive types (list, integer, float,...) or derived types too / arbitrary terms?
* What values can Number_of_solutions take? Only the atoms {zero_or_more,zero_or_one, error} ?

http://logtalk.org/manuals/refman/directives/mode2.html

Cheers,
Parker

Parker
Posts: 33
Joined: Wed Feb 27, 2008 2:51 pm

Re: Usage of the mode/2 directive

Post by Parker » Mon Apr 21, 2008 11:04 am

Looking at the source of the compiler (v2.31.4) I have reached the following conclusions:
* What is the complete list of mode prefixes allowed? {+,-,?,@} ?
Exactly these 4 prefixes.
* What types are permitted for mode arguments? Only primitive types (list, integer, float,...) or derived types too / arbitrary terms?
Either no type or an arbitrary atom. It is only for readability.
* What values can Number_of_solutions take? Only the atoms {zero_or_more,zero_or_one, error} ?
{zero, one, zero_or_one,zero_or_more,one_or_more,error}
This is only used for documentation and threading.

Do correct me if I'm wrong.
Cheers,
PJ

Paulo Moura
Logtalk developer
Posts: 474
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Usage of the mode/2 directive

Post by Paulo Moura » Mon Apr 21, 2008 6:20 pm

Parker wrote:Hello Paolo,

mode(Mode, Number_of_solutions)

I have read the documentation for this directive in the reference manual but still have a few queries about usage:

* What is the complete list of mode prefixes allowed? {+,-,?,@} ?
* What types are permitted for mode arguments? Only primitive types (list, integer, float,...) or derived types too / arbitrary terms?
* What values can Number_of_solutions take? Only the atoms {zero_or_more,zero_or_one, error} ?

http://logtalk.org/manuals/refman/directives/mode2.html
Check the Logtalk grammar details on the mode/2 on the Reference Manual:

http://logtalk.org/manuals/refman/grammar.html

Cheers,

Paulo
Paulo Moura
Logtalk developer

Parker
Posts: 33
Joined: Wed Feb 27, 2008 2:51 pm

Re: Usage of the mode/2 directive

Post by Parker » Tue Apr 22, 2008 11:05 am

Perfect, the grammar has all I was looking for!

Thanks.
PJ

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest