freenode/#lisp - IRC Chatlog
Search
12:53:09
Xach
Hmm, is this ok? (defun starts-with (subseq seq test) (and (<= (length subseq) (length seq)) (every test subseq seq))?
12:53:41
Xach
I've done endless variations of a starts-with thing and I don't remember using this. (e.g. mismatch, :start and :end with string= and stuff, etc)
13:56:57
moldybits
sbcl gives me a style warning for (error "invalid thing: " thing) ... oh, nevermind. :)
15:30:48
phoe
A naïve way causes an error to be signaled: "cannot insert multiple commands into a prepared statement"
16:30:11
dim
you can use my code for that from pgloader at https://github.com/dimitri/pgloader/blob/master/src/utils/read-sql-files.lisp
16:30:46
dim
phoe: the reason why it fails is that Postmodern is using the PostgreSQL extended query protocol which works with a query at a time, with out-of-line parameters (good to avoid SQL injections)
16:31:03
dim
the trade-off is that you then need to make sure in the app that you're sending one query at a time using that protocol
16:32:05
dim
https://github.com/dimitri/pgloader/blob/master/src/utils/read-sql-files.lisp implements a simple hand-written parser for SQL queries delited with a semi-colon (;)... not that simple, it knows about dollar-quoting and other forms of escaping
16:32:58
dim
select E'\';' as ";"; is an example of a corner-case when parsing SQL queries from a file
17:02:14
dim
jackdaniel: http://paste.debian.net/1074118/ if you want to have a look, but don't allocate time for that, I was just curious about building pgloader with ECL that's all
17:02:27
jmercouris
why does (string-downcase nil) return "nil", is there a more sensible function that will actually return nil?
17:03:19
dlowe
strings designators (which include symbols) are converted to strings if they are not strings
17:05:18
Bike
if you want to test whether something is a string and signal an error if it's not, you can do it yourself
17:30:25
pjb
(defun string-downcase⊥ (x &rest keys &key start end) (declare (ignore start end)) (when x (apply (function string-downcase) x keys)))
17:48:36
shka_
i will discuss with maintainer if everything is fine, i was aggressive with my approach so it may be a little bit controversial.
17:50:24
shka_
declaim inline here and there, replaced few defmethod with defun, replaced one class with struct, changed few internal functions
18:08:32
phoe
dim: does it mean that I likely won't get a (postmodern:execute-file #p"/home/phoe/foo.sql")?
18:09:18
phoe
it doesn't make much sense to me - in order to execute a SQL file, I need to either parse and digest it, or drop all the way down to bash to execute "psql < foo.sql"
19:25:05
phoe
dim: https://github.com/phoe/postmodern-execute-file that's a hack that works well for me.
20:44:04
moldybits
if obj is an instance of a class defined in package P, and i want to get or set the slot value, i have to (slot-value obj 'P::slotname). hm ...
20:46:41
scymtym
moldybits: you would normally use an accessor (whose name would normally be exported from P)
20:48:47
scymtym
i.e. for (defpackage #:p (:use #:cl) (:export #:name)) (in-package #:p) (defclass c () ((name :accessor name))) you would have something like (in-package #:p2) (p:name obj) (setf (p:name obj) value)
20:49:31
moldybits
i'm using my own setter so that i can store the modifications done to the object in a history list. i could :before all the setting accessors, or maybe there's even a way to do it for all of them, but that'd hide the magic. hm.
20:50:29
moldybits
one option would be to take whatever symbol is passed in an get the corresponding one in P.
20:54:58
moldybits
i don't know what those are. i'm reading keene's book, though. hopefully she'll cover it. :p
20:56:19
phoe
moldybits: you'll want to get into metaprogramming. see, in Lisp, classes are just objects like all other objects, and you can modify them like all other objects.
21:02:55
phoe
moldybits: that'll allow you to do things like https://plaster.tymoon.eu/view/1267#1267
21:19:59
Bike
LdBeth: what you actually do is define your own class of slot-definition, which lets you do that, yes
21:33:35
shka_
line 48 and 55 contains code required for mop machinery to locate proper slot definition based on the metaclass
21:36:43
vms14
you mean it's not explaining things very well so you need to make a bit of research or alike?
21:38:35
shka_
understanding what the hell is PG trying to explain with CPS macros was challenging for no good reason
21:40:07
shka_
anyway, that's just my opinion, you may have directly opposite opinion and that's fine
23:14:04
didi
Suppose I have a function that returns a variable number of values, so I will use VALUES-LIST to return accumulated values. I want to alleviate the creation of this intermediary list. How about using a construction like (defun fn () (let ((l (produce-result-list))) (declare (dynamic-extent l)) (values-list l)))?
23:25:25
Bike
since the code that produces the list is within that function, and wouyld need to know to allocate on the stack
23:26:16
didi
Bike: Interesting. So what about, instead of (produce-result-list) I have (loop ... collect (produce-single-item))?
23:27:24
Bike
as an example, see the sbcl manual under 6.2, "At present, SBCL implements stack allocation for"
23:33:35
jmercouris
I've also set-up (slime-setup '(slime-fancy slime-company slime-asdf slime-indentation slime-sbcl-exts))
0:36:38
jeosol
any CL library I could call from the CL side to make an 3d image like this https://www.researchgate.net/figure/Reservoir-simulation-grids-with-2-5-and-10-dip_fig2_254533377