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
There are essentially 3 variations for normal dataflow, AKA dataflow-flatmap:
~~>
~/~>
~~> +~/~>
IMO these should be implemented separately, using do-then, do-else, do-then-else:
def _dataflow_then(s: Script[Any], t: Any => Script[Any], e: Throwable => Script[Any]): Script[Any] = {
var s_node: N_call[Any] = null
([do @{s_node = there.asInstanceOf[N_call[Any]]}: s then t(s_node.$success)^])
}
def _dataflow_else(s: Script[Any], t: Any => Script[Any], e: Throwable => Script[Any]): Script[Any] = {
var s_node: N_call[Any] = null
([do @{s_node = there.asInstanceOf[N_call[Any]]}: s else e(s_node.$failure)^])
}
def _dataflow_then_else(s: Script[Any], t: Any => Script[Any], e: Throwable => Script[Any]): Script[Any] = {
var s_node: N_call[Any] = null
([do @{s_node = there.asInstanceOf[N_call[Any]]}: s then t(s_node.$success)^
else e(s_node.$failure)^])
}
Something similar holds for dataflow-map:
def _dataflow_then_map(s: Script[Any], f: T => Any): Script[Any] = {
var s_node: N_call[Any] = null
([do @{s_node = there.asInstanceOf[N_call[Any]]}: s then ^let f(s_node.$success) ])
}
def _dataflow_else_map(s: Script[Any], g: Throwable => Any): Script[Any] = {
var s_node: N_call[Any] = null
([do @{s_node = there.asInstanceOf[N_call[Any]]}: s else ^let g(s_node.$failure) ])
}
def _dataflow_then_else_map(s: Script[Any], f: T => Any, g: Throwable => Any): Script[Any] = {
var s_node: N_call[Any] = null
([do @{s_node = there.asInstanceOf[N_call[Any]]}: s then ^let f(s_node.$success)
else ^let g(s_node.$failure) ])
}
Probably the latter three may be implemented more efficiently using dedicated do-thenMap, do-elseMap, do-thenMap-elseMap nodes.
Also the parser should start to accept syntax for the else-parts.
The text was updated successfully, but these errors were encountered:
Another thing: to pass the earlier mentioned Pastiche test, there should also be a dataflow operator that transfers both the success data and the failure exception, packed in the Try:
x ~+/~> y
x ~+/~(p:Try[T])~~> y
This requires another new construct:
do x finally y
which is in ACP terms equivalent to
do x then y else y
The difference in Scala terms is that there is only one occurrence of y.
There are essentially 3 variations for normal dataflow, AKA dataflow-flatmap:
IMO these should be implemented separately, using
do-then
,do-else
,do-then-else
:Something similar holds for dataflow-map:
Probably the latter three may be implemented more efficiently using dedicated do-thenMap, do-elseMap, do-thenMap-elseMap nodes.
Also the parser should start to accept syntax for the else-parts.
The text was updated successfully, but these errors were encountered: