You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 9, 2023. It is now read-only.
var original = new Alg.Group(
new Alg.Sequence([
new Alg.BlockMove("R", 1)
]),
1
)
var parsed = parse(algToString(original));
console.log(structureEquals(original, parsed));
Ideally, I'd like there to be only a single representation of this alg.
One possibility is to have a nested kind of sequence that must have at least two units in it. The parser actually uses this requirement to avoid unnecessary nesting (which is why parsed is different):
Con: Nesting certain (or all) top-level algs inside another alg would not be possible without changing the top-level representation into an equivalent nested representation.
Define every Algorithm with nested algs to have its own lists, e.g. a commutator has {A: Unit[], B: Unit[]}. This requires making sure to call the Sequence processing code for each of the components in every relevant Algorithm in every traversal, possibly leading to subtle bugs.
Don't allow anything except a Sequence to contain a Unit, and require a Sequence layer.
This results in larger data structures, and an extra level of access in some cases. However, code might be more consistent, because looking inside a nested alg always requires going through a Sequence the same way.
The following prints
false:Ideally, I'd like there to be only a single representation of this alg.
One possibility is to have a nested kind of sequence that must have at least two units in it. The parser actually uses this requirement to avoid unnecessary nesting (which is why
parsedis different):alg.js/src/jison_parser/index.jison
Line 147 in 716c91d
Ideas:
uglifyjs-webpack-pluginwith "mode": "production" #5).Algorithmwith nested algs to have its own lists, e.g. a commutator has{A: Unit[], B: Unit[]}. This requires making sure to call theSequenceprocessing code for each of the components in every relevantAlgorithmin every traversal, possibly leading to subtle bugs.Sequenceto contain aUnit, and require aSequencelayer.Sequencethe same way.See https://gist.github.com/lgarron/f33d88a571f4bc9536801a8a7b035a91 for more thoughts on this.