Re: C structures

2006-01-04 Thread Kjetil S. Matheussen
Leonardo Lopes Pereira: I would like to know if is there any way to convert C structs to any type of Guile data. SND has some neat features for doing that: http://ccrma.stanford.edu/software/snd/ Example: (load-from-path "eval-c.scm") # (define-ec-struct data datas somethingels

Re: JIT compiler

2006-01-04 Thread Kjetil S. Matheussen
Neil Jerram: Leonardo Lopes Pereira <[EMAIL PROTECTED]> writes: I would like to know if there is any Just-in-time compiler related resourse on Guile. There is guile-hobbit, which is a normal compiler, but I'm not sure if it is working with all features of current Guile. I'm not aware of an

Order of execution in quasiquote lists (again)

2006-01-06 Thread Kjetil S. Matheussen
Hi, I'm still confused and irritated that the order of execution in quasiquote lists are not (in my opinion) proper. I wrote about this to this list some time ago, and got the expected answer that the scheme standard does not specify the order. However, there is nothing wrong still doing it acco

Re: Order of execution in quasiquote lists (again)

2006-01-07 Thread Kjetil S. Matheussen
Han-Wen Nienhuys: Hi, I'm still confused and irritated that the order of execution in quasiquote lists are not (in my opinion) proper. I wrote about this to this list some time ago, and got the expected answer that the scheme standard does not specify the order. However, there is nothing wrong

Proof of concept dynamic FFI

2007-07-19 Thread Kjetil S. Matheussen
Jon Wilson: Hi, I've written a bit of code that lets you call any function from a dynamically loaded shared lib with any args. Well, actually, since it is just a proof of concept, it only lets you call functions that take zero or one args. The arg (if there is one) must be of type int. The

Re: hobbit and modules

2007-08-21 Thread Kjetil S. Matheussen
Thien-Thi Nguyen: greetings earthlings, buggy optimizers? heh! we go for buggy everything! http://www.gnuvola.org/software/guile/hjh/ to go cloud tripping you have to crouch REAL low first... Wow, great that someone still keeps hobbit alive for guile. When playing with it 3 years ago,

Injecting variables into closures.

