freenode/#lisp - IRC Chatlog
Search
20:29:31
aeth
You basically never need reader macros. e.g. Let's say you're writing a bunch of hash-tables that start with certain values and you want to make that easier. Is #h(:foo 42 :bar 43) as a hash-table reader-macro really better than (hash :foo 42 :bar 43) as a hash-table regular-macro? The reader macro makes everything harder, and the editor probably thinks ":foo" is special, and what if :foo is (+ x y) instead?
20:29:38
TheWild
ah, this explains why the weird thing was happening. I thought I'll get a reference to the body of +
20:30:30
jackdaniel
reader macros are useful when you want to augument syntax (i.e parse commas as separators), it is never needed for ordinary lisp code
20:31:04
phoe
TheWild: also, Common Lisp is a Lisp-2 - in very basic terms, it means that + can name multiple things - in standard CL, the symbol + names both a variable and a function
20:31:14
TheWild
if all the code is a list then in theory I could (execute-here function-body) or (translate-to-something-else function-body)
20:31:35
phoe
(even though it has N namespaces, because there are a few more namespaces in the standard and then also programmers can define their own)
20:31:54
jackdaniel
it means that it has two different namespaces for variables and functions, there are certainly more namespaces
20:32:18
phoe
neeasade: variables, functions, classes, tagbody tags, catch tags, restarts... I forgot one I think, but whatever
20:32:42
neeasade
I'm coming to cl from elisp, which is also a lisp-2, so it feels a little natural already
20:32:58
jackdaniel
namespaces are quite arbitrary, you may assign a special meaning to a name in your own interface and you have one new namespace
20:34:02
phoe
functions are defined via DEFUN forms or LAMBDA forms which are lists, but once these forms are evaluated, function objects are created
20:34:34
aeth
TheWild: I think you mean (eval function-body) and that can only happen if you save the function's source somewhere (the function is compiled). You could have a macro that has two effects, though, one being a defun and the other saving the definition. It's not quite as simple as a direct eval because that would only work for (defun foo () "Hello") and not (defun foo (x) (format nil "Hello, ~A~%" x)) because (eval `(format nil "Hello, ~A~%"
20:34:50
neeasade
that's why macros are fun, because in that phase you can treat the code as a list and do those kinds of transformations
20:34:53
phoe
but just as jackdaniel said - since Lisp code is lists, it can be treated as data, and you can operate on it using normal list-processing functions
20:34:55
aeth
in case that got cut off: because (eval `(format nil "Hello, ~A~%" x)) won't know what x is.
20:36:16
jackdaniel
phoe: I did not mean that. I meant what I said: you may take a function, assign it to a variable and pass it to another function, and that code is manipulated with macros (so it is treated as argument). not that you may code-walk it
22:22:19
neeasade
hello #lisp, I'm trying to grok quicklisp -- as a test, I randomly picked the package "cl-speedy-queue".
22:23:10
no-defun-allowed
now cl-speedy-queue has been loaded, so you can probably use the library from the package cl-speedy-queue (or check which packages are loaded in the printout)
22:24:13
no-defun-allowed
but basically you need to prefix the library's function names with cl-speedy-queue:
22:24:35
no-defun-allowed
eg if my library has the function FROBICATE i might write (my-library:frobicate thing)
22:25:15
neeasade
can I alias things -- eg something like cl-speedy-queue -> csq, so I can (csq:function) ?
22:26:44
no-defun-allowed
package local nicknames are on their way to being implemented in modern CL implementations, so come back in a few months
22:27:07
no-defun-allowed
but if you're lucky, the author may have picked one since that's quite a long name
22:31:40
no-defun-allowed
drmeister: Probably a bogus guess, but it seems ECL uses the Boehm-Weiser collector from the documentation
23:25:29
drmeister
Thank you - I know about ECL's garbage collection - I wonder if they managed to get code put under control of the GC.
23:41:35
no-defun-allowed
Judging by https://common-lisp.net/project/ecl/static/manual/ch34s06.html, the feature name suggests ECL uses dlopen which probably would not allow for that to happen.
0:01:29
aeth
How do people generally structure their conditions? Would it make sense to have them in one central file to simplify the flow of things in case they're later needed elsewhere, or do people generally put them in the file that they are designed for, if they're only currently used in one place?
0:11:50
splittist
aeth: one possible benefit of putting them all in the same file is that you can abstract common functionality into 'internal' functions. Of course, source files are either an awful mechanism, or irrelevant in the face of M-. and friends, depending on my mood (:
1:33:08
pjb
aeth: conditions are classes (and with multiple-inheritance too) and you will have whole hierarchies of conditions just like you have hierarchies of normal classes. You would organize them the same way.
1:33:42
pjb
aeth: in CL, you're free to organize things as you wish, you're not constrained by equivalences such as class = namespace etc.
1:42:37
defunkydrummer
pjb: i think conditions aren't classes. Or in any case, their slots aren't easily accesible.There was something on the clhs
1:46:34
defunkydrummer
there it is, the condition system predates CLOS. on some implementations probably conditions are classes, but dunno which does and which doesn't
1:47:48
defunkydrummer
on sbcl i wanted to access slots of a conditon and i couldn't, despite appearing as a class from the point of view of slime, with slots
1:48:36
defunkydrummer
but those slots weren't accesible unless i used the mop. "Direct-slots" of the condition class were nil.
1:50:57
pjb
defunkydrummer: you can define accessors for condition slots, just like any slot in CLOS classes.
1:52:45
defunkydrummer
probably. in this case the class was defined by a lib, and you couldn't access the slots using slot-value, etc.
1:52:59
pjb
Using with-slots or slot-value is not a good idea anyways, because slot-value accesses the slot directly, without the mediation of the accessor methods that could be overriden for subclasses.
2:36:28
krwq
hey, i got around 2M strings which have assigned id - is there some library which would allow me to lookup quickly? when I've tried hash-table it exhausted heap
2:37:41
krwq
strings are urls and prefixes are reasonably similar - perhaps some prefix tree or something?
2:45:26
neeasade
hi again all. I'm using a lib with some cffi and when I load it in quicklisp, I get a failure building grovel types? https://pastebin.com/raw/u6vNT0y5
2:52:00
krwq
beach: I've (setq inferior-lisp-program "sbcl") (setq slime-lisp-implementations '((sbcl ("sbcl" "--dynamic-space-size" "4096")))) - but (sb-ext:dynamic-space-size) still shows 1GB, am I doing something wrong?
2:54:40
krwq
pjb: will try ccl if can't get it to work with sbcl (although expecting couple of things to break since I've never tried it before)
3:02:43
White_Flame
How can I have quicklisp show compile-time warnings when loading a local-project?
3:07:17
White_Flame
just got finished debugging a nasty compilation order bug, where first-time load would have shown compilation warnings
3:11:36
aeth
It's verbose for *every* project so if there's something that's really noisy (like UIOP) you have to manually load it first, not verbose, just to silence it
3:13:22
aeth
(UIOP gives a lot of redefinition warnings because of its with-upgradeability and similar macros)
4:00:50
pjb
White_Flame: loading a project is not compiling it. It cannot provide compile-time warnings, because it doesn't save them!
4:01:54
pjb
White_Flame: if you want to compile the project, then note that ql:quickload does not have a :force-compile option. I usually just rm -rf ~/.cache/common-lisp …
4:02:29
pjb
White_Flame: I would find it a nice feature, if indeed, ql did save the compilation error and warnings, and produced them each time the system is loaded…
4:03:34
White_Flame
I guess the proper solution is for QL to distinguish "I am using this as a library" vs "I am developing this" roles under local-projects
4:04:45
White_Flame
or maybe an indicator in an .asd for "debug mode" that doesn't muffle the output
4:05:15
pjb
White_Flame: you don't understand. It doesn't muffle anything. It doesn't compile at all!
4:06:10
White_Flame
pjb: I guess your development cycle is not mine, if you never have compiles invoked by ql
4:07:08
pjb
Or you need to modify a root file in your dependency graph. But most system have rather flat dependency graphs.
4:07:29
pjb
The point of the asdf dependency graph is to make sure you compile only ONE file after you modify it.
4:29:46
aeth
pjb: For recompiling, it's easier/faster just to modify a "base" file that everything else depends on (obviously it will depend on the structure of the project in question), triggering a full recompilation of the project in question (though probably not its dependencies)
4:31:25
pjb
Easier, I don't know. But you could write a lisp function to search all the root files of an asdf system and do that. Call it (recompile-system :foo)…
4:46:26
aeth
I guess I structure things very differently, which is why I probably will wind up having a core/conditions.lisp just like I have a core/constants.lisp and a core/settings.lisp and you can probably even count utils/utils.lisp (and the other utils)
7:54:17
flip214
White_Flame: you can always just touch the .asd file, this causes recompilation - and will give you all the warnings anew
8:07:40
White_Flame
flip214: the main thing was what :verbose t gave me, not actually triggering the recompile