freenode/#lisp - IRC Chatlog
Search
3:23:46
equwal
no-defun-allowed: CL lacks lots of basic functions it would be nice to have. Like today I wanted to compute some permutations, and had to write the code manually (when it could have been a library).
3:31:35
pjb
Strange... (com.informatimago.clext.association::permutations '(1 2 3)) #| --> ((1 2 3) (2 1 3) (2 3 1) (1 3 2) (3 1 2) (3 2 1)) |#
4:46:33
aeth
permutations would be pretty low on my 'nice to have built into a language' list, below regexp, and I rarely use regexp
4:49:48
aeth
but when the hard algorithm for $thing is on Wikipedia and it's not that many lines (incomprehensible lines, but still not many lines)...
6:02:30
ebrasca
loke: For example replace (+ (* x x) (* x x) (* x x)) with (* 3 x x) or someting better.
6:06:18
aeth
and when they're not floats, you still get generic arithmetic unless you can bound the problem because they could become bignums
6:36:02
loke
You have a simplifier function that takes an expression, and simplifies it, such as: ((MTIMES) x x) → ((MEXPT) x)
6:45:00
ebrasca
loke: Can maxima replace (loop :for i :from 1 :to 10 :sum i) with someting like (/ (* (+ 1 10) 10) 2) ?
6:50:16
no-defun-allowed
Maxima doesn't work on arbitrary CL code, and I don't think it has too many imperative constructs either.
7:00:28
aeth
you'd want a separate macro for that because, well, once you go declarative you lose a lot of determinism. Changeg one thing and suddenly O(1) to O(n!)
7:05:39
loke
Since all Maxima equations are expressed as Lisp structures, you can easily use it programatically
7:10:30
aeth
This isn't particularly hard to program up. It can get messy later on but still... https://en.wikipedia.org/wiki/Summation#Identities
7:11:31
aeth
iirc, I started doing something along those lines for my Project Euler solutions, but never cleaned it up enough to be useful
7:21:43
aeth
the problem with rules is that you can never have enough rules in your system if you don't limit your scope
7:22:12
aeth
before you know it, you're going to be saying "sure, I guess integrals are technically in the scope of a summation macro"
7:26:24
edgar-rft
For infinite scope you'd need an infinite number of rules. There's always at least one case left. Same why one can't handle *all* real-world problems with laws. :-)
7:27:15
aeth
ebrasca: two potential downsides: (1) compilation time or (2) too magical so you can't actually tell what's going on
7:28:35
aeth
I suppose the third downside is that you give up some dynamicness to be optimized. You can see this fairly directly what the currently-optimized CL looks like
7:29:41
aeth
ebrasca: afaik optimizations are, well, the goal of optimizations is to take something that's easy to understand and make it hard to understand, but faster, so that the source code is as simple as possible
7:32:53
aeth
The downside if you go too far is that it can be fragile. You wind up with a system you don't really understand and you can only hope to say the right magic words to make it run fast. SQL appears to me like a good example of this.
8:09:13
p_l
(the joke goes that if you know how to use EXPLAIN there's a >$300k/year salary waiting for you)
9:12:01
phoe
let us discuss (subtypep `(cons (satisfies foo) (satisfies foo2)) `(cons (not float) t))
9:12:32
phoe
on a fully conforming implementation without FOO or FOO2 defined, is NIL NIL the only valid result?
9:41:28
phoe
minion: memo for Bike: we screwed up. CLHS SATISFIES describes the type specifier as: "denotes the set of all objects that satisfy the predicate predicate-name, which must be a symbol whose global function definition is a one-argument predicate."
9:44:16
phoe
minion: memo for Bike: but a quick (defun foo (x) (declare (ignore x)) (= 1 (random 2))) and the same for foo2 bar bar2 fix that issue.
9:45:00
phoe
This also answers the question I had above - the consequences are undefined so the implementation can return anything or nothing.
9:45:17
phoe
ebrasca: European Lisp Symposium next year is where I'll be, I'm also in Cracow all the time
10:01:42
phoe
OK - because of the above, I would request https://gitlab.common-lisp.net/ansi-test/ansi-test/merge_requests/30/diffs to be reviewed.
10:05:47
jackdaniel
good luck, I've heard that a maintainer is a very unresponsive person. first remark: add proper commit message, this does not tell me anything
10:29:39
phoe
And as far as I understand, whether t1 is a subtype of t2 depends on a series of coin flips at typechecking time - it might be a subtype, it might not.
10:31:02
jdz
Isn't there a constraint that the same type test for the same value should always return the same value?
10:33:09
phoe
The page for TYPEP also states: A type-specifier of the form (satisfies fn) is handled by applying the function fn to object.
10:34:24
phoe
It also doesn't make too much sense to me - if I have an object with a slot, I can define a SATISFIES type that checks whether the value in that slot is true or false. Naturally, this means that every time I mutate the value of that slot, the "cached" results for SATISFIES are no longer valid.
10:36:04
jdz
I don't understand: how can you cache a result of SATISFIES test? What's the cache key?
10:36:21
phoe
"<jdz> Isn't there a constraint that the same type test for the same value should always return the same value?"
10:37:11
jdz
The same result of SATISFIES test for the same value; what' you're saying about the slots is that you're using a different value.
10:39:20
jdz
Well, if time is a parameter for a SATISFIES test, then I don't find such a type very useful :/
12:36:59
phoe
minion: memo for Bike: OK, here is the first rough draft of my range-merging hack. https://plaster.tymoon.eu/view/1557#1557 Works on CCL, should work on SBCL with minor modifications.
12:44:46
phoe
In theory we could skip the whole checking if there any neighboring ctypes and just go straight for trying to find the exclusive points. I'll add that simplified version in the first annotation.