Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Computer Aided Design - CAD > Cadence > Re: what is the...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 3990 of 4373
Post > Topic >>

Re: what is the difference between defun and procedure?

by Riad KACED <riad.kaced@[EMAIL PROTECTED] > May 8, 2008 at 04:51 PM

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.
 




 3 Posts in Topic:
what is the difference between defun and procedure?
Reotaro Hashemoto <ahm  2008-05-08 08:34:42 
Re: what is the difference between defun and procedure?
Riad KACED <riad.kaced  2008-05-08 16:51:00 
Re: what is the difference between defun and procedure?
Andrew Beckett <andrew  2008-05-09 10:47:44 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 20:22:36 CST 2008.