aartaka has quit [Read error: Connection reset by peer]
simendsjo has joined #lisp
narimiran has quit [Ping timeout: 246 seconds]
jonatack has quit [Ping timeout: 272 seconds]
Bourne has joined #lisp
gaqwas has quit [Remote host closed the connection]
toorevitimirp has joined #lisp
notzmv` has joined #lisp
toorevitimirp has quit [Remote host closed the connection]
ym has quit [Remote host closed the connection]
hendursaga has joined #lisp
notzmv has quit [Ping timeout: 240 seconds]
hendursa1 has quit [Ping timeout: 240 seconds]
gaqwas has joined #lisp
ym has joined #lisp
treflip has quit [Quit: WeeChat 2.6]
bilegeek has quit [Quit: Leaving]
aartaka has joined #lisp
_whitelogger has joined #lisp
libertyprime has quit [Read error: Connection reset by peer]
edgar-rft has joined #lisp
simendsjo has quit [Ping timeout: 258 seconds]
jonatack has joined #lisp
zaquest has quit [Quit: Leaving]
zaquest has joined #lisp
cosimone has joined #lisp
liberliver has joined #lisp
libertyprime has joined #lisp
<treflip>
Hi! Has anyone used cl-earley-parser? I'm having troubles with parsing words that aren't defined in the lexicon.
iAmDecim has joined #lisp
brown121407 has quit [Read error: Connection reset by peer]
wxie has joined #lisp
random-nick has joined #lisp
iAmDecim has quit [Ping timeout: 260 seconds]
space_otter has quit [Remote host closed the connection]
mindCrime has quit [Ping timeout: 244 seconds]
aartaka has quit [Ping timeout: 258 seconds]
wxie has quit [Ping timeout: 256 seconds]
libertyprime has quit [Quit: leaving]
brown121407 has joined #lisp
iAmDecim has joined #lisp
minerjoe has joined #lisp
brown121407 has quit [Ping timeout: 240 seconds]
rippa has joined #lisp
iAmDecim has quit [Ping timeout: 260 seconds]
jasom has quit [Ping timeout: 244 seconds]
Volt_ has joined #lisp
wxie has joined #lisp
brown121407 has joined #lisp
jasom has joined #lisp
brown121407 has quit [Remote host closed the connection]
<iissaacc>
any libraries with a util function for currying functions with keyword args? I've written my own but thought it might be better to use a widely used library for readability
orivej has quit [Quit: No Ping reply in 180 seconds.]
jprajzne has quit [Quit: jprajzne]
<mseddon>
beach, right. Because in my toy implementations I defer checking until after LOAD has processed the whole file.
beinnblade has joined #lisp
choegusung has joined #lisp
orivej has joined #lisp
<Alfr_>
mseddon, beach, ``load sequentially executes each form it encounters in the file [...]''. And then some about top level form when implicit compilation is involved.
orivej_ has joined #lisp
orivej has quit [Ping timeout: 256 seconds]
nicktick has quit [Ping timeout: 258 seconds]
choegusung has quit [Quit: leaving]
EvW has joined #lisp
nicktick has joined #lisp
pve has quit [Ping timeout: 240 seconds]
nadare has quit [Ping timeout: 240 seconds]
<Bike>
sure, but the implementation doesn't have to issue warnings about undefined functions immediately.
<Bike>
or at all, i don't think
TwoNotes has quit [Quit: Leaving]
simendsjo has quit [Ping timeout: 256 seconds]
Alfr_ has quit [Quit: Leaving]
nadare has joined #lisp
liberliver1 has joined #lisp
liberliver has quit [Ping timeout: 246 seconds]
liberliver1 is now known as liberliver
nadare has quit [Remote host closed the connection]
<AeroNotix>
if a c function wants to take a `void *` for context in a callback. Is it a bad idea to get a pointer to any lisp object and use that? Does the GC guarantee that an object's address doesn't change?
<AeroNotix>
or should I implement the void* context as a key to some map which looks it up- therefore circumventing any issues with the GC relocating objects?
IAmRasputin has quit [Quit: WeeChat 1.9.1]
<phoe>
wait what
<phoe>
for context? what do you mean by context?
<AeroNotix>
A lot of C libraries that you provide callbacks to, will also take a void* which is some arbitrary value that will also be passed to the callback
<AeroNotix>
it's so you can have some state (i.e. context)
<phoe>
oh, so basically, that's arbitrary user-provided data
<AeroNotix>
yeah
<phoe>
do you make any use of that inside the callback? if not, pass a null pointer
<AeroNotix>
I will make use of that inside the callback
IPmonger_ has joined #lisp
<phoe>
oh, so you need a piece of raw memory that you will operate on in the C world
<AeroNotix>
Well I want it to be a lisp object at some point, whether directly or being able to use the pointer to find that lisp object
IPmonger has quit [Ping timeout: 256 seconds]
<phoe>
wait a second, manipulating Lisp data in C isn't really something that you would want to do
<phoe>
you could try to allocate a static vector and fill it with your data of choice and grab the vector-sap and pass it that way, but that data is going to be ub8s or something similar
<Bike>
no, the gc does not necessarily guarantee that objects's addresses don't change. your implementation may have a way to "pin" objects to get that guarantee for them in particular.
natj212_ has joined #lisp
<AeroNotix>
I looked up pinning for SBCL, didn't seem like it would be ideal for this
<phoe>
what exactly are you trying to do in the callback?
<AeroNotix>
The callback handles network packets
<Bike>
how is it not ideal? it's what you asked for.
<AeroNotix>
Bike: it looked as if the pinning is tie to the life time of a scope
<Bike>
well, yes. you can't permanently pin objects I don't think.
IPmonger has joined #lisp
IPmonger_ has quit [Ping timeout: 246 seconds]
<AeroNotix>
phoe: the idea would be that the library calls your callback function when there is data to be sent out. My plan was to make a basic callback function and then the void*/user-data it would contain a method to retrieve an actual lisp function
<phoe>
I am confused now
<Bike>
aeronotix wants to use a closure as a callback.
<phoe>
who calls into C? is the callback provided by you, or already existing? who passes in that void* data and who receives it and who decides what it is and how it should be parsed?
<AeroNotix>
not a closure
Alfr has joined #lisp
<Bike>
if it's the usual C callback idiom it sounds like a closure to me.
<Bike>
you give it a function pointer and a void*, and then it calls the function pointer with the value you gave it. that's what you do if your language doesn't have closures.
<AeroNotix>
Bike: yes the latter
<AeroNotix>
I wouldn't call that a closure, though
<AeroNotix>
but whatever, semantics.
<phoe>
it isn't a closure in the C world
<AeroNotix>
right
<phoe>
but you can write a Lisp closure and have that called when your defcallback function is created
<phoe>
or, if you call into C and then C calls back into Lisp, you can use dynavars for providing dynamic context
<Alfr>
Bike, that's what they meant. Thanks for the clarification.
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<AeroNotix>
phoe: I can't provide dynamic variables for this
<AeroNotix>
the callbacks will be called whenever and from multiple threads
<AeroNotix>
I don't control that
<AeroNotix>
so I can't bind a dynamic variable hoping that it will be bound properly
Codaraxis has quit [Remote host closed the connection]
<AeroNotix>
which is why I wanted to use the void* to hold some lisp function and then it will be available all the time every time the callback is called.
<phoe>
you don't need to do that if you define a callback via cffi:defcallback
<phoe>
when control reaches such a callback function then that function has all of Lisp at its disposal
Codaraxis has joined #lisp
<phoe>
it can do whatever, intern symbols, find fdefinitions, etc
<AeroNotix>
is there an equivalent of defcallback which doesn't bind the callback to a name?
<AeroNotix>
like an "anonymous" callback
<natj212_>
I'm trying to remember this common lisp macro. It's similar to let but it doesn't evaluate the expression and just stores the expression. I'm trying to avoid copy-pasting aref everywhere
<natj212_>
Does anyone remember this?
<phoe>
natj212_: macrolet?
<phoe>
AeroNotix: I don't know if it's in CFFI
<natj212_>
Macrolet is for storing macros right?
<natj212_>
That'd probably work just might be overkill
aartaka has quit [Ping timeout: 265 seconds]
<phoe>
natj212_: what do you mean by "storing the expression"
<phoe>
AeroNotix: sb-alien::alien-lambda
<Bike>
that sounds more like symbol-macrolet
<Bike>
though "storing the expression" is not the ideal way to think of it
<phoe>
that's not portable though, I don't know if CFFI has anonymous callbacks like that./
<phoe>
how many callbacks do you want to define like that, anyway? why not name them?
<AeroNotix>
well I will just be using sbcl any way
<Bike>
you can do like (symbol-macrolet ((x (aref y z))) (setf x 4)) which is equivalent to (setf (aref y z) 4).
puchacz has joined #lisp
<AeroNotix>
phoe: because the library is intended to be arbitrarily used with user-code. The whole API is intentionally created so you can override tonnes of parts of it with callbacks.
<Bike>
also it's a special operator rather than a macro.
<AeroNotix>
it would be a crap API if I took that ability away
<natj212_>
Symbol-macrolet might work
<phoe>
AeroNotix: I don't understand, why can't the user just (defcallback my-package:my-callback ...) and pass my-package:my-callback as their callback?
<phoe>
that's customizability right there
<AeroNotix>
phoe: because I am trying to hide that it's a CFFI wrapper? I want to provide a nice API instead of something disgusting like that
<AeroNotix>
I want them to just be able to provide pure lisp functions, no cffi, no nothing
<phoe>
I see, so you might need to generate alien closures on the fly that close over Lisp functions.
<AeroNotix>
I don't think so
<AeroNotix>
if we go back to the beginning of my question
<phoe>
defcallback over a gensym might work, but that's ugly stuff.
<AeroNotix>
I had already mostly figured a nice API before we got into the weeds with interrogation
<phoe>
what does your API look like?
<AeroNotix>
there just needs to be one callback function defined, inside my wrapper, the library already has a void* user-data. Just set the void* to point to however you need to look the user's code up again.
<AeroNotix>
for example: `(make-instance 'my-class :handle-event-type-x #'some-function)`
<AeroNotix>
rather than what you're suggesting which is to leak the internals of the library (i.e. cffi details) to the user.
<AeroNotix>
the goal here would be to make #'some-function the void* that the c lib already takes
<AeroNotix>
and my generic callback uses that
<phoe>
hmmmm
<AeroNotix>
phoe: does that not make more sense?
<phoe>
yes, it does
<AeroNotix>
right
Codaraxis has quit [Remote host closed the connection]
<phoe>
in the general case passing Lisp pointers to C is impossible because of Lisp GC being able to move objects at any time
<AeroNotix>
yeah I get that, which is why I was going to set the void* to a key on some datastructure. Like a map protected with a RW lock
<phoe>
you could index Lisp functions in some sorta hash table that is keyed with integer keys.
Codaraxis has joined #lisp
<AeroNotix>
yeah ok
<AeroNotix>
I will do that
natj212_ has quit [Ping timeout: 260 seconds]
<puchacz>
hi, is http://clhs.lisp.se/Body/m_case_.htm required to use eq (so I can use keywords, or list of keywords in keys? or just symbols, t and otherwise? it says it has to be the "same", and the word "same" is linked, and "same" is explained that it is indistinguishable by a predicate, not saying which preidcate....
<AeroNotix>
this is a http3/quic library. So far nothing I've found available aside from two libraries work with Google's load balancers.
<AeroNotix>
so hence needing to use this daft library to do things. I hate the way the library is, but them's the breaks.
<phoe>
puchacz: as far as I remember CASE uses EQL
<AeroNotix>
There's a bunch of http3/quic libraries out there, but they don't support talking to Google load balancers... which is tedious to say the least.
<Alfr>
AeroNotix, how do you decide that those functions won't be used again and you may loose your last reference to it? Otherwise you're going to accumulate some-functions.
Codaraxis has quit [Remote host closed the connection]
<puchacz>
phoe: is it specified officially?
Codaraxis has joined #lisp
<AeroNotix>
Alfr: you mean "how do you not leak memory" - the usual techniques.
<puchacz>
eql should match on characters
<AeroNotix>
by being diligent and not writing code that leaks.
<phoe>
AFAIK there is a minor hole in the CASE page, it doesn't mention that EQL is used
<phoe>
but AFAIK somewhere the spec says that if a predicate is not specified then EQL is assumed
<phoe>
some things like CATCH explicitly use EQ.
<phoe>
but it is explicitly noted
<puchacz>
phoe: I would need to try but I had an impression that it was not matching characters from string
<Alfr>
AeroNotix, I mean do you get some notification from the C side that some provided callback won't ever be used again?
<AeroNotix>
Alfr: you explicitly close/free the library. It won't keep using things after you've closed it, barring a bug in the underlying library
<puchacz>
phoe: it works (case (aref " " 0) (#\space "space"))
<phoe>
try macroexpanding this
<puchacz>
one sec
<puchacz>
eql in sbcl
<puchacz>
why is it quoting '#\b etc?
<Alfr>
AeroNotix, so you have some points where you know that something won't be used again and can thus feed those some-functions to the GC on the lisp side. I was only curious. :)