unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* calling scheme procedures by name from C
@ 2009-08-02  9:17 Richard Shann
  2009-08-02 11:17 ` Linas Vepstas
  2009-08-02 13:00 ` calling scheme procedures by name from C Paul Emsley
  0 siblings, 2 replies; 13+ messages in thread
From: Richard Shann @ 2009-08-02  9:17 UTC (permalink / raw)
  To: guile-user

Hi,
I want to call a scheme procedure with four arguments from C.
(The example scheme procedure here is just displaying its arguments.)

(define (d-UploadRoutine a b c d)
  (display a)
  (display b)
  (display c)
  (display d))

But I can't find what the correct parameters types are - the headers
just say SCM, here are three things that give errors, two commented out


SCM proc =  gh_str2scm("d-UploadRoutine",  strlen("d-UploadRoutine"));
// proc = scm_string_to_symbol("d-UploadRoutine");
// proc = scm_string_to_symbol( gh_str2scm("d-UploadRoutine",  strlen("d-UploadRoutine")));
SCM arg1 =  gh_str2scm("hello", strlen("hello"));
SCM arg2 =  gh_str2scm("he2lo", strlen("hello"));
SCM arg3 =  gh_str2scm("he3lo", strlen("hello"));
SCM arg4 =  gh_str2scm("he4lo", strlen("hello"));
scm_call_4(proc, arg1, arg2, arg3, arg4);

The three definitions of proc lead to the following three error messages:

ERROR: In procedure apply:
ERROR: Wrong type argument in position 1: "d-UploadRoutine"


ERROR: In procedure string->symbol:
ERROR: Wrong type argument in position 1 (expecting string): 33820865


ERROR: In procedure apply:
ERROR: Wrong type argument in position 1: d-UploadRoutine

It seems to me the docs are rather deficient here! They don't give the types of the
arguments, and the header only tells you they are SCM...

Help much appreciated,

Richard Shann







^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: calling scheme procedures by name from C
  2009-08-02  9:17 calling scheme procedures by name from C Richard Shann
@ 2009-08-02 11:17 ` Linas Vepstas
  2009-08-02 12:03   ` Richard Shann
  2009-08-02 15:00   ` Mike Gran
  2009-08-02 13:00 ` calling scheme procedures by name from C Paul Emsley
  1 sibling, 2 replies; 13+ messages in thread
From: Linas Vepstas @ 2009-08-02 11:17 UTC (permalink / raw)
  To: richard.shann; +Cc: guile-user

2009/8/2 Richard Shann <richard.shann@virgin.net>:
> Hi,
> I want to call a scheme procedure with four arguments from C.
> (The example scheme procedure here is just displaying its arguments.)
>
> (define (d-UploadRoutine a b c d)
>  (display a)
>  (display b)
>  (display c)
>  (display d))
>
> But I can't find what the correct parameters types are -

guile is not typed, or rather, is typed at runtime only, or dynamically typed.

> the headers
> just say SCM, here are three things that give errors, two commented out
>
>
> SCM proc =  gh_str2scm("d-UploadRoutine",  strlen("d-UploadRoutine"));

The gh_* routines are old and deprecated, and have been for about
a decade now .. don't use them.

