Search found 11 matches
- Thu Dec 15, 2011 8:21 am
- Forum: Common Lisp
- Topic: Implementing "last" with do*
- Replies: 19
- Views: 31140
Re: Implementing "last" with do*
Ok,all right! Thank you Well, actually, BUTLAST has an optional 2nd argument that lets you say "but the last n elements". Be that as it may, this solutions is actually just incorrect. It relies on the assumption that all elements in the list are unique. SET-DIFFERENCE is for taking the dif...
- Thu Dec 15, 2011 5:27 am
- Forum: Common Lisp
- Topic: Implementing "last" with do*
- Replies: 19
- Views: 31140
Re: Implementing "last" with do*
Soluciòn interesante, no conocìa la funciòn "set-difference". Pero suppongo que no hay manera de hacerlo por "los ultimos n".sw2wolf wrote:(set-difference '(1 2 3 4 5 6 7) (butlast '(1 2 3 4 5 6 7)))
- Sun Dec 11, 2011 12:41 pm
- Forum: Common Lisp
- Topic: Implementing "last" with do*
- Replies: 19
- Views: 31140
Re: Implementing "last" with do*
I don't why..but I was thinking the code you just wrote is the SAME I tried (without success) in the beginning.. ...however it works! Thank you List isn't a keyword, but it does happen to be the name of a common function. But call your variables what you wish. I think you are confused on how the equ...
- Sun Dec 11, 2011 6:39 am
- Forum: Common Lisp
- Topic: Implementing "last" with do*
- Replies: 19
- Views: 31140
Re: Implementing "last" with do*
Well... 1) About your function: WORKS (but I changes list to LISTA , because "list" is a KEY-WORD ). Just I don't understand: how can it works? equal match pointers... 2 integers are supposed to be the same if they are the same object..not the same value.. Indeed, I used EQL and it works f...
- Sun Dec 11, 2011 5:54 am
- Forum: Common Lisp
- Topic: Implementing "last" with do*
- Replies: 19
- Views: 31140
Re: Implementing "last" with do*
Yeah. Thank you for the very exaustive explanation. However I'm doing a BASIC common list course at university...but the info you gave me will be useful (and I will save them on my PC) because I'm (and I will keep) studying A.I. . (I don't well how to format the code..etc..I'm a "novice" o...
- Sun Dec 11, 2011 4:33 am
- Forum: Common Lisp
- Topic: Implementing "last" with do*
- Replies: 19
- Views: 31140
Re: Implementing "last" with do*
(Sorry for double reply) I tried to update the code to handle "last n elements". I know it give INFINITIVE LOOP because I will go matching NIL with NIL. But how to save the lenght of the list t to match it? For example: - I pass list of 7 elements: ' (1 2 3 4 5 6 7) - I want last 4 element...
- Sun Dec 11, 2011 4:19 am
- Forum: Common Lisp
- Topic: Implementing "last" with do*
- Replies: 19
- Views: 31140
Re: Implementing "last" with do*
ok thank you. But is not supposed to be "automatically" done by the compiler?
I mean new compilers optimize the code
I mean new compilers optimize the code
- Sat Dec 10, 2011 9:08 pm
- Forum: Common Lisp
- Topic: Implementing "last" with do*
- Replies: 19
- Views: 31140
Re: Implementing "last" with do*
I cannot understand what you mean with "replace the line".
I don't see any way to replace that line...is the "end condition" (recursion is based on: end case , recursive call. No?)
I don't see any way to replace that line...is the "end condition" (recursion is based on: end case , recursive call. No?)
- Sat Dec 10, 2011 2:36 pm
- Forum: Common Lisp
- Topic: Implementing "last" with do*
- Replies: 19
- Views: 31140
Re: Implementing "last" with do*
thank you very much!!
Very useful
Any hints to make the "full" version? (the one which returns "last n elements")
Very useful

Any hints to make the "full" version? (the one which returns "last n elements")
- Sat Dec 10, 2011 12:42 pm
- Forum: Common Lisp
- Topic: Implementing "last" with do*
- Replies: 19
- Views: 31140
Implementing "last" with do*
Hello everyone. I'm trying to implement ITERATIVE "last" function. But it doesn't seem to work. It is important I use do* . However if you have any suggestion of good "alternatives" it's ok! I know "last" function accepts &optional n , but this is a "simplified...