Search found 15 matches

by White_Owl
Wed Oct 25, 2017 2:54 pm
Forum: Common Lisp
Topic: delete does not work
Replies: 12
Views: 19358

Re: delete does not work

The DELETE functions are intended as a possible optimisation, an optimisation that no longer really makes sense. Well... That does look plausible. Well, after reading all these posts I came to a conclusion: Do not use DELETE. Use (setf list (remove item list)) . That would be much more reliable bet...
by White_Owl
Tue Oct 24, 2017 12:18 pm
Forum: Common Lisp
Topic: delete does not work
Replies: 12
Views: 19358

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????
by White_Owl
Tue Oct 24, 2017 10:49 am
Forum: Common Lisp
Topic: delete does not work
Replies: 12
Views: 19358

delete does not work

C:>clisp ... Welcome to GNU CLISP 2.49 (2010-07-07) <http://clisp.cons.org/> ... [1]> (setf lst '(1 2 3)) (1 2 3) [2]> (delete 1 lst) (2 3) [3]> lst (1 2 3) [4]> (delete 2 lst) (1 3) [5]> lst (1 3) [6]> (delete 1 lst) (3) [7]> lst (1 3) [8]> But I do not see any mentioning about first element in th...
by White_Owl
Tue Oct 24, 2017 7:21 am
Forum: Common Lisp
Topic: Parsing a string.
Replies: 3
Views: 5597

Re: Parsing a string.

Thank you...
Found two solutions: First is smaller. Second is more flexible.
by White_Owl
Mon Oct 23, 2017 1:56 pm
Forum: Common Lisp
Topic: Parsing a string.
Replies: 3
Views: 5597

Parsing a string.

I have a file with format like text-a1 text-b1 1 text-a2 text-b2 2.98 text-a3 text-b3 3.6 Doing the reading like this: (defun myload (file-name) (let ((t1) (t2) (n)) (with-open-file (in file-name :direction :input :if-does-not-exist :error) (loop for line = (read-line in nil) while line do (progn (w...
by White_Owl
Wed Oct 04, 2017 9:29 am
Forum: Common Lisp
Topic: Pick and remove
Replies: 6
Views: 9361

Pick and remove

I want to pick an element from the list by position and remove that element from the list. Something like: (defun pick (index list) (let ((e)) (setf e (nth index list)) (delete e list :start index :end (1+ index)) e)) (defvar *mylist* '(a b c d e)) => *MYLIST* (pick 2 *mylist*) => C *mylist* => (A B...
by White_Owl
Mon Oct 02, 2017 8:26 am
Forum: Homework
Topic: loop through forms in a macro
Replies: 3
Views: 5599

Re: loop through forms in a macro

Thank you guys.
I think, I understand it now a little better...
by White_Owl
Fri Sep 29, 2017 3:28 pm
Forum: Homework
Topic: loop through forms in a macro
Replies: 3
Views: 5599

loop through forms in a macro

The task: Time is a macro that can be wrapped around any Lisp call to time how long it takes. It will print out various statistics: (time (sleep 2)) Write a macro (time-many &body forms) that is like TIME but takes multiple forms as arguments. For each argument, it first prints the form being timed ...
by White_Owl
Mon Sep 18, 2017 2:55 pm
Forum: Homework
Topic: Determine number of arguments for a function
Replies: 8
Views: 11396

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))...
by White_Owl
Mon Sep 18, 2017 4:38 am
Forum: Homework
Topic: Determine number of arguments for a function
Replies: 8
Views: 11396

Re: Determine number of arguments for a function

sylwester wrote: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!
The only change required for making it a proper CLISP is to remove ccl prefix from arglist function