[mercury-users] Paper on Mercury from AI practitioner's standpoint

Gregory D. Weber gdweber at indiana.edu
Fri Jan 14 08:59:12 AEDT 2005


Hello Ian,

Ian MacLarty <maclarty at cs.mu.OZ.AU> writes:

> On 13 Jan 2005, at 11:26, Gregory D. Weber wrote:
> 
> > I'm writing a paper which I hope to present to an AI conference this
> > spring, describing my experiences with Mercury in reimplementing the
> > machine learning program CN2.  The paper will have no new information
> > for experts in programming languages; it is simply a practitioner's
> > report on his first use of Mercury for serious application programming.
> >
> > I invite comments to help ensure that I do not misrepresent
> > the language to potential users.  A draft is posted at
> > http://mypage.iu.edu/~gdweber/papers/drafts/mercury.pdf.
> >
> 
> Hi Gregory,
> 
> Just a comment on the section entitled "Debugging Problems".  How much
> of an atom or term is printed can be controlled.  For example if you
> are using the "pretty" (formally "raw_pretty") print format you can
> issue a command "set depth 100" to print the term down to a depth of
> 100.  Also did you try to use the interactive term browser which
> allows you to browse a term like a directory structure?  In my
> experience these two features eliminate the need for inserting print
> statements in the Mercury code (except for rare cases where there is a
> bug in the actual compiler that only manifests itself when debugging
> is turned off).  These features have been available in the debugger
> for a while now.  Which version were you using?

I was using 0.11, which has been the current release for about two
years.  I did this programming last summer, and it is hard to
remember the details about how I used the debugger.  On first
reading your comment, I did not remember using the "set depth"
command or the term browser.  But on further reflection I think
I may have done that.  I think what I wanted the debugger to
do was print _selective_ information, and using set depth,
I could control the amount of information, but it was sometimes
either too little or too much -- for example on a call such
as foo(a, [b, c, d, e, f], g, [[h], [i]]), I might want to
see something like "Entered foo with X = d, Y = f, Z = h.
I really need to get back and do some debugging again to
refresh my memory!

> 
> Also did you you use state variable syntax when threading the IO
> state? This makes things a lot easier and preserves purity.

I did not use state variable syntax, which I became aware of
only recently.  I agree that it makes it a lot easier within
the body of each predicate.  But I think that if we have
a sequence of calls

main --> p1 --> p2 --> ... --> p10,

and p10 does some I/O, then each of the predicates p1 ... p10
needs to be declared with a pair of io__state variables,
whether using state variable syntax or not, right?

Thanks very much!

Greg

> 
> Ian.
> 
> --------------------------------------------------------------------------
> mercury-users mailing list
> post:  mercury-users at cs.mu.oz.au
> administrative address: owner-mercury-users at cs.mu.oz.au
> unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
> subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
> --------------------------------------------------------------------------
> 
> 

-- 
Gregory D. Weber

Associate Professor of Computer Science, Indiana University East
2325 Chester Boulevard, Richmond, Indiana 47374-1289, U.S.A.
Telephone (765) 973-8420          World-Wide Web http://mypage.iu.edu/~gdweber/

----
Plain text is the document format that maximizes readability and 
minimizes hassle and hazard.  It is the format of the official documents
defining Internet protocols (http://www.rfc-editor.org/).
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list