On the other hand, I notice that the tutorial at
http://www.gnu.org/software/guile/docs/docs.html
still uses gh_, so clearly, the gnu docs need cleanup :-(

> // proc = scm_string_to_symbol("d-UploadRoutine");
> // proc = scm_string_to_symbol( gh_str2scm("d-UploadRoutine",  strlen("d-UploadRoutine")));
> SCM arg1 =  gh_str2scm("hello", strlen("hello"));
> SCM arg2 =  gh_str2scm("he2lo", strlen("hello"));
> SCM arg3 =  gh_str2scm("he3lo", strlen("hello"));
> SCM arg4 =  gh_str2scm("he4lo", strlen("hello"));
> scm_call_4(proc, arg1, arg2, arg3, arg4);
>
> The three definitions of proc lead to the following three error messages:
>
> ERROR: In procedure apply:
> ERROR: Wrong type argument in position 1: "d-UploadRoutine"

google suggests that you read

http://www.lonelycactus.com/guilebook/x220.html
and
http://lonelycactus.com/guilebook/c1204.html

which I think is a start, and should get you going.

There's more stuff in
http://www.gnu.org/software/guile/manual/html_node/Programming-in-C.html

but it lacks examples.

> It seems to me the docs are rather deficient here!

The examples are particularly so.

> They don't give the types of the
> arguments, and the header only tells you they are SCM...

scheme is like perl, in that the types are determined during
runtime.  This is considered to be a "strength", in that, in principle,
you can define a routine that does the "right thing" for any type.

--linas




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: calling scheme procedures by name from C
  2009-08-02 11:17 ` Linas Vepstas
@ 2009-08-02 12:03   ` Richard Shann
  2009-08-02 15:00   ` Mike Gran
  1 sibling, 0 replies; 13+ messages in thread
From: Richard Shann @ 2009-08-02 12:03 UTC (permalink / raw)
  To: guile-user

On Sun, 2009-08-02 at 06:17 -0500, Linas Vepstas wrote:
> 2009/8/2 Richard Shann <richard.shann@virgin.net>:
> > Hi,
> > I want to call a scheme procedure with four arguments from C.
> > (The example scheme procedure here is just displaying its arguments.)
> >
> > (define (d-UploadRoutine a b c d)
> >  (display a)
> >  (display b)
> >  (display c)
> >  (display d))
> >
> > But I can't find what the correct parameters types are -
> 
> guile is not typed, or rather, is typed at runtime only, or dynamically typed.
> 
> > the headers
> > just say SCM, here are three things that give errors, two commented out
> >
> >
> > SCM proc =  gh_str2scm("d-UploadRoutine",  strlen("d-UploadRoutine"));
> 
> The gh_* routines are old and deprecated, and have been for about
> a decade now .. don't use them.
> 
> On the other hand, I notice that the tutorial at
> http://www.gnu.org/software/guile/docs/docs.html
> still uses gh_, so clearly, the gnu docs need cleanup :-(
> 
> > // proc = scm_string_to_symbol("d-UploadRoutine");
> > // proc = scm_string_to_symbol( gh_str2scm("d-UploadRoutine",  strlen("d-UploadRoutine")));
> > SCM arg1 =  gh_str2scm("hello", strlen("hello"));
> > SCM arg2 =  gh_str2scm("he2lo", strlen("hello"));
> > SCM arg3 =  gh_str2scm("he3lo", strlen("hello"));
> > SCM arg4 =  gh_str2scm("he4lo", strlen("hello"));
> > scm_call_4(proc, arg1, arg2, arg3, arg4);
> >
> > The three definitions of proc lead to the following three error messages:
> >
> > ERROR: In procedure apply:
> > ERROR: Wrong type argument in position 1: "d-UploadRoutine"
> 
> google suggests that you read
> 
> http://www.lonelycactus.com/guilebook/x220.html
This seems to do the trick - I googled without finding anything so
useful, but I am a dreadful googler. The lines I needed were these:

	func_symbol = scm_c_lookup("do-hello");
	func = scm_variable_ref(func_symbol);


> and
> http://lonelycactus.com/guilebook/c1204.html
> 
> which I think is a start, and should get you going.
> 
> There's more stuff in
> http://www.gnu.org/software/guile/manual/html_node/Programming-in-C.html
> 
> but it lacks examples.
> 
> > It seems to me the docs are rather deficient here!
> 
> The examples are particularly so.
> 
> > They don't give the types of the
> > arguments, and the header only tells you they are SCM...
> 
> scheme is like perl, in that the types are determined during
> runtime.  This is considered to be a "strength", in that, in principle,
> you can define a routine that does the "right thing" for any type.

Unfortunately, the writer of scm_call_4 did not choose to define the
routine to do the right thing for any type I tried! And as the docs
didn't even give the C-prototype (which anyway only tells me it takes
SCMs) I cannot call the function without looking at the implementation.
Or asking the ever helpful band of schemers!
Thank you very much for such a speedy & informative reply.
Richard


> 
> --linas





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: calling scheme procedures by name from C
  2009-08-02  9:17 calling scheme procedures by name from C Richard Shann
  2009-08-02 11:17 ` Linas Vepstas
@ 2009-08-02 13:00 ` Paul Emsley
  2009-08-02 13:35   ` Richard Shann
  2009-08-02 19:51   ` Peter TB Brett
  1 sibling, 2 replies; 13+ messages in thread
From: Paul Emsley @ 2009-08-02 13:00 UTC (permalink / raw)
  To: richard.shann, guile-user

Richard Shann wrote:
> 
> SCM proc =  gh_str2scm("d-UploadRoutine",  strlen("d-UploadRoutine"));
> // proc = scm_string_to_symbol("d-UploadRoutine");
> // proc = scm_string_to_symbol( gh_str2scm("d-UploadRoutine",  strlen("d-UploadRoutine")));
> SCM arg1 =  gh_str2scm("hello", strlen("hello"));
> SCM arg2 =  gh_str2scm("he2lo", strlen("hello"));
> SCM arg3 =  gh_str2scm("he3lo", strlen("hello"));
> SCM arg4 =  gh_str2scm("he4lo", strlen("hello"));
> scm_call_4(proc, arg1, arg2, arg3, arg4);
> 
> The three definitions of proc lead to the following three error messages:
> 
> ERROR: In procedure apply:
> ERROR: Wrong type argument in position 1: "d-UploadRoutine"
> 
> 

It is indeed the wrong type of argument.

Look at scm_c_define_gsubr()

http://www.gnu.org/software/guile/manual/html_node/Primitive-Procedures.html

Paul.

and p.s. use the new style interface not the gh_* one. e.g.
SCM arg1 = scm_makfrom0str("hello");








^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: calling scheme procedures by name from C
  2009-08-02 13:00 ` calling scheme procedures by name from C Paul Emsley
@ 2009-08-02 13:35   ` Richard Shann
  2009-08-02 19:51   ` Peter TB Brett
  1 sibling, 0 replies; 13+ messages in thread
From: Richard Shann @ 2009-08-02 13:35 UTC (permalink / raw)
  To: guile-user

On Sun, 2009-08-02 at 14:00 +0100, Paul Emsley wrote:
> Richard Shann wrote:
> > 
> > SCM proc =  gh_str2scm("d-UploadRoutine",  strlen("d-UploadRoutine"));
> > // proc = scm_string_to_symbol("d-UploadRoutine");
> > // proc = scm_string_to_symbol( gh_str2scm("d-UploadRoutine",  strlen("d-UploadRoutine")));
> > SCM arg1 =  gh_str2scm("hello", strlen("hello"));
> > SCM arg2 =  gh_str2scm("he2lo", strlen("hello"));
> > SCM arg3 =  gh_str2scm("he3lo", strlen("hello"));
> > SCM arg4 =  gh_str2scm("he4lo", strlen("hello"));
> > scm_call_4(proc, arg1, arg2, arg3, arg4);
> > 
> > The three definitions of proc lead to the following three error messages:
> > 
> > ERROR: In procedure apply:
> > ERROR: Wrong type argument in position 1: "d-UploadRoutine"
> > 
> > 
> 
> It is indeed the wrong type of argument.
> 
> Look at scm_c_define_gsubr()
This is for defining scheme procedures using C. My procedure is defined
in scheme, I wanted to call it from C, for which the code in the other
response 

func_symbol = scm_c_lookup("d-UploadRoutine");
proc = scm_variable_ref(func_symbol);

does the trick.
Thanks for the response,
Richard


> 
> http://www.gnu.org/software/guile/manual/html_node/Primitive-Procedures.html
> 
> Paul.
> 
> and p.s. use the new style interface not the gh_* one. e.g.
> SCM arg1 = scm_makfrom0str("hello");
> 
> 
> 
> 





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: calling scheme procedures by name from C
  2009-08-02 11:17 ` Linas Vepstas
  2009-08-02 12:03   ` Richard Shann
@ 2009-08-02 15:00   ` Mike Gran
  2009-08-02 17:22     ` Linas Vepstas
  1 sibling, 1 reply; 13+ messages in thread
From: Mike Gran @ 2009-08-02 15:00 UTC (permalink / raw)
  To: linasvepstas; +Cc: guile-user, richard.shann

On Sun, 2009-08-02 at 06:17 -0500, Linas Vepstas wrote:
> 2009/8/2 Richard Shann <richard.shann@virgin.net>:
> The gh_* routines are old and deprecated, and have been for about
> a decade now .. don't use them.
> 
> On the other hand, I notice that the tutorial at
> http://www.gnu.org/software/guile/docs/docs.html
> still uses gh_, so clearly, the gnu docs need cleanup :-(
> 

....

> google suggests that you read
> 
> http://www.lonelycactus.com/guilebook/x220.html
> and
> http://lonelycactus.com/guilebook/c1204.html
> 
> which I think is a start, and should get you going.
> 
> There's more stuff in
> http://www.gnu.org/software/guile/manual/html_node/Programming-in-C.html
> 
> but it lacks examples.
> 
> > It seems to me the docs are rather deficient here!
> 
> The examples are particularly so.

Oh my oh my.  I wrote that doc at lonelycactus.com quite awhile ago.  I
keep meaning to take it down, because the way I did things was a little
strange and a little old.  But, oddly, there are few other
tutorial-level resources.  Someone really ought to put something better
together.

-Mike




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: calling scheme procedures by name from C
  2009-08-02 15:00   ` Mike Gran
@ 2009-08-02 17:22     ` Linas Vepstas
  2009-08-02 18:08       ` Daniel Kraft
  0 siblings, 1 reply; 13+ messages in thread
From: Linas Vepstas @ 2009-08-02 17:22 UTC (permalink / raw)
  To: Mike Gran; +Cc: guile-user, richard.shann

2009/8/2 Mike Gran <spk121@yahoo.com>:
>
> Oh my oh my.  I wrote that doc at lonelycactus.com quite awhile ago.  I
> keep meaning to take it down, because the way I did things was a little
> strange and a little old.  But, oddly, there are few other
> tutorial-level resources.  Someone really ought to put something better
> together.

Well, don't take it down; it doesn't use the gh_ functions from what
I can tell, so its not totally misleading.  I'm more concerned about
the 'turtle graphics' pages, which do use the gh_* functions.  What
I do like about that one is that its fairly short and concise, which is
what I tend to like best.

--linas




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: calling scheme procedures by name from C
  2009-08-02 17:22     ` Linas Vepstas
@ 2009-08-02 18:08       ` Daniel Kraft
  2009-08-02 19:15         ` Linas Vepstas
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Kraft @ 2009-08-02 18:08 UTC (permalink / raw)
  To: linasvepstas; +Cc: guile-user, richard.shann

Linas Vepstas wrote:
> 2009/8/2 Mike Gran <spk121@yahoo.com>:
>> Oh my oh my.  I wrote that doc at lonelycactus.com quite awhile ago.  I
>> keep meaning to take it down, because the way I did things was a little
>> strange and a little old.  But, oddly, there are few other
>> tutorial-level resources.  Someone really ought to put something better
>> together.
> 
> Well, don't take it down; it doesn't use the gh_ functions from what
> I can tell, so its not totally misleading.  I'm more concerned about
> the 'turtle graphics' pages, which do use the gh_* functions.  What
> I do like about that one is that its fairly short and concise, which is
> what I tend to like best.

I also got started using Guile with that turtle package tutorial, and it 
was really quite nice for the purpose...  But I also later rewrote my 
original code to not use gh_ after I discovered there was a new API ;)

This document is linked here:
http://www.gnu.org/software/guile/docs/guile-tut/tutorial.html

So it seems to be part of the "official documentation" somewhat... 
However, it does not seem to be the stuff in doc/tutorial (actually, 
grepping doc for tortoise does not give any hits at all?) -- so does 
anyone know who wrote it and where/what it is meant to be?

If that's no problem with the original author, I'd volunteer to rework 
the tutorial for the new Guile API.  Or maybe write some other tutorial 
in the same style just with another example (that maybe does not use X 
functions but something more basic).  What do you think about this?

Yours,
Daniel




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: calling scheme procedures by name from C
  2009-08-02 18:08       ` Daniel Kraft
@ 2009-08-02 19:15         ` Linas Vepstas
  2009-08-02 19:37           ` Daniel Kraft
  2009-08-13 23:19           ` Updated Guile Tutorial Neil Jerram
  0 siblings, 2 replies; 13+ messages in thread
From: Linas Vepstas @ 2009-08-02 19:15 UTC (permalink / raw)
  To: Daniel Kraft; +Cc: guile-user, richard.shann

2009/8/2 Daniel Kraft <d@domob.eu>:
> Linas Vepstas wrote:
>>
>> 2009/8/2 Mike Gran <spk121@yahoo.com>:
>>>
>>> Oh my oh my.  I wrote that doc at lonelycactus.com quite awhile ago.  I
>>> keep meaning to take it down, because the way I did things was a little
>>> strange and a little old.  But, oddly, there are few other
>>> tutorial-level resources.  Someone really ought to put something better
>>> together.
>>
>> Well, don't take it down; it doesn't use the gh_ functions from what
>> I can tell, so its not totally misleading.  I'm more concerned about
>> the 'turtle graphics' pages, which do use the gh_* functions.  What
>> I do like about that one is that its fairly short and concise, which is
>> what I tend to like best.
>
> I also got started using Guile with that turtle package tutorial, and it was
> really quite nice for the purpose...  But I also later rewrote my original
> code to not use gh_ after I discovered there was a new API ;)
>
> This document is linked here:
> http://www.gnu.org/software/guile/docs/guile-tut/tutorial.html
>
> So it seems to be part of the "official documentation" somewhat...

