Make conversion between Lorentz and Indigo more pleasant and convenient
Clarification and motivation
Sometimes we want to convert Lorentz to Indigo, e. g. if there is some Lorentz code that we don't want to modify and want to use directly "as is" in Indigo. Currently there are fromLorentzFun2Args
and fromLorentzFun1ArgVoid
functions for that. But one may want to do it for Lorentz functions with different number of arguments.
Functions that convert from Indigo to Lorentz are also somewhat messy. There are: compileIndigo
, compileIndigoOps
, compileIndigoContract
and toLorentzFun2Args
.
-
toLorentzFun2Args
seems to serve the same purpose ascompileIndigo
, probably only one should remain. -
compileIndigoOps
is not used and I don't have use cases for it in mind, so maybe it can be removed. -
compileIndigo
works only with 2 arguments, but we may want to compile a function with a different number of arguments to Lorentz.
Acceptance criteria
- Ideally it would be nice to have polymorphic function that turns a Lorentz instruction into equivalent Indigo function. Its input stack values should be turned into
IsExpr ex a => ex
arguments and return value should be turned intoVar ret
or()
. If that's not doable, let's generate such functions using TH or something like that. -
compileIndigo
andtoLorentzFun2Args
should be merged into one function, let's call itcompileIndigo
. -
compileIndigo
should work with arbitrary number of arguments. It's similar to the first criterion. -
compileIndigoOps
should be removed unless there is a good reason not to do so.
Edited by Ivan Gromakovskii