libera/#commonlisp - IRC Chatlog
Search
10:43:54
coat
is there a function that take can take all elements of list *b* and append it to list *a*. For example, (defparameter *a* (list 10 20 30)) (defparameter *b* (list 40 50)). I need (some-func *a* *b*) such that the result would be *a* = (10 20 30 40 50)?
10:48:13
shka
also, note that destructive modification of lists is perhaps not the best idea if said list (or part of it) has any chance of being shared
11:36:13
coat
beach: Is the surprise about (nconc a b) regarding the fact that some other variable may be referring to 'a' and might be expecting it to not change?
11:45:04
beach
coat: Also, a piece of general advice: Do not worry about performance unless your application needs to be faster than it is. And then, only consider parts of the application that are bottlenecks in terms of performance.
11:45:36
beach
coat: Worry about your algorithms and data structures in terms of asymptotic complexity as usual.
11:50:34
beach
coat: There is a very general rule in programming, and that is, use the most specific construct that will get the job done.
11:51:29
coat
why are there so many equal functions in CLHS? it is quite confusing while programming and need to check the CLHS again and again
11:51:51
coat
is there a shortcut to look up function documentation in SLIME? say I want to see what equal does in SLIME itself without opening the browser
11:56:00
susam
coat: There are two things I use. C-c C-d d to describe symbol. C-c C-d h to open CLHS in a web browser.
11:59:02
coat
beach: but I understand your point about asymptotic complexity. you mean terms of big oh notation, right?
11:59:07
beach
I mean, those are both language specific resources, and they probably wouldn't cover rules like the one I just cited.
12:01:27
beach
coat: Part of the reason Common Lisp has so many operators is historical. But then, most people complain that it doesn't have enough.
12:02:33
beach
coat: But here is another general rule of programming: The smaller the language, the more code you have to write yourself, and you often need to do it differently for each project, and certainly in a way incompatible with what other people do.
12:03:26
beach
coat: I would have to think about that and look around. I haven't had to do that for a very long time.
12:04:34
beach
coat: I had some very good teachers at the university, and then I studied a lot myself.
12:08:46
beach
https://en.wikipedia.org/wiki/Erik_Sandewall https://sv.wikipedia.org/wiki/Anders_Haraldsson (last one only in Swedish)
12:12:03
beach
coat: You can learn a lot from people like Robert C Martin (a.k.a. Uncle Bob). He comes across as a bit weird if you watch his "clean code" videos, but he actually knows what he is talking about.
15:34:42
shka
is when he mentioned that nobody will be serious about the programming until software bug will cause a major aviation accident
15:36:28
shka
yeah, it sounded ludicrous at first, but i actually think that this may be not be worst idea ever
15:38:28
beach
I agree, but it would be a terrible idea presently. What will happen will depend a lot on the "experts" that are chosen to draft legislation. I won't be surprised if (say) free software is outlawed, and VSCode becomes mandatory, and stuff like that.
15:47:47
jcowan
Obviously Boeing has very good (and very expensive) e&o insurance, some of it paid for by taxpayers. I read once that aviation didn't become profitable (as opposed to pervasive) iuntil the 1960s or so
15:49:27
beach
I am not worried about Boeing. I am worried about the future of software development.
15:54:33
shka
regardless, despair https://www.bloomberg.com/news/articles/2019-06-28/boeing-s-737-max-software-outsourced-to-9-an-hour-engineers
17:47:47
pjb
well, airbus at least uses a Coq-validated C compiler: https://github.com/AbsInt/CompCert
17:48:44
pjb
Perhaps one day we'll have a formal specification of CL, and a Coq validated CL compiler?
20:22:50
coat
I am trying to make a small wrapper that can push a cons to alist. (defun add-key-value (key value alist) (push (cons key value) alist)) (defparameter *a* nil) (add-key-value "foo" "bar" *a*). But *a* remains as NIL after I execute this.
20:28:36
pjb
(define-modify-macro aconsf (key value) (lambda (alist key value) (acons key value alist))) (let ((alist '((a . 1) (b . 2)))) (aconsf alist 'c 3) alist) #| --> ((c . 3) (a . 1) (b . 2)) |#
20:29:13
pjb
coat: unfortunately, a lot of CL functions don't have their parameters in the right order for define-modify-macro… So you need to swap them, eg. with that lambda.
20:30:03
coat
pjb: Okay. Curious about another thing. Is creating a list and pushing cons to it not a popular way? Do people usually use acons instead?
20:30:27
pjb
(let ((alist '((a . 1) (b . 2)))) (let ((alist (acons 'c 3 alist))) alist)) #| --> ((c . 3) (a . 1) (b . 2)) |#