|
From: | Michael Erdmann |
Subject: | Re: [Chicken-users] Parsing lists from external scheme intepreters |
Date: | Wed, 29 Sep 2004 22:16:01 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616 |
Felix Winkelmann wrote:
Michael Erdmann wrote:Hallo *, currently i am build a small extension for chicken which allows to use chicken code as an client for the framerD database. I am able to issue request to the server. The result are scheme list (in text) and i am looking for a simple way to convert this in chicken data instanes. Typical results are (ignore the result = in front): result = #t result = ("if" @3ff031ad/7381a "then" @3ff031ad/73801 @3ff031ad/7381c) result = ("declare" @3ff031ad/7380c)To convert strings into data, you can use string-ports, which are quite portable: (define (string->data str) (let ((i (open-input-string str))) (read i) ) )
Thanks, this works fine. I am now able to connect to the FramerD database and send queries and retrving the result set. Now the complicated part starts. FramerD was providing the concept of choices in order to represent the contents of result sets. The nice thing about it was the following trick: (define x (choice 1 2 3 4 5) ) (define (inc y) (+ y 1)) (inc x) -> (choice 2 3 4 5 6) which means the operation inc was executed on any member in the choice. I have not seen this by now in the chicken documentation. Does some thing similar exisit some where? I guess i can represent a choice as a list of elements where the list is somehow marked as a choice. Michael.
See also: http://srfi.schemers.org/srfi-6/srfi-6.html > I have checked the documentation i found operations to start end end > a list but not to add anything. > I'm sure whether I understand: you mean to add things to a list? cheers, felix
[Prev in Thread] | Current Thread | [Next in Thread] |