freenode/#lisp - IRC Chatlog
Search
18:13:05
stacksmith
Sanity check: I am considering writing a with- macro that creates an environment for dealing with a complicated data structure. I was considering swinging in the package native to it with (use-package) for the body... Am I asking for trouble?
18:16:24
stacksmith
Is there another way to do this? It seems reasonable to not have to type the package over and over inside an environments made specifically for that task...
18:19:44
Pierpa_
Your macro could substitute symbols in whatever package with other symbols in the correct package?
18:22:01
stacksmith
Actually not too bad, because I can use the same symbols in different environments for different structures that require similar treatment... Kind of generic protocol...
18:22:08
Shinmera
I wrote a library that does something like that. https://github.com/Shinmera/deferred
18:23:15
stacksmith
If I had a penny for every library I wrote that I never ended up using, I'd have not quite enough for a cup of coffee.
20:01:10
jcowan
I have heard it said that compiler macros are a Bad Thing (or at least do not deliver on their apparent promises), but I can't find the argument now. Does anyone have an idea where or who?
20:10:56
bjorkintosh
jcowan, is it this, perhaps? http://www.mschaef.com/blog/tech/lisp/defmacro-coupling.html
20:12:24
jcowan
bjorkintosh: I'll read that in detail, but I do remember it was specifically about define-compiler-macro, not defmacro in general.
20:16:31
loginoob
is there something in emacs so that i can rapidly access online documentation of any lisp function or variable with few keystrokes?
20:17:39
bjorkintosh
loginoob, are you already aware of this then? https://common-lisp.net/project/slime/doc/html/Documentation.html
20:18:28
loginoob
bjorkintosh: aware but never read it because its been only a week since i started learning lisp
21:45:53
zch
Why would you use a top-level LET for function definitions? For example, here is some code (not mine) that has function definitions inside a let and has some local variables as well: https://0x0.st/sadA.txt - I'm just curious as to why not have top-level function definitions and either a LET inside those definitions for variables you're working with or introducing global variables.
21:46:24
jackdaniel
zch: because there are other functions and you don't want to pollute global environment
21:47:35
_death
zch: there may be small perf gains, but personally I don't like that style and just use a global
21:48:26
zch
I found it interesting, since I've never seen anyone code like that before (im a nooby programmer)
21:48:29
jackdaniel
stylewarning: regarding lisp hacking, I've created a debugging tool for clim pane hierarchies, check it out: http://hellsgate.pl/files/43a9c4f5
21:48:55
stylewarning
jackdaniel: consider it as spooky as you please, but i saw that this morning :)
21:48:58
jackdaniel
I can manipulate sizes and positions of each pane in the gadget on the left (window on the right is an actual application-frame)
21:49:04
_death
also, in this case where it's only used in this one function, you could use a simple LET inside the function with LOAD-TIME-VALUE
21:50:01
Shinmera
stylewarning: Things aren't progressing as fast as I'd like and I haven't released a library in month
21:51:27
stylewarning
I've been super excited about jackdaniel's completion of Thrift for CL. I think it opens up so many possibilities for using Lisp programs as microservices.
21:51:36
jackdaniel
I've just tested it in the repl with: `(defun xxx (a &aux (b 42)) (print b) (incf b) (if (> a 4) (xxx (1- a) )))'
21:52:59
stylewarning
jackdaniel: CLHS says otherwise: http://www.lispworks.com/documentation/HyperSpec/Body/03_dae.htm
21:53:06
jackdaniel
most of the implementation was done by Mr James Anderson, we just cleaned it up and pursued merge mainstream
21:56:25
jackdaniel
either way, it's late here, I'll re-read tomorrow (I'm too tired to process), goodnight \o
22:29:09
jcowan
I think what I have sorta figured out is that a compiler macro should be associated with a function, not with the function's name
22:35:24
_death
I suppose in a Scheme attitude it makes sense.. but in practice what will it give you that the current approach, with a compiler-macrolet operator, is lacking? assuming (setf (fdefinition ...) ...) is quite rare
22:44:06
jcowan
yes, probably nothing much, since compiler macros are only applied during direct calls
22:54:20
Bike
also, if you didn't get an answer on why compiler macxros aren't great, it's just because most optimizations require more information than just surface syntax.
23:22:08
pillton
I'm struggling with why you would want a local compiler macro for a local function which is also invoked as a function object.
23:25:22
Bike
maybe you have a with- macro that makes some local function available, and sometimes it can be compiled easier
23:29:52
Bike
(apply #'call-next-method args...) could be inlined as (funcall next-method-function (list* args...) more-methods), incidentally
23:49:46
jcowan
Bike: when you say "most optimizations", you are talking about bog-standard compiler optimizations, not things like optimizing (+) to 0, right?
23:50:42
Bike
for +, for example, you want to reduce that to zero, and reduce (+ a) to a, and probably (+ a b c) to (+/2 a (+/2 b c)) or such
23:50:59
Bike
but you also want to constant fold and maybe group numbers of the same kind together, and you can't do that syntactically
23:52:30
jcowan
well, okay, you can't do value propagation followed by constant folding, but the problem is with the value propagation
23:52:57
fiddlerwoaroof
should quicklisp rebind *print-case* inside of quickload? It's probably not ideal to mess with people's settings like that, but a bunch of libraries seem to assume that *print-case* is :upcase in their macros, which often leads to mysterious breakages.
23:53:34
jcowan
one example I've seen is optimizing exponentially growing functions when their arguments are fixnums
23:56:01
fiddlerwoaroof
This frequently is done incorrectly because the library author only ever tests with *print-case* :upcase
23:56:58
fiddlerwoaroof
While, in an ideal world this wouldn't be a problem, I'd generally prefer to have quicklisp temporarily normalize the value of *print-case* rather than having the library break mysteriously later on.
23:57:09
Bike
but of course compiler macros aren't useless, it's just that they're not capable of describing all or probably even most function-specific optimizations
23:57:32
fiddlerwoaroof
I only ever notice this because I set *print-case* to :capitalize in .sbclrc
23:57:52
Bike
i really don't think this is quicklisp's problem. you can rebind it yourself, or you can file bugs with the libraries
23:58:13
fiddlerwoaroof
Sure, it's not quicklisp's problem, strictly speaking, but it might be a useful feature
0:00:18
jcowan
Bike: one of the things I ask people when I interview them is how to compute fibonacci(n) in Blub in O(1) time
0:01:08
fiddlerwoaroof
First you write a Scheme runtime with TCO, then you implement it the obvious way :)
0:01:23
jcowan
the answer is that fib(42) or so is the largest representable Fibonacci number in typical Blubs (not Python, though)
0:08:55
jcowan
supposing you needed a fibonacci function in your program, you could supply a compiler macro that would avoid calling it all for less than bignum results
5:38:17
burzos
Is there a variable I can toggle to force `format` to always show the dot in proper lists?
5:40:14
beach
I don't think so. FORMAT probably just calls the appropriate PRINT function, so ultimately PRINT-OBJECT. But you are not allowed to modify the standard behavior of PRINT-OBJECT. You can try doing it anyway and see. Why do you need this?
5:41:39
burzos
I have assoc lists and I'm `format`ing them in a user console, but it's confusing when some of the entries are dotted and some aren't (because the value can be a list or an atom).
5:44:31
beach
You can always print it "manually". I mean, the REPL is not meant to be used for end-user stuff.
5:46:26
burzos
Yeah. The frontend def needs a lot of work, this is just for debugging in the interim.
5:47:16
loke
He only wants to display the first level using ditted notation, and doing that is trivial with format (FORMAT T "(~s . (~{~s~^ ~}))")