freenode/#lisp - IRC Chatlog
Search
23:15:13
clothespin
https://solarianprogrammer.com/2019/08/20/building-sbcl-steel-bank-common-lisp-windows/
5:35:16
housel
Today I discovered that one of the gabriel benchmarks in cl-bench has been wrong since forever https://gitlab.common-lisp.net/ansi-test/cl-bench/merge_requests/1/diffs?commit_id=5f4da018672624b28d761c1b35015a98b19653ad
6:48:51
buffergn0me
madrik: because you have to name the variable something, and the name is more likely than not going to be misleading
6:49:21
buffergn0me
madrik: also, it is not clear if the variable is used more than once, or is assigned to, until you read and understand the whole piece of code
6:58:00
phoe
I know one person who does everything to minimize the number of variables altogether and would therefore write all of this without a single variable binding, but I consider this approach to be highly unreadable when opposed to actual usage of LET
6:59:26
phoe
(defun foo (...) (go-further (combine (compute-1 foo bar) (compute-2 baz quux)))) gives you an additional debugging disadvantage - there are no variable bindings to inspect
7:11:41
buffergn0me
phoe: That is true. I sometimes introduce intermediate variables for debugging when using other programming languages. But with SLIME it is easy to evaluate forms, and get at the argument list of called functions. I can't think of a time I had to add a variable to ease debugging in CL
7:14:09
phoe
neither can I, but I think a part of that is because I already use variables generously
7:15:48
Shinmera
"don't name things because the name is misleading" is the strangest thing I've read in a while. The name adds context to give meaning to how you're using it.
7:15:50
asarch
One stupid question: I load the library: (ql:quickload :caveman2), I create the project skeleton: (caveman2:make-project #P"/home/asarch/school" :author "me"), load my project: (load #P"school/app.lisp"), make some work, quit and exit Slime. How can I reload the project again? (load #P"school/app.lisp") -> System "school" not found
7:26:56
beach
I agree with Shinmera. I often introduce variables using LET* just to add names that explain what the values are.
7:28:32
buffergn0me
madrik: FP people call it point-free or tacit style. Also stack- (FORTH) and array- (APL) oriented programming is similar
7:29:39
beach
madrik: I usually go with LET* so as to save horizontal space. But it depends. If I have several variables that do not depend on one another, and then a few that depend on most of those, nested LETs are preferable.
7:30:45
madrik
For instance, I was reading the code to a log analyzer I wrote. I have a LET with two bindings, one for an ip and one for a domain.
7:31:16
beach
In that case, a nested LET might be preferable since the first two do not depend on each other.
7:32:30
Nilby
If you want your code to read like Forth and APL by all means avoid naming things. For that matter use only &rest arguments.
7:33:17
beach
madrik: With LET, it is perfectly clear that the computation of component-2 does not involve component-1.
7:41:37
madrik
Indeed. Unlike, say, the situation with SETQ and SETF, this seems like a style issue mostly.
9:06:22
madrik
I trawled the Lisp newsgroup archives for a bit on this point (SETQ v SETF). There was a trend of thought that advocated using SETQ for the express purpose of assigning to variables, and SETF for other cases.
9:09:04
Shinmera
I mean there's the argument that it's more explicit about its purpose, but that's already encoded in the fact that a variable is going to be a lone symbol, so
9:09:30
heisig
And there is this funny case where SETQ can expands into SETF when symbol macros are involved :)
9:26:02
madrik
So, it doesn't make sense to think of SETQ being 'lower-level' or 'more primitive' than SETF?
9:28:29
Nilby
(when (> (get-universal-time) 3786854400) (alias-shiftf 'sets 'set 'setf) (without-package-locks (unreify-special-form 'setq)))
9:30:54
no-defun-allowed
Rather, it's already past that universal time that designates the start of 2020, give or take.
9:35:14
Nilby
I'm saying, now that it's 2020 I wish we could just say, as long as we're not running some old ass code, SET should be SETF, SETS or better SET-SYMBOL should be SET, and SETQ should be gone.
9:49:49
madrik
Nilby: Maybe SET, once its meaning is again open for change, can be used to create sets, like LIST right now creates lists.
9:53:41
madrik
On the topic of change, is there any movement toward a revision of the ANSI standard?
10:01:30
beach
madrik: I have a project on the backburner to create a revised language definition that would just specify lots of behavior that is now undefined. It is called WSCL, which means Well Specified Common Lisp, and it pronounced like "whistle".
10:05:38
srandon111
hello all i am studying clojure from the book "clojure for the brave and true" i arrived at anonymous functions... and was wondering... how can i create a function which multiplles all elements within a vector? i tried this...( (fn [[x]] (* x) ) [4 3 4]) but doesn't work...only returns the first element i also tried this... ( (fn [& x] (* x) ) [4 3 4]) but again doesnt work... "Cannot cast clojure.lang.ArraySeq to java.lang.Number" so can somebody
10:06:58
no-defun-allowed
(defun multiply-vector (vector constant) (map 'vector (lambda (x) (* x constant)) vector))
10:07:27
no-defun-allowed
And yes, you would have more luck discussing mocklisp 2^W^Wclojure in #clojure.
10:12:53
madrik
Shinmera: I haven't used Python very much, but from the outside, the change from 2 to 3 seems to have proved very painful and disturbing. Is that the kind of break in backward compatibility you had in mind?
10:13:44
Shinmera
One of many, yes. But also remember CL's history. The only way it could have happened in the first place is with all of those weird compatibilities from pre-existing dialects.
10:14:08
Shinmera
I do not think most lispers would give up that compatibility just to have some different names.
10:18:38
Shinmera
customisable INTERN. Most of everything else is either not important, or already covered with portability libraries.
10:21:28
beach
madrik: The standard says that if some operator is defined to take an argument of a particular type, and there is no particular mention of what happens if that type is violated, then the behavior is undefined. So there are many operators that could fail in spectacular ways rather than signaling an error.
10:24:35
beach
madrik: *sigh* that is precisely what I said. Implementations catch it, so I would like for the revised standard to put that in writing.
10:25:26
p_l
madrik: it's the difference of having known error type with defined continuations for the case when that happens
10:25:39
beach
Specifically, I would like to have a relation between the SAFETY debug quality and the behavior of AREF when something other than an array is given.
10:27:20
beach
Exactly. It would be reasonable to require an error of type TYPE-ERROR to be signaled when SAFETY is (say) 3.
10:31:21
Nilby
Shinmera: I've been running with a customizable intern patch to sbcl and ccl for years now. But of course it doesn't help for writing software for others to use.
10:42:04
Nilby
Shinmera: Hmmm. That is probably better. Just a little more complicated to implement.
10:46:51
no-defun-allowed
Speaking of which, anonymous packages (like anonymous classes) would be handy. That could be another component of a safe reader.
10:49:11
no-defun-allowed
I guess (make-package (gensym)) is half of that, but it should also not be retrieved through FIND-PACKAGE and should be garbage collectable as such.
10:53:39
no-defun-allowed
I hesitate to say that packages aren't exactly first class for that reason, because that isn't how the term isn't defined, but it feels a bit like that.