Skip to content

Commit

Permalink
Merge pull request #1808 from triska/gensym
Browse files Browse the repository at this point in the history
gensym-related improvement and correction
  • Loading branch information
mthom committed May 16, 2023
2 parents f7d9237 + 021c01d commit c71b8e0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/lib/gensym.pl
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
must_be(var, Unique),
atom_si(Base),
gensym_key(Base, BaseKey),
( bb_get(BaseKey, UniqueID0) ->
UniqueID is UniqueID0 + 1,
bb_put(BaseKey, UniqueID),
append_id(Base, UniqueID, Unique)
; bb_put(BaseKey, 1),
append_id(Base, 1, Unique)
).
( bb_get(BaseKey, UniqueID0) -> true
; UniqueID0 = 0
),
UniqueID is UniqueID0 + 1,
append_id(Base, UniqueID, Unique),
bb_put(BaseKey, UniqueID).

reset_gensym(Base) :-
atom_si(Base),
bb_put(Base, 0).
gensym_key(Base, BaseKey),
bb_put(BaseKey, 0).

0 comments on commit c71b8e0

Please sign in to comment.