libera/#commonlisp - IRC Chatlog
Search
4:55:37
Josh_2
Okay I have found that annoying bug again, ofcourse it occurred when I deployed my application to my VPS
4:57:27
Josh_2
Okay https://plaster.tymoon.eu/view/2871#2871 here I have at the top my macro, then in the middle the function using the macro and then at the bottom a condition that is signalled when evaluating a function (in a different package) that is using the function in the middle
4:58:29
Josh_2
Not sure why I am getting this error, the reason I had to use keys is an attempt to make conversion from destructuring-bind to with-hash-keys easier
5:15:23
asarch
If I have: '((:id 1 :name "taco") (:id 2 :name "pizza") (:id 3 :name "beer")), how could I remove (:id 2 :name "pizza")?
5:23:21
moon-child
could use EQ if you guarantee structure-sharing ahead-of-time. Or use a hash table if you have a bunch of elements to remove
5:23:55
asarch
Then I could have '((:id 1 :name "taco") (:id 2 :name "pizza") (:id 3 :name "beer")) and then a list of ids '(1 2)
5:24:23
asarch
(loop for element in '((:id 1 :name "taco") (:id 2 :name "pizza") (:id 3 :name "beer")) do (remove-if ... <- ?
5:27:09
moon-child
remove-if says exactly what it does: you're removing some elements from a list. It is more specific
5:32:52
asarch
But how can I pass the list of the elements I want to delete?: (remove-if (lambda (x) (member x '((:id 1 :name "taco") (:id 2 :name "pizza") (:id 3 :name "beer")))))
5:36:45
moon-child
(let ((ids-to-delete ...)) (remove-if (lambda (x) (member (getf x :id) ids-to-delete)) list))
5:37:31
moon-child
ids-to-delete is available to the function you create, so we say that the function closes over ids-to-delete
5:38:39
akoana
just for fun, what about (set-difference '((:id 1 :name "taco") (:id 2 :name "pizza") (:id 3 :name "beer")) '((x 1) (x 2)) :key #'second :test #'equal)
5:39:46
asarch
(remove-if (lambda (x) (member (getf x :id) '(1 3))) '((:id 1 :name "taco") (:id 2 :name "pizza") (:id 3 :name "beer")))
5:42:14
moon-child
ACTION considers pointing out that j's 'hook' combinator obviates the misdirection, decides against it
5:42:39
asarch
(set-difference '((:id 1 :name "taco") (:id 2 :name "pizza") (:id 3 :name "beer")) '((:id 1 :name "taco")) :key #'second)
5:52:28
Spawns
is it possible to have my interpreter's implementation of conses as an immutable data structure but provide a mutable api to the lisp itself? do any cl implementations do something like that?
5:53:22
Spawns
i am sort of confused how you could implement that, since lists don't store pointers going backwards
5:54:39
Spawns
appending and pushing is easy, but doing set-car or whatever to an element in the middle is tricky
5:57:13
beach
Spawns: I have no idea what that means. Mutability doesn't seem to have anything to do with back pointers.
5:58:04
Spawns
how can you create a new list when doing "set-car" in the middle of a list, if you can't copy the list from front to back with just that part of it changed
5:58:13
beach
And I don't see the difficulty of doing a RPLACA "in the middle" whatever that might mean.
5:59:18
Spawns
like with appending, you just make a brand new list with an extra element tacked on the end, pushing you do the same but with the front. setting a car however, just gives you a single cons cell from the list, so you don't know how to return an entirely new list with just that part changed
6:01:44
moon-child
Spawns: obviously, immutable languages are turing-complete, so you _can_ implement a mutable language in terms of immutable semantics
6:02:58
moon-child
Spawns: setf is a macro. In the case of CDDR, that will expand to something like (rplacd (cdr list) nil)
6:03:01
beach
I would appreciate not being corrected when I attempt a pedagogical approximation to a newbie.
6:03:23
Spawns
i think you are right about performance moon-child, that will be a lot of allocations and general churn
6:04:16
Spawns
the main reason I am asking is because doing mutable link lists in rust is a massive annoyance
6:04:21
beach
Spawns: More generally, this is a channel for Common Lisp. You are attempting the implementation of a different language for which we have no specification, so it is nearly impossible to give you advice.
6:04:46
beach
Spawns: I think you need to phrase your questions in terms of how Common Lisp is or can be implemented.
6:04:53
moon-child
Spawns: I think I told you before that trying to implement lisp in rust was not going to work out
6:05:14
Spawns
i was curious if you are familiar with how cl implementations implement their lists beach
6:05:45
minion
Spawns: SICL: SICL is a (perhaps futile) attempt to re-implement Common Lisp from scratch, hopefully using improved programming and bootstrapping techniques. See https://github.com/robert-strandh/SICL
6:06:40
beach
Spawns: Usually, a CONS cell consists of two consecutive words in memory, and a list is just a sequence of CONS cells, linked by their CDR.
6:07:16
beach
Spawns: SICL bootstrapping? The compiler is written in Common Lisp and generates native code. Or will, when we are done.
6:08:33
beach
Spawns: You might want to read the paper by Krystof, entitled "SBCL, a Sanely Bootstrappable Common Lisp". SBCL is mostly written in Common Lisp as well.
6:09:55
beach
Spawns: You might also watch my videos for the online Lisp meeting, entitled "Creating a Common Lisp implementation".
7:21:07
ns12
Hello, in "EVAL-WHEN considered harmful to your mental health" (https://fare.livejournal.com/146698.html), I see "The Lisp processor reads a stream of text (an unfortunate choice of specification, INTERLISP and Smalltalk fans may tell you) ...".
7:27:51
beach
ns12: I am just guessing, but I think it means that Common Lisp is based on keeping source code in files, and those other systems are more "image based".
8:33:57
pjb
ns12: nothing prevents to to adopt an image based development model with CL implementations (that have images, ie. all but ecl). Have a look at: Image Based Development http://www.informatimago.com/develop/lisp/com/informatimago/small-cl-pgms/ibcl/index.html
8:35:10
pjb
ns12: it's just the matter of developping a few tools, including a nice editor. there's CL:ED but most implementations defer to an external program or don't implement it.
8:38:13
phoe
and there's the problem where images accumulate cruft over time - and Smalltalk and Interlisp images are no exception
8:40:37
phoe
sure, but textual source code is inspectable easier than images which are composed of many things that are impossible to show as text
8:41:03
phoe
while text as a representation of source code has many downsides, this one is a clear upside
8:42:03
moon-child
I may ask my image (or, at least, ought to be able to ask my image) not only 'show me all the objects', but also 'show me all the relationships between the objects'
8:47:20
akater[m]
How expensive would it be to keep a registry of all objects, or at least of objects of all interesting classes to make cruft more manageable? (Maybe commercial Lisps do this already, I don't know)
8:48:12
phoe
maybe you don't need to do that - you should be able to walk the whole image in order to find interesting objects
8:51:19
moon-child
so you can't so easily say 'trace _all_ the objects in the image' (as a gc would, say). (I assume that it still is possible, though)
8:53:14
phoe
https://github.com/sbcl/sbcl/blob/a45f58f7b5e10666cd80bcba9bd90a84b3d49c53/src/code/traceroot.lisp#L171-L282
8:55:09
phoe
https://github.com/sbcl/sbcl/blob/f16d44366365a9529b78b05d6787be8b5e9ac084/src/code/room.lisp#L343-L393
12:35:24
cage
hi! Can be assumed that (string= nil nil) ; => t ? I checked the hyperspec but i was not able to answer my question.
13:10:22
Shinmera
mcoll: You won't find many people using them on "freenode". If you want better insights, throw a mail to their mailing lists, or look at their appraisals that they list on their websites.
13:15:48
beach
My paper on debugging rates Allegro the best: http://metamodular.com/SICL/sicl-debugging.pdf
13:16:22
beach
Not that I used it myself, but it actually has a real debugger which none of the others I investigated does.
13:17:49
phoe
before rasengan decided to flip the network upside down and forced everyone to migrate here
14:03:17
lisp123
You will have to figure out a way of copying the faces from lisp major mode to slime repl (C-h m should tell you what the exact major mode of the slime repl is called)
14:04:35
lisp123
Something like this may help https://protesilaos.com/codelog/2022-01-08-emacs-face-remap-add-relative/
14:05:03
lisp123
THere's different ways to do it, and its a bit complicated (I don't know exactly how just yet and won't have time to look into it)
14:06:50
lisp123
Ask on #emacs actually, somebody might be able to help, its not that obscure of a question
14:54:54
mgl
I don't seem to receive the two-factor authentication code from https://gitlab.common-lisp.net/. Is this a known issue?
14:56:20
minion
The URL https://gitlab.common-lisp.net/users/sign_up?secret=b491250b will be valid until 15:00 UTC.
15:47:01
kevingal_
What I want to know is how to stop everything in the REPL being coloured a string after there's an error message with a newline in it.
15:52:21
edgar-rft
kevingal_: what REPL are you talking about? Emacs/Slime or some CL implementation running in a terminal emulator?