Search found 61 matches

by Kohath
Sun Jun 17, 2018 3:24 am
Forum: Common Lisp
Topic: program correction
Replies: 1
Views: 3624

Re: program correction

Dear scridondarius Please use the code tag: (defun C:radius (/ OR_OPEN OR_CLOSE filter ss tent telem tcontent telemupper n) ; retrieve the selection set containing both ; single and multiline text objects (setq filter (list '(0 . "CIRCLE")) ss (ssget "X" filter)) ; iterate over the selection set (se...
by Kohath
Fri May 22, 2015 4:22 pm
Forum: Common Lisp
Topic: Lisp for trimming/breakine a polyline or Line
Replies: 2
Views: 4305

Re: Lisp for trimming/breakine a polyline or Line

It sounds like you might be talking about AutoCAD's lisp called AutoLisp. Note: AutoLisp ≠ Common Lisp. Try posting in the Other Dialects section: viewforum.php?f=29
by Kohath
Fri Apr 17, 2015 5:33 am
Forum: Common Lisp
Topic: Conditional branching with more then one line of code
Replies: 3
Views: 4631

Re: Conditional branching with more then one line of code

And don't forget progn's lookalikes prog1 and prog2. I've found them useful once or twice. :o
by Kohath
Sun Feb 08, 2015 9:29 pm
Forum: Common Lisp
Topic: Macros multiple return values
Replies: 3
Views: 4964

Re: Macros multiple return values

I don't quite get what you're asking, but some comments: Code produced by macros can return as many values as you want. You can do what you want in the second line of your examples with multiple-value-list . As for a macro returning multiple forms, I think 0 return values will get converted to one r...
by Kohath
Thu Jan 29, 2015 5:02 am
Forum: Common Lisp
Topic: what code/packages do i need to start on ai?
Replies: 1
Views: 5594

Re: what code/packages do i need to start on ai?

Hi Leck, welcome to LispForum. It seems as though you're getting many views but no replies :(. I don't know enough to answer your questions, but I'd say Common Lisp is up there on the hypothetical list of best programming languages for AI. So, thoughts on topics you mention: Electronic eye: You'll p...
by Kohath
Sun Jan 18, 2015 4:43 pm
Forum: Common Lisp
Topic: Passing arguments to find-if
Replies: 4
Views: 5129

Re: Passing arguments to find-if

It's probably a confusion around Lisp-1 vs Lisp-2 ( http://en.wikipedia.org/wiki/Common_Lisp#The_function_namespace ). You are writing in Lisp-1 style, like Scheme. To fix it, call the passed function with funcall : (defun look-up (key field-func table) (find-if #'(lambda (x) (equal (funcall field-f...
by Kohath
Sun Jan 18, 2015 3:27 pm
Forum: Common Lisp
Topic: Need help with lisp list to macro arguments for compiler.
Replies: 4
Views: 6553

Re: Need help with lisp list to macro arguments for compiler

Okay, so the original problem was that you start with a macro that accepts code ( body ), but then you want to store that code in a list first. Lisp can do that, but you'd have to use eval I think. So to avoid that, please try something like this: (defun fn-def-pattern (c-visibility c-ret-type c-nam...
by Kohath
Sun Jan 18, 2015 5:44 am
Forum: Common Lisp
Topic: Need help with lisp list to macro arguments for compiler.
Replies: 4
Views: 6553

Re: Need help with lisp list to macro arguments for compiler

Please take the following in your stride and keep going with Lisp, as it's well worth the effort. But this may hurt. ;) General Dissarray, first I'd suggest using functions to make it easier to work with (IMHO). Rather than having bodies, you can pass a function, much like using mapcar instead of lo...
by Kohath
Tue Aug 19, 2014 9:37 pm
Forum: Common Lisp
Topic: is there a way to see the expanded form of a macro?
Replies: 4
Views: 4951

Re: is there a way to see the expanded form of a macro?

Cheers, glad I could help. :idea: Many times it will be clearer when you know whether you're using a macro or a function (or a special form for that matter). Function calls all have standard evaluation rules, but macros can do what they want with evaluation (like not evaluate code in the case of mac...
by Kohath
Mon Aug 18, 2014 10:54 pm
Forum: Common Lisp
Topic: is there a way to see the expanded form of a macro?
Replies: 4
Views: 4951

Re: is there a way to see the expanded form of a macro?

One other thing, I wrote this little helper macro to make expanding macros easy and readable: (defmacro mac (form) `(pprint (macroexpand-1 ',form))) The reason it's a macro is so that you don't have to quote the code you copy in (like you have to with macroexpand and macroexpand-1). Used like so: (m...