Skip to content

Commit

Permalink
Use existing constant-related functions
Browse files Browse the repository at this point in the history
  • Loading branch information
emileferreira committed Feb 1, 2024
1 parent 250c50e commit 99f13da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions RASP_support/DrawCompFlow.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,10 @@ def __init__(self, depth, d_heads, d_ffs, add_tokens_on_ff=False):
ff_parents = list(set(ff_parents))
ff_parents = [p for p in ff_parents if not guarded_contains(d_ffs, p)]
# in the trivial case (no parents and only one ff), the ff is marked as
# constant
if not ff_parents and len(d_ffs) == 1 and d_ffs[0]._constant:
# switch the parents and ffs to label the trivial ff as 'X'
ff_parents, d_ffs = d_ffs, ff_parents
# constant and should be labelled as 'X'
for x in [ff for ff in d_ffs if ff.is_constant()]:
d_ffs.remove(x)
ff_parents.append(x)
rows_by_type = {RES: d_ffs, VVAR: ff_parents}
rowtype_order = [VVAR, RES]
if add_tokens_on_ff and not contains_tokens(ff_parents):
Expand Down
4 changes: 2 additions & 2 deletions RASP_support/analyse.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ def __init__(self, select, sequences, comp_depth):
# filter out non-ffs in the non-trivial case
all_ffs = [m for m in all_ffs if m.from_zipmap]
else:
# mark the sequence as constant (indices / tokens) in the trivial case
# mark the sequence as constant in the case of trivial indices or tokens
for ff in all_ffs:
ff._constant = True
ff.mark_as_constant()
if remove_minors:
all_ffs = [ff for ff in all_ffs if not ff.is_minor]

Expand Down

0 comments on commit 99f13da

Please sign in to comment.