[mercury-users] newbie question: instantiating a type (practicing with the tutorial)

Tomas By tomas at basun.net
Thu Sep 23 19:45:32 AEST 2010


On Thu, September 23, 2010 11:28, Jean-Marc Vanel wrote:
> my original question was related to the example in the Mercury tutorial

Ah, ok. Then I see two problems. (1) there should an empty list somewhere,
as the initial value of the "dictionary", and (2) "search" can fail, so

  Dic2 = set( [], "jmv", "JM Vanel" ),
  ( search( Dic2, "jmv", V) ->
    io.write_string( "search( dic, jmv, V) : V= ", !IO),
    io.write_string( V, !IO), io.nl(!IO)
  ; io.write_string( "fail\n",!IO) ).

Perhaps?

/Tomas


--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list