<luis>
Is it possible to look up a (setf foo) function given a non-constant symbol foo?
<phoe>
luis: (fdefinition (list 'setf foo))
<phoe>
FUNCTION and SYMBOL-FUNCTION are gonna fail you because one is a specop and the other does not work on extended function designators
<phoe>
I got bitten by it a few times
<luis>
phoe: yep. thanks!
ghard has joined #lisp
<jackdaniel>
if foo is known at read time, you may do something goofy like (function #.`(setf ,foo)) ; but yeah, fdefinition is the right thing to do here
EvW has joined #lisp
<jackdaniel>
or, to increase the fun: #'#.`(setf ,foo) ;-) however the reader may not accept that
<dim>
hi! did someone by any chance have already written an SQL parser, ideally using esrap?
wxie has quit [Ping timeout: 240 seconds]
<dim>
I find myself needed to pseudo-parse SQL in different contexts, from parsing PL/SQL; so sometimes it's just a query, sometimes it's a query in parentheses, and sometimes it finishes with a semicolon, but other times not, and deciding when to stop consuming what looks like part of the SQL query seems impossible without actually parsing SQL queries
shifty has joined #lisp
<jackdaniel>
someone other than you had asked me about that, I'd say "maybe dim knows something" :-)
<dim>
current problem is that I'm consuming a closing paren that is part of the surrounding context rather than the query
<dim>
jackdaniel: ahah
dra has quit [Quit: Leaving]
<jackdaniel>
you need to introduce different terms for each context, otherwise it will get messy I think
<jackdaniel>
(and I think that esrap is a good tool to write that)
<dim>
I believe parsing balanced parens is only possible if you know when to parse a literal or identifier expression that contains a paren (select 'foo' as "("; is valid SQL) ; but for that you need to know where to expect identifiers and literals, and then how to do that without writing the full blown SQL parser?!
<dim>
and the current parsing fails in many ways (mainly because the parser had only seen a limited amount of Oracle PL/SQL code before)
<dim>
I know that at some point I will have to parse Oracle SQL statements in full and a compiler that rewrites them in SQL for Postgres, I didn't want *now* to be that time
<phoe>
dim: there's also $$ to take into account
<dim>
oh yeah, I know about that, it's worse than just $$, it's $x$ ... $x$ and you can name them the way you want and nest them, pgloader knows how to do that for SQL files parsing
<dim>
lucky me, that's only in Postgres, and I'm parsing Oracle SQL now ;-)
<dim>
I'm trying to think of a trick that allows me to parse SQL and stop before consuming that closing paren at the end of it, without having to recognise SQL in full...
<dim>
maybe I need to write a SQL “skeleton” parser now, that recognize the structure (select <list of fields> from <list of source relations> where <expression> group by <list ...> order by <list> etc etc
bsd4me has joined #lisp
<dim>
I might not have to dive into each level deep, but without that how can I decide that the last closing paren is part of the SQL or part of the surrounding FOR ... IN (<sql here>) LOOP ... END LOOP; statement?
fixing_auth_hold has joined #lisp
<jackdaniel>
count parenthesis, I've been told that lispers are good at doing that :-)
<dim>
jackdaniel: if you would click on the plconvert link you will see a quite advanced PL/SQL parser written in esrap already
<jackdaniel>
ah, indeed, sorry
<dim>
jackdaniel: parens may be used inside literals or identifiers, and then you want to skip them
<jackdaniel>
right
<dim>
so can I implement parens counting in a simple way without writing a full parser that knows where to expect literals and identifiers? ;-)
tourjin has quit [Ping timeout: 246 seconds]
lalilulelo has quit [Ping timeout: 260 seconds]
<dim>
(my esrap fu isn't great by the way, so the existing PL/SQL parser isn't as good as it could be, but well, I spend like 3 days on it IIRC)
luna_is_here_ has quit [Ping timeout: 246 seconds]
<dim>
the next very fun step in plconvert is to use our awesome Common Lisp pretty printing technology to output PLpgSQL code from the output of the parser/compiler, and that's easy, it's just a tree of structure instances ;-)
luna_is_here has joined #lisp
sjl_ has joined #lisp
jonatack has joined #lisp
terpri has joined #lisp
terpri_ has quit [Ping timeout: 258 seconds]
wsinatra_ has joined #lisp
EvW has quit [Ping timeout: 260 seconds]
iAmDecim has joined #lisp
iAmDecim has quit [Ping timeout: 265 seconds]
Alloc has quit [Ping timeout: 258 seconds]
Alloc has joined #lisp
Oladon has joined #lisp
davepdot_ has quit [Remote host closed the connection]
Robdgreat has quit [Read error: Connection reset by peer]
rogersm has joined #lisp
Oladon has quit [Quit: Leaving.]
asarch has joined #lisp
<asarch>
How do you create an anonymous scope? (a la C' { ... })?
<Bike>
let
<phoe>
progn
<phoe>
oh, wait, you mean for variable binding?
<phoe>
or for what else?
<mfiano>
(block nil ...) :)
dead10cc has joined #lisp
shifty has quit [Ping timeout: 264 seconds]
coltkirk has quit [Ping timeout: 258 seconds]
bitmapper has joined #lisp
Robdgreat has joined #lisp
<phoe>
(prog nil nil ...)
<Bike>
seriously though it's let.
davepdot_ has joined #lisp
<Bike>
in C, "scope" means name binding.
davepdotorg has quit [Ping timeout: 246 seconds]
<jackdaniel>
((lambda (…) ) …), so, basically, let :)
TMA has quit [Ping timeout: 240 seconds]
schweers has quit [Ping timeout: 260 seconds]
Alloc has quit [Ping timeout: 256 seconds]
rumbler31_ has joined #lisp
narimiran has quit [Ping timeout: 240 seconds]
dpd88 has joined #lisp
rogersm has quit [Quit: Leaving...]
dead10cc has quit [Quit: Konversation terminated!]
save-lisp-or-die has joined #lisp
zigpaw1 has quit [Ping timeout: 265 seconds]
zigpaw1 has joined #lisp
retropikzel has quit [Quit: Leaving]
tamurasan has quit [Quit: WeeChat 2.3]
retropikzel has joined #lisp
save-lisp-or-die has quit [Ping timeout: 260 seconds]
<jasom>
dim: I'm booked for the next week, but it should be pretty straightforward if I get some free time in September. IIRC Oracle has very nice state-machine diagrams in their documentatin that translate straight to code
<jasom>
esrap is nice, as long as you only ever need to parse strings. I've been known to just write recursive-descent parsers when I need to parse other things
<asarch>
Yeah, sorry, my mistake. It should be: C's
* asarch
whispers "damn HP keyboards..."
TMA has joined #lisp
Alloc has joined #lisp
<Bike>
i don't think that changes the answer?
<phoe>
nah, it doesn't
Cymew has quit [Ping timeout: 258 seconds]
nicktick has quit [Ping timeout: 240 seconds]
ggole has quit [Quit: Leaving]
Josh_2 has joined #lisp
mike212 has joined #lisp
lnostdal has quit [Ping timeout: 258 seconds]
karlosz has joined #lisp
Bourne has quit [Ping timeout: 246 seconds]
frgo has quit [Remote host closed the connection]
Inline has joined #lisp
frgo has joined #lisp
liberliver has quit [Ping timeout: 272 seconds]
liberliver has joined #lisp
jesseoff has quit [Read error: Connection reset by peer]
<Josh_2>
Evening
liberliver has quit [Ping timeout: 272 seconds]
shangul has quit [Ping timeout: 240 seconds]
<Inline>
evening
rippa has joined #lisp
liberliver has joined #lisp
liberliver has quit [Ping timeout: 244 seconds]
liberliver has joined #lisp
Jesin has quit [Quit: Leaving]
stepnem has quit [Ping timeout: 240 seconds]
stepnem has joined #lisp
liberliver has quit [Ping timeout: 260 seconds]
luckless has joined #lisp
brj has quit [Ping timeout: 246 seconds]
VincentVega has joined #lisp
jw4 has quit [Read error: Connection reset by peer]
brj has joined #lisp
jw4 has joined #lisp
asarch has quit [Quit: Leaving]
liberliver has joined #lisp
Jesin has joined #lisp
Jesin has quit [Quit: Leaving]
yitzi has quit [Quit: yitzi]
<VincentVega>
Is there a function which returns true on a proper list but not on a quoted thing (e.g. ''sym)? Instead of (and (consp x) (not (equal 'quote (car x))))
mseddon has joined #lisp
<White_Flame>
so, true on (foo bar) and not on (quote bar)?
<White_Flame>
they are both materially lists, and it is the car that distinguishes
<VincentVega>
Oh, ok then
<White_Flame>
there isn't a builtin for that test, at the very least
<VincentVega>
I see. Thanks for the explanation!
<White_Flame>
np
<copec>
Out of curiosity, What are you looking at and/or thinking about VincentVega?
Jesin has joined #lisp
rogersm has joined #lisp
fixing_auth_hold is now known as lalilulelo
EvW1 has joined #lisp
bocaneri has quit [Read error: Connection reset by peer]
<VincentVega>
copec: actually, I was wring a macro for a cond which prepends a function call on each condition (unless t or otherwise) and, if the car of the clause is a list, prepends a call to each of the element in the list.
<VincentVega>
*prepends and or's all the calls
seok has joined #lisp
<copec>
Ah, I was wondering why you would need that function you asked about, that makes sense
<seok>
hello!
<copec>
Hi! (although I'm the random fellow nobody knows that says hi from the back)
cosimone has quit [Quit: Quit.]
mike212 has left #lisp ["Leaving"]
<VincentVega>
Something like (cond-fn fn ('(x y) z)) -> (cond (((or (fn x) (fn y)) z) which makes me think why don't I just generate mapcar into the resulting expansion instead of doing it beforhand
<seok>
hi!
<phoe>
heyyy
<phoe>
uhhhh one second
rogersm has quit [Quit: Leaving...]
<phoe>
why do you quote X Y? are they some sort of global arguments?
<phoe>
also, isn't this just (some #'fn (list x y))?
<VincentVega>
phoe: hi!
<VincentVega>
phoe: well, I was thinking kind of like what case does
<White_Flame>
I would use a keyword (cond-fn fn ((:special x y) x) ((normal-func param1 param2) ...))
<VincentVega>
maybe I shouldn't do that
<White_Flame>
intentionality is a good thing
<phoe>
case?
<phoe>
look at alexandria:switch
<phoe>
it's cl:case but with specifiable test function.
<wsinatra>
just good old fashioned loop here, for does look interesting though, a little easier to remember at a glance
<White_Flame>
I've built up some individual tools for iterating over structures in various ways, but I use loop or recursion otherwise
<sjl_>
I use loop in my libraries to minimize dependencies, iterate in my personal projects where I don't care as much
<seok>
I feel loop is a bit too verbose for hash-tables
<seok>
do you just write a helper macro for hashes?
<White_Flame>
yeah, that's why I made a (defmacro do-hash ((k v table) &body body) ...)
<seok>
I see
<White_Flame>
I like the syntactic structure of dolist
<seok>
I was happy with iterate until it conflicts with parenscript
<White_Flame>
and extended that to other stuff, including mapcar's consing
<dim>
jasom: thanks for your message! I'm getting started on transforming that state machine into an esrap rule set, but I will only get an hour here and there, so you might still be able to help when you get around to it ;-) also I'm only going for a partial parser at the moment, just to play with some files I've been given
gum has joined #lisp
<seok>
sjl_ yeah that sounds sensible. don't you get confused using both though?
EvW has joined #lisp
shka_ has quit [Ping timeout: 265 seconds]
<jasom>
dim: I enjoy writing parsers; it's mechanical enough that I find it meditative.
<dim>
when you have a clean grammar, that might be so
<jasom>
but it is time consuming and time is limited
<dim>
in that case it seems okay though
<dim>
what I'm most interested in is PL/SQL, SQL is just getting in the way
duuqnd has quit [Read error: Connection reset by peer]
<dim>
the SQL compiler is going to be most interesting that said! do you like working on compilers?
duuqnd has joined #lisp
<jasom>
I do, but need permission from work before working on compilers just because my work makes compilers. For something like SQL, it will probably be zero issue to get a sign-off.
seok has quit [Remote host closed the connection]
<VincentVega>
seok: I switched to iterate when I had to run through a queue. loop was ok, but (generating node next (or (cl-heap:dequeue q) (terminate))) (while (next node)) was better. Custom clauses, too. I am digging it so far.
<sjl_>
seok: not really. I've used both enough that I'm used to both at this point.
<dim>
jasom: it's a compiler from Oracle PL/SQL to Postgres PL/pgSQL, and if we're feeling very brave including Oracle SQL into Postgres SQL
<dim>
and then if people/contributor have a passion for the result we can envision a rewriting proxy for migration environments
<jasom>
That would actually be useful at work; we have an oracle DB we are hoping to transition to pg. I still need to learn some more pg DBA stuff though like how backups and point-in-time restoration work.
narimiran has joined #lisp
<fe[nl]ix>
jasom: what compiler do you work on ?
izh_ has quit [Quit: Leaving]
duuqnd has quit [Remote host closed the connection]
abhixec has joined #lisp
orivej has quit [Ping timeout: 240 seconds]
yitzi has joined #lisp
wsinatra has quit [Quit: WeeChat 2.9]
narimiran has quit [Remote host closed the connection]
<jasom>
fe[nl]ix: I don't, but others at my company do
wsinatra_ has quit [Ping timeout: 258 seconds]
<VincentVega>
Guys, given a type specifier (retrieved from a slot definition in my case), how would I say if its a (simple-array string) or a (simple-array bool)? The closest thing I found was array-element-type, but I have a specifier, not an object.
<Bike>
(upgraded-array-element-type 'string) => T on your implementation (and any real implementation), and ditto with boolean
<Bike>
array element types are about the storage format. they're not a declaration of the kinds of values it ends up holding. at least in most contexts.
<VincentVega>
Oh. Is there no way to get the exact specializer then, the one with which it was initially declared?
CrazyEddy has joined #lisp
<Bike>
not if you're treating them as types, because they are the same type.
<Bike>
if your type specifier is a list (SIMPLE-ARRAY something) you can just do (second ts), of course.
<VincentVega>
Well, it could be deftyped, so not always a list.
<VincentVega>
But, yeah, I see. Thanks for the clarification on this.
<White_Flame>
if you used bitvectors instead of arrays of bools, you'll both save space and be more type distinguished
<Bike>
it's something that trips people up a lot.
abhixec has quit [Ping timeout: 240 seconds]
<VincentVega>
I don't necessarily need bitvectors, I just wanted to do different things based on different type spec in the slot. It's not a big problem though.
<VincentVega>
Thanks for the pointer though, might come in handy in the future
<Bike>
in general, since lisp is gradually and dynamically typed, having different behaviors based on declared types doesn't usually work
<VincentVega>
Makes sense, yeah.
<VincentVega>
Now that you said it, that is : )
sonologico has joined #lisp
<jasom>
I'm always late to the party, but etypecase is usually good for dispatching on type as well VincentVega
<jasom>
oh, nevermind it's just a literal type specifier
<VincentVega>
Bike: And what if I needed this facility only at compile time, would it make any difference? Sorry, just have to make sure : )
<Bike>
subtypep is always going to give the same results for those inputs, if that's what you mean
<jasom>
VincentVega: I don't think there's a good way other than just destructuring the type specifier yourself
<VincentVega>
Bike: Ok.
<VincentVega>
jasom: how can I do destructuring?
Alloc has quit [Ping timeout: 260 seconds]
<VincentVega>
jasom: I mean, given there are deftypes and all
Alloc has joined #lisp
<jasom>
I don't think there's a portable way to expand deftypes
wsinatra_ has joined #lisp
<VincentVega>
jasom: Oh well, can't have it all : ) Anyway, it's not such a big problem, rather just a temporary nuisance. Thanks, people!
shifty has joined #lisp
<jasom>
there are definitely non-portable ways though, and someone may have made a portability shim for it.
Necktwi has quit [Remote host closed the connection]
cosimone has joined #lisp
<kilimanjaro>
what are the common alternatives to SXHASH? i would like SOME-FN which roughly satisfies (= (some-fn x) (some-fn y)) == (equalp x y)
IPmonger has quit [Remote host closed the connection]
<kilimanjaro>
on SBCL at least, SXHASH seems to be optimized for performance and so will cause collisions for objects which a hash can't be computed quickly (e.g. vectors all seem to hash to the same value)
sm2n has quit [Quit: Leaving]
<Xach>
Hmm, are you able to (ql:quickload "cl-mixed" :verbose t)?
Necktwi has joined #lisp
<kilimanjaro>
Xach: yes
<Xach>
Thanks. When I try, I get a CFFI library error. I'm not sure why.
hiroaki has joined #lisp
<Xach>
kilimanjaro: are you using the latest quicklisp dist update?
<White_Flame>
kilimanjaro: you could test for types that you want to be more specific on, and fall back to sxhash for the rest
<kilimanjaro>
Xach: oh, sorry, I was not
<kilimanjaro>
I just ran `(ql:update-dist "quicklisp")`
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<kilimanjaro>
After that, I tried again, and it still worked
<phoe>
Xach: what sorta error?
<kilimanjaro>
White_Flame: sure
<Xach>
phoe: Unable to load any of the alternatives: ("libmixed.dylib" "libmixed.so" "mac64-libmixed.dylib")
<Xach>
the final dylib comes with the project, in static/
<Xach>
kilimanjaro: what CL and version are you using?
<phoe>
oh! maybe it is a mac-only thing
<Xach>
phoe: no - i have this problem on my linux system also
<Xach>
phoe: but i'm not sure why. i thought maybe the working mac version would add some insight.
<Xach>
the static/ path is my cffi:*foreign-library-directories* too.
<Xach>
why on earth does it not get found?
chiota has joined #lisp
chiota has quit [Client Quit]
VincentVega has quit [Remote host closed the connection]
<phoe>
maybe it gets found but fails for whatever reason
VincentVega has joined #lisp
<kilimanjaro>
White_Flame: i guess for a slow but reasonably general solution, I could serialize the object to a stream using cl-store or similar, and then compute a digest (e.g. md5) using ironclad
<White_Flame>
so I presume you're doing tons of comparisons, where the hash cost is amortized well?
<Xach>
ha! on the mac it fails because I was in a directory that had been deleted from under me, so the underlying error was with getcwd.
<Xach>
i'm guessing the linux failure is due to something else. digging.
<dim>
jasom: re your migration at work, have a look at pgbackrest for PITR and recovery
<kilimanjaro>
White_Flame: yes
<White_Flame>
another goofy idea, especially for the vectors, is to hash the first N bytes of the datastructure memory being referenced
<White_Flame>
although for cons lists, that would be limited to just the car & cdr words
<White_Flame>
but structs & vectors would benefit from that
gravicappa has quit [Ping timeout: 240 seconds]
jibanes has quit [Ping timeout: 240 seconds]
Necktwi has quit [Ping timeout: 264 seconds]
jibanes has joined #lisp
Necktwi has joined #lisp
abhixec has joined #lisp
<Josh_2>
added dedicated threads for accepting and processing connections on my HTTP server and It's just slowed it down
<Josh_2>
sad face
<Josh_2>
trying to go from HTTP1.0 to 1.1 with persistent connections
<Xach>
AHA
<phoe>
Xach: !!!!!!!
<Xach>
/lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found
<Xach>
as required by the static libmixed.so
<phoe>
oh goodness
<Xach>
not literally static, the one in static/
<Alfr_>
kilimanjaro, probably won't work: (equalp 1d0 1) but the hashes for these numbers printed most likely will differ, similar problem (equalp #\a #\A) is true.
<Xach>
i wish cffi bubbled that up somehow
<Xach>
there's a comment in the source to that effect
ralt has quit [Quit: Connection closed for inactivity]
gaqwas has quit [Ping timeout: 265 seconds]
<phoe>
can it bubble it up?
cosimone has quit [Quit: Quit.]
<phoe>
I mean, does the dlopen syscall provide any information about what exactly blew up, or does it just set errno/retval to EIMDED and the programmer gotta figure out what went wrong?
<Xach>
phoe: I'm not fully certain.
<Xach>
i would bet on "yes"
* mfiano
wonders which end of the question that bet is on
<fe[nl]ix>
Shinmera probably compiled that on a very recent distribution, and Xach is running an old(er) one
<fe[nl]ix>
for the same reason the officially distributed SBCL x86-64 binaries don't run on older distros
<fe[nl]ix>
one lesson here could be that if you want to distribute binaries, better compile on a distro from 2-3 years ago like Ubuntu LTS or Debian stable/oldstable
<mfiano>
Xach: It loads for me on SBCL 2.0.7, both dist version and HEAD, though has some warnings, and not just STYLE-WARNING, so probably needs to be fixed before inclusion anyway
jon_ has quit [Read error: Connection reset by peer]
jonjitsu has joined #lisp
Alloc has quit [Ping timeout: 260 seconds]
Alloc has joined #lisp
specbot has quit [Remote host closed the connection]
specbot has joined #lisp
Alloc has quit [Ping timeout: 260 seconds]
specbot has quit [Remote host closed the connection]
minion has quit [Disconnected by services]
minion has joined #lisp
Alloc has joined #lisp
sjl_ has quit [Ping timeout: 258 seconds]
jasom_test has joined #lisp
pve has quit [Quit: leaving]
jasom_test has quit [Quit: jasom_test]
torbo has joined #lisp
minion has quit [Remote host closed the connection]
minion has joined #lisp
specbot has joined #lisp
VincentVega has quit [Remote host closed the connection]
<jasom>
kilimanjaro: the only good way I can think is to come up with a canonical serialization and hash that serialization. equalp has so many special-cases
<jasom>
kilimanjaro: also note that equalp is potentially non-portabe with non-simple characters; I don't know what actual implementations do, but the spec leaves it up to the implementation
<jasom>
I can think of reasonable implementations of equalp that would have differing behavior based upon the current locale, for example.
sonologico has quit [Remote host closed the connection]
random-nick has quit [Ping timeout: 240 seconds]
hiroaki has quit [Ping timeout: 264 seconds]
orivej has joined #lisp
bilegeek has quit [Quit: Leaving]
bitmapper has quit [Remote host closed the connection]
bitmapper has joined #lisp
<White_Flame>
what is the rationale behind equalp ignoring string case?
<aeth>
White_Flame: probably because the most generic thing is case insensitive equality, given that there are case-insensitive predicates in the language.
<aeth>
the real problem is that there's not an equality one step less general than EQUALP
<White_Flame>
but to have that wrapped into the only facility which steps structure slots & makes it much less useful
<White_Flame>
right
<aeth>
By naming conventions of case-sensitivity vs. case-insensitivity, the case-sensitive version of EQUALP would be called EQUAL=
<White_Flame>
or that string sensitivity in comparisons isn't a dynamic binding
<aeth>
And I wouldn't be too shocked if the name EQUAL= is why we don't have EQUAL= :-p
<aeth>
Humans are biased by aesthetics.
<White_Flame>
well, "=" is used for pseudo-numeric equivalence
<White_Flame>
string= using the same stuff as char= which is the numeric equality of char codes
Necktwi has quit [Ping timeout: 265 seconds]
<White_Flame>
(which is roughly used because of incomplete coverage blah blah)
<aeth>
Yes, it wouldn't necessarily be EQUAL=, but there still would be an issue with naming it. I could definitely imagine postponing thinking about it for the next edition of the standard... which obviously never happened.
<aeth>
This is, of course, about why it's logical, not about what actually happened. You'd have to ask someone who was involved, if there's no written record of it.
<White_Flame>
but still, case-insensitive string comparison is not a deeper structural equality test; it's orthogonal