Files
mercury/tests/hard_coded/pprint_test.m
Julien Fischer 9480a49274 Change the argument order of predicates in the sparse_bitset modules to make
Branches: main

Change the argument order of predicates in the sparse_bitset modules to make
it more conducive to the use of state variable notation.

Group function clauses together with the clauses for the corresponding
predicates.

library/sparse_bitset.m:
	As above.

library/digraph.m:
compiler/make.dependencies.m:
compiler/mode_robdd.equiv_vars.m:
compiler/mode_robdd.implications.m:
compiler/mode_robdd.tfeirn.m:
tests/hard_coded/bitset_tester.m:
tests/hard_coded/pprint_test.m:
tests/valid/loop_inv_bug.m:
	Conform to the above change.

library/digraph.m:
library/getopt.m:
library/getopt_io.m:
library/map.m:
	Remove dependencies on the svset module.

NEWS:
	Announce the above change.
2011-05-19 13:11:47 +00:00

60 lines
1.4 KiB
Mathematica

% Test to_doc's special handling of some types.
:- module pprint_test.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
:- import_module int, varset, term, list, sparse_bitset, map, array, pprint.
:- func line_length = int.
line_length = 72.
:- pred get_new_vars(var(int)::out, var(int)::out) is det.
get_new_vars(Var1, Var2) :-
varset__init(VarSet0),
varset__new_var(Var1, VarSet0, VarSet1),
varset__new_var(Var2, VarSet1, _VarSet2).
main -->
{ get_new_vars(Var1, Var2) },
pprint__write(line_length, to_doc(Var1)),
io__nl,
pprint__write(line_length, to_doc(Var2)),
io__nl,
pprint__write(line_length, to_doc([5, 6])),
io__nl,
pprint__write(line_length, to_doc(["five", "six", "seven"])),
io__nl,
pprint__write(line_length, to_doc([Var1, Var2])),
io__nl,
{ Set0 = sparse_bitset__init },
{ sparse_bitset__insert(42, Set0, Set1) },
{ sparse_bitset__insert(84, Set1, Set2) },
pprint__write(line_length, to_doc(Set1)),
io__nl,
pprint__write(line_length, to_doc(Set2)),
io__nl,
{ Map0 = map__init },
{ map__det_insert(41, 42, Map0, Map1) },
{ map__det_insert(82, 83, Map1, Map2) },
pprint__write(line_length, to_doc(Map1)),
io__nl,
pprint__write(line_length, to_doc(Map2)),
io__nl,
{ array__from_list([1, 2, 3], Array) },
pprint__write(line_length, to_doc(Array)),
io__nl,
pprint__write(line_length, to_doc({7, 8, "abc"})),
io__nl.