Commit 3a811a463553d8bac5508d982c43176e531d2847

Authored by Salvador Abreu
1 parent 0f83aa78
Exists in master

added uniq_name/2.

Showing 1 changed file with 8 additions and 0 deletions   Show diff stats
fz/util.pl
... ... @@ -10,3 +10,11 @@ subset(S, [H|T], R) :- subset_aux(T, H, S, R).
10 10 subset_aux(S, R, S, [R]).
11 11 subset_aux([H|T], R1, S, [R1|R]) :- subset_aux(T, H, S, R).
12 12 subset_aux([H|T], X, [X|S], R) :- subset_aux(T, H, S, R).
  13 +
  14 +% -- uniq_name(ROOT, NAME) ----------------------------------------------------
  15 +
  16 +uniq_name(ROOT, NAME) :-
  17 + g_read(ROOT, N),
  18 + N1 is N+1,
  19 + format_to_atom(NAME, "~w_~w", [ROOT, N1]),
  20 + g_assign(ROOT, N1).
... ...