-
|
Hello -- I'm using the expressions language. I need queue functionality (push, pop). What you do you recommend? If I could use JS arrays that would be great. (#3550) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
Try config({matrix:"Array"})
a = []
a.push(1)
Or a = [].toArray()
a.push(1)
Or you could try to import your custom functions according to your needs. |
Beta Was this translation helpful? Give feedback.
-
|
Assuming 1D matrices a = []
a[end+1] = 10
a # [10]
a.resize([a.size()[1]-1])
a # []And you could import your own push and pop functions. math.import({
push: (m, v) => {m.set([m.size()[0]], v)},
pop: (m) => {m.resize([m.size()[0]-1])}
})a = []
push(a, 10)
a # [10]
pop(a)
a # [] |
Beta Was this translation helpful? Give feedback.
-
|
This is great, thank you! |
Beta Was this translation helpful? Give feedback.
Assuming 1D matrices
And you could import your own push and pop functions.