Hi Ahmad,
That's a very hard question and this is my attempt
1. To start, there is a bit of comment from the SKILL Language User
Guide.
In SKILL, function calls can be written in either of the following
notations:
- Algebraic notation used by most programming languages: func( arg1
arg2 =85)
- Prefix notation used by the Lisp programming language: (func arg1
arg2 =85)
For comparison, here is a SKILL program written first in algebraic
notation, then the same
program, also implemented in SKILL, using a Lisp style of programming.
procedure( fibonacci(n)
if( (n =3D=3D 1 || n =3D=3D 2) then
1
else fibonacci(n-1) + fibonacci(n-2)
)
)
Here is the same program implemented in SKILL using a Lisp style of
programming.
(defun fibonacci (n)
(cond
((or (equal n 1) (equal n 2)) 1)
(t (plus (fibonacci (difference n 1))
(fibonacci (difference n 2)))
)
)
)
2. My point of view is both defun and procedure are doing the same job
with a slightly different syntax. The only difference is :
With defun, you have to keep a white space between the function name
and the "(" of arguments, i.e fibonacci (n).
3. defun is a lisp function actually whereas procedure is a pure skill
function
4. I'm enable to tell you whether there is any difference in terms of
performance. I don't think so otherwise Cadence would have advised one
syntax preferably to the other.
5. My thinking is that defun suits the Lisp-ish chaps and procedure
the C-ish ones. So the choice is yours !
Let's wait for other comments ...
Riad.


|