eo
eo copied to clipboard
implement `seq` in EO with the help of `dataized`
I believe, it should be possible, with the help of recursion
I think we will need try
object here because it has finally
attribute which just dataizes object and forgets about it
@yegor256 @maxonfjvipon @volodya-lombrozo is this issue free? can I take this one?
@l3r8yJ thanks for your desire to help. Of course you can try, but it would be kind of dirty implementation which abuses the design of try
. So I'm not sure we really need it now in such way.
@yegor256 WDYT?
@maxonfjvipon then maybe you know an another issue I can help with?
@maxonfjvipon I would wait a bit with this ticket
[steps] > seq
loop 0 > @
[index] > loop
if. > @
and.
index.lt steps.length
(dataized (steps.at index)).size.ge 0 # any convertion to true
loop (index.plus 1)
true
Variants of convertion to true
-
(dataized (steps.at index)).size.ge 0
-
(dataized (steps.at index)).as-bool.if true true
To deny remove dataization object must have flag that dataization of object has side effects. I think about this mechanism as portal from declarative EO to platform, for example any call of C API has side effect
It is works!
# The test Application with very important comment XXXXXXXXXXXXXXXXXX.
[args] > app
my-seq > @
*
QQ.io.stdout "1\n"
QQ.io.stdout "2\n"
QQ.io.stdout "3\n"
QQ.io.stdout "4\n"
[steps] > my-seq
loop 0 > @
[index] > loop
if. > @
and.
index.lt steps.length
steps.at index
^.loop
index.plus 1
true
@Chamber6821 looks pretty good. But the logic of seq
assumes that it dataizes all the steps
except the last one, which is just returned without dataization. You may see it here (ind < items.length - 1
)
@maxonfjvipon fixed
# The test Application with very important comment XXXXXXXXXXXXXXXXXX.
[args] > app
my-seq > @
*
QQ.io.stdout "1\n"
false
QQ.io.stdout "2\n"
false
QQ.io.stdout "3\n"
false
QQ.io.stdout "4\n"
false
[steps] > my-seq
loop 0 > @
[index] > loop
if. > @
and.
index.lt (steps.length.minus 1)
or.
(dataized (steps.at index)).as-bool
true
^.loop
index.plus 1
steps.at index
@Chamber6821 much better, one more thing: if steps
is empty - seq
should return true
@maxonfjvipon
# The test Application with very important comment XXXXXXXXXXXXXXXXXX.
[args] > app
my-seq > @
*
QQ.io.stdout "1\n"
false
QQ.io.stdout "2\n"
false
QQ.io.stdout "3\n"
false
QQ.io.stdout "4\n"
false
[steps] > my-seq
if. > @
steps.length.eq 0
true
loop 0
[index] > loop
if. > @
and.
index.lt (steps.length.minus 1)
or.
(dataized (steps.at index)).as-bool
true
^.loop
index.plus 1
steps.at index
I will create PR
@Chamber6821 yeah, you can try
@yegor256 let's make a new release with tag 0.38.4
@rultor release, tag is 0.38.4
@yegor256 I'm closing it since it's implemented