freenode/#lisp - IRC Chatlog
Search
11:20:54
schweers
does anyone here use series? I had a problem that I always got a whole load of warnings about using non-series objects as series expressions (or something like that, I donβt remember the exact detail). Was I likely doing something wrong or does series not behave well if parts of a series computation are defined and reused in different places?
11:22:18
knobo
djeis: https://sourceforge.net/p/sbcl/sbcl/ci/f0cda4884a396fa7a215f461c0187bac28f87521/
11:22:28
djeis
schweers: I've worked with it a good bit, but I don't understand too much of the internals. It's code-walker does some fun stuff inside lol.
11:23:07
schweers
as long as I had /one/ large expression all was well, but β¦ thatβs not how I like to do things
11:24:28
djeis
Nothing's wrong with them. I like them too, when they make code clearer. Just wasn't expecting it π
11:26:51
knobo
I also like anaphoric macros. Just that I realized that my likings does not always help me.
11:27:55
knobo
I'm kind of damaged by using perl for many years. Though it's quite many years since I used perl now.
11:28:37
knobo
I'm still afraid of going down the path of "wow... thats a cool feature. let me see how I can misuse that"
11:29:37
djeis
That's fair, I suppose, but I find in Lisp that kind of thinking can also lead you to a better understanding of what's actually going on under the hood.
11:31:58
djeis
The series optimizer is trying to make a single loop out of the series expression you've created, so it can efficiently pipeline everything.
11:32:48
djeis
If the expression has state which cannot be resolved in a single pass loop the optimization fails
11:33:22
djeis
And it gives you a ton of warnings because when screamer was written the fallback runtime code was a lot slower
11:33:32
schweers
thatβs what I though too. seems to me that that makes it almost unusable in real programs
11:34:15
djeis
It makes it a lot less flexible, I suppose, but no less that any other looping construct.
11:35:28
schweers
without fully understanding those in the firstplace, so I may have been very misguided
11:37:21
schweers
I know, but it doesnβt seem to do that by storing state (i.e. closures and the like) but by resolving it all at macro expansion time
11:38:27
djeis
The problem with series is that it's trying to not loop over its inputs twice. Transducers can't do that either.
11:40:29
schweers
are you sure? because I thought that transducers avoid exactly that. Well, that and consing.
11:42:20
djeis
But yeah, the series fallback is closer to using lazy sequences in clojure instead building a transducer
11:45:22
schweers
I might still have some code in git, but I can hardly remember where and when to look
11:46:05
schweers
but it was basically something like this: (let ((intermediate (series stuff ...))) (do series stuff with intermediate))
11:47:45
djeis
Every code-walker you introduce adds a ton of compilation overhead, and because code walking isn't standard across implementations occasionally they step on each other's toes. Not a huge problem in practice, but it's bitten me once or twice.
11:48:27
schweers
hmm, okay? I do have one issue with this: iter code is annoying to debug, at least in sbcl
11:49:48
djeis
If you've set debugging to 3 you can usually step through it just fine, in my experience.
11:50:45
schweers
sbcl tells me which expression itβs about to evaluate, but if I let slime show me the code it highlights the entire iter expression
11:51:46
djeis
It's not like a regular macro, so it's much more difficult for sbcl to track where the input code ends up in the generated expression. It also effects the warnings sometimes.
11:54:50
djeis
So yeah, when I can I often use loop or do, since they have much better behaved semantics with the debugger and compiler and are often slightly better optimized. Occasionally tho, you can't beat some of the tools iterate gives you.
11:56:00
schweers
Iβve never been a fan of loop, I always have to look up how to say things. iter just feels much more natural to me. thatβs one of the reasons I use it. Also there are things that are easy to say with iter, but cannot be directly expressed with loop
11:56:43
djeis
Both have similar tools to iterate but limit themselves just enough that they don't need a code walker
11:57:55
djeis
Once the code gets complicated enough, readability alone is often enough that I use iterate regardless
13:02:40
Shinmera
Speaking of FOR, I've just updated the docs to add some comparisons to LOOP for the examples.
13:11:03
axion
Shinmera: Thanks for listening. and I saw your comment, I just don't know how to reply yet.
13:14:58
Shinmera
π΄π ππππ ππππ ππππππ ππππ
13:15:04
axion
Shinmera: would it be possible to have the same syntax as loop destructuring, minus the ordinary lambda list sutff like &key etc, but given a VALUE form?
13:15:13
schweers
ACTION just realized that the word umlaut does not contain any of the characters it describes
13:16:52
jackdaniel
phoe: it was an unicode character `WHITE VERTICAL RECTANGLE (U+25AF)' copied over to fool around
13:17:41
phoe
schweers: πππ ππππ ππππ πππ π±ππππππ πππ πππππππ. π―ππ ππππ π·πππ πππππππ ππππ πππππππ ππ?
13:19:14
schweers
and I thought it was somewhat fancy that I can enter some greek symbols directly from the keyboard
13:19:46
Shinmera
axion: Having something like (for:for (((a b c) = (something) :transform-by multiple-value-list))) could work, but I don't know.
13:21:54
Shinmera
axion: Alternatively: (for:for (((values a b c) = (something)))) could work, but it would rule out using values as the name of a variable while destructuring.
13:22:02
jackdaniel
hum, someone apparently wrote a paper with a proof, that P <> NP: https://arxiv.org/pdf/1708.03486.pdf
13:22:40
axion
Shinmera: I have been thinking about it, and I don't think it is easily handled, nor does it make much sense.
13:23:01
Shinmera
axion: Well, I can see value in it, or value in the general :transform-by argument as posted above.
13:23:41
axion
Ok, I'm just not sure the best way to do it. I will say that loop, metabang, let-plus, etc all do not handle it though
13:24:16
Shinmera
The first case would require modifying all the existing bindings to include a :transform-by key argument. The latter would require changing the UPDATE operator.
13:24:59
axion
Actually ignore that last comment. let-plus does handle it, but it's not an iteration library. I'm not sure what I was thinking. There is something it didn't handle, but I can't remember now. I think I need to wake up.
13:25:55
Shinmera
The foreign update binding thingy I have on my own wishlist for FOR is much more complicated to implement without incurring general overhead.
13:30:55
Shinmera
The foreign update binding would require either a prefetch phase where the bindings are scanned for injections, which are then inserted into the update forms of the respective target bindings, or control variables that are set when an update happens.
13:34:02
Shinmera
Also: FOR generates efficient code where it can. Expansions should be on par with LOOP.
13:42:08
axion
TIFF supports 32 bit color, layers, and many internal formats, mostly lossless with better compression.
13:43:10
axion
Well I guess I can't ask you to compare my library with png-read then if you use FFI :)
13:44:35
Shinmera
I'm always open to switching to CL-native things, if I don't have to drop support. So, if there's something that can load JPG, PNG, GIF, and BMP in reasonable time I'd be happy to switch.
13:46:06
axion
opticl currently uses png-read, which is incredibly slow, but I am looking to change that.
13:47:39
Shinmera
I'm currently much more bothered by Harmony/cl-mixed fucking crashing in my face for inexplicable reasons.
13:48:35
Shinmera
Ah. I don't use the gl functions. I just load into memory and handle the texture allocation myself.
13:50:00
axion
It's a nasty issue though, for an unmaintained piece of software. Baggers wants to wrap SOIL2 soon.
13:51:19
Shinmera
Speaking of texture crap, any idea why this would give me an invalid operation gl error: (GL:TEX-IMAGE-2D :TEXTURE-2D 0 :DEPTH-STENCIL 956 1160 0 :DEPTH-STENCIL :UNSIGNED-BYTE (null-ptr))
13:51:20
axion
I personally try to do everything in portable CL except when I have no control. I use sdl2 for windowing, and opengl because, yeah.
13:51:35
Shinmera
Even if I use a specific internal format like :depth24-stencil8, I get the same complaint.
14:11:46
Bike
simple-array definition question. clhs make-array says that if :displaced-to is nil, the new array is not a displaced array. but clhs array-displacement says it can, depending on implementation, return something for arrays that were made with :displaced-to nil
14:17:05
phoe
"If make-array is called with adjustable, fill-pointer, and displaced-to each nil, then the result is a simple array."
14:18:42
beach
Some implementations implicitly displace some arrays. (For example, adjustable arrays might be represented as displaced arrays.) Permitting ARRAY-DISPLACEMENT to return non-NIL for those arrays allows those implementations not to have to record some additional information in the array about whether an explicit :DISPLACED-TO was provided.
14:19:15
Bike
That's what I thought, but I don't understand how that's allowed by the definition of make-array
14:24:06
Bike
i understand that, what i don't get is the apparently clear prohibition on make-array: "If displaced-to is nil, the array is not a displaced array."
14:24:18
Bike
is that just wrong? or does "displaced array" not mean "array that returns something from array-displacement"?
14:25:54
beach
But, honestly, I think they got it wrong. The two pages were probably written at different times.
14:43:57
schweers
beach: is this a typo? βFurthermore, most of the improvements will be such that a modern
14:48:21
schweers
um. I thought you meant it the other way around: that a modern conforming implementation of of Common Lisp will already be a conforming implementation of WSCL
14:55:19
beach
It so happens that the Common Lisp HyperSpec states that, by default, if nothing else is mentioned, then the behavior is undefined (or unspecified, I forget).
14:57:22
beach
schweers: Yes, some implementations would like to make some code as fast as possible, so it is reasonable to leave the door open in unsafe code.
14:58:45
Bike
it's pretty inconsistent. integer-length has "should signal a type error", which means in safe code it's signaled
14:59:29
beach
Yes, very inconsistent. And I am guessing that the reason for that is mostly laziness on the part of the authors.
15:01:15
beach
schweers: So I don't want to add any work (or as little as possible) for maintainers of existing modern Common Lisp implementations. I merely want to make life easier for application programmers, so that they can trust some widely agreed-upon behavior.
15:02:22
beach
And I think that is the only kind of update to the standard that would be widely accepted.
15:02:50
schweers
Bike: this is not merely a boring part. Itβs scary! I didnβt know that βshould be signaledβ meant that I might not get a condition if i lower the safety level below 3.
15:03:44
beach
schweers: Since it is sooo 20th century to print things, we can afford to have the explicit text on every page nowadays.
15:07:33
beach
So, for this issue about array-displacement, I would check all major implementations, and if they all return NIL when NIL was given to :DISPLACED-TO I would remove the possibility for implementations to return something else.
15:09:04
beach
The possibility of returning non-NIL saves at most a word in the implementation of an array. That doesn't seem relevant anymore.
15:11:28
beach
Anyway, I consider taking contributions to WSCL. Someone told me I unfortunately used an old dpANS, so that could be fixed. And turning individual chapter files into a single LaTeX document is something other people are better at than I am.
15:21:34
kami
Hi beach: I was very busy working in two different customer projects at the same time.
15:25:35
kami
Can someone please help me optimise this function. I've sprinkled it with any combination of (the single-float ...) and (the fixnum ...) without avail. Now I've decided to try to understand with your help what happens.
15:27:31
Shinmera
kami: Well, your integer can be a bignum, so log can't be optimised for fixnums, so truncate can't, so 1+ can't.
15:29:13
Shinmera
axion: Apparently the data type had to be :unsigned-int-24-8 (which is not mentioned on the spec page!) to match the depth-stencil format.
15:30:07
Shinmera
Anyway, so UI component clipping works. https://filebox.tymoon.eu//file/TVRRd013PT0=
15:34:06
kami
Bike: I pasted a wrong version. http://paste.lisp.org/display/353520#1 is with fixnum. Here, log is obviously optimised, but truncate now complains.
15:37:27
Bike
not totally sure what's going on there, but you allow n to be negative, meaning log n will be complex
15:38:14
_death
it seems you're just trying stuff until things seem to work, instead of actually thinking about what input you want to have
15:39:07
zulu_inuoe
Just because I always seem to discover new magical loop uses, is there a non-consing way to LOOP backwards through a list?
15:41:34
zulu_inuoe
Bike: That is true. I'll need to go back and optimize it anyway (drawing goes back-to-front, but raycasting happens front-to-back) so for now a consing loop (reverse it is
15:42:53
phoe
zulu_inuoe: NREVERSE is the non-consing destructive version, REVERSE has no side effects but conses.
15:44:29
zulu_inuoe
phoe: Yes. I am aware. I'm going to cons away with reverse for now and come back to it, because it's not worth it to make it a 'from end' loop if I have to hand-code it. So I'll just come back to it eventually and probably use a different data structure
15:56:21
zulu_inuoe
phoe: It's UI code. Panels have a list of their children. So, small numbers like 10, max.
15:56:40
zulu_inuoe
And this reverse call is only on hit detection for mouse clicks, so it's not every frame sort of thing
16:01:54
phoe
zulu_inuoe: do you know the length of the list in advance? is it constant for your whole operation?
16:02:38
oleo
there's no guarantee on inlining but the compiler will know when and when not the best....
16:03:46
zulu_inuoe
Really.. I am just going to go back and write something efficient at a future date. It is okay!.. But thank you
16:03:53
phoe
if required, bind it to a special variable so you can access it from anywhere in your call.
16:06:42
zulu_inuoe
and yeah I just realized I can get rid of that let and use two more :for clauses
16:07:00
zulu_inuoe
but aughh I will move on to my actual TODO list for today :P this is too distracting
16:35:22
beach
As it turns out, the maximum number of traversals is quite small, and traversing a list is quite fast.
16:35:49
beach
For the sequence functions, it is expected that the most time is spent in the KEY and TEST functions.
16:42:37
beach
Time to go fix dinner for my (admittedly small) family. I might check in briefly later.
16:51:25
jasom
Fare: it looks like I left my ql2nix script in a non-working state. I fixed the two issues I found and it's now running smoothly with 1270 nix expressions generated, which is ~40% done. It's an O(n^2) algorithm, (though with a verly large factor on the N and small factor on N^2) so probably ~20 more hours for it to run. I plan on parallelizing it once it's working solidly, which should hopefully get me to
17:04:02
jackdaniel
are you planning to include some kind of benchmark table? (comparing to cffi and png-read)?
17:04:12
warweasle
In PAIP, where he uses unification to create a logic-based prolog: Could I use a depth first topological sort instead?
17:08:09
axion
Xach: Not much actually, and the benefit of the 2 (I think) specials far outweigh a performance penalty. The specials shadow the buffer pointer for each branch of the concrete syntax tree, so I do not have to manage it myself.
17:09:47
Xach
apng has been around for a long time but support is not universal. but i think it is increasing.
17:12:25
axion
I will be taking a break from image formats for a little bit. It took me a week to code this up, because I wanted to do it right. I had help from |3b|...he contributed quite a bit of code too. Thanks!
18:03:44
jasom
thetabit: also if you want to share structure (plists can be used as a very simple immutable data type)
18:06:52
thetabit
so I am trying to create objects that store information about a database and it's tables and fields. Properties include can update table, can update a field within a table, or table is read only, etc. I can't imagine that the property list would be very big, maybe like 15 properties
18:10:28
thetabit
haha, I'm just being hesitant because it feels like it needs to be more complicated... I am going to try to build first using plist, (or alist) and see how it feels :D
18:12:17
axion
Right. Any list, or actually linked list, must traverse it to the end to add to it, or find something in it. Hash tables are near constant speed....not linear.
18:12:38
axion
You can push to the front of a list rather fast, or keep a pointer to the tail to avoid this, but
18:13:19
Shinmera
The constant lookup of a hash table can exceed the traversal of a list in some cases.
18:13:31
thetabit
Yep just small data sets contain properties for how an object should be loaded. So small lists seem to be okay in this instance I think
18:14:13
warweasle
If I have a recursive function where all paths return nil, will that tail-call optimize?
18:51:05
Bicyclidine
is change-class a no-op if the instsance is already a direct instance of the class, or should i ust avoid that
18:53:36
Bicyclidine
function parameters aren't destructured arbitrarily. you can use destructuring-bind for that.
18:53:52
some-user
for example if i'm expecting function to accept point struct(x,y) can i get those x and y in (defun f (magic x y))?
18:57:12
axion
If that is a real 2d point struct, it should probably not be a structure-class anyway and supply :type argument instead.
19:00:09
axion
some-user: Sure. a defstruct has the option to be typed into a list or vector, to be compiled into such a type, instead of having the overhead of a class instance. This way, you get vector indexing with aref etc, as well as named accessors, and the result, on sbcl at least is the same assembly as regular arrays.
19:03:14
axion
some-user: Here is an example of mine. 'instances' of this struct are not class instances like normal structs, and are instead (simple-array single-float (3)) types. At the same time, you can still use the x/y/z accessors to index into them. https://github.com/mfiano/gamebox-math/blob/master/src/vector-base.lisp#L6-L13
19:04:09
pjb
Bicyclidine: the standard doesn't seem to say anything, but the name of update-instance-for-different-class would indicate that change-class doesn't call it when it's the same class. Otherwise, you could count on side effects performed by shared-initialize and update-instance-for-different-class to apply. I think I would avoid doing thatβ¦
19:05:21
pjb
You can use with-accessors on any kind of structure or even other things, as long as you have accessors for it.
19:06:56
pjb
(defstruct (point (:type list)) x y) (defun foo (p) (destructuring-bind (x y) p (list :x x :y y))) (foo (make-point :x 1 :y 2)) #| --> (:x 1 :y 2) |#
19:07:30
pjb
or (defun bar (x y) (list 'x x 'y y)) (apply (function bar) (make-point :x 1 :y 2) #| --> (1 2) |#
19:09:20
axion
Which is plenty high on most implementations. As far as I remember ABCL had 50, which is by far the lowest I've seen.
19:14:52
_death
phoe: sure, I can give you at a monetary rate that's a little higher than average.. and a supply rate that's reasonable
19:18:43
pjb
You'd need, I estimate, about one billion Earth planets to gather 2^128 bytes of RAMβ¦
19:19:28
pjb
(current Earth planets. Of course, we'll have more storage in the future; can you afford a time machine?)
19:19:59
_death
pjb: if you understood my meaning, you'd understand that I would get richer and richer so I can buy more and more galaxy to sell :)
20:27:03
jrm
Anyone here today affiliated with common-lisp.net ? Most or all of the tarball links at gitlab.common-lisp.net seem to be broken.
20:57:37
Posterdati
phoe I fixed an iolib issue with openbsd errno constants, if someone is interested...
21:03:21
pjb
Posterdati: it's rather very easy to know, you just log in into your github account, and it will tell you everything about your PR.
21:09:21
phoe
Common Lisp: where you suddenly remember that you made a pull request two years ago and go check if it was merged
21:32:09
rpg
I could perhaps ask Dave if I could put the LW evaluation license I have on his VM, but he'd have to agree it's only for ASDF testing use.
21:32:33
rpg
I'd like to punch the person who thought /var was a good place to put virtual machines.....
22:10:57
dim
I want to extend a feature from cl-mustache, and for that I want to add a bahevior when a defmethod returns nil, can I do that from an :after auxiliary method, or do I need to implement an :around method?
22:19:15
phoe
dim: you need to create a subclass of that class, unless the class is final, at which point you're screwed. inside that subclass, create a method with the same signature and include a call to super() that will return a value; based on that value, you will be able to implement the logic you want.
22:19:45
phoe
oh, whoops, this is not Java - here you can do it in three lines of code instead of a whole separate God damn class file <3
22:26:00
Shinmera
If reflection actually allowed replacing methods Java could be made to be much more bearable.
22:28:54
dim
phoe: and in Java you can't make anything happen unless you have access to all call sites instanciating the objects
22:30:34
phoe
dim: of course you have all call sites instantiating the objects, after all you've made your own Factory class that produces these objects for you, so you only change the Factory code.
22:31:04
phoe
it's obvious you don't create these objects anywhere else in any other places or ways and no other client code you're using creates them anywhere else, right? Right?