2007-11-29 Thread Kjetil S. Matheussen
Hi, I need (well) to inject variables into closures, and have come up with the following macro to do so: (define-macro (inject-variable name value) (define env (gensym)) (define closure (gensym)) (define vars (gensym)) (define secondname (gensym)) (define secondval (gensym)) (define

Re: Injecting variables into closures.

2007-11-29 Thread Kjetil S. Matheussen
On Thu, 29 Nov 2007, Kjetil S. Matheussen wrote: Hi, I need (well) to inject variables into closures, and have come up with the following macro to do so: (define-macro (inject-variable name value) ... (cond ((null? (cdr ,env

Re: Injecting variables into closures.

2007-11-29 Thread Kjetil S. Matheussen
On Thu, 29 Nov 2007, Kjetil S. Matheussen wrote: (let () (display (defined? 'gakk)) (inject-variable gakk 90) gakk) => #f90 By the way. I'm quite surprised the environments consist of linked lists. Wouldn't it be much faster using hash tables instead? Perhaps

Re: Injecting variables into closures.

2007-11-29 Thread Kjetil S. Matheussen
On Thu, 29 Nov 2007, Clinton Ebadi wrote: "Kjetil S. Matheussen" <[EMAIL PROTECTED]> writes: Hi, I need (well) to inject variables into closures, and have come up with the following macro to do so: (define-macro (inject-variable name value) (define env (gensym))

Re: Injecting variables into closures.

2007-11-29 Thread Kjetil S. Matheussen
Ludovic Court?s: Hi, "Kjetil S. Matheussen" <[EMAIL PROTECTED]> writes: Now I wonder, is this safe and portable? Or are there other and better ways to do this? Neither `define-macro' nor `procedure->macro' is portable: both are Guile-specific (SCM m

Re: the future of Guile

2007-12-04 Thread Kjetil S. Matheussen
"Marco Maggi": 4. If a garbage collector allows to remove the need for "scm_remember_upto_here" it must be adopted even if it makes Guile slower and it raises memory usage a bit (or more than a bit). If we replace "should" with "must", I agree. Regarding the HBGC, a few nonsc

Re: the future of Guile

2007-12-04 Thread Kjetil S. Matheussen
On Tue, 4 Dec 2007, Kjetil S. Matheussen wrote: > > "Marco Maggi": > > > > 4. If a garbage collector allows to remove the need for > > "scm_remember_upto_here" it must be adopted even if it > > makes Guile slower and it raises memor

Re: the future of Guile

2007-12-04 Thread Kjetil S. Matheussen
On Tue, 4 Dec 2007, Roland Orre wrote: On Tue, 2007-12-04 at 19:34 +0100, Kjetil S. Matheussen wrote: ... Oh, and another thing. My tests (available in the guile-devel archives) also showed that the HBGC version usually use a bit less memory than Guile's old garbage collector. (Yet an

Re: the future of Guile

2007-12-06 Thread Kjetil S. Matheussen
"Marco Maggi": 3b. Death to structs! IMO they were "an attempt", but the resulting code is awful (sorry, but can you disagree?). Err.. but aren't structs the main part of how GOOPS is implemented? IMO Guile's structs do nothing that cannot be done better with a good old C str

Re: the future of Guile

2007-12-07 Thread Kjetil S. Matheussen
"Marco Maggi": 4. If a garbage collector allows to remove the need for "scm_remember_upto_here" it must be adopted even if it makes Guile slower and it raises memory usage a bit (or more than a bit). Who cares? I have written thousands and thousands of lines of guile ext

How to use guardians

2008-03-13 Thread Kjetil S. Matheussen
Hi, I'm trying to use guardians, but have a little bit of trouble understanding how they work. I have made a function "add-guardian-object" which takes an object "object" and a function "cleanup-func". "cleanup-func" is called before the object is freed. Here is my implementation of "add-guard

Re: How to use guardians

2008-03-13 Thread Kjetil S. Matheussen
Thien-Thi Nguyen: (das-guardian (list cleanup-func object))) Here, you add the compound object (constructed using `list'), not just `object'. Is that what you want do, really? Ah, of course. Thank you very much. Also for the mysteriously quick reply. :-) I have now changed "add-g

Re: Passing C pointers through guile

2008-07-06 Thread Kjetil S. Matheussen
Ludovic Court?s: Hi, "Maciek Godek" <[EMAIL PROTECTED]> writes: is there any portable and recommended way for passing C pointers around in guile environment? I think of something like scm_to_ptr (analogous to scm_to_int etc.). Certainly such a value would be completely useless for the interpr

Re: Passing C pointers through guile

2008-07-09 Thread Kjetil S. Matheussen
On Wed, 9 Jul 2008, Greg Troxel wrote: > "Kjetil S. Matheussen" <[EMAIL PROTECTED]> writes: > > > Ludovic Court?s: > >> Hi, > >> > >> "Maciek Godek" <[EMAIL PROTECTED]> writes: > >> > >>> is there any po

Re: Passing C pointers through guile

2008-07-10 Thread Kjetil S. Matheussen
Ludovic Courtès: > Sure, if you just do this now and then, SMOBs aren't a problem. > But that doesn't change the fact that all the functionality SMOB > provides is overkill when the only thing you need is to hold > a pointer. It's not overkill, it's exactly what you need: disjoint SMOB type, `f

Re: Closure?

2008-07-11 Thread Kjetil S. Matheussen
Ludovic Court?s: "Maciek Godek" <[EMAIL PROTECTED]> writes: I've been wondering if there's any way to recall (or get inside) an environment of a closure (= to directly access variables bound to a closure) Yes, with `the-environment': guile> ((lambda (a b) (the-environment)) 2 3) (((a b)

Re: Closure?

2008-07-11 Thread Kjetil S. Matheussen
On Fri, 11 Jul 2008, Kjetil S. Matheussen wrote: > > > Ludovic Court?s: > > "Maciek Godek" <[EMAIL PROTECTED]> writes: > > > >> I've been wondering if there's any way to recall > >> (or get inside) an environment of a closure (=

Re: Closure?

2008-07-12 Thread Kjetil S. Matheussen
On Fri, 11 Jul 2008, Maciek Godek wrote: Kjetil S. Matheussen: The function "local-eval" is probably what you want. I use local-eval a lot, it's one of the really really nice features provided by Guile: (define-macro (with env . code) `(local-eval (quote (begin ,@code)) ,

Re: Closure?

2008-07-14 Thread Kjetil S. Matheussen
"Maciek Godek" I don't know exactly how it works out that using a define in local-eval falls foul of the define placement rule, but it is not hard to imagine that it could do. The other question is: is it really necessary to impose such limitations on "define". Why is it required to make its p

Re: Closure?

2008-07-14 Thread Kjetil S. Matheussen
On Mon, 14 Jul 2008, Maciek Godek wrote: Kjetil S. Matheussen: I think local-eval is necessary for making a namespace system of the below type without having to use codewalking macros to expand the bodies of functions: (define-namespace bank) (def-bank sum 0) (def-bank (add n) (set! sum

Re: What new libraries or functionality does Guile need?

2008-07-19 Thread Kjetil S. Matheussen
"Jose A. Ortega Ruiz": Hi- If you could ask someone to write a library or package a set of functionality for Guile that it doesn't currently have, what would it be? (My personal projects are near completion, and I may have some Saturdays free.) Bindings for OpenGL/GLU/GLUT would be great.

Re: What new libraries or functionality does Guile need?

2008-07-22 Thread Kjetil S. Matheussen
JonWilson: It seems that snd has a significant amount of functionality that might be generally useful. Would it be possible for the snd team to spend some time factoring out these things? I know that snd-c and the GL bindings have been mentioned here, but I suspect there are other things as w

Re: Me no understand scoping

2008-07-30 Thread Kjetil S. Matheussen
Clinton Ebadi: As a matter of style, you probably want to avoid local-eval as it will have to be removed whenever Guile ends up with a faster compiler (one I've never heard this before, and I think you are way wrong. first-class environments etc. is what makes Guile special and it would be in

Re: References/locations

2008-08-08 Thread Kjetil S. Matheussen
"Maciek Godek": Subject: References/locations To: guile-user@gnu.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1 Hi, it's me again, asking silly questions. Not at all, your questions are very good. :-) This time I would like to know if there's a s

Re: X11 bindings and shell bindings

2008-09-18 Thread Kjetil S. Matheussen
"Ishan Arora": > And is there a procedure to > synchronously run a shell code and return the output as a String. Thanks. > Should do: (use-modules (ice-9 rdelim)) (define (get-system-output command) (let ((logfilename (tmpnam))) (system (string-append command " > " logfilename)) (let

Re: Dynamic variable binding

2008-11-13 Thread Kjetil S. Matheussen
Sebastian Tennant: Hi all, An elementary scheme problem from an elementary schemer... I need to create multiple variable bindings from a list of symbols. The value of the variables is unimportant. It's the 'names' of the variables that matter. In pseudo-scheme code: (map (lambda (v) (def

Re: Placement of defines

2008-12-18 Thread Kjetil S. Matheussen
Sebastian Tennant: Hi all, Having read this interesting thread: http://sourceware.org/ml/guile/1999-08/msg00118.html I understand that internal definitions may not occur anywhere other than at the beginning of the body of the enclosing expression, which explains why this works: ((lambda (x)

Re: Placement of defines

2008-12-19 Thread Kjetil S. Matheussen
Sebastian Tennant: Quoth "Kjetil S. Matheussen" : Yes, this limitation in Scheme is a horrible pest. There's no decent reason why you shouldn't be allowed to use define other places than right after a lambda, except the long discussion involved how it should behave in var

Re: Killing off scm_init_guile for Guile 2.0 ?

2009-01-16 Thread Kjetil S. Matheussen
Linas Vepstas: I feel obligated to respond, having made all sorts of noise. 2009/1/15 Neil Jerram : whether people think that scm_init_guile is really needed. kill it. there seem to be perfectly adequate ways of living without it. Unfortunately, the current documentation describing how to

Re: Killing off scm_init_guile for Guile 2.0 ?

2009-01-23 Thread Kjetil S. Matheussen
On Fri, 23 Jan 2009, Neil Jerram wrote: 2009/1/16 Kjetil S. Matheussen : Snd uses scm_init_guile when compiled as a Pd external. Pd is a graphical programming language for audio processing, and "externals" are linked into the program during runtime. When Snd is a Pd external, it

Re: scheme (format) question

2009-03-22 Thread Kjetil S. Matheussen
Mark Polesky: ;; Hi. ;; ;; How can I change the following code so that ;; it returns "2 0.25 0."? That is: return ;; integers without decimal point, otherwise ;; round to as many decimal places as needed, ;; but not more than 4. (let ((a 2.0) (b 1/4) (c 1/3)) (format #t "~&~a ~a

Re: scheme (format) question

2009-03-23 Thread Kjetil S. Matheussen
On Sun, 22 Mar 2009, Mark Polesky wrote: (define (my-format bool string . list-of-nums) (apply format bool string (map set-precision list-of-nums))) (let ((a 2.0) (b 1/4) (c 1/3)) (my-format #t "~&~a ~a ~a" a b c)) Kjetil, Awesome. Thanks. I knew there was something simple

Re: Getting the (text) selection from the clipboard

2009-06-20 Thread Kjetil S. Matheussen
Richard Shann: Does anyone know if there is a guile procedure to get the (text) selection? (That is from doing Copy in another application) Richard Assuming you mean X selection, I've used the "xsel" program to do this: (define-macro (include filename) (define ret "") (for-each-line-in-