[Cook] Function Arguments (and Algebra)

Pendergraft, Jerry JPendergraft at sjm.com
Sat Oct 15 16:05:14 EST 2011


Essentially you can pass lists by name (think reference) rather than content.
foo = one two three;
bar = a b c;

1) [myfunc foo bar];
vs:
2) [myfunc [foo] [bar]];

In 1 you would write myfunc to expand the lists ala:
  dosomething with [@1];
  somethingelse with [@2];

in 2) you get content of both lists concatenated.
Sounds like you want to use #1

On 14 Oct, 2011, at 16:56 , Kyle Loveless wrote:

> Hi,
>
> In a function I'm writing, I want to pass in multiple lists. Is my instance, one is a list of include folders and the other is a list of object files.
>
> From what I can tell, I need to explicitly pass the size of each of these lists so the function can know where one list ends and the other starts. Is this right?
>
> Assuming this, I tried to use the "wordlist" function to extract the correct range from the "arg" parameter, depending on the lengths given. The problem I ran into with this is I need to do addition, which I realized I don't know how to do in a cookbook.
>
> So two questions:
> 1) If passing lists to a function, do I need to explicitly pass the lengths of the lists, or is there some better way?
> 2) Can I do numeric algebra in cookbooks? If so, how?
>
> Thanks!
>
> Kyle
> _______________________________________________
> Cook-users mailing list
> Cook-users at lists.auug.org.au
> http://lists.auug.org.au/listinfo/cook-users


This communication, including any attachments, may contain information that is proprietary, privileged, confidential or legally exempt from disclosure. If you are not a named addressee, you are hereby notified that you are not authorized to read, print, retain a copy of or disseminate any portion of this communication without the consent of the sender and that doing so may be unlawful. If you have received this communication in error, please immediately notify the sender via return e-mail and delete it from your system.


More information about the Cook-users mailing list