freenode/lisp - IRC Chatlog
Search
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~^ ~}))")
6:22:44
beach
More generally, it is impolite, because you kind of encourage dozens of people to click on links that might be of no interest to them. So you are wasting people's time.
6:34:04
onion
what about notes and comments about someone's behavior, i can see this being more productive if it was a personal concern, kept privately. but i notice some people are looking at CL implementations on the web so i thought i would share that right where those people have been asking. maybe my timing is off