freenode/lisp - IRC Chatlog
Search
21:36:17
engblom
I know I have once before asked but I forgot: what is the difference between :use and #:use in defpackage?
21:43:22
engblom
pjb: Thanks, I found the use of #:use but it must then be specific to mgl-pax:define-package, which is used in that file
22:07:15
engblom
I will have to use multiple return values. Does CL have destructuring as in Clojure? (meaning I can have something like (defun adding ((x y)) (+ x y)) and then call it with the result of a multivalue function)?
22:15:30
engblom
I am looking at https://github.com/keithj/alexandria/blob/master/package.lisp. Why do all the exported functions got #:function-name instead of just :function-name?
22:16:17
Bike
the things in defpackage are string designators, so symbols have no meaning beyond their symbol name, so #:f and :f are the same to defpackage
22:16:29
Bike
the only difference is that with #:f there will not be a symbol interned in the keyword package
22:19:44
Bike
keyword is a special package. all the symbols in it are constants with themselves as values. that's why if you put :foo in the repl you get :foo back.
22:20:12
kagevf
you can also do (multiple-value-call #'+ 1 2 3) ... m-v-c will take all the values of any forms ... it's like it does the (values ...) for you
22:25:14
pjb
Since eval is a function :foo would be evaluated before its value being passed to eval…
0:34:07
nij
Hello! I cannot figure out why flet fails to bind a function in a lexical environment: https://bpa.st/3VPQ .. While evaluated, it complains that #'adhoc-test is unbound.
0:35:01
Bike
typep is just a function, so it doesn't know anything about the lexical environment it's called in
0:35:09
nij
Oh.... yeah now I remember: "which must be a symbol whose global function definition is a one-argument predicate." http://clhs.lisp.se/Body/t_satisf.htm#satisfies
0:37:35
nij
Bike: what would you do to type-test in this scenario, in which "3" and "2" appearing in the def of adhoc-test might vary at run time?
0:42:48
nij
Anyway, do we really need #'typep? It feels very restrictive when I cannot put any lambdas there.
0:50:00
saturn2
typep is useful for the things it is meant for. it's not meant to express every possible predicate
0:51:56
saturn2
i think SATISFIES is kind of a half-baked afterthought and was probably a mistake to include in the standard
1:40:56
Bike
why bother with satisfies or typep in that case? all it does is make your program longer
2:06:36
Bike
since complex types work in an upgradey way, i think (typep (complex 7d0) '(complex (real 0 0))) could be true in some implementation
7:11:33
phoe
I have no idea what DAO-CLASS is, but I assume that it's a typo problem between USER-ID versus USER-IP
7:16:03
beach
ebrasca: My guess is that the metaclass requires you to have a slot named user-id, but your slot is named ida.
7:18:24
beach
ebrasca: So by importing that symbol, you med it impossible for both phoe and me to determine that this symbol came from Postmodern.
7:19:07
phoe
I guess that postmodern docs should be able to solve this problem, or maybe someone with more postmodern dao experience
7:19:40
phoe
beach: honestly I think the same, but I know everything I need once he mentioned the import
7:20:42
beach
phoe: Sure, but ebrasca is also contributing to SICL, and the style guide for SICL, explicitly calls for explicit package prefixes, possibly using package-local nicknames.
7:21:45
beach
But if ebrasca doesn't understand the reason for the rule, then it is likely going to be a problem in the SICL contributions too.
7:30:28
ebrasca
beach: Your style guide is a bit bad. See this one https://lisp-lang.org/style-guide/ , I think it is more easy to understand.
7:40:11
beach
I am not trying to be aggressive. I am just tired of arguing stuff like this, over and over. I made up my mind about the SICL style guide. Saying that it is "bad" is not helping.
7:41:39
Nilby
I like line length 80 because my eyes aren't great and I want to be able look at multiple pages side by side on a laptop. ... or underwater. in the dark. through a straw. :)
7:42:08
beach
And I would have to explain why I prefer what I wrote, to the guide in the link that you posted. And, like I said, I am really, really tired of that.
7:44:15
minion
flip214, memo from rpg: I don't have any experience with CL-WHO, so I don't know what ITERATE would do with it, but there are relatively easy-to-use extension capabilities in ITERATE.
7:49:31
ex_nihilo
ebrasca: I usually have two panes open side-by-side in emacs when I am coding; 80 cols works great for that on my laptop, but much wider and I start to have line-wrapping problems
7:52:36
ebrasca
I did not think about smaller screens , in screen I can fit 160 with two panes side by side so thinked 140 is ok.
7:55:23
flip214
ebrasca: lisp code is much denser than other programming languages, so line breaks (and indentation) is a valuable tool to show relations between forms; I think having too much stuff in one line is harmful.
7:55:55
flip214
Nilby: sometimes I change an xterm to a 1-pixel font - so that I can do graphics via writing spaces and X's ;)
7:57:42
Nilby
Also 1 or 2 pixel fonts are good for editor minimaps, which also add to the width on-screen.
8:07:34
ex_nihilo
ebrasca: if a lambda list is too long, you could put arguments on multiple lines, but that could also be a sign that your function is trying to do too much; maybe two functions would be better
8:08:32
flip214
ex_nihilo: that quickly degenerates into a function that prepares some object with lots of args, and then a function that consumes such an object and only a few args... which is not better, IMO
8:10:20
ex_nihilo
flip214: I don't mean that you should solve the problem of long lists of arguments by adding function definitions; I meant that when you have long lists of arguments you should _consider_ whether you have the best design
8:12:22
phoe
when they get too long and there is too many of them I tend to cut them in half and create a new package
8:21:01
phoe
moon-child: in Lisp, notnot means that we want something of type BOOLEAN, not a generalized boolean
8:21:28
beach
So without arguing a particular width, I think the purpose is to minimize the amount of white space (without changing the preferred names) so that the maximum amount of information can be presented to the programmer. Now, we can just go count the fraction of white space to non-white space for different widths.
8:22:11
beach
phoe: That would be weird. (not (null ...)) sure, but not (not (not ...)) because in the last case, ... should already be Boolean.
8:24:37
flip214
beach: In german it's uncommon to say "außer ...."; I notice that I don't use UNLESS. I feel much more comfortable with (IF (NOT ...)) which corresponds to the German "Wenn nicht 'alles gut ist', 'sage Fehler'" example.
8:24:47
jdz
And have to resort to converting UNLESS into WHEN and do the boolean transformations of the test-form.
8:25:22
flip214
I sometimes try both (NOT (AND ...)) and (OR (NOT ) (NOT )) to see which is more readable
8:25:36
phoe
I generally avoid UNLESS AND and UNLESS OR and convert it to WHEN OR and WHEN AND whenever possible
8:25:48
engblom
I saw https://lisp-lang.org/style-guide/ mentioned. There is actually one thing I wish it had: better instructions for how to achieve the 100 character limit per line. Like recommendations on how to split longer forms, how to handle longer docstrings, max number of forms/line etc.
8:26:03
beach
flip214: I understand. I use (IF (NOT ...) as well, but not as a replacement for UNLESS. I use it when there is both a `then' and an `else' form, and I have reasons to care about the order of the two.
8:26:34
ex_nihilo
beach: if you wanted a bool instead of a list from MEMBER, wouldn't you use (NOT (NOT (MEMBER ...)))?
8:28:12
beach
ex_nihilo: I tend to pretend that MEMBER returns a Boolean, and I would use FIND if I want some object.
8:29:56
jdz
I think I'd use either (if (member ...) t nil), or (not (null (member ...))) instead of double NOT.
8:36:29
beach
engblom: Like I said, the idea would be to minimize the fraction of white space to non-white space. You introduce newlines as required. If the newlines leave too much space to the right, you have too many. If have too much indentation, you have too few.
9:00:28
pjb
beach: if you want to convert a generalized boolean to a boolean, (not (not gb)) is indicated. It is hard to justify (not (null gb)) in that case, because gb is a boolean, so a boolean operator such as NOT is indicated.
9:03:36
beach
ebrasca: I haven't thought about it much. It is certainly higher priority to work on the code itself.
9:05:38
pjb
ATOM may very well return (you dummy bastard) when x is not a cons cell. (atom 't) #| --> :failed |# (atom "hello") #| --> generalized |# (atom 'nil) #| --> boolean |# (atom '(a . d)) #| --> nil |#
9:08:31
beach
That's a cute idea. Make an implementation that does everything that is allowed by the standard in the most non-obvious way.
9:09:28
beach
Er, I mean "That's a cute idea. Make an implementation that does everything that is allowed by the standard, but in the most non-obvious way"
9:10:36
pjb
To be a conforming implementation any undefined behavior must be defined and documented.
9:12:03
beach
"If AREF is passed an object that is not an array, then a short snippet of "Jingle bells" is played to the speaker".
9:17:01
heisig
The Common Lisp equivalent of Bastard Tetris (http://fph.altervista.org/prog/bastet.html) :D
9:24:27
fiddlerwoaroof
beach: I've often thought randomizing things where the spec leaves order unspecified would be useful