freenode/#lisp - IRC Chatlog
Search
11:46:30
jmercouris
however is there not a way to do what I want? or will I have to split apart my queries by semicolon or something...
11:50:06
jmercouris
so the only thing I can think of doing is splitting the string by semicolon and executing one query at a time..
11:50:33
jmercouris
however that seems very dumb and I feel like it should be possible to execute multiple queries...
12:08:28
jmercouris
I know that I'm doing two passes over the list and I could have done it more intelligently, I'm just thinking about stylistic changes
12:42:55
jmercouris
well at any rate, I will heed your advice since you are a more experienced developer than I
12:43:48
shka__
in that case, it may be a good idea to introduce new dynamic variable for stream to print such messages
12:44:49
jmercouris
if a user has access to these files, then the server is already fully compromised...
12:45:00
jdz
It's not very nice when somebody thinks they're just putting some SQL in some files, and suddenly program crashes.
12:46:10
jmercouris
however I still don't see how I can use cl-dbi to execute the contents of a SQL file
12:47:04
jmercouris
jdz: see this previously posted error: https://gist.github.com/jmercouris/2fb0215b5c9cc06db0400923b4a190b0
12:48:08
jmercouris
I'm not sure if this is a problem specific to the Sqlite driver and I won't have problems on postgres or mysql, however cl-dbi doesn't seem to have a "execute-queries" or something like that
12:48:09
jdz
Yes, that's an SQLite error. So you can use a real database, or have each SQL statement in a separate file.
12:51:27
jmercouris
anyways, it seems to be either a limition of the sqlite driver implemented for cl-dbi
17:04:57
beach
Oh, if such a function is called in a context where a value is needed, then NIL is used.
17:06:25
Inline
so when you don't return anything from the second branch in an if, does that not correspond to when then ?
17:08:20
beach
francogrex: Just like if you have a FUN2 that returns more than one value, and you do (defparameter parameter (fun2)) then only the first return value of fun2 is used.
17:09:31
francogrex
(multiple-value-list (r% "glm" :formula "aes ~ complaints+country+vaccine" :family "poisson" :offset (r% "as.matrix" (r% "log" (r% "subset" sub :select "doses"))) :data sub))
17:15:10
francogrex
* (multiple-value-list (r% "glm" :formula "aes ~ complaints+country+vaccine" :family "poisson" :offset (r% "as.matrix" (r% "log" (r% "subset" sub :select "doses"))) :data sub))
17:16:24
sjl_
multiple-value-list always returns a list. If your REPL isn't printing anything, something is very wrong.
17:16:25
beach
francogrex: Again, I don't know what that means. sjl_ seems to want to help you, so I'll be quiet.
17:19:06
sjl_
Right. Then I'm as confused as beach. (multiple-value-list (...)) returns nil when (...) returns zero values.
17:20:45
sjl_
I don't know what that means, but if it's a REPL it should be reading the form, eval'ing it, and printing the result (which is NIL).
17:23:55
sjl_
Try loading your project in a normal SBCL REPL straight in a shell and evaluating that form. That will help narrow things down.
17:28:50
sjl_
... can you screenshot it? There must be something fundamental that's not getting communicated here.
17:29:04
francogrex
hence my question is there another possibility than (values) that a function returns nothing?
17:29:33
sjl_
If you're running (multiple-values-list ...) at an SBCL REPL and not getting anything printed at all (or an error signaled) something is very, very wrong.
17:30:57
francogrex
* (multiple-value-list (r% "glm" :formula "a ~b+c+d" :family "poisson" :offset (r% "as.matrix" (r% "log" (r% "subset" sub :select "expo"))) :data sub))
17:33:26
sjl_
It doesn't matter what r% returns. Having (multiple-value-list ...) around it means that a list WILL be returned, unless an error is signaled and you bail out of the debugger.
17:35:07
francogrex
yes so (multiple-value-list (/ 2 0)) is that case you talk about but here it is not the same
17:35:20
sjl_
and if a list is returned, the REPL should be printing it. So if you're not hitting a debugger and selecting an ABORT restart or something, something is very strange.
17:44:23
scymtym
if the implementation's REPL establishes an ABORT restart, the behavior could be caused by code like (multiple-value-list (handler-bind ((error #'abort)) (/ 2 0)))
20:11:39
asarch
In the McCLIM example, how would you fix this "circular dependency"? http://paste.scsys.co.uk/582739
20:14:24
no-defun-allowed
A file is a compile unit, so all functions will be defined "before" they are compiled.
21:10:20
pfdietz
asarch: you can suppress undefined function style warnings if you provide a (declaim (ftype ...)) at the top level, I believe.
21:11:12
pfdietz
Alternately, you can make it a generic function, and stick the defgeneric in some early loaded file.
22:03:34
sjl_
ACTION looks ruefully at "minutes lost wondering why method isn't getting called before noticing one-character typo in name" tally, sighs
22:06:13
sjl_
(defgeneric send-message (database value)) (defmethod send-mesage ((database foo) value) ...) does not warn in recent SBCL versions.
22:09:16
verisimilitude
Ada's system for preventing just this manner of thing comes to mind; you can use the overriding keyword to cause a compilation error if the subprogram doesn't actually override something or not overriding to do the opposite.
22:10:28
verisimilitude
I suppose I'd rather have a superfluous warning when purposefully doing this, since it would also cover this case.
22:25:00
pjb
The other solution is 1- respect the Lysoff substitution principle, 2- to use next-method-p and call-next-method when appropriate, 3- to use method combinations when appropriate, 4- not care whether there's other methods or not, since methods can be added or removed dynamically.
22:32:30
aeth
Failing early can be good. e.g. It would be nice to see if a CLEANUP method exists before the program runs instead of at the very end.
22:33:07
aeth
Well, not really before the program runs. Right at the start before anything is really started is often good enough.
22:40:46
pjb
aeth: already, with CL you have multiple dispatch, and multiple inheritance. So it doesn't make much sense to expect to "override" or not a method.
22:42:27
pjb
asarch: for example, if I use CL and CLIM, there's: Using #<Package "COMMON-LISP"> in #<Package "FOO"> would cause name conflicts with symbols inherited by that package: interactive-stream-p clim-lisp-patch:interactive-stream-p
22:51:07
aeth
pjb: What I mean is that some APIs are simply "if it implements #'bar it's okay" but if #'bar is only called at the end, or at least hours in, it could take you quite some time to realize that something's missing!
22:51:10
pjb
asarch: when I define a package, and the *application-frame* variable, there's no error.
22:51:51
pjb
aeth: Granted, API should be defined studily. This is why I have some doubt about using generic functions in APIs…
23:00:43
aeth
pjb: I'm not sure there's a better solution than calling a #'cleanup method at the end of an unwind protect if it's a framework (with inversion of control: i.e. it is in charge of the control flow) that wraps everything in an unwind-protect.
23:00:47
aeth
And that cleanup could have just about anything, including freeing foreign data if CFFI-wrapped libraries are used, other calls to cleanup, resetting globals, etc.
23:01:37
aeth
The main drawback, of course, is that that method is essentially by definition called exactly once at the very end, so if it's missing it will take some time to find out when ideally you want to verify that it's there before init.