freenode/#lisp - IRC Chatlog
Search
18:11:27
nij
How to make nickname for a function? (defun f () ()) (setf g #'f) doesn't do what I want, in that (g) returns error.
18:21:09
Alfr
nij, there's also (setf (fdefinition ..) ..); fdefinition also accepts function-names, e.g. (setf frob), which symbol-function does not.
18:22:11
Alfr
nij, also make sure that what you assign really is a function (not a special operator or macro).
19:03:51
lukego
Hey can anyone recommend (or not) an OpenCV binding for Lisp? (Can the ones on Github dates ~2013 be usable or is that hopelessly old in OpenCV terms?)
19:05:02
lukego
Or alternatively, can someone suggest a practical mostly-automated way to extract a set of polygons from a photo? e.g. if you'd take a photo of a keyboard and detect the shape and location of each key
22:09:07
Josh_2
Hey, a foreign function I'm trying to call expects a pointer to a 'const unsigned char ' what encoding type is that? utf-8 doesn't seem to be working properly so I'm not sure if I have the encoding correct
22:15:26
Bike
the function might actually want strings in some encoding, but unsigned char* just means bytes.
22:21:44
Josh_2
I pass it the base64 encoded string converted to a pointer that I receive from a different function
22:25:54
Josh_2
https://gitlab.matrix.org/matrix-org/olm/-/blob/master/python/tests/account_test.py#L74 this is the test I'm trying to copy, it uses the methods sign https://gitlab.matrix.org/matrix-org/olm/-/blob/master/python/olm/account.py#L185 and ed25519_verify https://gitlab.matrix.org/matrix-org/olm/-/blob/master/python/olm/utility.py#L83
22:26:56
Josh_2
https://github.com/K1D77A/cl-megolm/blob/master/src/account.lisp#L87 that is my lisp version of sign, and this is my lisp version of ed25519 verify https://github.com/K1D77A/cl-megolm/blob/master/src/utility.lisp#L33
22:30:34
Josh_2
You can call (%olm:utility-last-error <utility pointer>) and it will return a string telling you some information about the error
22:39:16
Josh_2
Thats why I showed you the python version of the functions because I assume they are correctly using the C library
22:43:11
Bike
but you're not interfacing with that api at all. you're using this one: https://gitlab.matrix.org/matrix-org/olm/-/blob/master/include/olm/olm.h and that's the one you need to understand
22:47:41
Josh_2
https://gitlab.matrix.org/matrix-org/olm/-/blob/master/include/olm/utility.hh here is the verify function
2:33:15
Josh_2
Some functions which expect base64 strings as input work just fine and then these two (so far) keep failing :(
2:37:59
Josh_2
hmm seems the pickle functions take a void * while the ones causing issues require uint8_t *, how do I create uint8_t * with cffi?
2:48:25
Nilby
You can ususally just use the cffi string type, but you have to make sure the cffi encoding matches the expected encoding of the foreign functions.
2:49:07
Josh_2
thats what I've been doing, but I tried utf-8 which is what the python version is using, and I've tried ascii
2:51:20
Nilby
If it's base64 I imagine it's converting aribtrary binary data, so you don't want a character encoding conversion.
2:57:05
Nilby
On some platforms you can even use the lisp array data directly without conversion with cffi:with-pointer-to-vector-data.
3:03:20
Josh_2
well when I use (cffi:with-foreign-array ..) I get an error about not being able to find an applicable method relating to cffi:dimensions
3:05:51
Josh_2
cffi:with-pointer-to-vector-data doesn't do that though, not that I can find that function in the online