Well, its on the main gnu.org website, so it doesn't get much
more official than that.

> However,
> it does not seem to be the stuff in doc/tutorial (actually, grepping doc for
> tortoise does not give any hits at all?)

?? It is linked directly from the main guile documentation page at

http://www.gnu.org/software/guile/docs/

which is linked directly from the main guile page at:

http://www.gnu.org/software/guile/

>  -- so does anyone know who wrote it
> and where/what it is meant to be?

I don't get what you are saying ...
at the bottom of your URL it says clearly:
 "I wrote this page because ... etc
Copyright (c) 2000 David Drysdale
Permission is granted to copy, distribute and/or modify ...
GNU Free Documentation License,

> If that's no problem with the original author, I'd volunteer to rework the
> tutorial for the new Guile API.

Well, with the GFDL, you don't have to contact the original author.
You can hack away at it as desired.

> Or maybe write some other tutorial in the
> same style just with another example (that maybe does not use X functions
> but something more basic).

Yeah, X examples are rather anachronistic.  I dunno, an OpenGL
version might be fun.  Imagine .. 3D programming in scheme ..!
it would not be a bad idea, I don't think.

Anyway, doing something interactive would be appropriate --
something vaguely enjoyable when its done.  Maybe a simple
fractal explorer?

> What do you think about this?

