freenode/#lisp - IRC Chatlog
Search
14:47:04
puchacz
hi, it does not feel right to use (format s "~a" it) to print character by character to a stream, where s is inside (with-output-to-string (s)....)
14:47:24
puchacz
I am sure there is something like print-character that does not print #\space but actual space
14:48:27
beach
stacksmith: There have been no surprises so far. But the hardest part is definitely the organization of the compiler so as to obtain good performance.
14:49:32
pjb
you can write a simple CL compiler easily enough, if you target a lisp VM. Take for example clisp. The compiler is a single source file.
14:52:35
stacksmith
beach: have you looked at Self? There were some nice ideas there, in-line polymorphic caches and such. At the time code size was troublesome, but that's not an issue anymore...
14:53:00
beach
stacksmith: I am aware of Self, but haven't studied the specific compilation techniques in depth.
14:53:25
beach
stacksmith: Yes, I am betting that code size is no longer a problem in order to simplify the compiler.
14:53:45
stacksmith
The polymorphic caches could accelerate dynamic dispatch, and they are pretty simple.
14:54:12
beach
stacksmith: I already invented a dispatch technique that is now used in Clasp, and SICL.
14:57:52
beach
This paper describes the nursery collector, in case you are interested: http://metamodular.com/sliding-gc.pdf
15:00:35
shka
i guess, so, haven't been in touch with academic publications ever since i finished master degree
15:01:07
beach
But ideas tend to come automatically when one works with a problem for a long period of time.
15:02:09
shka
recently i attempted to help my colleague with his thesis, and oh my god, he had like huge stock piles of papers all from circa 0.5 IF journals
15:03:14
beach
shka: True, there is a lot of bad writing out there, as Steven Pinker correctly points out.
15:06:36
beach
Some of them are bad, even though they took considerable effort to write. Again, as Steven Pinker points out. :)
15:07:43
beach
stacksmith: Oh and the other VERY HARD part is bootstrapping. I will figure it out eventually, but it is taking a lot of time.
15:11:59
stacksmith
Bootstrapping is always an issue... I think SBCL fork was largely about that - and look at the mess today.
15:12:37
beach
That is definitely what SBCL was about. I am trying to take things one step further by not using any C code at all.
15:17:35
beach
By using first-class global environments, I am hoping to avoid the technique that SBCL uses of renaming the packages. And by bootstrapping from a full Common Lisp, I can use the CLOS machinery for stuff that would otherwise require special code.
15:22:48
beach
Like, I can write (defclass symbol (t) ((%name ...) (%package ...)) :metaclass built-in-class)
16:01:47
drmeister
I want to define a type... (deftype molecule-type () '(member protein ligand ion solvent))
16:02:54
drmeister
I have a property-list slot in my MOLECULE class and I want to set the :TYPE property that way. That will lose type info.
16:03:59
drmeister
And not rely on a property list for something fundamental like this that can have one of a limited set of values.
16:23:21
drmeister
I think we are gonna want one for C++ methods. Or we have something to define reader, writer and read-write accessors.
17:10:33
jsjolen
Hi! Is there a way to check where a Quicklisp provided system comes from? (I want to know if a particular system is from a fork or the original author)
17:11:05
jsjolen
I tried inspecting objects returned from ql:system-apropos-list but I didn't find the relevant data
17:13:16
Bike
hm, i don't know how to do it automatically, but it's all in https://github.com/quicklisp/quicklisp-projects/tree/master/projects
17:22:18
puchacz
I am getting error on this source: 0: [RETRY] Retry compiling #<IRONCLAD-SOURCE-FILE "ironclad" "src" "public-key" "ed448">.
17:34:18
Shinmera
Probably because keywords are usually reserved for either key-value pairs, or for specific tokens of their own. Lambda list keywords are markers of a different kind of structure.
17:47:32
puchacz
st00pid compiler..... I changed #() to #.(make-array 0 :element-type '(unsigned-byte 8)) and it works
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