freenode/#lisp - IRC Chatlog
Search
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: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?
22:52:14
phoe
if you have foo(String, String default "bar") and foo(String) you have separate functions, but then a call to foo("asfads") would be ambiguous
23:06:13
pjb
public void foo(String a, String b); public void foo(String a){ foo(a,"bar"/*the default*/); }
23:07:37
dim
pjb: do you know http://p-nand-q.com/programming/obfuscation/java/computed_gotos_howto.html already? ;-)
2:07:12
malice
I inserted break after some let, but I can only see one variable of this LET, and there should be three.
2:07:29
malice
Is it possible that compiler optimized out these variables and that's why they're missing?
2:15:59
malice
I'm still wondering. After adding log statements some variables appeared, but not all.
3:00:24
|3b|
ACTION just does (break "foo" x y z ...) when i want to see variables in break, works for specials or expressions too :) (hit enter or middle click on "foo" at top of debugger window to see the values in inspector)
3:03:21
|3b|
well, usually i just try C-u C-c C-c on the function and try restarting the frame if i'm not doing something where that risks breaking state i want to keep (or repeating external side effects in a bad way)