Hi Sean Well done ! However, I don’t understand why you added the call to keysort/2 since setof/3 already sorts the list (this is the only difference between setof/ and bagof/3). You can remove it.
Daniel PS: about sockets: I have put a version in the git which adds the SO_REUSEADDR option at socket creation. To get it: git clone git://git.code.sf.net/p/gprolog/code gprolog-code BTW: if you write on the socket, you may to call flush_output(SO) to be sure the data is sent (and thus accessible on the other side). Le 22 nov. 2013 à 23:43, Sean Charles <[email protected]> a écrit : > Danieal, > > Mission accomplished! > > I ran with what you gave me and I now have a process that executes tests in > the same order as they are declared in the source text. I had to learn (very > quickly) about the A-B pair notation, something I had not seen before but as > with the predicate indicator thing, once you know how it works the rest is > easy…easier. > > Here’s what I ended up with: > run_tests :- > get_all_tests(AllTests), > keysort(AllTests, SortedTests), > maplist(exec_test, SortedTests), > > The get_all_tests/1 predicate and the supporting acts look like this: > get_all_tests(Tests) :- > setof(Line-Name, get_one_test(Name, Line), Tests). > > > get_one_test(Name, Line) :- > current_predicate(Name/0), > atom_concat('test_', _, Name), > predicate_property(Name, prolog_line(Line)). > > > exec_test(_-TestFunction) :- /* omitted for brevity! */ > > Essentially I get all the test_ predicates then keysort/2 them into line > number order and then maplist/2 over the exec_test/1 function which is now > modified to accept a pair. Damn that’s useful to know! > > So, once again, thank you very mud for your support in helping me out. > > I am going to try to finish my Redis tests over the weekend and then I am > going to update my “main” project with this improved code. in fact, I might > even create a little github project and then include it as a dependency or > something like that later on. > > Have a great weekend! > :) > Sean. > > > > > > -- > Ce message a été vérifié par MailScanner pour des virus ou des polluriels et > rien de suspect n'a été trouvé. -- Ce message a ete verifie par MailScanner pour des virus ou des polluriels et rien de suspect n'a ete trouve.
_______________________________________________ Users-prolog mailing list [email protected] https://lists.gnu.org/mailman/listinfo/users-prolog
