Get_dict_ex/3 does not exist?

get_dict_ex/3 seems to not be accessible:

:- begin_tests(get_dict_ex).

   nonempty_dict(foo{x:alpha, y:bravo, z:charlie}).

   test("bagof/3 collects with get_dict_ex/3", [true(T)]) :-
      nonempty_dict(Dict),
      bagof(Key-Value,  get_dict_ex(Key,Dict,Value), Bag),
      keysort(Bag,SortedBag),
      T = (SortedBag == [x-alpha, y-bravo, z-charlie]).
      
:- end_tests(get_dict_ex).

rt(get_dict_ex) :- run_tests(get_dict_ex).

yields:

?- rt(_).
% PL-Unit: get_dict_ex 
ERROR: user://1:12:
        test bagof/3 collects with get_dict_ex/3: received error: findall_loop/4: Unknown procedure: plunit_get_dict_ex:get_dict_ex/3
 done
% 1 test failed
% 0 tests passed
false.

Maybe it has been removed or renamed? Once could just use .get/2 (“dot-get/2”) after all.

I see. That has existed in the exploratory phase introducing dicts. Eventually became ‘$get_dict_ex’/3 as I considered it to be too obscure for the public API. Will delete from the docs.

P.s. If you write tests, please consider making pull requests on the test suite.

1 Like

P.s. If you write tests, please consider making pull requests on the test suite.

Okay. Currently I’m attaching them to the manual as explainers.

I am pretty sure David knows this already, for others who don’t there is a wiki that shows how to do this GitHub Pull Request.

If anyone finds a problem or bug with it, as it is a wiki please fix or let me know. I will warn you my Git skills are horrible; no matter how many times I get good at it for a few weeks after the next long pause I seem to forget it all again.

1 Like

Thanks. Be aware that the current page annotation system is pretty broken en contains a lot of outdated or otherwise dubious messages. This will probably be integrated with Discourse in due time. Not sure what should happen to the old annotations. I guess we can migrate them, but they probably need reviewing and cleanup first.

2 Likes