Search
Tuesday, 9th of April 2019, 21:37:16 UTC
21:58:17
t58
Hey I'm using slime with emacs is there a shortcut to close all the open parens? I'm sure there was one like C-c C-q or something like that but I can't find any reference to it online.
22:11:07
LiamH
If you use insert-parentheses, you always get your close paren with your open paren.
22:17:43
White_Flame
and paredit is highly recommended, nearly always keeping things balanced (except for cut'n'paste)
22:18:04
White_Flame
including doublequotes, moving parens out of comments, etc
22:24:28
t58
hmm paredit seems interesting I'll take a look thanks
2:57:16
beach
Good morning everyone!
4:08:25
p0a
Is sbcl + emacs slime the right way to go about writing CL in debian?
4:08:35
p0a
I'm familiar with emacs but it's been so long I've done some CL that I don't know what' sup
4:09:26
beach
I don't know about Debian in particular, but that combination is probably the most frequently used by #lisp participants.
4:09:50
p0a
beach: and quicklisp right?
4:19:08
beach
p0a: What kind of programs are you planning to write?
4:21:30
p0a
beach: I want to record some numbers from shapes in the plane
4:21:40
p0a
beach: for example, generate a random triangle, record its angles. something like that
4:22:13
beach
I think I understand.
4:23:14
p0a
It won't be deep stuff unfortunely. It's just that CL is convenient for me
4:23:27
p0a
because I don't like having to use all the different syntaxes there are out there
4:24:51
p0a
I have to go, thanks for the help
4:35:23
p0a
Hello again, why is slime-mode not indending my code? I tried to load slime-fancy...
4:53:11
loke
p0a: are you pressing TAB to indent
4:55:02
p0a
loke: I was being silly and not using `lisp-mode'! sorry!
5:04:49
p0a
How can I LOOP over three lists simultaneously?
5:05:07
p0a
(loop for i in list1 ... j in list2 ... etc)
5:05:22
p0a
but I don't want to have them run concurrently. I realize I can have 3 loop macros but I'm just wondering
5:05:36
beach
You want them nested?
5:05:41
beach
Then you nest your LOOP.
5:06:08
beach
If you describe your problem more in detail, it might be easier to help.
5:06:26
p0a
I want to loop over a list L with three variables i, j,k and collect (list i j k)
5:06:42
p0a
I don't mind some repeats
5:06:51
beach
Loop over three lists or one list?
5:07:12
beach
So you want all combinations of three elements?
5:07:45
beach
If the list is (a b c d) you want ((a a a) (a a b) (a b a)...)?
5:08:04
p0a
Ideally I'd like only unique ones but I can filter them later
5:08:18
beach
You need three nested loops then.
5:08:21
p0a
i.e. (a b c) (a b d) (b c d) (a c d)
5:09:00
p0a
but my collect's will be nested
5:09:22
p0a
I can flatten later but is it easy to do it inside loop?
5:09:32
beach
(loop with result = '() for i in list do (loop for j in list do (loop for k in list do (push (list i j k) result))) finally (return result))
5:10:38
beach
With some slight variation, you could uniquify at the same time.
5:10:59
loke
you could also use nconc
5:11:15
p0a
sounds like n-concatenate?
5:11:38
loke
(loop for ... nconc (loop ... nconc (loop ... collect (list i j k))))
5:12:15
loke
Just in case you don't want push on result
5:12:53
p0a
so that's part of the macro, nice
5:21:29
beach
p0a: (loop for (i . ii) on list nconc (loop for (j . jj) on ii nconc (loop for k in jj collect (list i j k))))
5:21:51
beach
That way you don't have to uniquify afterwards.
5:25:07
p0a
huh not sure what you did there
5:25:49
p0a
also, is there a way to check if a list of bools is all true without REDUCEing over AND?
5:26:57
p0a
Maybe I can just use loop actually
5:28:18
loke
p0a: You can't reduce over AND (and is a special form)
5:28:26
specbot
http://www.lispworks.com/reference/HyperSpec/Body/f_everyc.htm
5:28:32
loke
What you want is EVERY
5:28:44
loke
(every #'identity LIST)
5:29:08
p0a
I can use NEVER or EVERY, nice, thank you
5:29:16
beach
p0a: All I did was to use the remaining list in the nested loops, rather than the entire list.
5:30:08
p0a
so what about the previous values ?
5:30:34
p0a
ooh that's qhy it's unique, nice
5:35:29
p0a
beach: that's very nice, thanks!
5:35:58
p0a
I now understand that you're using `on' to go through the list one cdr at a time
5:49:25
p0a
alright, have to go. Thank you a lot
6:39:16
pjb
(defun combinations (list n) (cond ((zerop n) '()) ((= 1 n) (mapcar (function list) list)) (t (mapcan (lambda (rest) (mapcan (lambda (first) (list (cons first rest))) list)) (combinations list (1- n)))))) (combinations '(a b c) 3) #| --> ((a a a) (b a a) (c a a) (a b a) (b b a) (c b a) (a c a) (b c a) (c c a) (a a b) (b a b) (c a b) (a b b) (b b b) (c b b) (a c b) (b c b) (c c b) (a a c) (b a c) (c a c) (a b c) (b b c) (c b c) (a
6:52:10
splittist
top o' the mornin'
7:01:02
splittist
loke: http://dialectblog.com/2011/06/27/top-o-the-morning-myth-and-reality/
7:40:15
Josh_2
top 'o the mornin to ya splittist
Wednesday, 10th of April 2019, 9:37:16 UTC