Jump to content
Sheep

Type of DEFUN

Recommended Posts

Sheep

Hi all, i seen several defun with a unique word(?) like

(defun Test ()

(defun c:Test ()

(defun m:Test ()

(defun LM:test ()

(defun DT:Test ()

What does the c, DT, m and LM stands for? When should i use it and why? Thank you for your time. Are there any other defun type other then the above sample?

Edited by Sheep

Share this post


Link to post
Share on other sites
rlx

only if your command begins with 'c:' , you can call the command (after loading) on the command line with the name that follows. So when you load 'MyRoutine.lsp' and this routine has a function called 'c:test' you would only have to type test on the command line. In all other cases you have to call the command with parentheses. So when you have a function that is written as (defun test1 ().... you have to start it with (test1). If you have a function (defun LM:Test1 ()... you have to start it with (LM:Test1).

 

The reason why someone uses LM: as prefix would be when your name is Lee Mac. See it as a sort of signature , calling card whatever. So when you write a few  brilliant routines for us here on this forum , you could write them as (defun Sheep:Test1 ()... and then someone would have to type (Sheep:Test1) to start your mean lean lsp routine.

 

There are more types of defun , like defun-q and this has to do with how your function will be evaluated (as a list) . This is often used for functions that can modify themselves so very useful for self 'learning' routines. But this is more advanced stuff and there are people that can explain this far more better than me.

  • Like 3

Share this post


Link to post
Share on other sites
Lee Mac

@rlx has pretty much covered it, but I've also posted an explanation here which you may find useful.

Edited by Lee Mac
  • Like 1

Share this post


Link to post
Share on other sites
Sheep

thanks you. i need to learn more.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...