Skip to content

Commit b8368d1

Browse files
committed
Collect values in a different way
One of the other tests indicates that there actually is supposed to be a difference between Integer and the values keyword. The latter is needed to make the evaluate algorithm work. Therefore we should still attempt to collect values in Indices but failures should not be fatal and Integer (which we apply no matter what) should do the heavy lifting. Signed-off-by: Connor Behan <[email protected]>
1 parent 33f2d9d commit b8368d1

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

core/properties/Indices.cc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,22 @@ bool Indices::parse(Kernel& kernel, std::shared_ptr<Ex> ex, keyval_t& keyvals)
6767
//std::cerr << "got values keyword " << *(ki->second->name) << std::endl;
6868
if(*ki->second->name=="\\sequence") {
6969
auto args = std::make_shared<cadabra::Ex>(ki->second);
70-
kernel.inject_property(new Integer(), ex, args);
70+
auto prop = new Integer();
71+
kernel.inject_property(prop, ex, args);
72+
73+
if (prop->from.is_integer() && prop->to.is_integer()) {
74+
if (prop->difference.to_integer() < 100) {
75+
for (int i=prop->from.to_integer(); i<=prop->to.to_integer(); ++i) {
76+
values.push_back(Ex(i));
77+
}
78+
}
79+
}
80+
7181
++ki;
7282
continue;
7383
}
74-
collect_index_values(ki->second);
7584

85+
collect_index_values(ki->second);
7686
// If all values are indices, add an `Integer' property for the object,
7787
// listing these integers.
7888
bool is_number=true;

0 commit comments

Comments
 (0)