[Chicken-users] help :)

2013-06-05 Thread nehal singhal
Hi, I am a newbie to chicken.Can i get some aid as to how to start coding through chicken. I was recently learning racket and also have know-how of Python-2.6. Please guide a little. regards, Nehal Singhal. ___ Chicken-users mailing list

Re: [Chicken-users] set! atomic?

2013-06-05 Thread Felix
From: Bryan Vicknair bryanv...@gmail.com Subject: [Chicken-users] set! atomic? Date: Tue, 4 Jun 2013 19:15:52 -0700 SRFI-18 states: Read and write operations on the store (such as reading and writing a variable, an element of a vector or a string) are not required to be atomic. It is

Re: [Chicken-users] help :)

2013-06-05 Thread Matt Gushee
Hi, Nehal-- Have you seen the Chicken for Python programmers tutorial? http://wiki.call-cc.org/chicken-for-python-programmers That would be a good place to start. Then if you are still unsure how to proceed, you will probably get more help if you ask more specific questions. Best of luck with

Re: [Chicken-users] help :)

2013-06-05 Thread Mario Domenech Goulart
Hi, On Wed, 5 Jun 2013 16:07:56 +0200 nehal singhal nehalsingha...@gmail.com wrote: I am a newbie to chicken.Can i get some aid as to how to start coding through chicken. I was recently learning racket and also have know-how of Python-2.6. Please guide a little. Welcome. There's the

[Chicken-users] Chicken C interface

2013-06-05 Thread pluijzer .
Hello everybody, I was planning to use Chicken Scheme in a fashion more similar to Guile and Lua. i.e. passing Scheme Data Objects from Chicken to C and back using the C interface. I am a little confused though as how to have a C function return a Scheme List that is seen by the garbage

Re: [Chicken-users] help :)

2013-06-05 Thread Dan Leslie
Feel free to ask questions in the IRC channel, #chicken on irc.freenode.net -Dan On 6/5/2013 7:07 AM, nehal singhal wrote: Hi, I am a newbie to chicken.Can i get some aid as to how to start coding through chicken. I was recently learning racket and also have know-how of Python-2.6.

Re: [Chicken-users] Chicken C interface

2013-06-05 Thread Dan Leslie
I do this a fair bit in the Allegro egg. Here's an example: https://github.com/dleslie/allegro-egg/blob/985ca2ceef0f5b4028af3f97729f13cba2976fe5/color.scm Basically, use C_alloc to allocate the memory required to host both the List structure and the data it is to contain, then use the C_list

Re: [Chicken-users] help :)

2013-06-05 Thread Pedro Melendez
Hey Dan, What's the preferred method to ask? I didn't know about the IRC channel and now I am dubious what would be better if asking over there or using the email list... Cheers, Pedro. On Wed, Jun 5, 2013 at 11:44 AM, Dan Leslie d...@ironoxide.ca wrote: Feel free to ask questions in the

Re: [Chicken-users] Chicken C interface

2013-06-05 Thread Peter Bex
On Wed, Jun 05, 2013 at 08:47:45AM -0700, Dan Leslie wrote: I do this a fair bit in the Allegro egg. Here's an example: https://github.com/dleslie/allegro-egg/blob/985ca2ceef0f5b4028af3f97729f13cba2976fe5/color.scm Basically, use C_alloc to allocate the memory required to host both the

Re: [Chicken-users] Chicken C interface

2013-06-05 Thread Thomas Chust
On 2013-06-05 19:50, Peter Bex wrote: [...] There is no C_listp predicate because you can't directly check an object for being a list; you must check whether it's C_SCHEME_END_OF_LIST (then it is a list). Otherwise, if it's a pair you take its cdr and loop. If it's something else, it's not

Re: [Chicken-users] Chicken C interface

2013-06-05 Thread Peter Bex
On Wed, Jun 05, 2013 at 07:57:49PM +0200, Thomas Chust wrote: Hello, but it's trivial to detect cyclic lists during the traversal using either a set of seen elements or just two iteration pointers travelling at different speeds. In C that's rather painful. Note that the OP was asking

