Search found 538 matches

by nuntius
Wed Feb 20, 2019 10:27 pm
Forum: Common Lisp
Topic: Using &rest parameters in Common Lisp
Replies: 3
Views: 33367

Re: Using &rest parameters in Common Lisp

You probably want something like this.

Code: Select all

(defun func-one (&rest params)
  (let ((value-a ...)
        (value-b ...)
    (apply 'func-two (cons value-a (cons value-b params)))
  ...))
by nuntius
Tue Dec 18, 2018 7:01 pm
Forum: Books and Resources
Topic: cartesian coordinates system
Replies: 2
Views: 25522

Re: cartesian coordinates system

What operations are you looking for? How many dimensions? What does this library integrate with? On one hand, there are simple roll-your-own solutions, such as the complex coordinate system in SICP. https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book-Z-H-17.html On the other hand, ...
by nuntius
Sat Nov 10, 2018 3:21 pm
Forum: Homework
Topic: Add 1 to the middle element of a list
Replies: 2
Views: 30053

Re: Add 1 to the middle element of a list

Construct a new list. Include the original head, new middle, and original tail.

There are ways to destructively modify the middle value in the original list (setf ...), but I think the new list is what your instructor is looking for.
If done right, the amount of code is about the same either way.
by nuntius
Sun Sep 02, 2018 12:47 pm
Forum: Homework
Topic: Product function
Replies: 2
Views: 23352

Re: Product function

There are a few ways to do this.

I would guess that you are supposed to use recursion for complex forms.

In other words, have the product function call product on smaller pieces of the input.
by nuntius
Sat Aug 18, 2018 3:55 am
Forum: Homework
Topic: function which builds, from a list, a list without the eleme
Replies: 1
Views: 21226

Re: function which builds, from a list, a list without the e

Things to look at / fix: called REMOVE instead of MY-REMOVE hard-coded #\R instead of using the passed parameter pass a character to remove instead of a quoted symbol (#\r vs 'r) run (string 'nose) and look at the capitalization of the result P.S. The forum strips backslashes. Double-backslash is co...
by nuntius
Wed Aug 15, 2018 8:39 pm
Forum: Common Lisp
Topic: Paul Graham style LISP/the LISP Way or Avoiding the CLOS
Replies: 2
Views: 45385

Re: Paul Graham style LISP/the LISP Way or Avoiding the CLOS

It sounds to me like you are asking how to do type-based function dispatch in Lisp. My recommendation is simple. If your goal is to write applications, then start with CLOS (or the native object system of your Scheme) and only switch if you hit some limit, at which point you will have identified spe...
by nuntius
Thu Mar 22, 2018 8:07 pm
Forum: The Lounge
Topic: Re-evaluating expression
Replies: 3
Views: 28047

Re: Re-evaluating expression

In LISP, afaik, eval uses null lexical environment and current dynamic environment Agreed. so a function argument (parameters are lexical) cannot be re-evaluated inside a function. I think I follow your question. Common Lisp evaluates function arguments in the calling context, before the function i...
by nuntius
Wed Mar 21, 2018 8:02 pm
Forum: The Lounge
Topic: Re-evaluating expression
Replies: 3
Views: 28047

Re: Re-evaluating expression

I had to read the full "Yacas evaluation scheme" on the linked page to understand the quoted statement. Back in the "good old days" (so I'm told), things like scoping rules were not taken for granted, and there were many ideas for how a variable name is mapped to a memory locatio...
by nuntius
Thu Oct 19, 2017 6:06 pm
Forum: Other Dialects
Topic: transferring multi-texts from cad to excel sequentially
Replies: 1
Views: 27187

Re: transferring multi-texts from cad to excel sequentially

I'm no AutoLisp expert, but I believe that (assoc 0 xcx) will return "TEXT", and (assoc 1 xcx) will return the desired text value. Use these in the strcat function as desired. http://www.jefferypsanders.com/autolispexp_enti.html#Text https://www.autodesk.com/techpubs/autocad/acad2000/dxf/t...
by nuntius
Thu Oct 05, 2017 8:09 pm
Forum: Common Lisp
Topic: Pick and remove
Replies: 6
Views: 18645

Re: Pick and remove

There are cases where the consing is quite cheap. For example, a single pick, or if the pick index is always small. Don't know enough about the OP's use case to say one way or the other. Maybe he should copy the whole list into an array. Then pick becomes aref or svref. ;) Much better amortized time...