News for hackers. Stuff that matters.
Re:Nilang.jl – A Reversible Julia DSL by choeger on Sunday October 11, 2020 @07:04AM (#24744967)
Wait a second, does it yield an exact inverse or a numerical approximation?
Re:Nilang.jl – A Reversible Julia DSL by e12e on Sunday October 11, 2020 @08:35AM (#24745365)
Given the example of reversing over a function that calculates the first Fibonacci number greater than 100, it seems to be a bit more going on than "just" a numerical approximation:

https://github.com/GiggleLiu/NiLang.jl/blob/master/examples/...

Ed: after skimming the paper (that went mostly over my head) - this does indeed seem to be about "actually" running functions in reverse - given a function only defined "forward" in the nilang DSL. It appears the graph embed examples are missing in the master branch, unfortunately.

I wonder if this can be used more trivially to solve simple problems too - like calculating values/sums pertaining to compound interest/investment, given a naive function for calculating sums etc (its trivial to add up compounded interest and deposits, but a tiny bit more complicated to answer the question "at what time is my portfolio at X or more dollars).

Re:Nilang.jl – A Reversible Julia DSL by GiggleLiu on Sunday October 11, 2020 @04:04PM (#24748642)
Graph embedding example is not missing, it in the appendix of the paper's master branch: https://github.com/GiggleLiu/nilangpaper/blob/master/invc.pd...

The source code is available here: https://github.com/JuliaReverse/NiGraphEmbedding.jl

Re:Nilang.jl – A Reversible Julia DSL by GiggleLiu on Sunday October 11, 2020 @03:20PM (#24748282)
Very good question. Floating point `+=` and `-=` are not exactly reversible. This is the only approximation that we have made in NiLang. To compile NiLang to a reversible device (rigorously reversible), we need to overhaul current number systems, i.e. using fixed point numbers and logarithmic numbers instead. Fixed point numbers are exactly reversible under `+=` and `-=`, logarithmic numbers are exactly reversible under `*=` and `/=`. Here is an example of implementing Bessel function with two number systems: https://giggleliu.github.io/NiLang.jl/dev/examples/besselj/