Send Gretl-users mailing list submissions to
gretl-users@lists.wfu.edu
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.wfu.edu/mailman/listinfo/gretl-users
or, via email, send a message with subject or body 'help' to
gretl-users-request@lists.wfu.edu
You can reach the person managing the list at
gretl-users-owner@lists.wfu.edu
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Gretl-users digest..."
Today's Topics:
1. Re: function Command (Logan Kelly)
----------------------------------------------------------------------
Message: 1
Date: Fri, 17 Aug 2012 16:28:32 +0000
From: Logan Kelly <logan.kelly@uwrf.edu>
Subject: Re: [Gretl-users] function Command
To: Gretl list <gretl-users@lists.wfu.edu>
Message-ID:
<997A3903FC5FF540AB9AD9D2564C8F596D781304@UWRFMBX01.servers.uwrf.edu>
Content-Type: text/plain; charset="utf-8"
Daniel,
Can you see q in the scalars list which can be accessed through the icon view, which can be accessed through the GUI: view->icon view? Also could you use the print command, i.e. print q (or you might look up printf if you want to format the output)
Logan
P.S. Peter, thanks for the syntax correction.
From: gretl-users-bounces@lists.wfu.edu [mailto:gretl-users-bounces@lists.wfu.edu] On Behalf Of Summers, Peter
Sent: Friday, August 17, 2012 9:55 AM
To: Gretl list
Subject: Re: [Gretl-users] function Command
Daniel,
There are actually 2 problems here:
1) You have an extra comma after p ? change (scalar p,) to (scalar p). The comma makes Gretl think there are more input arguments coming, hence the ?missing type identifier.?
2) Re Logan?s suggestion, you need to assign a value to q before the return command.
The following works on my (Win 7) machine:
function scalar model(scalar p)
q = 3*p
return q
end function
HTH,
PS
From: gretl-users-bounces@lists.wfu.edu<mailto:gretl-users-bounces@lists.wfu.edu> [mailto:gretl-users-bounces@lists.wfu.edu]<mailto:[mailto:gretl-users-bounces@lists.wfu.edu]> On Behalf Of Daniel Sirim
Sent: Friday, August 17, 2012 8:20 AM
To: gretl-users@lists.wfu.edu<mailto:gretl-users@lists.wfu.edu>
Subject: [Gretl-users] function Command
Hello ,
i have got a new question refering to the ?function? command.
First of all I want to understand the Syntax of this command. I read the Guide and check the syntax but why is it not working?
genr p = 3
function scalar Model( scalar p,)
q= 3*p
end function
just a small example but to get to understand it. It says : expected a type identifier?. But why ? there is the name of the Function called Model and also the type ? scalar?. What is wrong with that?
If I got this, it is my aim to built an Modular System, which means, First on the upper side of the script I want to have the basic formulas, like
1. function series AB (series a, scalar b, scalar c, scalar d)
a*(1-exp(-b*(c-c0)))
end function
2. Function ?..
3. Function ?..
And so on ?
After declaring and defining the parameters und the function body of the basic formulas, I want to stick them together, I need it like this because it depends on the case which basic function I need and also the sequence could be different ( for example: case 1: 2. Formula + 3. Formula + 2. Formula?. Case 2: 3.Formula + 1.Formula ?)
My Other Question is is it possible to make this "combinedfunction" easier to write ?
What I mean is let the commands like series oder scalar away, cause its also declared.
Hopefully somebody can help me I thing there will be some other question but I think for the first round it more then enough.
Thank you, and I hope for some answers =)
Daniel.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.wfu.edu/pipermail/gretl-users/attachments/20120817/818dc17d/attachment.html
------------------------------
_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
End of Gretl-users Digest, Vol 67, Issue 26
*******************************************