-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Indexing arrays programatically with a variable #31
Comments
Hi, Thanks for being patient, I had a few very busy weeks. (defmacro get-index [signal idx]
`(get (symbol-add ',signal "<" ,idx ">"))) Evaluating whatever is between <> would be handy. However, this could potentially clash with signals in the waveform. |
Thank you for the reply. I see. I guess I wasn't aware of the symbol-add operator. So this is what we use to create a symbol that we build at runtime, am I correct? |
Yes, with >-> (symbol-add 'a 'b 3 (+ 2 2) "-def")
ab34-def |
Great! Maybe consider adding it to the documentation so other people can see the feature. You can close the issue. |
Hello,
we have a case where we want to access an array element programatically:
This however does not work. It is reading the whole my_signal.my_array<some_index> as a variable name and I can't seem to figure out how to make it evaluate some_index so that eventually compiles to this: my_signal.my_array<3>.
I managed to do it by defining a custom operator:
then doing
Only then I can successfully evaluate the index.
It would be nice if whatever between <> is evaluated rather then being taken as is.
The text was updated successfully, but these errors were encountered: