freenode/#lisp - IRC Chatlog
Search
11:08:16
pjb
schweers: there's nothing wrong, but it should be equivalent to (defun … (labels ((do-not-name-it-helper-or-anything-like-that …)) …))
11:08:49
pjb
schweers: the only downside of having defun not as a toplevel form, is that the compiler cannot make note that a function is defined, so it may issue undefined function warnings.
11:09:51
pjb
schweers: the only case where you would need to put defun in a non-toplevel labels, would be if your local functions would have to be used by several defun. Then you have to ask yourself seriously why not making them global functions.
11:11:28
schweers
pjb: that is exactly the situation I had. I’ve now declared the helper functions to inlined. I’m not entirely happy with the notes yet, but I’ll do some more testing etc before I continue banging at it.
11:12:13
pjb
You know that optimizing type declarations and notes, will give you only 1 or 2% improvement.
11:14:04
loke
pjb: actually, not always. My implementation of the simplex noise algorithm ended up 10× or so faster by adding delcarations.
11:14:17
Younder
pjb: the optimization structure for Lisp is hard to understand. Perhaps you could come up with some simple rules. Like don't cons up.
11:16:13
Younder
I seem to remember 40x penalty for using temporary list's in calculations. Estimates of cource
11:22:55
tfb
I think the first-order story about declarations is: it matters for float-intensive code
11:25:34
Younder
tfb, For float intensive, you need AFX or better still GPU. So tap into something like LAPACK
11:27:03
tfb
Younder: you don't (and you can trust me on this: I run float-intensive code on thousands of cores)
11:34:48
Younder
tfb: Are you telling me you are running computing intensive applications on a cluster entirely in Lisp?
11:38:06
tfb
Younder: No, sorry. All our HPC code is fortran. What I meant was that if you have float code which falls back to generic arithmetic that's often a factor of ~100, so if the system should be spending 1% of its time in float code, it's now spending half of it. So making sure float code doesn't fall back to generic arithmetic really matters if there is even a very small amount of it
11:41:07
Younder
Well I have tried a simulation of 65000 star galaxy similar to the Magellan cloud on my Titans
11:43:14
Younder
I studied physics in my time, and have a particular fondness for celestial mechanics.
11:57:43
Younder
My PI2's were spendt for a simulation of telephone central system. MPI and C again.
11:59:40
Younder
Cool though this is I have moved mostly into embedded comping these days. Designing a drone which is totally anonymous.
12:01:15
Younder
6 cameras, a NVidea TX1 and more C. Though RUST is coming up as a solid alternative.
12:04:48
Younder
A circuit boar with a Xilix FPGA implementation of G5 with a Digital Devices MEMS antenna on a M2 port with PCIe that will fit on a credit card is the current challenge.
12:06:08
Younder
But feel free to ignore me as I make to many grammatical and syntactical mistakes, being dyslexic
12:37:15
Xach
ASDF 3.3.1 reports fatal circular dependencies that ASDF 3.1.5 does not. I wonder if it's in error or something else.
12:38:06
Xach
hmm, the latter has asdf-system-connections, which is I think a pit of trouble these days.
12:46:33
Xach
dim: are you in any position to investigate and perhaps propose changes to simple-date to make things work again?
12:47:18
Xach
dim: I think the whole glue thing might be a candidate for removal and simplification at the expense of a little more cross-dependency.
12:52:14
Shinmera
Xach: I've been having even more issues with ASDF 3.3: https://github.com/Shinmera/qtools/issues/25
12:52:35
Shinmera
Something about invoking QL or ASDF while it's trying to load another system is messing it up
12:52:51
Shinmera
Haven't had time to investigate yet, but this was never a problem until the recent ASDF updates in SBCL.
13:02:12
dim
Xach: I could see about devoting some time to it... my gut feeling is that we have bugs in ASDF tho
13:04:52
dim
I'm not sure I've learnt enough CL to see about improving Postmodern yet... last I tried I sure wasn't there yet ;-)
13:06:57
Xach
I feel awful about giving neutral feedback about its impact. I didn't test properly or something.
13:07:41
dim
the only way to never make a mistake is to never do anything, as my mother would say ;-)
13:14:42
nickb
Hi. I'm trying to install sqlite3 on a Windows system using quicklisp. I know nothing about lisp, just need to build an application using it. I get an error: https://gist.github.com/anonymous/9d632dff0f9e26e84ba91458d3ff5eea (doesn't tell me much). Any advice?
13:16:10
tfb
Younder: rust looks like an interesting thing. But fortran is so embedded for the stuff we do I am sure it will live for ever, unfortunately
13:17:03
pjb
nickb: you would have to learn how the sqlite3 library is named on MS-Windows, and to know where it's stored, to configure cffi to find it there.
13:18:56
nickb
first 2 require at least some basic knowledge on how lisp works which I'm lacking as of now. Point me towards something to read please
13:39:59
knobo
When I do (select-dao 'some-postmodern-class) columns with null value is returned as :null. Can my slots be unbound in stead?
13:46:41
phoe
knobo: grepping the manual tells me not. You can try some manual processing of the returned daos if you really want it, as in, loop for all slot-values if :null then slot-makunbound.
13:48:08
nickb
pjb: CFFI should be able to find my sqlite3 libs. The only lib (sqlite3.dll) is in PATH, shouldn't that be enough?
13:50:24
Shinmera
Windows (unfortunately) just reports the library as missing if its dependencies can't be found, even if the library itself can be.
13:50:30
nickb
I can't tell; the only error I get when trying to install "sqlite3" is that the name is not resolved
14:00:38
nickb
Ok when I get an error that the library is missing I have an option to enter alternative name instead. So I enter: ("sqlite3-lib") and get and error: Unable to load foreign library (SQLITE3-LIB-625). Am I doing this completely wrong?
14:14:24
nickb
The whole point is to build pgloader _for_ Windows. Doubt I can do that in macOS or Linux :(
14:16:01
nickb
https://gist.github.com/anonymous/86260013ea5acab933ea9ed025f348e5 (this path is what MSYS2 understands; I've tried with different formats as well)
14:20:08
pjb
You cumulate the difficulties: Using MS-Windows, Using sbcl (with his uninformative error messages)…
14:24:41
didi
I am certain I asked this before, but I can't remember the answer, sorry: Why doesn't (let ((x 42)) (loop for x = x then (+ x 1))) work? i.e. SBCL complains that NIL isn't of type NUMBER. I suspect the second X from the LOOP form isn't bound to 42.
14:33:11
lieven
the x of 'for x' already gets defined in the loop prologue and shadows the outer x of the let
14:34:23
didi
lieven: oic. I was expecting the same behavior of DO, I guess, as in the second X gets the value of the environment.
14:46:54
tfb
(both implementations I have easy access to 'work' with (let ((x 1)) (loop for x from x below ... do ...)
14:52:48
lieven
there's an exception in 6.1.1.4 made for loop-as-then that is not made for the others so testing with from x might not be relevant
15:01:01
lieven
of course, 'for x = <form1>' is a shorthand for 'for x = <form1> then <form1>' and it will evaluate <form1> for each step of the iteration
15:23:37
pjb
didi: basically, for is not a binding keyword. loop creates all the variables it need before.
15:24:17
pjb
didi: this is also what makes the variable available in the loop epilog in practice (even if using them is not well defined).
15:27:38
pjb
Ober: (defun octet-vector-to-string (os) (prin1-to-string os)) (octet-vector-to-string (coerce #(1 2 3) '(vector (unsigned-byte 8)))) #| --> "#(1 2 3)" |#
15:28:50
pjb
jdz: so it should be at the very least: (map 'string (lambda (x) (or (code-char x) #\?)) codes)
15:29:49
Ober
convert this #(159 31 191 95 191) to "there". leveldb does encoding to vector, but does not do the reverse on fetching
15:30:42
pjb
Oh! (defun convert (x) (when (equalp x #(159 31 191 95 191)) "there")) (convert #(159 31 191 95 191)) #| --> "there" |# works.
15:32:58
beach
Ober: But you never mentioned that your vector contains octets representing UTF-8-encoded characters.
15:33:51
Ober
because that is how it is written. Illegal :UTF-8 character starting at position 0. [Condition of type BABEL-ENCODINGS:INVALID-UTF8-CONTINUATION-BYTE]
15:36:42
Ober
hey pjb, have not see you at the godemiche meetup lately. good to see you still are a member though.
15:37:19
_death
(leveldb:with-open-db (db "/tmp/foo") (leveldb:puts db "hi" "there") (leveldb:gets db "hi")) => "there"
15:43:14
_death
Ober: I think I wrote this while working on some bitcoin code some years ago.. the blockchain was several gigs so didn't work with strings
15:44:09
pjb
Ober: now, look what you've done: you ask a meaningless question, I asked for clarification, you further added overly specific specifications, I provided a faithful implementation, and instead of starting to think, you started to insult.
16:12:17
_death
Ober: they weren't arbitrary objects.. I suppose if you want that you can use a serialization library like cl-store
16:13:58
Ober
yeah with a stream backend of a with-open-vector sort of thing, is what I was thinking
16:14:00
_death
Ober: then you miss some leveldb functionality, however.. for example the fact that keys are ordered
17:40:43
Fare
Xach: 3.3.1 tracks staging dependencies between systems. Its granularity is the file, not the individual top-level expression. Therefore if there are multiple stages in a sin
17:59:50
Fare
simple-date.asd has a completely bogus method at the end that is guaranteed to not do what the author intended and derail asdf
18:01:53
didi
Converting (values) to nil as in (null (values)) => t is a defined behavior? I want to depend on it.
18:07:00
Posterdati
please how can I determine the integer-length of an (unsigned-byte *) array? Thanks
18:12:18
pjb
You could compute: (reduce '+ (make-array (reduce '* (array-dimensions array) :displaced-to array) :key 'integer-length))
18:13:02
pjb
(and (subtypep '(unsigned-byte *) '(integer 0)) (subtypep '(integer 0) '(unsigned-byte *))) #| --> t ; t |#
18:17:51
aeth
Posterdati: If you mean you want to cut up an integer into smaller integers, ldb is one way.
18:20:07
Posterdati
pjb: I do not need how, I need a way to find the element size (in bit) of an array element
18:20:21
aeth
Posterdati: (array-element-type (make-array 42 :element-type '(unsigned-byte 32))) => (UNSIGNED-BYTE 32)
18:20:47
pjb
Posterdati: like: (array-element-type (make-array 1 :element-type '(unsigned-byte 13))) #| --> (unsigned-byte 16) |#
18:21:27
pjb
Posterdati: the upgraded element type designator can be of any form, and if it's T how will you determine it? And again what for?
18:21:31
Xach
Fare: http://report.quicklisp.org/2017-12-11/failure-report.html has other recent issues.
18:21:58
Posterdati
pjb: yes, but on sbcl it worked, not on ecl wich answer like (unsigned ext:byte8)
18:23:28
aeth
Posterdati: The only way to make it not implementation dependent would be to (1) only support some implementations (and avoid clisp, you're doing something numerical) and (2) wrap the parts that don't work with implementation-specific things
18:23:46
Fare
it would only appear to work when you specifically loaded cl-postgres or simple-date as the toplevel request, and not otherwise.
18:24:50
pjb
Posterdati: Right. (reduce 'max (decompose-base 257 256) :key 'integer-length) #| --> 1 |# so you will try to decompose into base 1?
18:26:07
pjb
Posterdati: 101 can be a representation in any base! Perhaps it represents (compose-base '(1 0 1) 1000000) #| --> 1000000000001 |# !
18:32:07
pjb
Posterdati: now, you could use a representation where the first slot of the vector would contain the maximum digit.
18:34:04
pjb
(compose-base (subseq representation 1) (1+ (aref representation 0))) (concatenate 'vector (vector (1- base)) (decompose-base word base))
18:34:07
pjb
(let ((representation (let ((base 256) (word #x55aa)) (concatenate 'vector (vector (1- base)) (decompose-base word base))))) (compose-base (subseq representation 1) (1+ (aref representation 0)))) #| --> 21930 |#
18:35:10
pjb
Posterdati: but obviously, it's not that good a representation because it's O(n) to wrap and unwrap. It would be better to use a structure with two fields.
18:35:34
pjb
Posterdati: but again, this is still silly, because in general you work only with one base, so you just keep it in a global variable.
18:43:53
Fare
I don't know when you found these issues, but the asdf-devel mailing-list is the right place to report them.
18:49:56
Posterdati
pjb: it is not desiderable to determine the size of element based on the maximum element in the array
18:50:57
jackdaniel
and I see such thing in postmodern system (:feature :postmodern-use-mop "closer-mop")
18:51:49
jackdaniel
:if-feature is broken as well for ECL < 16.2.0 (due to bug in ASDF which was fixed after 3.2.0)
18:59:07
Xach
http://report.quicklisp.org/2017-12-11/failure-report/f2cl.html#fishpack looks like it may be an SBCL bug?
19:07:53
Fare
OK, I fixed the build of chanl, too, but not its race conditions (that at least its test suite now find)
19:08:05
pjb
Posterdati: Again, the base is not intrisic. This is an external element, determined by convention or explicitely specified in a protocol. So you need to use an external value bound to a separate parameter.
19:15:47
Fare
Xach: I've sent a mail to asdf-devel looking for candidate maintainers to do more of that work together. If some failures are more urgent than others to address, please warn the mailing-list so we handle them first.
19:16:44
pjb
Posterdati: often, it's even hardwired (since usually you want efficiency and it's specified on paper, so it doesn't changes willy-nilly).
19:17:25
pjb
Posterdati: ie. instead of writing and using the functions I sprung'ed, you could write a macro that would generate efficient base conversion functions for hardwired word sizes.
19:21:12
Fare
Ah, OK. For the record, I don't remember :feature or :if-feature being broken since I made them work in 2.27. They are rather simple features (unlike one of the two ASDF 1 era homonymous "feature" features, which was removed in 2.27)
19:22:07
jackdaniel
but it got fixed after 3.2.0 (maybe unintentionally) so I didn't bother to report
19:23:13
jackdaniel
for normal load it worked fine, but when used with bundling op (either with delivery-op and make-build) it missed dependencies if if-feature was present (disregarding the content)
19:23:51
Fare
jackdaniel, oh. I remember touching that part of the code recently indeed, fixing issues along the way, but the details are out of cache.
19:24:55
Fare
I have a patch in a branch slated for 3.3.2 that fixes bugs that happen when you upgrade from e.g. ASDF 3.1.7
22:50:00
jmercouris
You can use a diffrent type of API search I think to look for regex/lines of code IIRC
22:50:56
Shinmera
fe[nl]ix: You can download all projects to Quicklisp's internal dist folder using: (mapc #'ql-dist:ensure-installed (ql-dist:provided-systems (ql-dist:find-dist "quicklisp")))
22:52:05
jmercouris
Here's what I was talking about: https://help.github.com/articles/searching-code/
22:52:06
fe[nl]ix
is it possible to specify a directory other than the default one ? I don't want to taint my installed systems
22:52:27
jmercouris
I think it only allows searching one repository/organization at a time but there should be a way to do it for all repositories of a specific language or something
22:58:14
Shinmera
I can't see any obvious way otherwise to get it to a specific directory. ql-dist:install has no other arguments.
22:59:33
jmercouris
What do you think a good way of implementing hooks in common lisp is? (something akin to emacs hooks)
22:59:51
jmercouris
from the emacs documentation, it seems that hook is just a list of functions that get called at a given time
22:59:59
jasom
anybody have a good pattern for I want to do N things in parallel, but I must perform a side-effect on the results in-order? Right now I'm doing this, which works but is slightly convoluted: https://github.com/jasom/sqlitestore/blob/master/sqlitestore.lisp#L231
23:00:26
jmercouris
should I have a list called something like (defparameter XY-Hooks ()) and add functions to that list to invoke upon event XY?
23:01:02
jasom
(quick description of how it works: I create a promise for each chunk of work and push the promise onto a queue; I then have a separate task poping from the queue, forcing the promise, and performing the side-effect.
23:01:44
Shinmera
jmercouris: If you store function objects in the list, then when you want to redefine your hook function, it won't be able to find the old one to remove it before adding the new one.
23:02:21
Shinmera
Usually in Lisp you want to have some kind of name->definition mapping to avoid this.
23:03:08
jasom
Shinmera: whether or not they are useufl as standalone functions is orthogonal to whether or not they should be named
23:03:37
jasom
Shinmera: i.e. my routing library gives each route a function name, which aids in debugging for backtraces
23:03:55
jmercouris
I guess one may not be able to remove an item from the hook without a reference to it, but that should be the problem of the user that adds that hook no?
23:03:56
basket
jmercouris: Because then it makes it difficult to change that function later. You have to find it somehow, remove it from the list, and add a new one
23:04:35
jmercouris
basket: Ok yes, in the scenario of (push 'named-func *xy-hooks*), one should be able to remove it though yes?
23:04:36
jasom
jmercouris: pushing an anonymous function makes it hard to redefine; pushing the name of a function makes it trivial.
23:05:25
jasom
and I disagree with Shinmera on the "polluting the function namespace issue" they are functions, they are named, ergo the function namespace is perfectly appropriate
23:05:44
jmercouris
Shinmera: When you say "redefine your hook function" do you mean, "redefine your function that is called by the hook XY"?
23:06:48
Shinmera
jmercouris: Well, when you redefine the hook, to be precise. Defining a hook usually involves creating a new function object to call.
23:06:51
jasom
jmercouris: any time you push an actual function object, e.g. (push (lambda () ...) ...) or (push #'foo () ...) it becomes difficult to locate one of those hooks later should you want to remove it or change its behavior
23:07:17
jasom
jmercouris: if you push the name of the function, you get redefinition for free, and locating it obviously becomes easier too.