Do it!

--linas




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: calling scheme procedures by name from C
  2009-08-02 19:15         ` Linas Vepstas
@ 2009-08-02 19:37           ` Daniel Kraft
  2009-08-02 20:07             ` Linas Vepstas
  2009-08-13 23:19           ` Updated Guile Tutorial Neil Jerram
  1 sibling, 1 reply; 13+ messages in thread
From: Daniel Kraft @ 2009-08-02 19:37 UTC (permalink / raw)
  To: linasvepstas; +Cc: guile-user

Linas Vepstas wrote:
>>  -- so does anyone know who wrote it
>> and where/what it is meant to be?
> 
> I don't get what you are saying ...
> at the bottom of your URL it says clearly:
>  "I wrote this page because ... etc
> Copyright (c) 2000 David Drysdale
> Permission is granted to copy, distribute and/or modify ...
> GNU Free Documentation License,

Stupid me, I did miss that...

>> If that's no problem with the original author, I'd volunteer to rework the
>> tutorial for the new Guile API.
> 
> Well, with the GFDL, you don't have to contact the original author.
> You can hack away at it as desired.

You're right of course, I feel silly :$

>> Or maybe write some other tutorial in the
>> same style just with another example (that maybe does not use X functions
>> but something more basic).
> 
> Yeah, X examples are rather anachronistic.  I dunno, an OpenGL
> version might be fun.  Imagine .. 3D programming in scheme ..!
> it would not be a bad idea, I don't think.

