freenode/#lisp - IRC Chatlog
Search
18:27:48
dieggsy
lol, i think they meant more abstractly like algorithms and shit. i might disagree wit that too though. I dunno, I love scheme and I love CL. you can learn from either and make great practical use of either
18:28:28
stylewarning
dieggsy: but learning either doesn’t really provide insight into implementation
18:29:17
stylewarning
dieggsy: and currently in Common Lisp it’s hard to answer the question “what if Common Lisp had XYZ?”
18:30:01
stylewarning
For instance I would love to know what a computed goto special operator would be like in Lisp
18:30:20
stylewarning
Unless you’re a genius compiler hacker like Paul K, you can’t just simply add this to something like SBCL
18:31:15
stylewarning
If we had a COMPUTED-GO special operator, then we could hack something like cheap coroutines in Lisp
18:31:59
stylewarning
That would be fun to play with, but necessitates a substrate for easily modifying a CL implementation
18:32:31
raeda_
On that topic, I've been playing with Graal/Truffle lately, which is a compiler toolkit. If there was a Truffle based CL, it would be easy to modify it for experiments
18:33:15
stylewarning
As discussed, a COMPUTED-GO, or even simpler, a jump table, are not something you can implement in CL as a macro without huge caveats
18:37:53
Bike
can't you? if the implementation optimizes CASE (as sbcl does for example) it doesn't seem to me like you'd be doing much worse than direct support
18:38:56
stylewarning
Bike: well if an implementation supports CASE as a jump table then of course we are Golden
18:39:45
Bike
i don't understand how the simple implementation helps here, if you want to worry about performance
18:40:41
stylewarning
Bike: I gave an example of a control structure that is difficult to implement; maybe there are better examples than what I provided
18:40:54
pyc
Pastebin link please for this channel? I forgot it. Someone should add the pastebin link to the topic.
18:41:12
stylewarning
Optimized CASE still doesn’t give computed goto; tags would need be able to appear anywhere in the lexical scope
18:44:40
Bike
for a coroutine wouldn't you have to jump "into" a tagbody, essentially? tagbody only has dynamic extent so you can't do that
18:45:51
Bike
if i wanted to implement coroutines i'd probably start with continuations and go from there
18:46:14
stylewarning
I think the DEFUN would be something like: LET jump-point = LTV(mutable-cell); (TAGBODY (go jump-point) ...)
18:46:52
Bike
well, i mean, so you'd have the tagbody in the coroutine, and when you yield you communicate the jump point back to the caller, right?
18:49:24
Bike
lisp doesn't let you do that. if you want to do that, you'd have to take care of things like storing the stack frame to put it back when you enter
18:49:57
Bike
e.g. if you had some dynamic-extent thing in play at the yield point, you'd need to be able to put that back when you resume
18:51:09
jcowan
stylewarning: CLHS 1.7 http://www.lispworks.com/documentation/HyperSpec/Body/01_g.htm tells you what the requirements are to call your implementation "a subset of CL".
18:51:28
Bike
yeah, and your body is something like (defun coroutine ... (tagbody ...)) and you're doing (return-from coroutine), yeah?
18:51:43
stylewarning
(defun f () (let ((cell ...)) (tagbody (go cell) ... (setf cell 1) (return-from f x) (tag 1) ...)))
18:52:56
Bike
okay, so your cell doesn't just have the jump point, it also has the entire stack frame?
18:53:43
stylewarning
In this case it just has the jump point; which isn’t 100% what’s required for a full “Just Works” coroutine with previously established lexical scope
18:54:39
Bike
are there uses for coroutines with no state besides the control point? i've never really usd them but i assumed the state was a large part of the appeal
18:54:47
stylewarning
But that’s a deficiency in our definition of computed goto, not necessarily in what we are trying to do with coroutines
18:55:31
stylewarning
If you have a computed goto, you’ll have to decide what lexical variables mean if you’re jumping into a lexical context
18:56:27
_death
there are also the "off the beaten path" CL implementations like Corman, Eclipse, Scieneer..
18:56:37
stylewarning
And hence why it would be nice to have a simplistic implementation that removes barriers to trying these things out
18:57:42
Bike
i don't know how much a simple implementation would help with that. like you could do a fairly small interpreter-based one, but then adding this kind of extension would be pretty involved
18:58:09
Bike
and implementing this with an interpreter would be vastly different from doing it with a compiler to the extent it would be hard to transfer what you'd learned
18:58:16
stylewarning
But I would contend it’s likely an order of magnitude less involved than trying to hack it into SBCL
18:58:33
Bike
(source: i wrote up a scheme with delimited continuations once. when i tried to write a compiler problems happened)
18:59:11
stylewarning
Yes interpreter vs compiler vs bytecode vs .... are real implementation issues and written about extensively
18:59:33
Bike
i guess the other thing i'd do is use sicl, which isn't exactly "simple", but it's modular enough to let you swap some stuff out
19:01:08
Bike
i just don't understand what you'd do with the simple prototype exactly. you couldn't use it with production code sicne it's not efficient. you couldn't use it as much of a jumping off point for modding a more efficient lisp.
19:05:01
stylewarning
I implemented this but it would be cooler with green threads https://github.com/stylewarning/lisp-random/blob/master/generators.lisp#L62
19:08:26
theothor`
FWIW, https://dlmf.nist.gov/LaTeXML/ can parse the dpans repos with some tweaks. Returns xml, and can parse directly to html. It struggles with the table macros, but I think workarounds are possible. The xml could be parsed to a clos thing also, I guess?
19:09:10
_death
stylewarning: https://8c6794b6.github.io/posts/Delimited-continuations-with-monadic-functions-in-Common-Lisp.html
19:10:18
stylewarning
_death: it’s cool but to me it’s a toy only in the sense that it doesn’t provide an orthogonal feature
19:10:46
stylewarning
IOW you need to write Lisp differently if you want this kind of feature using that technique
19:11:20
stylewarning
Same issue with CL-CONT-based continuations, where it can’t CPS the standard library like MAPCAR
19:12:47
stylewarning
(This is the CL-CONT version of coroutines: https://github.com/stylewarning/lisp-random/blob/master/coroutine.lisp )
19:13:14
stylewarning
(It appears like it’s a nice orthogonal feature but it doesn’t work in certain circumstances, whereas the thread version does)
19:14:19
_death
yeah, I have some snippets for coroutines using arnesi.. at one time I switched to cl-cont, but decided I liked arnesi better
19:55:51
pjb
stylewarning: you can check it in the sources https://gitlab.common-lisp.net/cmucl/cmucl search for process-yield and idle-loop
21:29:06
opcode
i need some help understanding car and cdr: why does (append (cdr '(1 2 3 4)) (car '(a b c d))) return (2 3 4 . A) and not (2 3 4 A)?
21:42:27
edgar-rft
APPENDing elements at the end of a list is not fast in Lisp, if you must add several elements one after the other it's often faster to PUSH to the reversed list and reverse again if finished. Alternatively you can keep a pointer to the last cell in a variable, but this only makes sense if you have really *many* of those APPEND operations on the same list.
23:47:55
moon-child
wait-process returns an exit code. I think launch-program might also do something if it can't start the command
23:50:02
irc_user
Got it, thank you. I haven't actually downloaded lisp yet but it looked interesting so I wanted to try rewriting some scripts in it. Looks like UOIP comes with it and isn't a separate lib?
23:51:03
moon-child
uiop is a general portability library. It is not part of common lisp, but many implementations ship an implementation of it
0:36:26
nij
Why do some people name their personal systems like this? com.xyz-name.system-name? Should I follow this convention?
0:36:56
White_Flame
it's to avoid collisions. Because only a few people do that, I"m not sure it's really necessary
0:37:21
White_Flame
but if you do use that, there are nicknames and package-local-nicknames that can give a shorter prefix instead of the fqdn style
0:40:40
saturn2
i'd say it's a good convention to follow if you want to publish a ton of different things and not worry too much about how appropriate they are for general use
0:41:45
saturn2
it's annoying when someone squats on a generic name with a library that's not very good
0:50:01
nij
So as my personal scripts pile up, I will have to make systems that named "nij.scripts.celebrate", "nij.scripts.wordie".. etc? Isn't this a little cumbersome? Is there a better way, like (defsystem "wordie" :inherit "nij.scripts"..)?
1:36:00
nij
Should I consider using SICL over SBCL? I heard that the former is "cleaner" without understanding.
1:43:32
martinodb
hi! i have a question. I'm trying the maiden IRC framework, so this maiden-silly agent connected to an IRC channel, but it doesn't talk to me at all. The documentation says something about activating it. Doesn't it do anything out of the box? do I have to edit the code? thanks!
1:50:27
nij
"Everything should be in a repl cuz that's the coziest place to have fun.. including the repl itself!"
1:50:41
no-defun-allowed
If you are only interested in cleanliness, then your code would be subject to the ugly parts of both SBCL and SICL.
1:54:14
mister_m
I accidentally did an infinite recursion in the repl (using slime), I'd like to stop this without killing my inferior lisp process, how can I do that from within the REPL buffer? C-c C-c doesn't seem to do anything
2:07:40
mister_m
maybe I just missed the SLDB buffer that was created on C-c C-c in the REPL buffer.
3:19:48
asarch
I did a downgrade to Debian Stable and its Emacs 26.1 has been failing to get the M-x 'package-refresh-contents' to install Slime
4:00:56
White_Flame
mister_m: if your inferior-lisp gets dropped into ldb, you probably blew the heap, or the stack twice
4:03:35
dieggsy
asarch: melpa has been odd recently. I don't use it as my package repo but I search their website sometimes and it's been extremely slow
5:09:30
White_Flame
the lack of interchangeability of different communications stream styles is a general problem, across many domains
5:11:52
White_Flame
I don't know enough for it to be a definite "no", but such situations hit me too often between other stream interfaces
6:12:26
beach
pbaille: #lisp is not really for trivial questions, but such questions are tolerated, especially if traffic is low. If trivial questions become too annoying, you may get redirected to #clschool which is meant for such questions.
6:13:21
beach
pbaille: On the other hand, some newbie questions are not trivial, and the answers to them are often worth repeating here, like for instance the semantics of function calls and argument passing.
6:18:25
pyc
Does https://plaster.tymoon.eu/edit not work anymore? I tried it many times but it does not return me a link I can share. The input just disappears after posting my snippet.
6:20:23
pbaille
I was curious about code equivalence those days. Is there any known works around that. for instance determining the equivalence of those 4 expressions:
6:21:05
beach
pbaille: That would be an undecidable problem in general, so I think you are out of luck.
6:21:07
pbaille
sorry I'm discovering IRC... the four expressions posted where intended to be after my question. all my apologies.
6:21:11
no-defun-allowed
You may reduce the first three to the fourth using substitution in this case, but generally equivalence is equivalent to the halting problem.
6:21:21
pyc
no-defun-allowed: thanks! I can see your post. I wonder why it does not work for me. When I click post, it goes back to the https://plaster.tymoon.eu/edit and the input disappears. I don't get any link I can share.
6:22:04
pyc
no-defun-allowed: are you logged into https://plaster.tymoon.eu/edit ? or did you use it without logging in? I am not logged in.
6:22:19
flip214
pbaille: you could try to use macro expansion to rewrite all expressions to a minimal subset - eg. replace LET by a LAMBDA form.
6:22:56
flip214
but then you'd still need quite a few manually defined rules - eg. the order of variables in LET can be different.
6:24:12
flip214
and you might need an expression simplifier to see that (* (- a b) (+ a b)) equals (- (* a a) (* b b)) and so on.
6:24:37
flip214
so you can arbitrarily far, depending on how much time/effort you're willing to spend...
6:24:52
pbaille
but maybe bindings can be ordered using kind of an hash of the value they are bind to
6:25:07
flip214
OTOH, I can also see an alternative way -- compile the expressions, and try to prove that the machine code gives identical results.
6:25:27
Nilby
As you may know, there are many undecidable in general problems which are quite worthwile and solvable in specific.
6:25:31
flip214
Ie. like decompiling back to C or so... that would get rid of many small differences in the sources
6:25:34
moon-child
that throws away information. It is likely to be harder to prove interesting facts about machine code than about lisp code
6:26:33
flip214
moon-child: not necessarily... at least that's a well-defined set of basic instructions.
6:26:34
moon-child
those 'small differences' are things you need to be able to handle anyway. Many of them will result from compiler optimizations, the sorts of analysis underlying which you will need to replicate if you would like to automatically prove things about code