freenode/#lisp - IRC Chatlog
Search
15:24:00
oni-on-ion
its the caffeine junkies, honestly i think; the more caff i got in veins, the faster i want things to go
15:25:10
beach
schweers: Oh, and by the way, if you do attempt it, I am very interested in the outcome.
15:25:39
schweers
I guess it really would be best to attempt to carefully measure the runtime before and after the change
15:26:30
schweers
Ah, I remember what one of my reasons was: as far as I know sbcl does not use the types given in the slots of a standard-class, but does so in structs.
15:27:52
schweers
what exactly do you mean? what does sbcl do with the slot types when debug is 3? check on every access (write?), whether the type still holds?
15:29:13
beach
I almost never need all the speed that I could get, so I run everything with (DEBUG 3) (SPEED 0) (SAFETY 3).
15:31:02
dim
data structures come first, but well you need to have an idea of the algorithm you want to implement I guess
15:32:52
beach
Occasionally, for benchmarking code related to performance claims in a paper, I use local declarations that override this default.
15:36:33
beach
Today I have been working on specifying precise stack traversal for the SICL GC. I think I need three tables for each possible frame: One table indicating what stack locations contain local variables with Common Lisp objects. One table indicating what callee-saves registers contain variables with Common Lisp objects. And one table mapping callee-saves register so stack locations in which caller data was saved.
15:36:57
oni-on-ion
hmm "Bear in mind, though, you may get some nasty surprises by meddling with global defaults. Just for example, with those development settings, libraries that make use of tail recursion may not work properly."
15:37:37
beach
oni-on-ion: You mean libraries that count on implementation-specific handling of tail recursion?
15:38:49
beach
So, for the GC, I need to traverse the stack with a table holding frame-related values of callee-saves registers, swapping them with real stack locations as I go down the stack and swapping back when I back up the stack.
15:39:20
oni-on-ion
beach: sry not sure, its from here: https://www.reddit.com/r/lisp/comments/39i6lx/is_there_a_way_to_have_a_global_declaim/ -- i might just put :optimize in defsystem for my own stuff
15:39:56
beach
oni-on-ion: Common Lisp does not require implementations to optimize tail recursion, so a library that relies on that is not portable.
15:40:54
oni-on-ion
beach: ah makes sense, i was wondering, the guy is just extra-defensive. i won't worry.
15:42:42
beach
I have no opinion. Like I said, the things I do run fine with my default settings, except for the occasional local declaration. I have no desire to make my "production" code more optimized and less safe.
16:14:06
didi
Tell me if this is reasonable: I have a macro like `dolist', that iterates over a data structure, offering an element at each loop pass. To avoid allocating a new element for every loop pass, I'm thinking of allocating only one element and filling it with data at the beginning of the loop. This means that any program using this macro can't just take the element and run with it. Is this OK?
16:15:19
beach
didi: I don't understand. Are you elements just Common Lisp objects or are they structured in some way?
16:17:30
didi
beach: They are structured in a particular way. I interact with this data structure using an `element', but there is not `element' inside of it. When I add and `element' to it, it is broken down inside it. When I retrieve and `element' from it, it is constructed.
16:21:18
didi
beach: Sure. I have a big graph. This graph has something called a CONTACT. Whenever I want to iterate over all the contacts of this graph, I don't want to alloc each and every contact. Sometimes I just want to know if the contact I have in hand is inside this big graph.
16:22:57
beach
didi: So are there contacts associated with the nodes of the graph scattered around the graph already, and you want to search for a particular one?
16:24:05
didi
beach: Because there isn't an object contact inside it. When I ask for the contacts, it's produced using the relationships of the graph.
16:24:59
beach
Oh, so what I said was false. There are not already contacts associated with nodes in the graph. They are somehow generated during traversal?
16:26:10
didi
beach: Oh, yes. But they are local, so there's no need for a search. They are almost like labels. So a contact is a triple (vertex1, vertex2, label).
16:26:35
didi
But there is not triple (vertex1, vertex2, label) inside the graph. I have to produce it.
16:27:31
flip214
as long as it's documented that this MUST not be used outside (or in different threads!), you should be okay.
16:28:16
didi
beach: The graph is a hash table. Each hash key is a vertex, and each hash value is an associate list, where the assoc key is another vertex and the assoc value the label.
16:28:34
flip214
how about a local function that checks whether the current "element" is equal to some other one instead?
16:29:09
flip214
didi: so you have the vertexes stored twice, as V1 => V2 => label and V2 => V1 => label?
16:30:56
beach
didi: Presumably, since you are writing a macro, you might want to do other things with these contacts. Not only search for an occurrence. Right?
16:31:29
didi
beach: Right. I used to return a list with all the contacts, when asked, but the memory exploded with these, so I came up with the macro idea.
16:33:22
didi
beach: Ah! You really get it. That's how I' doing right now. BUT, some functions ask for the CONTACT, so I sometimes have to alloc the contact anyway. What I'm in the middle of, is deciding if I go full CONTACT or not.
16:35:23
beach
ACTION vanishes in order to have dinner, and lets flip214 come up with further ideas.
16:36:52
flip214
didi: can you replace the ALISTs with two arrays, with the same index pointing to the vertex and the label?
16:37:58
didi
flip214: Hum. Not a bad idea. I'm always trying to reduce the memory usage of this beast. Thank you.
16:39:34
flip214
well, then have the vertices and labels in a global array, use the indizes to address them, and then you end up with two (say) 32bit numbers that you can pack into one 64bit value
17:09:07
flip214
didi: so you'd have an array indexed by vertex# with arrays of 64bit fixnum values as elements...
17:31:23
aeth
loke, oni-on-ion: Pretty much every advantage of interpreted languages that people list can be done by Common Lisp AOT implementations, better. That's probably why people think Lisp will be slow. (I'll concede the lack of sandboxing, but on the other hand only JS and Lua do sandboxing.)
17:32:20
aeth
oni-on-ion: I think you'll find that most of the very fast CL libraries work on specialized arrays. It's something that (SB)CL is good at (technically, some implementations like CLISP don't do this well).
17:38:44
sjl
Is there a way to reduce over a numeric range in lparallel without instantiating a sequence of the numbers, or will I need to roll it myself?
17:39:31
sjl
e.g. (lparallel:preduce (lambda (n x) (+ n (if (evenp x) x 0))) (alexandria:iota 101) :initial-value 0) but without allocating a sequence of consecutive integers
17:43:12
akkad
well such as in posix shell. where you have background tasks you spawn, but can bring them to the foreground.
17:45:19
akkad
keeping track of background tasks you might have running in a loop, and say, updating the code, then stopping/restarting that given task
17:48:34
trittweiler
akkad: Assuming you're talking of threads (and not of child processes), do you know about `M-x slime-list-threads'?
17:49:48
trittweiler
that will give you a list of all the threads and you can invoke the debugger on any of them, then possibly redefine a function and invoke the CONTINUE restart
21:37:47
serichsen
Xach: I'm thinking about hard forking `cl-arrows' (https://github.com/nightfly19/cl-arrows). nightfly19 does not respond to any contact attempt. Its current state comes (entirely) from a fork/pull request by me, and another pull request where I rounded it out later is ignored. My problem is that no one ever talked nor thought about a license. Do you think that it would be right ethically if I renamed or copied my fork
21:37:48
serichsen
(https://github.com/Harleqin/cl-arrows) to `arrows', put my name in it and made it public domain?
21:38:21
theemacsshibe[m]
Is there a way to create a Hunchentoot handler for any URL? I need to create a proxy server for a specific application.
21:38:52
fiddlerwoaroof
serichsen: I don't think you have the right to the code, unless it's licensed under an OSS license
21:41:36
aeth
I suppose there's an implicit right to use it and to submit improvements to it if it's on Github, but not much beyond that.
21:42:51
aeth
(github probably has terms of service letting you do the whole pull request thing no matter the license)
21:44:10
Bike
"If there's no license then legally no one has rights to it" is incorrect. you don't need explicit copyright notices nowadays, it's the base assumption.
21:44:45
serichsen
Ah. I read a bit about copyright in the USA, and as far as I was able to tell, if something is done in a collaboration, all authors have the right to the entirety (unless they have a contract or license saying otherwise). But that doesn't answer how it is internationally anyway, and I asked about ethics.
21:46:10
Beep-Lord
serichsen: I'd rewrite the software. There could be legal issues for anyone that would use your software otherwise. It doesn't look like it would be too hard to do.
21:47:10
aeth
https://help.github.com/articles/github-terms-of-service/#5-license-grant-to-other-users
21:48:13
aeth
Even with no license the user has the right to view and fork it if it's on Github. The right only applies to use on Github.
21:49:34
pjb
aeth: well, you can always use it, patch it, but you're cannot distribute it. Ie. forking of repos without a license should be forbidden in the first place!
21:50:31
aeth
pjb: The ToS requires any public repos to be usable through GitHub services. So you can fork it (on Github) and you can do all the other Github stuff. But I don't think you'd have the right to run it
21:50:51
pjb
aeth: I would argue that forking constitute redistribution. Which is not allowed by copyright when no specific license is provided.
21:51:16
aeth
pjb: The license, when none is given, on Github is https://help.github.com/articles/github-terms-of-service/#5-license-grant-to-other-users
21:54:52
pjb
one problem anyways with the default github licensing, is that once you take a copy out of github, arguably the github terms don't apply anymore.
21:58:49
Beep-Lord
serichsen: Make sure you base your work off of your own ideas or another project that has an open license, such as swiss-arrows.
23:00:06
kenster
I'm trying to get (defcmethod upload-session "new" new :pointer) to define a method on the class with the name new that calls a C function called "FileUploadingSession_new" that returns a pointer.
23:00:43
kenster
the issue is the arguments list that I'm passing up, I want ((test :int) (blah :int)) to turn into (test :int) (blah :int) when it gets passed into defcfun
23:01:00
kenster
but I also want to properly handle the empty arguments list case, which is to not pass anything into defcfun — besides of course ,cfun-name and ,creturn-type
23:26:01
pillton
Sometimes when writing complicated macros it is better to use a function to generate the code.
23:29:21
pillton
Lets assume %defcmethod is a function. What code do you want it to generate from its arguments?
23:32:24
kenster
a defcfun with the bound method signature and a defined method that applies a list of arguments to that method
23:34:09
kenster
I want to safely use C functions in a lispy manner, I can't use SWIG because I am using C++17
23:39:32
pillton
kenster: You don't apply-list-as-rest. It should just be (apply #',ffi-method-name method-args).
23:44:31
pjb
kenster: when you test if arguments is a list, this is something that is known at macroexpansion time. Therefore there is no reason to test it at run-time! You can select the defcfun form at macroexpansion time.
23:49:45
kenster
but I still have (FILEBUCKET::CFFI-DEFUN # #:RETURN-TYPE301 #:C-STRUCT-NAME302 NIL)
23:57:33
serichsen
That might be a problem of the class you use there. By the way, you should not use slot-value to interact with your objects (unless it is inside of something like initialize-instance) but define readers or accessors. Usually # is a placeholder of the printer for things it doesn't show completely.
0:04:46
pjb
serichsen: the problem is worse: you cannot access slots (even :allocation :class slots) without an instance!
0:09:37
pjb
kenster: now, notice that I used make-symbol. This doesn't intern the symbol. This show that you could just use gensym there, without concatenate etc.
0:10:22
pjb
Right. Wrap the defclass in an (eval-when (:compile-toplevel :load-toplevel :execute) …)
0:13:56
pjb
kenster: also, since as you can see you cannot access the struct-name slot without making an instance, usually class attributes are just kept in global variables. In this case, you need a map between class name and structure name in the compilation environment for use at macroexpansion time. You could keep this map in a global variable (a hash-table), and fill it with a specific macro. Or you could write your own class definini
0:13:56
pjb
macro that could expand into this at compiliation time, and the defclass form for run-time.
0:17:41
pjb
kenster: this is because you compute the names instead of taking them as parameter to your macros.
0:18:05
pjb
kenster: cffi-method-name is not the name of the function defined with defcfun in cffi-defun, therefore no such function exist.
2:56:51
mathZ
`pkg info maxima` => maxima-5.41.0, why doesnot maxima run ~/maxima-init.mac automatically after started ?