libera/#commonlisp - IRC Chatlog
Search
10:19:31
mrcom
pjb: Weird crashes I was getting in CCL on OSX have stopped. Which is even weirder. Didn't update anything.
10:59:55
nij-
Swank.lisp has ~4000 lines of code, much for a newbie like me. Could someone confirm that it implements socket/connection by itself, making no use of any networking library like usocket or trivial-socket? https://github.com/slime/slime/blob/master/swank.lisp
11:03:59
nij-
Yeah.. I'm thinking if it's possible to factor the socket part out, making it easier to support other protocols.
11:05:52
nij-
Xach: Thanks for your confirmation. And yes, if they switch to usocket, the amount of codes could be largely decrease.
11:08:31
pl
nij-: the issue is that you want swank to run self-contained so that you can just start it on any supported implementation without external dependencies
11:10:31
nij-
That makes sense. I feel that being orthogonal and being self-contained are two good attributes that contradict to each other.
11:19:48
shka
swank does not support encryption or logging so it's only natural that localhost is only allowed
11:28:29
nij-
shka: My apologies if the following is too simple: Does that mean all instances in the same LAN can get access to my swank server?
11:32:34
nij-
My main concern is that I want to let root to open a swank server, without letting the other users (on the same machine) to get access to it.
11:34:05
akater[m]
What should `(truename #P"")` return? I can't even infer it must share attributes with `*default-pathname-defaults*`.
11:38:43
jmercouris
I wrote a piece of code that I'm not very happy with: http://dpaste.com/DPG7WHVEN
11:44:46
shka
well, because then you would simply CL:FIND-IF the right cluster, and you could vector-push-extend to it if found
11:49:42
yitzi
If you need to do that kind of thing and position, find, member, etc don't work I would suggest writting a function to do it versus making an embedded loop. I personally find them to be confusing sometimes.
12:17:32
pjb
mrcom: perhaps because of an upgrade of the system? Since Apple collects crash reports, it may correct its system before the application developper can get around them ;-)
13:22:39
Guest87
I'm trying to generate a table from a list of lists representing the rows. The straightforward dolist works for text data. I need the first column to be buttons. I can't get a (:button) from a list to evaluate. I'm stumped.
13:26:22
rain3
show a working snippet with the straightforward dolist which works, maybe we can change it into something better
13:31:50
Guest87
(spinneret:with-html (dolist (row '(("a" "b") ("c" "d"))) (:tr (dolist (col row) (:td col)))))
13:35:51
Guest87
That produces two rows of two cells. My intuition was to substitute something like (:button "Test1") and (:button "Test2") for "a" and "c", or something similar.
13:44:30
rain3
I remember that spinneret in public interface only has macros , that's the reason it is awkward when we need to pass data to it other than hardcoded sourcecode and we must use eval
13:53:02
rain3
an alternative is to use this library instead https://gigamonkeys.com/book/practical-an-html-generation-library-the-interpreter.html https://gigamonkeys.com/book/practical-an-html-generation-library-the-compiler.html
13:53:27
eric
Thanks! Even if it's not perfect, I think it'll work. Yeah, I'm working though that book now.
13:56:20
tfb
dumb question: is there a version of quickload which loads only if not already loaded (like require ish)
13:58:30
tfb
oh. Does that mean quickload tells you what it *would* do? So it's 'To load ...' message doesn't mean it is loading it?
14:01:13
eric
Josh_2: close, and was another approach, but that hardcodes the column as a button. I was looking for a generic (make-table) that I could feed lists with tags in the list instead of the generator.
14:05:16
eric
I'd have a button in a cell when the data list had a (:button) in it instead of a "plain text" element. So it could be '((:button "button1") "b") or '("b" (:button "button1:)), with the items switching places.
14:18:30
eric
Interesting approach. I thought about listp, but if I wanted to use an (:a "http://somewhere") or (:img "smile.png") I'd have to write more cases on (car a), (car b), for each tag type.
14:28:15
Josh_2
you would do something like (if (listp <item>) (destructuring-bind (tag ele &rest args) <item> (:tag :name tag ele)) (:th ele))
14:57:29
Bike
technically it might be required that there's an expander so *macroexpand-hook* works, but there's no standard way to retrieve it
14:58:22
phoe
(block nil (let ((*macroexpand-hook* (lambda (expander hook env) (declare (ignore hook env)) expander))) (macroexpand-1 'foo))i)
15:00:00
phoe
if the macroexpand hook has access to the expander function, then I have access to the expander function
15:00:28
phoe
except above I forgot to RETURN-FROM it, and miraculously this code still worked despite not being correct
15:31:30
fbiaaa
hi! I'm using company-mode in Emacs but get no completion suggestion while editing common lisp file. I'm using two company backends: company-files and company-capf. Should I add some other backend?
15:46:19
beach
Having said that, I find slime-company more irritating than helpful most of the time.
15:47:24
beach
And often I get suggestions that are completely wrong for the context, and no suggestions that would be appropriate.
15:50:37
beach
I guess it's a consequence of the fact that Emacs and SLIM have very limited "knowledge" about the meaning of the Common Lisp code.
15:50:50
akater[m]
Asking again, just in case: what should `(truename #P"")` return according to spec? SBCL and ECL both seem to use `*default-pathname-defaults*` here but I don't see why it should be taken into account.
15:54:22
phoe
akater[m]: I guess that the NIL pathname directory gets interpreted same as (:RELATIVE)
15:55:01
phoe
and getting the truename of a pathname that is relative to the current directory and has all other components empty is going to result in the current directory
15:57:52
akater[m]
phoe: Thank you. So, `(:relative)` directory component should always be converted to nil.
16:06:15
akater[m]
Well, it says “not used”. I read it as, `(:relative)` should not occur as the value.
16:13:53
phoe
I read this as, "(:RELATIVE) is not going to occur in any pathnames returned by the Lisp implementation because it will use NIL instead, but if you use (:RELATIVE), then it's harmless, Lisp will treat it same as NIL"
16:22:50
phoe
continuations require the ability to store away control stacks, whereas the condition system works on a single control stack.
16:23:20
phoe
when an unwind is performed, whether by the condition system or by some other means, the stack is destroyed
16:25:18
lisp123_
Yeah I was able to do it via PG's Continuation Macros (which I'm debugging now, not sure if I made a mistake somewhere), but was something that just popped in my mind because he was using the function RESTART, which means he did it before the condition system entered CL
16:26:06
pjb
akater[m]: that's because TRUENAME must do the same as OPEN, and OPEN must call MERGE-PATHNAMES on relative pathnames. "For information about opening relative pathnames, see Section 19.2.3 (Merging Pathnames)."
16:26:27
lotuseater
lisp123_: but the other way around could be possible ^^ Continuations, the mother of all monads :D
16:28:19
lotuseater
wish me luck, later I have the first phone call with the customer for the new project
16:28:59
lotuseater
hah lisp123_ we had the same thought. there are also this paper with Imperative/Declarative
16:29:34
pjb
(let ((lotuseaster '())) (append 'luck lotuseaster)) #| ERROR: The value luck is not of the expected type list. |# (let ((lotuseaster '())) (append lotuseaster 'luck)) #| --> luck |#
16:30:14
lotuseater
or (setf (person-lucky-p *lotuseater*) t) or an amount between 0 and 1 but bigger than 0
16:31:59
pjb
lisp123_: we can implement delimited continuations in CL easily enough. But full contiuations need a lot of machinery (basically a re-compilation of the CL code).
16:32:37
lisp123_
pjb: what does it mean by "delimited continuations"? Is that the same as PG's restriction that every continuation should be nested?
16:34:28
lotuseater
when I told someone it's kind of runtime GOTO he just heard "GOTO" and said "no that shouldn't be used"
16:35:10
beach
That's what Turbo thought about Pascal, so they removed the only exception mechanism that Pascal had.
16:37:34
Bike
you might also have to copy frames to the heap to implement them, since the delimited continuation still has indefinite extent, which you can see in "stream-yield" where the continuation is stored in a lazy list
16:40:25
Bike
i just mean i don't remember whether they're theoretically equivalent to some kind of delimited continuation or what
16:41:09
lisp123_
Based on what I saw, I say they are, but there might be some points I missed, I'm only looking at the two at a superficial level
16:41:35
lisp123_
"If an =bind, =values, =apply, or =funcall expression occurs in a seg- ment of code, it must be a tail call. Any code to be evaluated after an =bind should be put in its body."
16:42:33
Bike
okay, but as i mentioned, that's not actually an accurate description of delimited continuations
16:42:45
Bike
that's just a continuation with dynamic extent, which we already have with block/return-from
16:46:19
Bike
block/return-from are undelimited continuations, i guess, since they abort control, unlike a delimited continuation
16:47:01
lisp123_
Yup and with material consequences for not being exact, given their use in estoeric code
17:00:56
phoe
you would still need to be able to encode the rest of the computation in some way, which still requires a CPS transform
17:04:24
Bike
restarts are just a dynamic namespace for functions. don't actually do any control transfer stuff themselves. i forgot.
17:05:35
phoe
it's easy to define a non-DX restart equivalent, everything control-flow-related is still up to THROW and RETURN-FROM and GO though
17:21:13
pjb
Bike: the argument is that they are not because: (let ((c (block cont (lambda (x) (return-from cont x))))) (list (funcall c 42) (funcall c 33))) does not work.
17:39:22
Bike
pjb: they are not what? undelimited? "undelimited" does not mean "indefinite extent". i know blocks don't have indefinite extent and i said as much
18:13:51
lisp123__
I'm getting a strange error, but I'm not sure if anyone can point me in the right direction as its obscure
18:18:16
lisp123__
Its pretty convoluted so I wouldn't bother too much, it will take me some time to figure out...
18:23:17
phoe
"undefined function: COMMON-LISP-USER::DFT-NODE" also looks like it needs some attention
18:24:09
Bike
(defvar *cont* #'identity), actually. PG has (setq *cont* #'identity) in his book, which is incorrect.
18:25:26
lisp123__
This is a related version: https://stackoverflow.com/questions/24721676/continuation-in-common-lisp-by-macros-regarding-an-implemetation-in-onlisp
18:27:37
Bike
Okay. I fixed all the problems and ran that expression, and then I did (restart1) repeatedly. It returned a bunch of different values and then DONE, so I think it's working.
18:28:15
Bike
If you're seeing something different you might just need to recompile it. =defun will define RESTART1 as a macro rather than a function, as PG explains in his book, so you might have an out of date definition of it.
18:28:33
Bike
The problems were mostly that PG keeps doing (setq something value) instead of (defvar something value)
18:29:00
lisp123__
I loaded the functions with C-x C-e - that wouldn't have been the source of the issues by any chance (you mentioned 'recompile')?
18:31:46
Bike
=defun defines restart1 as a macro, as mentioned. However, you have restart1 defined after dft-node, which has a (restart1) form.
18:32:07
Bike
So if you load the file sequentially, the macroexpansion of dft-node's body will assume that restart1 is a function, and rewrite it as a CPS call.
18:33:15
lisp123__
Now I know why it worked sometime and not, I must have evaluated restart1 first in those caes
18:33:44
Bike
no problem. in the future you might want to default to using slime-compile-and-load-file, C-c C-k in slime
18:35:40
lisp123__
It worked for the simple cases, but fell over in the more advanced one that I was having at the end of the file
18:38:31
lisp123__
Also (as a final), is this how you avoided the undefined variables "trick" that PG did? https://plaster.tymoon.eu/view/2580#2580
18:41:00
lisp123__
That's why he didn't define it, because he wanted *cont* within the macros to shadow the outer *cont*
18:41:23
lisp123__
It is by manipulating *cont* that we will get the effect of continuations. Although *cont* has a global value, this will rarely be the one used: *cont* will nearly always be a parameter, captured by =values and the macros defined by =defun. Within the body of add1, for example, *cont* is a parameter and not the global variable. This distinction is important because these macros wouldn’t work if *cont* were not a local variable. That’
18:41:24
lisp123__
s why *cont* is given its initial value in a setq instead of a defvar: the latter would also proclaim it to be special.
19:33:51
Bike
i managed to write a macro transformer for delimited continuations to see what would happen. don't think it looks entirely like CPS transformation
19:34:20
Bike
(defun yield (x) (with/dc (shift k (cons x (k))))) (with/dc (reset (yield 1) (yield 2) nil)) => (1 2)
19:40:17
Bike
basically it does CPS except saves the continuation in a dynamic variable instead of adding a parameter like the usual formulation
21:05:56
lad
Anyone here use emacs/org-mode/babel for common lisp snippets? I seem to have to call "(in-package :my-package)" at the top of every code snippet. Seems each snippet defaults to COMMON-LISP-USER NS. I asked in #org-mode, but didn't get much
21:28:09
pjb
lad: Do you use it with slime or with something else (perhaps bare inferior-lisp? ilisp?)?
21:29:35
lad
pjb, my very first snippet has (in-package :my-package), but that package isn't auto used in subsequent snippets
21:30:16
pjb
lad: i would expect indeed for it not to be used. slime tries to scan the file for in-package forms, but since your file is an org-mode file, not a lisp-mode file, it may break.
21:32:41
lad
pjb, forcing that does work actually. Everytime I write the file I am prompted if I really want to write because "invalid coding system".