Hm... Maybe allowing to build a simple 3D scene, like:

(define x (make-scene))
(add-sphere x '(1 2 3) 5 'red)
...

But I fear this makes the backend code a lot more complicated than is 
good for this purpose; and the OpenGL code probably gets also lengthier 
than the X one (though I'm not an expert with OpenGL).

> Anyway, doing something interactive would be appropriate --
> something vaguely enjoyable when its done.  Maybe a simple
> fractal explorer?

Fractal Explorer sounds nice, and I'd use Gtk+ as "graphics library" for 
it.  On the other hand, I also quite like keeping the original "logo" 
package; with the interactive fractal explorer, I don't see much one 
could do with it apart from zooming/moving with Scheme commands.  For 
the logo package, one can, for instance, quite elegantly construct a 
Koch curve with a recursive Scheme function -- I don't know if the 
existing tutorial does this, but I quite like this idea and it would 
give a "nice" example where scripting with Guile is really useful and 
produces a cool result.

So I favour keeping it but maybe really switching the backend to Gtk+ 
from X.  Or do you have some other ideas for a good example project?

I'm looking forward to trying my hands on this ;)

Yours,
Daniel

-- 
Done:  Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: calling scheme procedures by name from C
  2009-08-02 13:00 ` calling scheme procedures by name from C Paul Emsley
  2009-08-02 13:35   ` Richard Shann
@ 2009-08-02 19:51   ` Peter TB Brett
  1 sibling, 0 replies; 13+ messages in thread
From: Peter TB Brett @ 2009-08-02 19:51 UTC (permalink / raw)
  To: guile-user

On Sun, 02 Aug 2009 14:00:48 +0100, Paul Emsley wrote:

> and p.s. use the new style interface not the gh_* one. e.g. SCM arg1 =
> scm_makfrom0str("hello");

I believe scm_makfrom0str is deprecated, and that new code should use 
scm_from_locale_string.

Regards,

                                 Peter


-- 
Peter Brett <peter@peter-b.co.uk>
Remote Sensing Research Group
Surrey Space Centre





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: calling scheme procedures by name from C
  2009-08-02 19:37           ` Daniel Kraft
@ 2009-08-02 20:07             ` Linas Vepstas
  0 siblings, 0 replies; 13+ messages in thread
From: Linas Vepstas @ 2009-08-02 20:07 UTC (permalink / raw)
  To: Daniel Kraft; +Cc: guile-user

2009/8/2 Daniel Kraft <d@domob.eu>:

>> Yeah, X examples are rather anachronistic.  I dunno, an OpenGL
>> version might be fun.  Imagine .. 3D programming in scheme ..!
>> it would not be a bad idea, I don't think.
>
> Hm... Maybe allowing to build a simple 3D scene, like:
>
> (define x (make-scene))
> (add-sphere x '(1 2 3) 5 'red)
> ...
>
> But I fear this makes the backend code a lot more complicated than is good
> for this purpose; and the OpenGL code probably gets also lengthier than the
> X one (though I'm not an expert with OpenGL).

There are some very easy-to-use windowing toolkits intended for
OpenGL e.g. glut. But, yes, simply setting up lights, setting up
viewpoint, declaring basic surface properties would be verbose.

>> Anyway, doing something interactive would be appropriate --
>> something vaguely enjoyable when its done.  Maybe a simple
>> fractal explorer?
>
> Fractal Explorer sounds nice, and I'd use Gtk+ as "graphics library" for it.
>  On the other hand, I also quite like keeping the original "logo" package;
> with the interactive fractal explorer, I don't see much one could do with it
> apart from zooming/moving with Scheme commands.  For the logo package, one
> can, for instance, quite elegantly construct a Koch curve with a recursive
> Scheme function -- I don't know if the existing tutorial does this, but I
> quite like this idea and it would give a "nice" example where scripting with
> Guile is really useful and produces a cool result.
>
> So I favour keeping it but maybe really switching the backend to Gtk+ from
> X.  Or do you have some other ideas for a good example project?

Sounds good to me. Whatever excites you the most is what counts!

--linas




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Updated Guile Tutorial
  2009-08-02 19:15         ` Linas Vepstas
  2009-08-02 19:37           ` Daniel Kraft
@ 2009-08-13 23:19           ` Neil Jerram
  1 sibling, 0 replies; 13+ messages in thread
From: Neil Jerram @ 2009-08-13 23:19 UTC (permalink / raw)
  To: Daniel Kraft, linasvepstas; +Cc: guile-user, richard.shann

Hi all,

I know that by know Daniel has updated the tutorial (and I'll comment
on that later), but there are a few points below that I should respond
to.

Linas Vepstas <linasvepstas@gmail.com> writes:

> 2009/8/2 Daniel Kraft <d@domob.eu>:
>>
>> I also got started using Guile with that turtle package tutorial, and it was
>> really quite nice for the purpose...  But I also later rewrote my original
>> code to not use gh_ after I discovered there was a new API ;)
>>
>> This document is linked here:
>> http://www.gnu.org/software/guile/docs/guile-tut/tutorial.html
>>
>> So it seems to be part of the "official documentation" somewhat...
>
> Well, its on the main gnu.org website, so it doesn't get much
> more official than that.

