freenode/#lisp - IRC Chatlog
Search
13:59:32
zigpaw
I was using vim for a long time so spacemacs and then doom-emacs give me a familiar environment and it got me past the 'first impression', but I think most younger people would compare it to something they got to know like atom or vs code and it gives very different feel (but that's just my opinion).
14:01:41
pjb
for slime/swank, there's swank:*swank-bindings* an a-list mapping *print-…* symbols to their values when evaluating expressions from slime.
14:08:33
unanimousarc
btw I've been learning common lisp through land of lisp and I've found it good so far, does anyone know if there's anything major missing from it or if there's a reason I should avoid it?
14:09:19
pjb
thre's no reason to avoid books, even bad books, as long as you keep a criticial mind about them, and read several of them.
14:11:20
pjb
unanimousarc: and more important that the general opinion about a book, to learn something, is the personal receiption you have of it. Whether your personality actual matches the teaching style of the book.
14:12:13
unanimousarc
I do enjoy this book because it is not shy to introduce a complicated topic concisely, which is what all papers are like (I am a physics phd student)
14:14:49
pjb
unanimousarc: PAIP contains a first part that is a summary of the CL specifications. You might like it.
14:15:32
shrdlu68
unanimousarc: ANSI Common Lisp by Graham is essentially a concise summary of the spec.
14:16:05
unanimousarc
so is the spec kind of like a standard library in other languages? Since there is so little syntax
14:17:07
pjb
unanimousarc: we could think of it like this. This reduces to the question of the "primitive" set. Unfortunately, there is no unique or specified primitive set.
14:17:57
pjb
CL distinguishes special operators, macros and functions. But special operators can be implemented as macros, and macros can be implemented as special operators. And functions from the CL package can be open coded (kind of inlined, or implemented as primitives).
14:18:37
pjb
And there are also some functions that cannot be implemented in terms of the other functions (they're really "primitive" functions of CL).
14:19:27
shrdlu68
unanimousarc: Not quite, the spec if technical standard which conforming implementations ought to adhere to, including a "standard library".
14:19:49
pjb
(defun funcall (f &rest args) (apply f args)) (defun apply (f &rest arguments-and-arglist) (??? f (append (butlast arguments-and-arglist) (first (last (butlast arguments-and-arglist))))))
14:19:52
unanimousarc
Yeah, of course there has to be some level of special forms, it said in this book that you can implement almost everything using just lambda, but I don't know anything about lambda calculus
14:20:49
pjb
There are other cases of "primitive" functions, eg. (setf gethash). So you cannot blindly say that functions and macros in CL are library.
14:21:40
pjb
Event if a great part of them can be implemented in terms of the others. have a look at http://home.pipeline.com/~hbaker1/MetaCircular.html
16:50:45
didi
If I'm creating a new struct, is there a vantage of defining it as :type list? Let's say it have few slots, less than 6.
16:55:31
zigpaw
there is also gentle introduction to common lisp (which is actually really really gentle).
16:57:19
phoe
it's just a matter of notation that anonymous functions in Lisp are invoked via the symbol LAMBDA
19:42:45
pjb
minion: memo for didi: there are downsides in using :type : then you won't be creating a new type, so it'll be harder to distinguish those structure instances from lists (or vectors). So you would do that, only when this would be the point.
19:47:14
aeth
On the other hand, you can manually deftype, but that's only practical for specialized arrays, not lists.
0:04:57
asarch
I'm trying to run the example from the "A Guided Tour of CLIM, Common Lisp Interface Manager"
0:18:54
pjb
Yes, define it! (cl:defun use (cl:&rest packages) (cl:apply (cl:function cl:use-package) packages))
0:20:31
pjb
Bike: asarch has a problem understanding packages and keywords and qualified symbols. He needs some play and exercises wiht them.
0:21:56
asarch
As far I understand: (defpackage :wasser (:use :clim)) (in-package :wasser) ... ;The rest of the code of the example
0:25:36
pjb
(defpackage "TEST" (:use)) (remove-duplicates (list (read-from-string "defpackage") (read-from-string ":defpackage") (read-from-string "cl:defpackage") (read-from-string "keyword:defpackage") (read-from-string "test::defpackage"))) #| --> (defpackage :defpackage test::defpackage) |#
0:26:40
pjb
(let ((*package* (find-package "TEST"))) (read-from-string "defpackage")) #| --> test::defpackage ; 10 |#
0:28:34
pjb
(let ((*package* (find-package "KEYWORD"))) (read-from-string "(cl:defpackage \"FOO\" (use clim))")) #| --> (defpackage "FOO" (:use :clim)) ; 32 |#
0:28:47
pjb
(let ((*package* (find-package "CL"))) (read-from-string "(cl:defpackage \"FOO\" (use clim))")) #| --> (defpackage "FOO" (common-lisp::use common-lisp::clim)) ; 32 |#
0:28:58
pjb
(let ((*package* (find-package "CL"))) (read-from-string "(cl:defpackage \"FOO\" (:use #:clim))")) #| --> (defpackage "FOO" (:use #:clim)) ; 35 |#
0:33:46
pjb
asarch: didn't you notice the fucking importance of the *package* variable for the meaning of what is read?
0:36:53
asarch
One step at the time: 1. I start a fresh session of SBCL. 2. Load clim: (ql:quickload "clim") 3. Load the pure code of this example: (load "example-02.lisp") and I get:
0:37:45
pjb
asarch: the stereotypical file will contain (defpackage "FOO" (:use "CL" "AND" "STUFF")) (in-package "FOO") …
0:38:42
pjb
if you want to type (use "CL"…) then you need *package* to be bound to the keyword package, so you need: (in-package "KEYWORD") (cl:defpackage "FOO" (use "CL" …)) (cl:in-package "FOO") …
0:39:52
pjb
asarch: again, read clhs in-package and clhs use-package closely, and underline each difference!
0:42:20
asarch
Ok. How would you fix this code? How would you write something like: #include <clim.h> and voila!
0:43:48
pjb
I explained you above the stereotypical file structure. Why cannot you apply it to your file? What's wrong with the sentence "the stereotypical file will contain (defpackage "FOO" (:use "CL" "AND" "STUFF")) (in-package "FOO") …" ?
0:44:38
pjb
What do you need to be told to be able to take a good example and reproduce it in your code?
0:45:52
pjb
Note that if error messages are unclear or ambiguous, in general maintainers will take bug reports about them and clarify/correct them.
1:14:11
pjb
FOr example, I could ask you what the standard says about a thing, but you wouldn't understand why I'm asking you about that thing, because you can't read an error message.
1:16:54
pjb
asarch: for example, we gave you the clhs use-package to read, but you still don't understand that packages such as the :clim package are not used IN the REPL, but used BY other packages.
1:17:31
pjb
(also incidently, you've been told from the start the solution, but you couldn't apply it).
1:22:10
asarch
So, an example would be fine. If I do: (defpackage :asarch (:use :common-lisp)) (in-package :asarch) I understand I am making available all the functions from :common-lisp plus the functions from :asarch, right?
1:27:11
no-defun-allowed
IN-PACKAGE also means all new symbols in the file or REPL will be interned into ASARCH.