mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 02:43:40 +00:00
34 lines
760 B
Mathematica
34 lines
760 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module bug510b.
|
|
|
|
:- interface.
|
|
|
|
:- import_module list.
|
|
|
|
:- type foo_set.
|
|
|
|
:- pred init_set(int::in, foo_set::out) is det.
|
|
|
|
:- pred make_foo_set(int::in, foo_set::out) is det.
|
|
|
|
:- pred foo_set_to_list(foo_set::in, list(int)::out) is det.
|
|
|
|
:- implementation.
|
|
:- import_module enum.
|
|
:- import_module int.
|
|
:- import_module sparse_bitset.
|
|
|
|
:- type foo_set == sparse_bitset(int).
|
|
|
|
make_foo_set(N, Set) :-
|
|
Set = sparse_bitset.make_singleton_set(N).
|
|
|
|
foo_set_to_list(Set, List) :-
|
|
sparse_bitset.to_sorted_list(Set, List).
|
|
|
|
init_set(N, Set) :-
|
|
make_foo_set(N, Set).
|