Jump to content

please explain me in this code?


hamidciv

Recommended Posts

hi dear friends

please if possible explain me this code that how do this? my problem understand Commands this code.

(foreach str (reverse '("adam" "ben" "claire" "david")) (setq lst (cons (strcase str) lst)) )

returns:

("ADAM" "BEN" "CLAIRE" "DAVID")??????????

thanks

Link to comment
Share on other sites

dear lee mac ,I've this code into your tutorial, in this code for foreach we define: one variabe (str) , one list and functions, i have 1 question of you:

2-(cons (strcase str) lst) what do?( are it store string?)

if your possible please general description of process code tell me.

thanks a lot

Edited by hamidciv
Link to comment
Share on other sites

2-(cons (strcase str) lst) what do?( are it store string?)

 

Rather than me explaining this small & simple snippet of code in great detail - I think it is far better that I recommend a good method to use when attempting to understand any section of code in general.

 

Firstly, dissect the code expression-by-expression from the innermost expression outwards - as this is how AutoLISP is evaluated.

 

For each expression, make sure you are aware of the value held by each variable or symbol referenced by the code.

 

Read the developer documentation for every function that you are not familiar with, and ensure that you understand the arguments required by each function, and the values that each function returns.

 

Here is the documentation for the functions in question:

 

reverse

foreach

strcase

cons

setq

 

A link to the main AutoLISP function reference (and other programming references) may be found on my site here.

 

Lee

Link to comment
Share on other sites

thanks dear lee

I took a few hours and I've understood the code.

i thanks infinitely for tutorial putted in your site.

i learned autolisp relatively, Do you recommend I'm starting to learn Visual LISP, Or continue the autolisp until an advanced stage?

Are Autolisp satisfies all the requirements of programming in AutoCAD or Visual LISP is also a need to learn?

thanks a lot

Link to comment
Share on other sites

thanks dear lee

I took a few hours and I've understood the code.

i thanks infinitely for tutorial putted in your site.

 

That's excellent to hear - you're most welcome hamidciv.

 

i learned autolisp relatively, Do you recommend I'm starting to learn Visual LISP, Or continue the autolisp until an advanced stage?

Are Autolisp satisfies all the requirements of programming in AutoCAD or Visual LISP is also a need to learn?

 

Firstly, please note that Visual LISP is not a replacement for 'Vanilla' AutoLISP, but rather an extension. With this in mind, I would personally recommend becoming entirely proficient in AutoLISP before moving into Visual LISP, as a solid foundation in AutoLISP will be immensely beneficial should you wish to venture into areas such as using Visual LISP Reactors for which your programming will need to be absolutely watertight.

Link to comment
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...