libera/#commonlisp - IRC Chatlog
Search
8:10:57
White_Flame
prokhor_: you could try defining ?pred1 and ?val1 prolog vars and using those in your expression
8:14:32
prokhor_
nice idea! but doesnt that just postpone the problem? (i would like to have masks like '((?pred ?var &?vars)) to make assertions from input...
8:15:02
hayley
White_Flame: Having PRED1 be a variable would be second-order logic, right? Dunno LispWorks but Prolog is all first-order to my knowledge.
8:20:16
beach
bitblit1: Why are you asking me about the LAMBDA syntax? I suggested nothing with lambda in it. Or was this just an unrelated question?
8:26:22
ogamita
Josh_2: the alternative is only a formal change: use a ~/ formatting function to indent. Something like this: https://termbin.com/y2og
8:26:44
ogamita
Josh_2: but cl-user::indent-object will do the prin1-to-string and split-sequence, etc.
8:27:34
ogamita
bitblit1: (com.informatimago.common-lisp.cesarum.sequence:group-by '(9 2 7 8 4 1 0 4 6 3) 2) #| --> ((9 2) (7 8) (4 1) (0 4) (6 3)) |#
8:36:10
White_Flame
hayley: if ?pred1 is bound, as I believe is the desired case here, it shouldn't be a problem
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.