Skip to content
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

Parsing variables #2

Open
smkatz12 opened this issue Sep 13, 2023 · 1 comment
Open

Parsing variables #2

smkatz12 opened this issue Sep 13, 2023 · 1 comment

Comments

@smkatz12
Copy link

Solve this (per discussion earlier):

upright = s -> abs(s[1]) < π / 4
ψ = @formula □(upright)
@mossr
Copy link
Member

mossr commented Sep 15, 2023

Variables now work. Due to some idiosyncrasies with Julia's metaprogramming, you first have to define the upright function as a @formula then you can use it in combination with @eval and interpolation with $

upright = @formula s -> abs(s[1]) < π / 4
ψ = @eval @formula ($upright)

Also note that if you want to use variable thresholds, you have to do the same thing:

λ = 0.5
ψ = @eval @formula s->s > $λ

This is a limitation of Julia's metaprogramming.

@mossr mossr closed this as completed Sep 15, 2023
@mossr mossr reopened this Sep 15, 2023
mossr added a commit that referenced this issue Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants