freenode/#lisp - IRC Chatlog
Search
19:55:01
pfdietz
There is an even better way of computing the n-th Fibonacci number, though, involving raising a certain 2x2 matrix to the n-th power. This takes O(log n) arithmetic operations (and with most of those having small size compared to the last O(1) iterations of the repeated squaring.)
20:59:50
aeth
Oh no. That's making me want to revise my project Euler code again. I think there's an n-th fib question or two
21:06:00
Bike
i remember the fib questions in euler generally being more about identities than computation
21:06:55
Bike
like sums of all, or odd, or even indexed fibonacci numbers are just otherfibonacci numbers, and stuff
21:08:50
aeth
I guess this new information won't be useful in my Euler lib (I separate my answers from the general algorithms/etc. used to solve the problem)
21:49:25
cl-arthur
There was a prime sieve implementation through infinite streams as one of the exercises in SICP if I recall correctly, fun stuff :)
21:52:49
russellw
I'm seeing recommendations to use (in-package :foo) to define your own namespace in which to define your functions and variables separate from anyone else's. I can see how that mostly works fine, but the problem is, suppose I'm writing e.g. a symbolic differentiation library. That needs to input (expt x 2) and return (* x 2), but expt and * need to be the standard ones, not the ones in package
21:58:16
aeth
russellw: You could do two things (and probably several other approaches) if you have to define your own *. You could call cl:* or you could define foo:* from a package that uses :cl
21:59:29
jasom
asarch: FWIW "Dynamic Programming" is a fancy name for something that basically boils down to speeding up recursive operations with memoization. As far as I can tell it got named that "because it sounded cool"
22:00:23
aeth
russellw: I haven't tested to see if this is portable yet, but for my Scheme I create a package called r7rs, but I don't in-package it, and just define r7rs::+, r7rs::*, etc.
22:05:15
jasom
russellw: the only reason *not* to :use "CL" would be if you want to have a distinct symbol with the same name as a standard one.
22:06:29
pjb
jasom: yes, there was a period where you had things like operational research, dynamic programming, artifical intelligence. Nowadays, we have deep learning, and stuff…
22:06:58
russellw
aeth, jasom, see, the thing is, I do not want to define my own *, and the problem is not getting to use CL, the syntax for this is straightforward. The problem is /quoted/ symbols. If I say '* then that will end up returning 'foo:*. I could firmly resolve in my mind to always write 'cl:* but in practice I would sometimes forget, and there is no way to automatically check for this error
22:07:57
aeth
russellw: I misunderstood your question, I thought you wanted separate symbols so (differentiate:expt x 2) would return '(cl:* x 2)
22:08:31
russellw
Right, no, I would actually rather avoid shadowing standard symbols where possible
22:09:40
aeth
For this sort of thing I tend to define both a macro and a function, where the macro is something like (defmacro foobar (form) (foo form)) or (defmacro foobar (&rest forms) (foo forms))
22:11:16
aeth
foo would be a function that takes '(expt x 2) and return '(* 2 x) while foobar would be a macro that calls that function, so it would evaluate (* 2 x) assuming x is defined, e.g. (let ((x 42)) (differentiation-macro (expt x 2))) => 84
22:12:07
aeth
(For the (&rest forms) version, you may want a slight variant like `(progn ,@(foo forms)) or `(progn ,@(mapcar #'foo forms)) etc. depending on your API of foo)
22:17:30
aeth
(In this very strange case you might want to insert a + in front and then feed `(+ ,@forms) into foo)
1:54:46
PuercoPop
Xach: Hi, what would be required for Quicklisp to update the ASDF version it updates to? Is there any reason besides not being a priority that Quicklisp doesn't update ASDF past 2.26?
5:48:03
|3b|
(and not packages defined by systems loaded through ASDF directly or modules loaded by REQUIRE)
5:48:56
Shinmera
There's no connection between systems and packages, so there is not. You can just list all packages with list-all-packages though.
5:52:05
ober
asarch: (map nil (lambda (p) (bt:make-thread (ql:quickload (ql-dist:package-name p)))) (ql:system-list))
5:56:19
|3b|
asarch: (in case you miss the intervening discussion, what ober told you to do probably isn't a good idea, it will start a few thousand threads and try to download and load all of the things available in quicklisp)
5:59:43
|3b|
how big is ql these days? thought i remembered hearing it was over a GB, but can't find any concrete #s
6:02:54
jack_rabbit
asarch, You can't know for a particular lisp image, but you can see anything that's been downloaded in quicklisp's dists directory.
6:30:43
jackdaniel
asarch: if you want to see which packages were added after load (it is not the same, because ql may load packages which were already defined on your system!), you may compare list-all-packages before and after calling quickload
6:39:54
aeth
i.e. (let ((packages (copy-seq (list-all-packages)))) (ql:quickload :foo) (set-difference (list-all-packages) packages))
6:55:00
asarch
One last question: is there any way to know what provides a package? (e.g. "cl-glut-examples")?
7:12:57
minion
To send a memo, say something like ``minion: memo for nick: the memo''. I'll remember the memo for any nick which is the same as the given nick, +/- differences in punctuation, and any nick which is an alias for it, and give it to them when they next speak.
7:14:02
shrdlu68
dim: I'm getting an error building pgloader in a debian container: https://gist.github.com/shrdlu68/64aec53821d4d02389229bac5b638474
7:14:42
jackdaniel
v0|d: on this issue you may find how to use perf to profile ecl: https://gitlab.com/embeddable-common-lisp/ecl/issues/451 (you have command in comments and a screenshot in a descriptions)
7:16:01
dim
shrdlu68: hi! thanks for building pgloader, it denotes some interest that I like seeing ;-) the bug has been reported as a gihtub issue to, and only happens with very recent SBCL; it's either a SBCL or ironclad/nibbles bug
7:16:59
dim
can you edit the pgloader Makefile and make it download nibbles from github in QL local-projects in the build directory, copying what the Makefile does for some other packages?