-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Improved handleArcs
function.
#51
Conversation
Removed OR-causality from the unimplemented features section
This is required for `groupSortOn`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of comments on existing code:
- I think
boolBit
is just standardfromEnum
. - Shall we rename
DynSignal
to justSignal
? I think it's clearer:data Signal = Signal Int deriving Eq
. - This will break when there are more than 26 signals:
show (Signal i) = [chr (ord 'A' + i)]
. Think how to improve. - This is a bit sad:
"+"
isSuffixOff
. Can't you convert to strings later, so you can avoid testing strings instead of working withTransition
type? - In
initVals
, can't you replacefoldr (\s -> (++)...
simply withmap
? - Can you remove explicit recursion from
arcPairs
andinitVal
? - In
output
, usenubOrd
fromextra
, which is faster. - Should
symbLoop
be calledconsistencyLoop
as in the paper?
@@ -32,6 +33,12 @@ data DynSignal = Signal Int deriving Eq | |||
|
|||
instance Show DynSignal where show (Signal i) = [chr (ord 'A' + i)] | |||
|
|||
instance Ord DynSignal | |||
where | |||
(<=) (Signal x) (Signal y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you prefer <=
instead of compare
you should at least simplify this as follows :-)
instance Ord DynSignal
where
Signal x <= Signal y = x <= y
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually just forgot to change this to compare, so I'm gonna use that. It just seems a little nicer to me for some reason
where | ||
effect = snd (head arcLists) | ||
causesForEffect = filter (\o -> snd o == effect) arcLists | ||
causesLists = map fst causesForEffect | ||
causesLists = map fst arcLists | ||
mapped = sequence causesLists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think name mapped
is not very meaningful (maybe it used to, but lost the meaning after refactoring).
@@ -116,17 +123,13 @@ doTranslate signs circuit = do | |||
|
|||
-- TODO: 1) Get rid of explicit recursion (use groupBy)? 2) Improve performance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can drop the TODO
: there is no explicit recursion any more, and the code is faster (we do sorting + one pass, instead of multiple passes).
Thanks for the comments, I will get to this ASAP.
I agree this needs improvement, but I don't believe it can be a quick fix, and it can be fixed with #35, allowing a user to define their own signal names. |
Well, there are plenty of quick fixes! For example: show (Signal i)
| i < 26 = [chr (ord 'A' + i)]
| otherwise = 'S' : show i
True, that would be preferable. |
instance Show Signal where show (Signal i)
| i < 26 = [chr (ord 'A' + i)]
| otherwise = 'S' : show i This throws errors, it doesn't like the |
I think formatting is wrong, perhaps this will work: instance Show Signal where
show (Signal i)
| i < 26 = [chr (ord 'A' + i)]
| otherwise = 'S' : show i |
That works, thanks.
Because of the numbering of transitions (e.g |
Made these changes now. Let me know if there's more to be done :) |
Merged from 10,600m above. |
Removed explicit recursion.
Added
extra
to the cabal file, required forgroupSortOn
.