How to calculate pseudo-parameter .numarea for user-defined function inside a print.

39 views
Skip to first unread message

Eugenii Barannik

unread,
Nov 24, 2019, 5:44:02 AM11/24/19
to fityk-users
Hello. How can I calculate pseudo-parameter .numarea for user-defined function inside a print?
In general, I use something like this:

for i = 0, n do
f = F:all_functions()[i]
print(f:get_param_value("numarea(800, 1600, 1000)"))
end

And get
%Spec003_C has no parameter `numarea(800, 1600, 1000)

I know it is possible to use F:execute ("print %%Spec%03d_A.numarea(800, 1600, 1000)" % i)

 but using f=F:all_functions()[i] instead of i is crucial for me since i know no way to calculate the amount of function (this will also solve problems).
Message has been deleted
Message has been deleted

Marcin Wojdyr

unread,
Dec 12, 2019, 2:57:55 AM12/12/19
to fityk...@googlegroups.com
Hi Eugenii,

I just realized I didn't reply to this message from November.

You can iterate over all functions with "for i, f in F:all_functions() do".
But there is no elegant way to get a value of "numarea", so you'd need
to use F:calculate_expr:

for i, f in F:all_functions() do
print(F:calculate_expr("%" .. f.name .. ".numarea(800, 1600, 1000)"))
end

Best wishes,
Marcin

On Sun, 24 Nov 2019 at 14:22, Eugenii Barannik <radc...@gmail.com> wrote:
>
> But i can't make
> f = ("F:all_functions()[%d]" % i)
> work
>
> On Sunday, 24 November 2019 16:19:02 UTC+3, Eugenii Barannik wrote:
>>
>> Okay, i can calculate number of functions now:
>> fn = (#(F:all_functions()))
> --
> http://groups.google.com/group/fityk-users
> ---
> You received this message because you are subscribed to the Google Groups "fityk-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to fityk-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/fityk-users/c829e72d-75d0-43b9-8eb5-9370ad00aeb7%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages