libera/#commonlisp - IRC Chatlog
Search
12:30:52
didi
Can I reliably compare functions for equality? I want to write a function that internally uses a hashtable (for performance) if a certain parameter is (member eq eql equal equalp), so I need to know if the parameter is one of these, otherwise I will not use the hashtable.
12:33:06
White_Flame
however, if you're looking at parameters to make-hashtable, that takes function designators, which would be a symbol, too
13:12:58
_death
didi: note that the result of, say, (lambda () 42) may or may not be EQ to previous results obtained by its evaluation
16:52:45
didi
Is there a function to map sequence elements which accepts the arguments :start, :end, and :from-end? I'm using `find-if' with a predicate that always returns nil, but it feels wrong. `map' is the obvious candidate, but I need to `subseq' and `nreverse' the input sequence myself.
16:59:47
jackdaniel
didi: find-if is a very nice solution to this if you don't expect more than a one sequence
16:59:59
jackdaniel
(setf (fdefinition 'map*) (curry #'find-if (constantly nil))) will wrap it nicely for you
17:09:56
didi
jackdaniel: In (setf (fdefinition 'map*) (curry #'find-if (constantly nil))), how do you process each element? I mean, the predicate is only a constant function. Mine is something like (lambda (x) (process x) nil).
17:15:29
_death
probably meant something like (lambda (f xs &rest args) (apply #'find-if (conjoin f (constantly nil)) xs args))
17:20:19
mgl
Is it possible to find the name of the defun/defmacro/etc in which a macro is being expanded? I only had a quick look at cltl2 lexical environments ... maybe it's there?
17:23:37
_death
I guess you could write compiler-specific code to find it out (if it's even there) but probably the ordinary solution (still rare) would be to have your own defun/defmacro/etc. macros that allow the code to keep track of this
18:25:34
pjb
(map 'vector (lambda (indicator value) (when indicator value)) (mapcar (range 3 5) (iota 10)) (iota 10)) #| --> #(nil nil nil 3 4 5 nil nil nil nil) |#
18:25:36
nij-
Is there an inspector that shows the details of objects in the web, and hopefully updates itself every second?
18:32:57
pjb
nij-: http://hubble.informatimago.com:8116 create yourself a login typing: new then connect, then type (inspect *package*) or any other object.
18:37:29
_death
maybe a short path would be to use clog to render swank-fancy-inspector's emacs-inspect output and take a few commands
19:11:07
pjb
didi: I answerd to your question "Is there a function to map sequence elements which accepts the arguments :start, :end, and :from-end?" (defun map-sequence (rtype fun sequence &key (start 0) end &aux (end (or end (length sequence)))) (map rtype fun (remove-if-not (range start end) sequence))) (map-sequence 'vector 'identity (iota 10) :start 3 :end 5) #| --> #(3 4 5) |#
19:12:00
pjb
didi: Note that in general :from-end doesn't mean reverse or right to left processing in the other sequence functions. It just mean semantically right-most result.
19:12:26
pjb
so a find :from-end could actually scan from left to right and just return the last result.
21:05:32
minion
liminality: please look at pcl: pcl-book: "Practical Common Lisp", an introduction to Common Lisp by Peter Seibel, available at http://www.gigamonkeys.com/book/ and in dead-tree form from Apress (as of 11 April 2005).
21:05:34
minion
liminality: paip: Paradigms of Artificial Intelligence Programming. More about Common Lisp than Artificial Intelligence. Now freely available at https://github.com/norvig/paip-lisp
21:06:13
jackdaniel
if you want to learn ~contemporary common lisp go after PCL, if you want to be walked over some cool programs go after PAIP
21:07:11
jackdaniel
meh, there is also a book "ANSI Common Lisp" by Paul Graham - it is a bit on the boring side (in a good way!) - a very good learning material with excercises
21:08:20
jackdaniel
there is ANSI Common Lisp (the standard) and there is a book that aims at teaching ANSI Common Lisp
21:09:05
jackdaniel
(mind that while PCL and PAIP are available on the internet to read, you'll need to buy Paul Graham's book)