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
In clojure it makes sense to define functions with no arguments to delay an evaluation or to perform side-effects.
(defnf []
some-effect)
(let [x (f)]
...)
As this makes sense for ohua too we should support algorithms without arguments too.
Example
(defalgof []
some-effect)
(ohua
(smap
(algo [a] .. (f) ...) ; f is executed multiple times
[...]))
ALang however makes no distinction between a value invoking a function.
A possible way to solve this is by adding a dummy ignored _ argument and inserting a unit argument at the call site.
The most important thing to do is to figure out how to ensure the inlined let _ = unit in ... bindings after applying a function like (λ _ . ...) unit are removed at the appropriate time.
Perhaps to this end it may be beneficial to distinguish the ignored binding _ explicitly rather than just making it the binding "_".
Something like
dataBnd=RealBinding
| Ignored-- `_`
The text was updated successfully, but these errors were encountered:
I may have a simpler suggestion:
Our ALang is purely functional and therefore can not understand what (f) means.
I believe that the adaptation of our Clojure frontend to ALang should handle this case.
As such, there should be a rewrite like this (f) -> (f (unit)) where unit is a built-in stateful function. No changes to ALang would then be necessary. As far as performance goes, this is again something that we can optimize via fusion or another optimization maybe in DFLang.
I would vote for not changing our ALang towards that.
In clojure it makes sense to define functions with no arguments to delay an evaluation or to perform side-effects.
As this makes sense for ohua too we should support algorithms without arguments too.
Example
ALang however makes no distinction between a value invoking a function.
A possible way to solve this is by adding a dummy ignored
_
argument and inserting aunit
argument at the call site.The most important thing to do is to figure out how to ensure the inlined
let _ = unit in ...
bindings after applying a function like(λ _ . ...) unit
are removed at the appropriate time.Perhaps to this end it may be beneficial to distinguish the ignored binding
_
explicitly rather than just making it the binding"_"
.Something like
The text was updated successfully, but these errors were encountered: