Skip to content

Commit

Permalink
support .keys for a map
Browse files Browse the repository at this point in the history
  • Loading branch information
dours committed Aug 19, 2022
1 parent f6802ef commit 73dd553
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions transpiler/src/main/eo/preface/xmyMap.eo
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
+alias sprintf org.eolang.txt.sprintf
+alias mkCopy preface.mkCopy
+alias pair preface.pair
+alias xmyArray preface.xmyArray

[] > xmyMap
pyint 16 > x__id__
Expand Down Expand Up @@ -89,6 +90,22 @@
self.value.write (*)
stackUp.forward (return 0)
123
[] > xkeys
[self] > apply
[stackUp] > @
(goto ((xmyArray.apply (*)).@)).result > accum
memory 0 > i
seq > @
(i.lt (value.length)).while
[unused]
(self.value.get i).fst > x
seq > @
(goto ((accum.xappend.apply accum x).@)).result
i.write (i.plus 1)
0
stdout (sprintf "keys len = %d\n" (accum.value.length))
stackUp.forward (return accum)
0
[x] > eq
memory TRUE > acc
memory 0 > pos
Expand Down

0 comments on commit 73dd553

Please sign in to comment.