Re: [Chicken-users] Chicken C interface

2013-06-05 Thread Thomas Chust
On 2013-06-05 20:11, Peter Bex wrote: On Wed, Jun 05, 2013 at 07:57:49PM +0200, Thomas Chust wrote: but it's trivial to detect cyclic lists during the traversal using either a set of seen elements or just two iteration pointers travelling at different speeds. In C that's rather painful.

Re: [Chicken-users] Chicken C interface

2013-06-05 Thread db05
this should work for basic list test (import foreign) # C_word C_listp(C_word p) { if (p == C_SCHEME_END_OF_LIST) { return C_SCHEME_TRUE; } // check for non-immidiate object and pair? if (!C_immediatep(p) C_pairp(p) == C_SCHEME_TRUE) { return C_listp(C_u_i_cdr(p)); } return

Re: [Chicken-users] Chicken C interface

2013-06-05 Thread Peter Bex
On Wed, Jun 05, 2013 at 08:19:15PM +0200, Thomas Chust wrote: On 2013-06-05 20:11, Peter Bex wrote: On Wed, Jun 05, 2013 at 07:57:49PM +0200, Thomas Chust wrote: but it's trivial to detect cyclic lists during the traversal using either a set of seen elements or just two iteration pointers

Re: [Chicken-users] Chicken C interface

2013-06-05 Thread Felix
From: Dan Leslie d...@ironoxide.ca Subject: Re: [Chicken-users] Chicken C interface Date: Wed, 05 Jun 2013 08:47:45 -0700 I do this a fair bit in the Allegro egg. Here's an example: https://github.com/dleslie/allegro-egg/blob/985ca2ceef0f5b4028af3f97729f13cba2976fe5/color.scm Basically,

Re: [Chicken-users] Chicken C interface

2013-06-05 Thread Felix
From: pluijzer . pluij...@gmail.com Subject: [Chicken-users] Chicken C interface Date: Wed, 5 Jun 2013 17:10:41 +0200 Hello everybody, I was planning to use Chicken Scheme in a fashion more similar to Guile and Lua. i.e. passing Scheme Data Objects from Chicken to C and back using the C

Re: [Chicken-users] Chicken C interface

2013-06-05 Thread Dan Leslie
Oh dear! Well, it works and I haven't had problems. What's the correct way to go about this? -Dan On 6/5/2013 2:36 PM, Felix wrote: From: Dan Leslie d...@ironoxide.ca Subject: Re: [Chicken-users] Chicken C interface Date: Wed, 05 Jun 2013 08:47:45 -0700 I do this a fair bit in the Allegro

Re: [Chicken-users] Chicken C interface

2013-06-05 Thread Dan Leslie
Thanks, I'll get on updating my broken eggs soon. obvious humpty dumpty joke notwithstanding -Dan On 6/5/2013 2:39 PM, Felix wrote: From: pluijzer . pluij...@gmail.com Subject: [Chicken-users] Chicken C interface Date: Wed, 5 Jun 2013 17:10:41 +0200 Hello everybody, I was planning to use

Re: [Chicken-users] Chicken C interface

2013-06-05 Thread Kristian Lein-Mathisen
I just though I'd mention srfi-4 http://api.call-cc.org/doc/srfi-4 as well, which are much easier to interface with from C. If all your elements are integers, for example, you might want to check out u32vector. Srfi-4 vectors use plain C float/int arrays and are possible as argument-types from

Re: [Chicken-users] Chicken C interface

2013-06-05 Thread Ivan Raikov
The correct way is to not let C manage memory at all ;-P In the mpi egg, I used foreign-primitive and C_alloc as follows: ;; Returns the current MPI time as a floating-point number (define MPI:wtime (foreign-primitive scheme-object () #EOF C_word result; C_word *ptr; ptr = C_alloc