freenode/#lisp - IRC Chatlog
Search
22:24:43
aeth
Shinmera: The advantage of a custom do-foo is that even though it looks like the "for foo in bar" idiom that can be duplicated manually or with loop, it can be made to be non-consing without changing the API because it's a macro. Basically, foo could be iterated over more efficiently. In this case a loop with "in (users ...)" is different than "(do-users (user (users ...)) ...)"
22:26:35
aeth
Initially, they would probably be essentially identical, but because do-users is a custom macro that doesn't have to follow the loop semantics, do-users could be rewritten to essentially lie about calling users (which would cons a list) and instead iterate in a way that doesn't allocate a user list.
22:27:26
aeth
For IRC, probably overkill. For other things, it could be very useful to have this extra layer of abstraction.
22:31:00
aeth
I see no issue with essentially lying about calling an accessor if the API is identical and the macro can handle things more efficiently. setf sort of does this. The foo in the setter (setf (foo 42) 3) has the same API as the getter (foo 42) but doesn't have to. So setf macro is already doing this sort of lie, in the standard language.
22:35:21
aeth
Well, what I mean is: setf is a macro, and (setf (foo 42) 3) doesn't evaluate "(foo 42)" and #'(setf foo) doesn't even have to have the same API as #'foo
23:47:22
fiddlerwoaroof
Recently, I've been experimenting with logical pathnames, and I find that they are a really nice way of dealing with paths
23:47:44
fiddlerwoaroof
For one thing, they allow for a fairly nice abstraction over the os/implementation-specific details of pathnames
23:49:00
fiddlerwoaroof
You just use + document a particular prefix for the files you need, and then the user sets up the translations to point the logical pathnames wherever they please
23:49:59
fiddlerwoaroof
And, they can specify translations very granularly: e.g. "MYAPP:config;**;*.*" can map one place and "MYAPP:data;**;*.*" can go somewhere else
23:51:48
fiddlerwoaroof
And, sbcl's implementation-specific part is pretty cool: you add a mapping for "SYS:SITE;**;*.*.*" to your .sbclrc and then it looks for files named <HOST>.translations in that directory to auto-load other hosts
0:05:07
didi
How do I configure the printer so (let ((x (cons nil nil))) (setf (car x) x)) prints, without looping forever?
0:13:07
jasom
(let ((*print-circle* t)) (prog1 nil (print (let ((x (cons nil nil))) (setf (car x) x))))) ;; <-- works for me
0:14:06
jasom
The REPL will try to print the results of PRINT, after *print-circle* is no longer bound to t, which is why the prog1 nil is there
0:14:47
jasom
didi: indeed because the print happens outside of the dynamic scope of your print-circle binding
0:22:37
jasom
dynamic bindings are useful for some things, but it also quickly becomes obvious why lexical bindings are the default
0:24:11
jasom
I find myself doing things like (defun foo (arg1 &key (option1 *option1*)) ...) so that I can be explicit when I need it, but not have to have the same 2 arguments passed to every single function everywhere for the common case.
0:35:24
didi
Heh, I've never used #'prog1 to stop the REPL from printing something. Before setting *print-length*, I used to add a final t or nil to form.
0:41:01
jasom
fiddlerwoaroof: https://github.com/jasom/sqlitestore/blob/master/build.lisp <-- here's my current build script, it works on everything that supports images. A small change can let it work on ECL type lisps as well, but I haven't done that yet.
0:43:08
jasom
fiddlerwoaroof: that will work as long as your asdf file is setup correctly, but it does have the issue of putting it in your asdf cache rather than local.
0:44:48
fiddlerwoaroof
I think that means it's ok to implement it as a macro, but that would be implementation-dependent
0:44:50
jasom
fiddlerwoaroof: in particular see "The pathname of the output of bundle operations is subject to output-translation as usual, unless the operation is equal to the :build-operation argument to defsystem. This behaviour is not very satisfactory and may change in the future. Maybe you have suggestions on how to better configure it? " in the ASDF docs for it
0:53:33
drmeister
Hey folks - I'm adding some optimizations to Clasp and I wanted to check my thinking.
0:54:27
drmeister
Currently Clasp's DEFMETHOD works like ECL - it walks the method lambda to determine if the method uses call-next-method or next-method-p and constructs a method function that does or doesn't have those local functions defined.
0:54:46
earl-ducaine
Lispiacs! re: defvar. I'd like to create a global special variable at run time that is ordinarially not present when the program's compiled files loaded. The easiest way is just to create a macro like so: (defmacro define-site-variable (variable value) `(defvar ,variable ,value))
0:54:50
earl-ducaine
where define-site-variable is obviously just a bit of implementation hiding of calling (defvar variable value)
0:54:54
earl-ducaine
The question: is there any reason why it wouldn't be advisable to use defvar in a non-toplevel form, given clhs' warning about compiling that code having no side-effects. (which would appear to be what I want)
0:55:47
drmeister
I think I need to store the result of that walk in the method by adding two new slots to the method class: method-calls-next-method and method-calls-next-method-p.
0:58:02
drmeister
I think I need to do this so that that I can optimize effective methods for slot accessors. If a class has an accessor with more than one method if the first method that would be called doesn't call call-next-method or next-method-p I can optimize it as a direct slot access.
1:00:20
drmeister
Another optimization is if the first method of the effective method doesn't call call-next-method/next-method-p then I can call the method function passing the arguments directly rather than passing the arguments as a list.
1:01:06
drmeister
Adding slots to the method class is kind of drastic but I think that's what needs to be done.
1:06:52
drmeister
Not like I'm waiting or anything - I'm proceeding with adding a leaf-method-p slot that is T if the method doesn't call call-next-method or next-method-p.
3:09:58
fiddlerwoaroof
You could also do something like (member :darwin *features*) if you need to do something programatically, but you should probably make sure something like trivial-features has been loaded to normalize the features list
3:14:15
jmercouris
I think it would be nice to be able to load the system without any graphical dependencies
3:15:41
Zhivago
I think it is always nice to delegate decisions like that to the user rather than to try to detect.
4:29:26
jasom
minion: memo for jmercouris the best way to use asdf and features is to use defsystem-depends-on to require any packages that might set features you need (e.g. trivial-features) and then if-feature inside your defsystem
4:29:35
jasom
minion: memo for jmercouris: the best way to use asdf and features is to use defsystem-depends-on to require any packages that might set features you need (e.g. trivial-features) and then if-feature inside your defsystem
4:37:54
asarch
When you do: (ql:quickload "quicklisp-slime-helper") and QuickLisp is doing "[package retrospectiff2]..........................", is it compiling?
9:05:07
loke
Oh here you are... Being all logcal and reasonable again. How are the rest of us going to be able to look smart? :-)
9:08:40
beach
dmiles: More to the point, if you assign to that slot in one class, it would not change in the other.
9:14:04
dmiles
well you mean in the case the subclasses allocation (on its prototype) is differnt than the superclasses's allocation?
9:14:45
beach
No, when they are the same. There will be one prototype for each class, so there would be two places to store the shared slot.