triffid has quit [Remote host closed the connection]
triffid has joined #commonlisp
dim` is now known as dim
msv has joined #commonlisp
<kiyafirs>
+bef
rendar has joined #commonlisp
istewart has joined #commonlisp
admich1 has quit [Ping timeout: 260 seconds]
admich1 has joined #commonlisp
johnjaye has quit [Remote host closed the connection]
johnjaye has joined #commonlisp
Bubblegumdrop has quit [Quit: ZNC 1.9.1+deb2+b2 - https://znc.in]
reb has quit [Remote host closed the connection]
soweli_iki has joined #commonlisp
decweb has quit [Quit: Konversation terminated!]
sveit has joined #commonlisp
<sveit>
Hi. I was wondering if it is considered good practice to have many small packages for "typed" operations. For example, say that I am defining a bunch of operations on bit-vectors and arrays of numbers which are similar, and so should be named the same thing (like vector+, matrix multiplication, etc) but which have very different implementations. to avoid a million names like "bit+", "array+", etc. (that can get quite long for more
<sveit>
examples) and which ends up getting disorganized, one could make a package for each datatype
<sveit>
but it seems that people do not tend to do that very much. CLOS is undesirable because I would still like the separate implementations of these functions for speed.
random-nick has quit [Ping timeout: 244 seconds]
Noisytoot has left #commonlisp [Leaving]
foretspa1sibles has quit [Ping timeout: 244 seconds]
foretspa1sibles has joined #commonlisp
rtypo has quit [Ping timeout: 252 seconds]
stanrifkin_ has joined #commonlisp
stanrifkin has quit [Ping timeout: 276 seconds]
<aeth>
I don't think there's one style here
<aeth>
although if you do have the type as a prefix, it's usually foo-, like the accessors that a struct FOO would generate
<beach>
Different packages sound like a good idea.
<beach>
sveit: What makes you think that using generic functions would make things significantly slower?
<sveit>
beach: I read that generic function calls are ~10x or more slower than regular function calls. maybe that's out of date.
<aeth>
Array and number stuff are kind of the best case scenario for non-generic code in CL
<beach>
sveit: That would depend on the implementation first of all. But more importantly, if your functions are doing real work, it is likely that the real work will dominate over the function call.
<beach>
Like "matrix multiplication" for instance. That is very likely going to dominate the execution time.
<sveit>
beach: that's true, but some of the functions I have in mind are just doing bit-operations, for example, over very small (say 3x3) matrices.
<beach>
OK. Good luck.
Noisytoot has joined #commonlisp
Bubblegumdrop has joined #commonlisp
JuanDaugherty has joined #commonlisp
<beach>
It is sad that generic functions are avoided for performance reasons. In this case, for instance, the caller must know the type of the argument to choose the right function in the right package. But if the type of the argument is known in the caller, a good Common Lisp implementation should be able to choose the right effective method without going through generic dispatch.
stanrifkin_ has quit [Quit: Leaving]
<JuanDaugherty>
do you avoid them for that reason beach?
<aeth>
beach: the real problem when matrices or mathematical vecs are involved isn't whether or not generics can be made fast, but that you usually want to be generic over the size of the matrix or length of the vec, not just the basic CL type
<beach>
JuanDaugherty: No, never.
<JuanDaugherty>
good
<JuanDaugherty>
that is to say good if u can use them in a facile manner cause u know how
<JuanDaugherty>
without great labor
<beach>
aeth: So you are saying that if you can't have generic dispatch handle the size, then you might as well avoid generic dispatch altogether.
Oladon has quit [Quit: Leaving.]
<aeth>
No, of course not. Genericness is too convenient. It just causes one to seek alternatives.
<beach>
JuanDaugherty: Not only do I think that the execution time of the code I write will be dominated by the real work of the function, but I have also published a paper that shows how to modify the call site when the callee is known, and it should be able to choose the right effective method.
<JuanDaugherty>
matching my expectation at least for stuff compiled to fasls
<aeth>
I think linear algebra lends itself more to the DSL approach than to something like generic functions. I tried other approaches like specialization-store, which dispatches based on the type (which includes array length), but it comes in two flavors: really slow, and manually DECLARE every type. This is because the implementation's type inference isn't exposed, only declarations (and even that requires an
<aeth>
extension!)
<JuanDaugherty>
i wouldn wanna do that in lisp if you mean solving problems in LP
Noisytoot has quit [Remote host closed the connection]
<JuanDaugherty>
the algebra or something but not the actual LP
Noisytoot has joined #commonlisp
<beach>
JuanDaugherty: Who said anything about LP (assuming by LP you mean "linear programming")?
edgar-rft has joined #commonlisp
sveit has quit [Ping timeout: 265 seconds]
<JuanDaugherty>
me; i interjected it from linear alg which I mainly think of in terms of solving LP
<JuanDaugherty>
or similar applications for which there is proven software
edgar-rft` has quit [Ping timeout: 272 seconds]
<aeth>
do these sorts of optimization problems even use linear algebra libraries? I don't know, they're such a formalized special case
chomwitt has joined #commonlisp
<aeth>
these days, if linear algebra is mentioned, I assume it's usually 1. graphics, 2. physics, 3. AI
<aeth>
sure you could use BLAS or CUDA or whatever, but with a sufficiently abstract frontend, you can swap out the backends as needed
istewart has quit [Quit: Konversation terminated!]
sveit has joined #commonlisp
<JuanDaugherty>
right, that's what i was sayin, lisp stuff for other than the actual problem computations
<JuanDaugherty>
which those pkgs address
sveit has quit [Ping timeout: 248 seconds]
<beach>
Interestingly, linear programming with floating-point arithmetic can be arbitrarily incorrect because of loss of precision, so if you want reliable results, it is best to use rational arithmetic, making Common Lisp ideal for such problems.
admich1 has quit [Ping timeout: 252 seconds]
JuanDaugherty has quit [Quit: praxis.meansofproduction.biz (juan@acm.org)]
admich1 has joined #commonlisp
sveit has joined #commonlisp
<aeth>
today's computers are so fast you can just use Lisp for compuational floating point stuff... it won't be highly optimized asm, but you probably won't notice, either, and even if you did, SBCL (and possibly others) can have inline asm, too
sveit has quit [Ping timeout: 276 seconds]
sveit has joined #commonlisp
sveit has quit [Ping timeout: 260 seconds]
mishoo has joined #commonlisp
ewig has joined #commonlisp
ewig has quit [Remote host closed the connection]
ewig has joined #commonlisp
sveit has joined #commonlisp
v88m has joined #commonlisp
admich1 has quit [Read error: Connection reset by peer]
admich1 has joined #commonlisp
bpanthi977 has quit [Ping timeout: 276 seconds]
sveit has quit [Ping timeout: 245 seconds]
ewig has quit [Remote host closed the connection]
pve has joined #commonlisp
ewig has joined #commonlisp
khinsen has joined #commonlisp
cmack` has joined #commonlisp
cmack has quit [Ping timeout: 260 seconds]
rgherdt has joined #commonlisp
rgherdt has quit [Remote host closed the connection]
rgherdt has joined #commonlisp
v88m has quit [Read error: Connection reset by peer]
v88m has joined #commonlisp
msv has quit [Quit: Leaving]
v88m has quit [Read error: Connection reset by peer]
brokkoli_origin has quit [Remote host closed the connection]
<yitzi>
mi6x3m: use LOOP and collect
<Colleen>
yitzi: drmeister said 14 hours, 44 minutes ago: Can you ping me when you are online? I'm seeing a thing with yampi where the server seems to be dropping messages from clients.
brokkoli_origin has joined #commonlisp
<beach>
mi6x3m: ,(loop for x in '(a b c) for y in '(1 2 3) collect x collect y) as yitzi suggested.
<ixelp>
(loop for x in '(a b c) for y in '(1 2 3) collect x collect y) => (A 1 B 2 C 3)
* beach
thinks that we might now hear that LOOP is not "lispy".
<gilberth>
Indeed. How about ,(mapcan #'list '(a b c) '(1 2 3))?
<ixelp>
(mapcan #'list '(a b c) '(1 2 3)) => (A 1 B 2 C 3)
<beach>
gilberth: yitzi is working on Khazern (an implementation of LOOP), so consider this a publicity stunt.
yitzi has quit [Read error: Connection reset by peer]
yitzi has joined #commonlisp
<yitzi>
I approve of the MAPCAN though. I'm a fan of MAPCAN wherever it can be used.
<beach>
Sure.
v88m has quit [Read error: Connection reset by peer]
reb has joined #commonlisp
chomwitt has joined #commonlisp
v88m has joined #commonlisp
v88m has quit [Read error: Connection reset by peer]
<jackdaniel>
it is called mapcan, not mapcant after all :)
<jackdaniel>
I think that a separate macro collect as present in cmuutils for instance makes perfect sense, it nicely composes with mapping functions
<yitzi>
mapcon is the one with the weird name. should've been maplisn
<yitzi>
or maplin
v88m has joined #commonlisp
v88m has quit [Read error: Connection reset by peer]
v88m has joined #commonlisp
v88m has quit [Read error: Connection reset by peer]
v88m has joined #commonlisp
v88m has quit [Remote host closed the connection]
v88m has joined #commonlisp
v88m has quit [Remote host closed the connection]
v88m has joined #commonlisp
v88m has quit [Remote host closed the connection]
v88m has joined #commonlisp
apac has quit [Ping timeout: 265 seconds]
v88m has quit [Read error: Connection reset by peer]
v88m has joined #commonlisp
bpanthi977 has joined #commonlisp
v88m has quit [Read error: Connection reset by peer]
stanrifkin has quit [Quit: Leaving]
v88m has joined #commonlisp
apac has joined #commonlisp
v88m has quit [Read error: Connection reset by peer]
mi6x3m has quit [Quit: Leaving]
leeb has joined #commonlisp
leeb_ has quit [Ping timeout: 252 seconds]
v88m has joined #commonlisp
v88m has quit [Read error: Connection reset by peer]
v88m has joined #commonlisp
v88m has quit [Remote host closed the connection]
v88m has joined #commonlisp
<kanuba>
(mapcan #'list '(a b c) '(1 2 3)) seems wrong, mutating a constant read-time structure.
<kanuba>
Ah nevermind, the lower order function should prevent that.
<yitzi>
by lower order you mean LIST?
<kanuba>
Yes
<kanuba>
The application constructs a new runtime structure
JuanDaugherty has joined #commonlisp
<kanuba>
I can't count the times I foolishly used mapcan on some closer-mop returned structures and corrupted my implementations internals, requiring a restart.
<kanuba>
But, there's always alexandria:mappend for similar behavior
<yitzi>
Yes, a mapcaa using APPEND would have been nice, but it has the small gotcha that the last list is not copied.
khinsen has joined #commonlisp
apac has quit [Ping timeout: 265 seconds]
pkal has quit [Read error: Connection reset by peer]
v88m has quit [Read error: Connection reset by peer]
apac has joined #commonlisp
Guest70 has joined #commonlisp
v88m has joined #commonlisp
Guest70 has quit [Client Quit]
v88m has quit [Read error: Connection reset by peer]
Guest57 has joined #commonlisp
khinsen has left #commonlisp [#commonlisp]
Guest57 has quit [Client Quit]
v88m has joined #commonlisp
v88m has quit [Read error: Connection reset by peer]
shka has quit [Quit: Konversation terminated!]
<decweb>
Shameless plug (if overkill): https://github.com/dtenny/clj-coll supplies `interleave` and `minterleave` depending on whether you want immutable or mutable results.
<ixelp>
GitHub - dtenny/clj-coll: Clojure collection and sequence APIs in Common Lisp, with optional Clojure collection syntax
v88m has quit [Read error: Connection reset by peer]
<decweb>
s'immutableimmutable|lazy/
Posterdati has quit [Remote host closed the connection]
<decweb>
s'immutable'immutable/lazy' ... third try, lots of irc fumbling ...
v88m has joined #commonlisp
v88m has quit [Read error: Connection reset by peer]
Posterdati has joined #commonlisp
v88m has joined #commonlisp
ingeniot has joined #commonlisp
ecraven- is now known as ecraven
JuanDaugherty has quit [Read error: Connection reset by peer]
DustyDynamite has joined #commonlisp
yitzi has quit [Remote host closed the connection]
anticomputer_ has joined #commonlisp
anticomputer has quit [Remote host closed the connection]
yitzi has joined #commonlisp
DustyDynamite has quit [Quit: Leaving]
admich1 has quit [Ping timeout: 260 seconds]
admich1 has joined #commonlisp
zxcvz has joined #commonlisp
ingeniot has quit [Ping timeout: 252 seconds]
zxcvz has quit [Client Quit]
admich1 has quit [Read error: Connection reset by peer]
admich1 has joined #commonlisp
<gilberth>
yitzi: The last list not being copied with APPEND would be fine for you would perhaps be using this with non-destructive code. I'd like to propose the name MAPCAP though.
<yitzi>
mapcap?
<yitzi>
What's the P stand for?
v88m has quit [Remote host closed the connection]
<gilberth>
It comes from the "P" in "APPEND". The "C" is for giving you the CARs. MAPLAP would be the variant that gives you the successive CDRs like MAPL or MAPLIST.