freenode/#lisp - IRC Chatlog
Search
7:21:54
didi
Is it possible to produce code at every function execution? For example, at https://paste.debian.net/hidden/1f98a75c the recursive LABELS function `sum' has an IF (a COND, really) that depends on the value of wrapping function `my-sum' parameter's `oddp'. The value of `oddp' has been fixed by the caller, so asking about its value at every recursion is unnecessary. I want to get rid of this IF. Maybe I can use some kind of local macro?
7:24:16
White_Flame
generating code at runtime involves sexpr lists as data, and a call to eval or compile
7:24:46
makomo
didi: you can't do it with a macro because macros work at compile-time, and at that moment you have no idea what ODDP is
7:24:57
White_Flame
in ye olde times, there were "fexprs" which were like macros but worked at runtime
7:25:29
White_Flame
which works perfectly fine if your lisp environment interprets sexprs, but doesn't fit with compiling implementations
7:27:30
White_Flame
in your specific example, didi, you could have sum-odd and sum-even that call each other, as 1- toggles between them. Only the entry point needs to test for oddp
7:28:45
pjb
didi: to do it automatically, you'll need some quite smart optimization in the compiler… (because you need to understand the pre/post conditions of the tests!
7:29:59
didi
White_Flame: Indeed, but I have a more complicated function on hold that needs to know the value of a parameter to decides how to iterate. Because it's in a tight loop, I might duplicate the function and change just where I have to, but I wanted to know if I could avoid it.
7:30:33
White_Flame
compile-time does have a lot of constraints, in not knowing what runtime values will be
7:31:09
pjb
So if you wanted the compiler to optimize your code, write it iteratively rather than recursively.
7:31:44
pjb
A good lambda-based compiler would do a good job with recursive functions too. (eg. if it's compiling with continuations).
7:35:55
didi
Yeah, look, SBCL has very similar functions for reducing from the front (`list-reduce') and reducing from the end (`list-reduce-from-end'). If it's good enough for SBCL...
9:07:01
no-defun-allowed
is there a function in CL that finds the duplicate elements in a list? eg (find-duplicates '(1 2 3 1)) => (1)
9:14:50
fivo
Is it possible to get the LAMBDA-LIST and the info like COMPILED FUNCTION shown by (describe 'symbol)?
11:43:31
jackdaniel
complex float operations improvements in ECL: http://hellsgate.pl/files/2542707e-report.html (no optimizations in compiler yet whatsoever, just generic dispatch on math operations). still behind sbcl though :c
11:44:28
jackdaniel
mandelbrot/dfloat is put there for scale, we should do much better job with double floats too
13:29:51
jackdaniel
I've put results in clim app: https://imgur.com/drAprZJ.png (numbers are little different - I've run it again and removed dfloat)
13:55:51
mgsk
I have some dir `./src/contribs` that contains things like plugins that depend on the main library. I want these to be loaded whenever the main library is loaded. Is this something that ASDF can deal with?
13:56:40
mgsk
I guess just doing `(:file ...)` would suffice in that case. I was expecting something more complicated
13:57:13
mgsk
e.g. I don't know ahead of time what is in the contribs dir, so I can't write out all the appropriate `(:file ...)`forms.
13:58:07
jackdaniel
a few months back I wrote an "autodiscovery" module class for someone, link should be somewhere in logs