hamidciv Posted September 27, 2014 Share Posted September 27, 2014 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 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 27, 2014 Share Posted September 27, 2014 Please refer to my tutorial: Mapcar & Lambda Which part of the code do you not understand? Quote Link to comment Share on other sites More sharing options...
hamidciv Posted September 27, 2014 Author Share Posted September 27, 2014 (edited) 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 September 27, 2014 by hamidciv Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 27, 2014 Share Posted September 27, 2014 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 Quote Link to comment Share on other sites More sharing options...
hamidciv Posted September 27, 2014 Author Share Posted September 27, 2014 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 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 27, 2014 Share Posted September 27, 2014 thanks dear leeI 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. Quote Link to comment Share on other sites More sharing options...
hamidciv Posted September 28, 2014 Author Share Posted September 28, 2014 dear lee Thank you very much for your excellent advice to me. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 28, 2014 Share Posted September 28, 2014 You're welcome hamidciv. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.