Search found 133 matches
- Wed Oct 25, 2017 12:33 pm
- Forum: Common Lisp
- Topic: delete does not work
- Replies: 12
- Views: 39486
Re: delete does not work
Repeated REMOVE or DELETE is O(n^2) regardless (unless you supply count it must walk the whole list for each call) The right way to empty a list is always a loop over POP Absolutely not.. Im talking about space complexity and not time! Remove n times is O(n^2) space since it makes n copies of every...
- Tue Oct 24, 2017 4:19 pm
- Forum: Common Lisp
- Topic: delete does not work
- Replies: 12
- Views: 39486
Re: delete does not work
If delete always mimic remove and at the same time does not always modify the original list - what is the point of having the delete functions???? Imagine this code: (defparameter *lst* (list 1 2 3)) (delete 1 (list 1 2 3)) (delete 1 *lst*) (delete 2 (list 1 2 3)) (delete 2 *lst*) Now since delete ...
- Mon Oct 23, 2017 4:11 pm
- Forum: Common Lisp
- Topic: Parsing a string.
- Replies: 3
- Views: 9834
Re: Parsing a string.
*read* is for reading list structure and literals as in actual lisp source code. The syntax decides what type the end result will have. *read-line* reads a line of text and returns it as a string not matter what the input looks like. *read-char* read one character and returns it as such. You might w...
- Mon Oct 02, 2017 7:54 am
- Forum: Homework
- Topic: loop through forms in a macro
- Replies: 3
- Views: 16156
Re: loop through forms in a macro
The macro gets the code unevaluated and you should use that when making the output, but the forms also needs to be in the resulting code, wrapped in time. Here is one way to do it: (defmacro time-many (&body forms) `(progn ,@(loop :for form :in forms :collect `(princ ,(format nil "Timing: ~...
- Sun Sep 24, 2017 2:05 pm
- Forum: The Lounge
- Topic: I need help to convert LISP code to MATLAB
- Replies: 1
- Views: 13567
Re: I need help to convert LISP code to MATLAB
I guess its perfectly ok to hire people in the loungue
- Mon Sep 18, 2017 6:26 am
- Forum: Homework
- Topic: Determine number of arguments for a function
- Replies: 8
- Views: 27769
Re: Determine number of arguments for a function
Proper CLISP??? CLISP is not a synonym for Common Lisp. CLISP is one of many Common Lisp implementations and just like SBCL or CCL. As with all implementations they might be a superset and sure enough arglist is defined in it, but it doesn't make it more portable. [1]> (defpackage :test (:use :cl)) ...
- Mon Sep 18, 2017 2:58 am
- Forum: Homework
- Topic: Determine number of arguments for a function
- Replies: 8
- Views: 27769
Re: Determine number of arguments for a function
No it's not.. It locks you in to one implementation. Thus you are no longer writing Common Lisp but CCLs superset of Common Lisp. It's very unfortunate!
BTW: Are you sure this is not a XY problem? What are you going to use this for?
BTW: Are you sure this is not a XY problem? What are you going to use this for?
- Sat Sep 16, 2017 4:41 pm
- Forum: Homework
- Topic: Determine number of arguments for a function
- Replies: 8
- Views: 27769
Re: Determine number of arguments for a function
What do you expect the result for these are?
Also, the name args? seems like you are doing a predicate and like Scheme naming conventions.
Code: Select all
(lambda (a &rest rest) rest)
(lambda (a &optional b) b)
(lambda (a &key (a 4) b c) c)
- Fri Sep 15, 2017 7:48 am
- Forum: The Lounge
- Topic: hello, i find "LISP" to be frustrating
- Replies: 5
- Views: 24351
Re: hello, i find "LISP" to be frustrating
With fresh unbiased eyes? Do you mean this is your very first programming language? Then this would be much easier than us people who has learned Algol first. If you have learned an algol dialect then it will be as learning a new natural language with LOTS of false friend words. As with flavors ther...
- Tue Jun 06, 2017 4:32 pm
- Forum: Common Lisp
- Topic: Passing commands to a function
- Replies: 2
- Views: 10117
Re: Passing commands to a function
This doesn't seem like a Common Lisp question.
It seems like the cond has a symbol as its last term.. every term should be a list with at least a predicate.. eg (t) would be the minimum to return t
It seems like the cond has a symbol as its last term.. every term should be a list with at least a predicate.. eg (t) would be the minimum to return t