freenode/#lisp - IRC Chatlog
Search
15:56:43
beach
If you do that, you need to check that predicate is a function, that it is a function that accepts exactly one argument, etc, etc.
15:58:58
beach
But you do that in return-type-of-predicate which is wrong. You should do it in the code for the predicate.
16:00:54
beach
Add to this fact that your functions names are strange and your docstrings are wrong, and you have a mess.
16:03:08
beach
I suggest you try to think in the terms I explained. Low-level code that detects a problem AND proposes restarts to fix it. High-level code that invokes the low-level code in a handler-bind and invokes the restart if the error happens.
16:04:39
beach
I also suggest that you look at the examples in PCL and try to identify the parts that I explained.
16:07:17
beach
And, when I look at the name LIST-OF-EVENS and its associated docstring, I think "That is a very complicated implementation of that specification. Why not just do (loop repeat (random m) collect (* 2 (random n)))?
16:16:07
beach
Josh_2: I suggest you start by writing MY-EVEN-P which is like EVENP, except that it proposes one or more restarts if the argument is not an integer. So if it gets a value that is not an integer, it calls ERROR, signaling an appropriate condition, and it has one or more restarts like returning FALSE.
16:17:34
beach
MY-EVEN-P is an appropriate abstraction, and it corresponds to the use case I explained before (i.e. low-level code that detects a problem...).
16:35:19
Josh_2
http://paste.lisp.org/display/358222#1 Now I'm more than happy to talk about everything else that sucks.
16:42:06
_death
now you can rename your RETURN-8008 restart to USE-VALUE, have it take one parameter and set I to it.. then you can (use-value 8008 condition) in your HANDLER-BIND
16:43:09
_death
and then you should have another loop, calling the predicate with the new I until a valid value is used
17:02:21
emaczen`
I'm trying to inspect a foreign array by using #'cffi:foreign-array-to-lisp but I have no idea what to do with the array-type argument
17:09:10
_death
Josh_2: cool.. usually you define a function that invokes the restart, for example (defun use-value (new-value &optional condition) (let ((restart (find-restart 'use-value condition))) (when restart (invoke-restart restart new-value)))) .. in the case of use-value, CL already defines such a function
17:10:17
emaczen`
has anyone used CFFI with opencv before? It is a bit difficult because the C API is deprecated in favor of the C++ API
17:10:50
_death
emaczen: I wrote some opencv bindings years ago, when the C API was not yet deprecated..
17:12:42
emaczen`
_death: I don't know who would remember particulars about cvEncodeImage... Only in the C API the documenatation says that it returns a single-row matrix that contains the encoded image as an array of bytes
17:13:58
Josh_2
hmm well I can't actually define a function called (use-value). I'm going out now so I'll fiddle when I get back. Thanks for all the help everyone.
17:14:15
emaczen`
In the newer APIs it looks like you pass a vector<uchar> and it gets filled with your bytes...
18:14:11
attila_lendvai
emaczen``: pass it something like '(:pointer (:structure my-foo-that-has-been-cffi-defstruct-ed)
18:21:40
emaczen``
attila_lendvai: I'll try it in a second, I thought I was getting a byte array from C but I'm actually getting a CvMat* which has a single row, so I have to defcstruct CvMat* and get that single row byte array first...
19:08:27
emaczen``
dlowe: yep, unless someone else has already tied into C and wrote a wrapping API, then you have to
19:12:40
fourier
emaczen``: in difficult cases I typically write the short C/C++ program which does exactly what I expect from Lisp program to do towards the library I'm dealing with and literally translate all back to lisp
19:20:00
emaczen``
fourier: I'm dealing with images and I think I'm going to have a hard time determining if I'm even getting what I expect
19:21:22
paule32
i search for quantum computer programming by doing lisp - have anyone links, infos ?
21:58:46
drmeister
Let's say I compile a minimal version of Clasp that has a compiler compiled into it.
21:59:34
drmeister
Can I expect to be able to compile-file all of the Common Lisp source code (including CLOS) and then link and load that together.
22:00:09
dim
https://www.ece.cmu.edu/~ganger/712.fall02/papers/p761-thompson.pdf --- you might already be familiar with it
22:00:25
drmeister
I realize this is not a well formed question and there are implementation dependent stuff here.
22:00:43
Bike
the trick is to make sure that anything the compiler uses is properly defind in the compiler context
22:02:12
Shinmera
fasls that only contain compile-time side-effects, such that you can load this minimal part to compile-file the rest without having to do a full load.
22:02:49
Bike
(eval-when (:load-toplevel) ...this goes in the fasl...) (eval-when (:execute) ...this is only executed when loading as source...) (eval-when (:compile-toplevel) ...in the cfasl...)
22:08:15
drmeister
The slow part of building clasp has been bclasp LOADing and JITting all of Cleavir and clasp's extensions to Cleavir, (~10 min) and then running that code to build all of cclasp (~50 min).
23:34:23
anticrisis
it's not evident from clhs: check-type that it can't be used for structs, or did i miss something?
0:08:17
antoszka
jmercouris: did you try compiling rust to object code/libraries and calling that the same way you'd call C (via cffi)?
0:08:41
antoszka
jmercouris: that's how I'd approach the problem, though I've honestly have zero experience with rust ;)
0:17:11
jmercouris
antoszka: I didn't try that, at any rate, I found out the project I want to use is too immature any way, so I'll just use C++ and I'll be fine :D
1:50:57
emaczen
I also can't figure anything out with #'cffi:foreign-array-to-lisp to try to see what's going on
1:58:19
Zhivago
And can you access the fields of what cvencodeimage provides a pointer to, and find expected values?
1:59:07
emaczen
that's my problem, when I evaluate that cffi:foreign-slot-value form, I just get another foreign pointer
3:48:21
emaczen
I can relate to the CCL cocoa-bridge and I have only just toyed with ABCL's java integration
3:48:45
beach
drmeister seems to come here to #lisp only when he has a general Common Lisp question to ask.
3:49:18
beach
emaczen: No I don't. But Clasp uses the Cleavir compiler framework for its main compiler. And I am working on Cleavir.
3:51:23
emaczen
jmercouris: I wish they had it integrated with OpenStep so I could use it elsewhere and not just on OSX
3:52:08
jmercouris
I guess you can make different bindings for different platforms that are abstracted somehow
3:53:52
emaczen
That's what I have now haha, but I need something fast. I keep freezing my mini becuase I use so much memory.
3:54:30
emaczen
I stopped starting SBCL with --dyanamic-space-size 4096 because I learned my lesson eventually... ha
3:55:38
emaczen
Right now, I want the bridge for capturing video. I'm working with the CFFI and I just don't know that much about C and there isn't much to inspect either...