It was believed to be useful at the time that David contributed it,
and so one of us (I can't remember who) added it to the website.

I believe it's still useful - and especially so now that Daniel has
updated the APIs.

>> However,
>> it does not seem to be the stuff in doc/tutorial (actually, grepping doc for
>> tortoise does not give any hits at all?)

No.  It's only on the website at the moment, not in Git or Guile
releases.  A bit weird, I accept, but not a big problem.

>>  -- so does anyone know who wrote it
>> and where/what it is meant to be?
>
> I don't get what you are saying ...
> at the bottom of your URL it says clearly:
>  "I wrote this page because ... etc
> Copyright (c) 2000 David Drysdale
> Permission is granted to copy, distribute and/or modify ...
> GNU Free Documentation License,

FWIW, David is a colleague of mine at work.

>> If that's no problem with the original author, I'd volunteer to rework the
>> tutorial for the new Guile API.
>
> Well, with the GFDL, you don't have to contact the original author.
> You can hack away at it as desired.

Indeed.  In any case, I am sure that David would have no problem with
reworking.

>> Or maybe write some other tutorial in the
>> same style just with another example (that maybe does not use X functions
>> but something more basic).
>
> Yeah, X examples are rather anachronistic.  I dunno, an OpenGL
> version might be fun.  Imagine .. 3D programming in scheme ..!
> it would not be a bad idea, I don't think.
>
> Anyway, doing something interactive would be appropriate --
> something vaguely enjoyable when its done.  Maybe a simple
> fractal explorer?

Personally I'm really happy that you've updated the existing tutorial;
because on the one hand it was a good tutorial, and on the other its
use of GH was definitely confusing people.  Of course, if you'd now
like to extend it by adding examples of other kinds of programming,
that would be great.

Regards,
        Neil




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-08-13 23:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-02  9:17 calling scheme procedures by name from C Richard Shann
2009-08-02 11:17 ` Linas Vepstas
2009-08-02 12:03   ` Richard Shann
2009-08-02 15:00   ` Mike Gran
2009-08-02 17:22     ` Linas Vepstas
2009-08-02 18:08       ` Daniel Kraft
2009-08-02 19:15         ` Linas Vepstas
2009-08-02 19:37           ` Daniel Kraft
2009-08-02 20:07             ` Linas Vepstas
2009-08-13 23:19           ` Updated Guile Tutorial Neil Jerram
2009-08-02 13:00 ` calling scheme procedures by name from C Paul Emsley
2009-08-02 13:35   ` Richard Shann
2009-08-02 19:51   ` Peter TB Brett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).