'Rupert Smith' via Elm Discuss
2017-05-10 16:07:28 UTC
By search, I mean a backtracking search over a 'graph' of possibilities.
There is a well-known pretty printing library by Joh Hughes. It is for
Haskell but can be made to work on ML style languages by introducing some
laziness explicitly. Haskell is lazy by default, which is why it is not
needed there.
http://belle.sourceforge.net/doc/hughes95design.pdf
It defines lambdas that evaluate to the various possible choices then only
evaluates the 'best' choice according to a heuristic for evaluating pretty
printing possibilities. I think when a bad choice deeper down is uncovered,
it can backtrack? To be honest, I never really analysed the code and fully
understood it, just made use of it or blindly ported it to ML.
Is there some library for Elm that helps with coding this kind of search?
Or a simpler example illustrating the technique?
I am trying to do a 2d layout algorithm, and thinking of some heuristic
that will choose amongst various layouts, trying simpler and more symmetric
options first.
There is a well-known pretty printing library by Joh Hughes. It is for
Haskell but can be made to work on ML style languages by introducing some
laziness explicitly. Haskell is lazy by default, which is why it is not
needed there.
http://belle.sourceforge.net/doc/hughes95design.pdf
It defines lambdas that evaluate to the various possible choices then only
evaluates the 'best' choice according to a heuristic for evaluating pretty
printing possibilities. I think when a bad choice deeper down is uncovered,
it can backtrack? To be honest, I never really analysed the code and fully
understood it, just made use of it or blindly ported it to ML.
Is there some library for Elm that helps with coding this kind of search?
Or a simpler example illustrating the technique?
I am trying to do a 2d layout algorithm, and thinking of some heuristic
that will choose amongst various layouts, trying simpler and more symmetric
options first.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.