libera/#commonlisp - IRC Chatlog
Search
6:09:12
bitblit1
pjb: How would I modify that to make it permutations of a list. I thought of binary but that has repitition?
6:18:16
bitblit1
What is the easy way of grouping a list into sublists for e.g: '(9 2 7 8 4 1 0 4 6 3) in groups of 2 => '((9 2) (7 8) (4 1)...)
6:23:09
bitblit1
Thanks beach However, this is dependent on the cddr function, if we wanted to lets say take pairs of 12 that would be really difficult
6:27:27
bitblit1
beach: I wanted to make something dynamic which pairs depending on a number in this case (list x y z) is also not dependent
6:55:32
prokhor_
i have a question specific on "common prolog" from lispworks but it follows cl implementation rules: I have an assertion like: (assert ((color red))) which gives: (color red) -> YES now i would like to know how how i could do sth like: (setq pred1 human) (setq val1 socrates) and (assert ((pred1 val1))
6:57:07
prokhor_
if i do like above, it takes the var names literally and does not fill in the values associated (i.e. it uses the symbol slot (?))
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).