Search found 18 matches

by Ajschylos
Sun Jan 25, 2009 3:39 pm
Forum: Common Lisp
Topic: pos+ function from Paul Graham's "ANSI Common Lisp"
Replies: 12
Views: 11714

Re: pos+ function from Paul Graham's "ANSI Common Lisp"

Hi 'Ramarren', thanks a lot for your comment. It's quite new for me that there exist so useful packages in CL. I am working on some hard problem intersecting fields like Number Theory, Algebra and Combinatorics. I have chosen LISP because of its power of expression (which is still difficult for me t...
by Ajschylos
Sun Jan 25, 2009 2:23 am
Forum: Common Lisp
Topic: pos+ function from Paul Graham's "ANSI Common Lisp"
Replies: 12
Views: 11714

Re: pos+ function from Paul Graham's "ANSI Common Lisp"

Thank you, that's really piece of beautiful code.
A.
by Ajschylos
Sat Jan 24, 2009 7:24 am
Forum: Common Lisp
Topic: pos+ function from Paul Graham's "ANSI Common Lisp"
Replies: 12
Views: 11714

Re: pos+ function from Paul Graham's "ANSI Common Lisp"

Great thanks for your comment. Now I understand better.
by Ajschylos
Sat Jan 24, 2009 1:22 am
Forum: Common Lisp
Topic: pos+ function from Paul Graham's "ANSI Common Lisp"
Replies: 12
Views: 11714

Re: pos+ function from Paul Graham's "ANSI Common Lisp"

Hi,
unfortunately none of your solutions works properly except the last one.
I mean the print the list of successive numbers starting from one ending on the length of the list.

The last one I treat as iterative solution.
by Ajschylos
Fri Jan 23, 2009 2:56 pm
Forum: Common Lisp
Topic: pos+ function from Paul Graham's "ANSI Common Lisp"
Replies: 12
Views: 11714

pos+ function from Paul Graham's "ANSI Common Lisp"

Hi, I've tried to solve an exercise 5 from page 57 that is: "Suppose the function pos+ takes a list and returns a list of each element plus it's position: > (pos+ '(7 5 1 4)) (7 6 3 7) Define this function using (a) recursion, (b) iteration, (c) mapcar." (a) and (b) are straightforward, but (c) I so...
by Ajschylos
Fri Jan 09, 2009 6:13 am
Forum: Common Lisp
Topic: Pairing elements from list - MAPCAR version
Replies: 4
Views: 3519

Re: Pairing elements from list - MAPCAR version

Thank you, this is a piece of beautiful code indeed. I've found solution very similar: (defun par-mul (l) (mapcon #'(lambda (sub) (mapcar #'(lambda (x) (* x (first sub))) sub)) l) ) I must analyze the difference between two approaches. Thank's a lot. Adam.
by Ajschylos
Wed Jan 07, 2009 10:46 pm
Forum: Common Lisp
Topic: Pairing elements from list - MAPCAR version
Replies: 4
Views: 3519

Re: Pairing elements from list - MAPCAR version

I am very sorry nuntius, the code I posted earlier works of corsue if "wynik" is global variable,
now I changed code so that function should return the list. That was my mistake. Adam.
by Ajschylos
Wed Jan 07, 2009 1:03 pm
Forum: Common Lisp
Topic: Pairing elements from list - MAPCAR version
Replies: 4
Views: 3519

Pairing elements from list - MAPCAR version

Hi everybody, I've started learning LISP again after several unsuccessful attempts, but now I gain some progress. I am stuck with the problem: Input: list of consecutive primes i.e. '(2 3 5 7 11) Output: list of their pairwise products without duplication '(4 6 10 14 22 9 15 21 33 25 35 55 49 77 121...