However, this is giving me some errors, and i’m not sure if what i’m doing is me misunderstanding the language. What i’m trying to do is use the first function to return a value inside of the second function. If possible i’d like to clarify the following points:
when to use defun-inline or just use defun - are they both globally scoped, or do I need to pass one function to the other in the arguments to use it?
are the constants globally scoped?
Can anyone give me some pointers why this code doesn’t work - can I call one function in the other function in such a way?
Thanks for all your help! Partial answers to some of these questions also appreciated! - Thanks
Both are globally scope. Basically, defun-inline is more efficient, but if you need to create a recursive function, you’ll have to use defun. There is a good note here and here.
In most instances, it is better to use inline functions rather than regular functions. Inline functions get inserted where they are called at compile time which will eliminate the function call overhead and will not store the function separately in the code.
There is a potential scenario where this is not true. If you are using an inline function with an argument that has been calculated, you will end up paying for that calculation every time the argument is referenced:
yes
There are couple things that needs to be fixed. For example, you will need to include condition_codes.clib as well. And in calculate function, since you want to return the value and not running another function, you don’t need (). The code below should work:
Thankyou! You solved this for me → I was returning the constants in brackets (which i guess was treating them more like conditions rather than a value!) Thanks!