Re: [Chicken-users] Re: SRFI 41

2009-05-07 Thread minh thu
2009/5/7 Phil Bewig :

> ...
>>
>> I disagree.  Streams and lists are not substitutable.  Haskell conflates
>> the two because everything in Haskell is lazy, so there is no difference.
>> But that isn't true in Scheme.
>>
>> There is a reason for 'delay' & 'force'. Scheme is "eager" but
>> "multi-paradigm" and API designers shouldn't go out of the way to hide the
>> fact. At least for the "basics" :-)
>
> Exactly.  Haskell is pure and lazy all the way.  Scheme is broader.

Hi,

I'm a bit surprised you mention delay and force for Scheme then say
Haskell is pure and lazy "all the way". You can have side effects in
Haskell and you can force evaluation too.

Cheers,
Thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Chicken in Blogs

2009-04-09 Thread minh thu
2009/4/9 Joshua Griffith :
> An interesting Google blog search:
> http://blogsearch.google.com/blogsearch?hl=en&ie=UTF-8&q=%22chicken+scheme%22&scoring=d
>
> Joshua

A 'planet' would be great.

Thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Wiki (early) spring cleaning!

2009-03-10 Thread minh thu
2009/3/10 felix winkelmann :
> On Tue, Mar 10, 2009 at 9:53 AM, Peter Bex  wrote:
>>
>> This has been implemented now.
>>
>> For example, you can visit http://chicken.wiki.br/eggref/3/9p to view the
>> Chicken 3 documentation for the 9p egg and http://chicken.wiki.br/eggref/3/9p
>> to view the Chicken 4 documentation for the egg.
>
> (Should probably mean "...eggref/4/9p" for the latter)
>
>>
>> The "quick" (short URL) way to access an egg documentation has not
>> entirely disappeared; it used to be http://chicken.wiki.br/9p but it has
>> become http://chicken.wiki.br/egg/9p.  'egg' is simply a symlink in the
>> wiki's root directory that points to eggref/N, with N the current latest
>> release version.  This would be the preferred way to link to the egg, if
>> no particular version is intended.
>>
>> If there are some hiccups resulting from this move, please let me know
>> about it.  There are four egg documentations (at least, files containing
>> the 'egg' tag) still left in the root.  I'd appreciate it if their
>> authors can have a look at them to see what should happen to them:
>>
>> gl-display
>> growl
>> svnwiki-atom
>> svnwiki-javascript
>>
>
> Thanks, Peter!
>

Sorry, I haven't followed the discussion.
I'm still on the mailing list but didn't use Chicken
for a long time (and it will probably not happen soon).

I'm the author of gl-display. Due to its state, I doubt
anyone is interested in it beside me, so it could be
deleted without problem for me.

Cheers,
Thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Open question on C binding style

2008-07-16 Thread minh thu
2008/7/17 Jim Ursetto <[EMAIL PROTECTED]>:
> On Wed, Jul 16, 2008 at 9:54 PM, Kon Lovett <[EMAIL PROTECTED]> wrote:
>> 1) When there is a one to one mapping between a Scheme variable/constant & a
>> C variable/macro-constant/constant/enum should the Scheme symbol naming
>> mirror the C naming? Should the C 'SOME_C_LIBRARY_MACCONST' identifier be
>> mapped to the Scheme 'SOME_C_LIBRARY_MACCONST', or some Scheme'ish
>> 'some-c-library-macconst'?
>
>> 2) A C procedure binding name:  'some_c_func' -> 'foreign-some-c-func' ,
>> 'some_c_func', 'C_some_c_func'?
>
> I prefer the scheme style for any exported API.  I use the C style
> only for internal stuff which is basically on the bare metal (maybe
> using a similar schemely name for a nicer wrapper), or when I really
> want to warn the user this is lowlevel stuff.
>
> Example from socket egg, SO_REUSEADDR -> so/reuseaddr (low-level
> integer value), and socket-reuse-address (high-level procedure).  Here
> I did not happen to use "SO_REUSEADDR" verbatim, though that would
> have been acceptable.  I just don't like shouting.
>
> In short, it depends on the egg.

I'm making binding for GLEW (thus making bindings for OpenGL 2.1).
I've chosen gl-vertex3f and GL-POINTS to map glVertex3f and GL_POINTS.

If I write the C code, I would have gl_vertex3f instead (in C).
I think GL-POINTS could be gl-points unambiguaously but maybe
someone would like to write a gl-points as higher level procedure.

And Felix chose gl:Vertex3f and gl:POINTS for the OpenGL bindings.
I guess when I'll release the egg, I'll make the two options
available.

Cheers,
Thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] chicken-setup

2008-07-15 Thread minh thu
2008/7/15 Shawn Rutledge <[EMAIL PROTECTED]>:
> On Mon, Jul 14, 2008 at 6:01 PM, Ivan Raikov <[EMAIL PROTECTED]> wrote:
>>   The idea is basically to isolate all of the general procedures for
>> e.g. installation and compilation, which once written would probably
>> stay relatively unchanged, and only modify the frontend as
>> chicken-setup policies evolve. We could also think about having
>> different frontends, e.g. for use with different package building
>> tools.
>
> This sounds good so far.
>
> So an egg could include a custom setup script, or else it would be
> auto-generated from the .meta file at installation time and therefore
> the egg is not required to provide it, right?
>
> On Tue, Jul 15, 2008 at 12:11 AM, Peter Bex <[EMAIL PROTECTED]> wrote:
>> I don't think this can be solved automatically (unless we want to
>> recreate Autotools or CMake) so what is needed is a way to override or
>> add to existing search paths by passing switches to chicken-setup,
>> which it then can pass on to the compiler. Example:
>>
>> chicken-setup foo.egg -I /opt/foo/include -L /opt/foo/lib
>
> That could be a last-ditch way to solve problems but I would hope most
> users wouldn't need to do that for most eggs.
>
> Is there anything wrong with putting extra -I's and -L's in the meta
> file, with some possible guesses the egg developer can think of, where
> a particular library or include might be located?  And chicken-setup
> could append the usual suspects automatically, like /usr/include,
> /usr/local/include etc.
>
> (library foo-wrapper
>  (version 1.4)
>  (make (foo-wrapper.scm) (compile -O2 -d0 -s foo-wrapper.scm
> -L/usr/lib/foo -L/usr/include/foo -ldl -lfoo -lchicken
>
> One problem I could think of is the case where the user has multiple
> versions of the same library, or is cross-compiling, in which case the
> default paths, or the paths suggested in the meta file, could be
> misleading.  I guess he'd have to specify the -I and -L somehow, as
> you suggest.  If the user does that, then chicken-setup would not
> include the default paths, or at least would put the provided paths
> first.
>
> Or somehow the meta file could suggest that libfoo.so might be located
> in a directory called foo-1.0, somewhere, and chicken-setup could
> expand that to -L/usr/lib/foo-1.0 -L/usr/local/lib/foo-1.0 etc.
>
> But the ability to cross-compile eggs is something I need to test
> soon; sounds like it's pretty cool already.  I'm working on a bitbake
> recipe for chicken for OpenMoko (I'm still a newbie with that) and am
> wondering if it's going to be possible to get bitbake to compile all
> the eggs too, and make ipk's for all of them, hopefully either
> semi-automatically or I can come up with a way to generate recipes
> automatically from the meta files, or something.

Hi,

Another case is when we use pkg-config as in
`pkg-config --cflags --libs pangocairo`.

Thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: Chicken-setup redesign (was: Re: [Chicken-users] Re: getopt, getopt_long?)

2008-07-14 Thread minh thu
2008/7/14 felix winkelmann <[EMAIL PROTECTED]>:
> On Mon, Jul 14, 2008 at 2:35 PM, Mario Domenech Goulart
> <[EMAIL PROTECTED]> wrote:
>>>
>>> Yes, that would work. You would also need a file for foo-1, I suppose,
>>> if one wants to to load the highest minor version of 1.XXX. This will
>>> produce lots of little loader-files, though.
>>
>> Hmmm.  I haven't thought about this level of granularity.  I thought
>> users would either specify the exact version they want or no version
>> (in this case, the highest would be used).  How would users specify
>> they want to load the highest minor version of 1.?
>>
>> I was thinking about creating a little loader for the highest version
>> _only_, for when users don't specify the version when loading an
>> extension (so the highest is picked).
>>
>> For example, if the foo egg is installed (say its version is 1.0), the
>> local repo would contain:
>>
>>foo-1.0.so
>>foo.so
>>
>> foo.so would be generated by compiling
>>
>>   (require-library foo-1.0)
>>
>> since 1.0 is the highest version.
>>
>> Now suppose there's a new version for foo (1.1).  So, when foo is
>> updated, the local repo would contain:
>>
>>foo-1.0.so
>>foo-1.1.so
>>foo.so
>>
>> Now, foo.so would contain the code to load foo-1.1, not 1.0, but users
>> will still be able to load 1.0 if they need (explicitly, though).
>>
>
> I guess having eitther the newest or a specific version is enough. I don't
> think having finer grained access is really necessary, but I think Peter
> proposed that?

I think he did too. But is you're view of fine-grained a bit 'reversed' ?

If you say you want foo-1, and *if* that library is done such that minor
version increases are backward-compatible in the same major number,
isn't it more naturall to request foo-1 and then get the highest minor
number than requesting foo then have the higher overall number ?

(since higher major numbers are more likely to break compatibility
than higher minor numbers)

In other words, foo-1.1 and foo-1.2 are the same library, while
foo-1.0 and foo-2.0 are too different. If I make a mistake here, I guess
we could have some guidelines on the semantic of version numbers...

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Re: #include in foreign-parse

2008-07-09 Thread minh thu
2008/7/9 felix winkelmann <[EMAIL PROTECTED]>:
> On Sat, Jul 5, 2008 at 11:04 PM, minh thu <[EMAIL PROTECTED]> wrote:
>>
>> Weird. By ending the #include <...> lines with a #include "file.h" with 
>> file.h
>> being in the .egg, chicken-setup ends successfully.
>>
>> Is it something known (and corrected in later version) ?
>>
>
> I'll check this. It is properly caused by a problem with the current
> include path during compalation of the egg.

In fact, while chicken-setup completes, it's not true it's successful
: no binding is generated.
I can't say more, I've reverted my egg to include the header files (so
it's certainly not a show-stopper for me).

Cheers,
Thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] getopt, getopt_long?

2008-07-08 Thread minh thu
2008/7/8 William Xu <[EMAIL PROTECTED]>:
> Hi,
>
> Does chicken have some egg for wrapping getopt, getopt_long?

I don't know specifically for getopt, but you might be interested by
http://chicken.wiki.br/tool or http://chicken.wiki.br/args-doc.

Cheers,
Thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Re: #include in foreign-parse

2008-07-05 Thread minh thu
2008/7/5 minh thu <[EMAIL PROTECTED]>:
> Hi,
>
> I've made bindings in the following way (in a .scm file):
>
> (foreign-parse #<
> ___declare ...
> ...
> #include "somefile.h"
> ...
>
> EOF
> )
>
> and the somefile.h is placed in the .egg.
>
> No problem, everything is fine.
>
> (But how do I install a local .egg ? chicken-setup complains the .egg
> is not in /tmp/chicken-... )
>
> Then, since the somefile.h ships with the library to bind, it makes sense,
> to replace
>
> #include "somefile.h"
>
> with
>
> #include 
>
> no more put it in the .egg, and assume the library is already installed.
>
> But now, when installing the egg, I've got
>
> Error: during expansion of (foreign-parse ...) - can not open include
> file: "somefile.h"
>
> I think the problem is because of the change "somefile.h"
> , but I'm not sure.
>
> The header is in /usr/local/include/, maybe sudo chicken-setup does not see 
> it ?
>
> Any idea ? (I'm still using chicken 3.2.0)
>
> Thanks a lot,
> Thu
>


Weird. By ending the #include <...> lines with a #include "file.h" with file.h
being in the .egg, chicken-setup ends successfully.

Is it something known (and corrected in later version) ?

Ciao,
Thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] #include in foreign-parse

2008-07-05 Thread minh thu
Hi,

I've made bindings in the following way (in a .scm file):

(foreign-parse #<

no more put it in the .egg, and assume the library is already installed.

But now, when installing the egg, I've got

Error: during expansion of (foreign-parse ...) - can not open include
file: "somefile.h"

I think the problem is because of the change "somefile.h"
, but I'm not sure.

The header is in /usr/local/include/, maybe sudo chicken-setup does not see it ?

Any idea ? (I'm still using chicken 3.2.0)

Thanks a lot,
Thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [chicken-users] silex GPL-2 licensed?

2008-03-19 Thread minh thu
>  [snip]
>  > Does this mean distributing the c intermediates of an app along with
>  > the chicken libraries (in c form) and eggs (again in c form) needed to
>  > run it therefore has no need for silex either and can be distributed
>  > under, for example, a BSD license?
>
>  That's right.  Of course, if you use a GPLed egg, you have to distribute
>  Scheme source for your whole app.  C source is obfuscated and doesn't
>  count for GPL purposes.

It seems to me that you both say the opposite. I understand the
exemple above of distributing averything in C form includes C code
from any egg (under any license, not just BSD).

So what is it, generated C code cannot be redistributed without the
scheme source if the scheme source is GPL or can it be, just like code
emitted by Bison or Silex ?

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Re: [Chicken-hackers] better hash function

2008-03-19 Thread minh thu
2008/3/19, Kon Lovett <[EMAIL PROTECTED]>:
> There is a "hashes" egg w/ FNV & many others.

I forgot that version of the first rule (of whatever rules set) :
- always look at what already exists
becomes
- always look at eggs unlimited

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] http server example question

2008-03-04 Thread minh thu
2008/3/4, Jim Ursetto <[EMAIL PROTECTED]>:
> Minh: I don't know if Peter's suggestion helped, but I fixed a bug a couple
>  weeks ago in r8628 that has not been propagated to the release version.
>  It fixed corruption in the headers which resulted in an invalid
>  Content-Length: which caused the precise symptoms you note.

What Peter said fixed my problem.
Thanks,
Thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] spiffy example

2008-02-29 Thread minh thu
Hi,

In 'Adding dynamic resources' at http://chicken.wiki.br/spiffy,
I think there are two mistakes :

- http:write-response-header should be write-response-header
- and before calling it, the current-request parameter should be
changed to the request argument.

I don't change the wiki because I'm not really sure of this (we can
use the code of the http egg example instead).

Cheers,
Thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] eggs unlimited 3

2008-02-29 Thread minh thu
Hi,

The call/cc.org homepage points to eggs unlimited 2 and not 3 (via
call/cc.org/eggs).

Cheers,
Thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] http server example question

2008-02-28 Thread minh thu
Hi

I'm trying to use spiffy. I've a little problem which is in fact
related to the 'http' egg.

Using the 'server example' from the 'http' wiki page with firefox,
firefox try to load the page for ever; it's only when I kill the
server (closing the port) that the page appears in firefox.

How should I handle this ? Is the Content-Length header field
important for this ?

Thanks,
Thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Re: define w/o define

2008-01-25 Thread minh thu
2008/1/25, Kon Lovett <[EMAIL PROTECTED]>:
> Hi,
>
> Also see the "environments" egg.
>
> #;10> (use environments)
> #;11> bar
> Error: unbound variable: bar
> #;11> (environment-set! (interaction-environment) 'bar 45)
> #;12> bar
> 45
>

Thanks all, I should have what I need :)
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] define not using define

2008-01-25 Thread minh thu
> [...]
> On a tangent, this reminds me of a macro I use. I wanted to introduce
> formal hook-points in the main program, and let the run-script inject
> hook-procedures into the main code if desired. The macro
> [...]

I guess you could now use the advice egg (http://chicken.wiki.br/advice).
Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] define not using define

2008-01-25 Thread minh thu
Hi,

Elf, does your use of callcc has the same purpose of Graham's eval
(i.e. define at the global scope) ?

Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] define not using define

2008-01-25 Thread minh thu
Hi,

Is it possible to register symbols in Chicken, just as a global
(define ...) would do from arbitrary code?

I'd like to be able to write (setting 'color '#f32(1 0 0 0)) and have
the same effect
than a (define color (make-parameter '#f32(1 0 0 0)) unless the color procedure
already exists.

Is it possible to define 'setting' as a procedure and not as a macro
(or am I limited to use 'setting' at the top level (I don't mean the
repl))?

The fact color is procedure is nice for me, I'd rather call (color)
than (look-up 'color).

Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] local metafile use to create an egg

2008-01-14 Thread minh thu
14 Jan 2008 18:02:15 -0200, Mario Domenech Goulart <[EMAIL PROTECTED]>:
> Hi minh thu,
>
> On Mon, 14 Jan 2008 15:02:55 +0100 "minh thu" <[EMAIL PROTECTED]> wrote:
>
> > Currently, I use a makefile to build an egg. Is it possible to create
> > it with the same process .meta file is automatically used when
> > committing in svn (i.e. locally, with no real commit)?
>
> I don't know if I understand what you want.  Maybe the script below
> can do the trick.  It packs an egg based on the information from the
> meta file found under the given egg directory.
>
> It assumes tar is installed and it doesn't generate the HTML
> documentation from eggdoc or wiki files (just ignores it).
>
> Example of use:
>
> $ csi -s eggify.scm ~/src/chicken-eggs/spiffy/trunk
> spiffy-base.scm
> spiffy.scm
> ssp-handler.scm
> web-scheme-handler.scm
> cgi-handler.scm
> simple-directory-handler.scm
> spiffy.setup
>
> $ cp ~/src/chicken-eggs/spiffy/trunk/spiffy.egg .
>
> $ chicken-setup spiffy.egg
>   gzip -d -c ../spiffy.egg | tar xf -
>   /usr/local/chicken-2.732/bin/csc -feature compiling-extension -s -O2 
> -no-trace spiffy-base.scm
>   /usr/local/chicken-2.732/bin/csc -feature compiling-extension -s -O2 
> -no-trace ssp-handler.scm
>   ...
>   rm -fr spiffy.egg-dir
>
>
> 8<
>
> (use posix (srfi 1))
>
> (define (eggify eggdir)
>   (let* ((metafiles (glob (make-pathname eggdir "*" "meta"
> (when (null? metafiles)
>   (die "Couldn't find any metafile."))
> (let* ((metafile (car metafiles))
>(metadata (handle-exceptions exn
> (die metafile ": syntax error.")
> (with-input-from-file metafile read)))
>(egg (car (alist-ref 'egg metadata)))
>(eggname (pathname-file egg))
>(doc-from-wiki (alist-ref 'doc-from-wiki metadata))
>(eggdoc (alist-ref 'eggdoc metadata))
>(files (alist-ref 'files metadata)))
>   (when (or doc-from-wiki eggdoc) ;; ignores documentation
> (set! files (delete (make-pathname #f eggname "html") files)))
>   (change-directory eggdir)
>   (system (string-append "tar czvf " egg " " (string-intersperse 
> files))
>
> (define (usage #!optional exit-code)
>   (print "Usage: " (program-name) " ")
>   (when exit-code
> (exit exit-code)))
>
> (define (die . msg)
>   (print (apply conc msg))
>   (exit 1))
>
> (let ((args (command-line-arguments)))
>   (if (< (length args) 1)
>   (usage 1)
>   (let ((arg1 (car args)))
> (if (member arg1 '("-h" "--help" "-help"))
> (usage 0)
> (begin
>   (unless (file-exists? arg1)
> (die eggdir " does not exist."))
>   (eggify arg1))
>
> >8
>
> Best wishes,
> Mario
>

Gee, I wasn't asking for that much ! You correctly understood,
although I was talking about the code used by the svn hook.

Thanks a lot,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] local metafile use to create an egg

2008-01-14 Thread minh thu
Hi,

Currently, I use a makefile to build an egg. Is it possible to create
it with the same process .meta file is automatically used when
committing in svn (i.e. locally, with no real commit)?

Thanks,
mt


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] ssp-handler

2008-01-14 Thread minh thu
Hi,

It seems http://trac.callcc.org/changeset/7190 hasn't get to the spiffy egg.
Should I get spiffy from svn ?

Thanks,
mt


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Re: Ending input reading without quit csi

2008-01-08 Thread minh thu
...
>  > You will have to handle it yourself.
>
> Oh, I'm not so sure:
>
> $ csi
> CHICKEN
> Version 2.739 - linux-unix-gnu-x86  [ manyargs dload ptables applyhook ]
> (c)2000-2007 Felix L. Winkelmanncompiled 2008-01-07 on debian (Linux)
>
> #;1> (use utils)
> ; loading library utils ...
> #;2> (for-each-line (lambda (line) (display line) (newline)))
> hello, world
> hello, world
> ; ^D here
> #;3>
>
> And moreover:
>
> #;3> (read-char)
> ; ^D here
> #!eof
> #;4>
>
> This is POSIX-compliant behaviour to allow for multiple EOFs to
> occur on reading from a terminal.

Your example works the same way here when I don't use the readline
extension in my .csirc. But I prefer to use the readline extension.

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Ending input reading without quit csi

2008-01-08 Thread minh thu
2008/1/8, felix winkelmann <[EMAIL PROTECTED]>:
> On Jan 8, 2008 12:09 PM, minh thu <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > Say I write in csi somethign like
> > (for-each-line (lambda (line) (display line)))
> > which will read from current-input-port,
>
> Correct.
>
> >
> > how can I end the input (if I use ctrl-d, it stops csi too) ?
>
> You will have to handle it yourself. One way would be to
> check the input (say, an empty line) and abort the iteration:
>
> (call/cc
>   (lambda (continue)
> (for-each-line
>   (lambda (line)
> (when (string=? "" line) (continue #f))
> ...
>
> > How can I make csi display another prompt while reading ?
>
> #;1> (repl-prompt (lambda () "::: "))
> ::: 123
> 123
> ::: 456
> 456
> ::: (+ 3 4)
> 7
>
>
> cheers,
> felix
>

Great, thanks
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Ending input reading without quit csi

2008-01-08 Thread minh thu
Hi,

Say I write in csi somethign like
(for-each-line (lambda (line) (display line)))
which will read from current-input-port,

how can I end the input (if I use ctrl-d, it stops csi too) ?
How can I make csi display another prompt while reading ?

Thanks,
mt


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] new eggs

2008-01-07 Thread minh thu
> [...]
> > You might also want to fix the Eggs Unlimited page, the entry
> > for sbky is messed up.
>
> The page was actually missing. A new version has been checked in, thanks
> for pointing this out.

The ajax page is a bit weird too.
Cheers,
mt


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] how to join two threads ?

2007-12-29 Thread minh thu
2007/12/30, Thomas Christian Chust <[EMAIL PROTECTED]>:
> minh thu schrieb:
>
> > [...]
> > I'd like to know how I can make an srfi-18 thread wait for the
> > completion of another one.
> > [...]
>
> From the SRFI-18 standard document:
> [...]

Oh! I've looked at the chiken wiki page only. Sorry and thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] how to join two threads ?

2007-12-29 Thread minh thu
Hi,

I'd like to know how I can make an srfi-18 thread wait for the
completion of another one. Specifically (if it changes anything), the
waiting thread is the primorial one and the thread to wait for is
created in the primordial one.

Thanks a lot,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] reading available data from a port

2007-12-28 Thread minh thu
> > 2/
> > Actually, what is to be read from i in 1/ is something like .
> > Note the ending  will appear later after some enclosed elements.
> > (This is an XML stream defined by XMPP core (rfc3920).)
> > Is it possible to use SSAX to read just an opening tag ?
>
> This should be possible, but I have no experience with SSAX, so perhaps
> someone who has can give a hint.
>
> Normally, you should be able to assume that you can read a complete
> XML element, or not? I'm no XMPP expert, but if the format is XML, you
> should be able to simply read complete elements and perhaps use
> multithreading and tcp read/write timeouts to handle incomplete
> data (if that is what you are trying to do here).

You can read a complete element only in the stream.
The stream is opened with an opening tag. The closing corresponding tag will
appears "later" or never.

But I think I can reuse SSAX:make-parser to simply emit SXML for the complete
elements embedded in the stream. The creation of SXML will be nearly a
copy of the SSAX:XML->SXML.

(Thus, my problem is gone, just need coding :)
Cheers,
mt


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] reading available data from a port

2007-12-27 Thread minh thu
Hi,

1/
I use tcp-connect to get i and o.
If I do (read-line i), it works if there is actually a \n.
If I do (read-string a-number i), it works if I don't try to get more
than available data.
(Assume the i isn't closed because the server will write later.)

How do I get what is already present ?
Should I instead use read-token until I have all what I want ?

2/
Actually, what is to be read from i in 1/ is something like .
Note the ending  will appear later after some enclosed elements.
(This is an XML stream defined by XMPP core (rfc3920).)
Is it possible to use SSAX to read just an opening tag ?

Thanks a lot and merry christmas !
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] XMPP egg ?

2007-12-22 Thread minh thu
Hi,

has someone already begun an (sxml based) xmpp egg ?

Cheers,
mt


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] how to use define-macro to...

2007-12-20 Thread minh thu
Hi,

1/
I'd like to "repeat" this code for a lot of operators (not just + as
in the following).
How can I do that ?

(define old+ +)
(define (+ a b)
  (if (or (instance-of? a ) (instance-of? b ))
(create-behavior (list a b) old+)
(old+ a b)))

The problem is how to capture the old + (as old+) to use it in the redefinition.

2/
I could write the following at any place I want to print debug info.

(cond-expand
  (debug-behaviors (printf "Debugging...~N"))
  (else)

Note the particular symbol debug-behaviors.

But it's boring; I would prefer have a "debug" macro instead :

(debug
  (printf "Debugging...~N"))

But I don't know how I can make it expends to nothing as in the else
clause of the
cond-expand. I use this :

(define-macro (debug rest)
  (cond-expand
(debug-behaviors rest)
(else '(noop

I have to use the noop procedure.

Also, can I write a "higher" macro to generate the "debug" one with a
particular debug-something symbol ?

Thanks,
mt


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] load printout

2007-12-20 Thread minh thu
19 Dec 2007 17:11:05 -0200, Mario Domenech Goulart <[EMAIL PROTECTED]>:
> Hi Rick,
>
> On Wed, 19 Dec 2007 12:18:36 -0600 Rick Taube <[EMAIL PROTECTED]> wrote:
>
> > is it possible to silently load a file, ie to not get any message
> > printed to the terminal during the load?
> >
> > #;1> (load "aaa.scm")
> > ; loading aaa.scm ...
>
> Yes, with the load-verbose parameter:
> http://chicken.wiki.br/Parameters#load-verbose
>
> Example:
>
> #;1> (load-verbose #f)

Somewhat related : try also csi -q
mt


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Re: chicken lottery!

2007-12-14 Thread minh thu
2007/12/14, Alex Shinn <[EMAIL PROTECTED]>:
> On Dec 11, 2007 10:56 PM, Alex Shinn <[EMAIL PROTECTED]> wrote:
> > Ladies, gentlemen and other, we've reached 350 eggs,
> > which means some lucky contributor is going to be the
> > proud owner of their very own Chicken T-shirt!  This
> > time we're inviting you all to witness the choosing live.
>
> ... and the winner is Terrence Brannon, author of the
> matpack egg!  We'll be sending a TV crew to deliver
> the T-shirt and interview Terrence on his good fortune!

Congratulations ! (I missed the live die roll)
mt


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] chicken lottery!

2007-12-11 Thread minh thu
> [snip]
>
>   Roll #eggs  Name
>  
>   1-23  23Ivan Raikov
>  24-32   9Arto Bendiken
>  33-40   8Tony Sidaway
>  41-43   3Will Farr
>  44-46   3Ben Kurtz
>  47-49   3Vo minh Thu
> [snip]

Hehe tha'ts nice but it's unfair to give me such a range, none of my
eggs are usable by other people than me (although I don't give up and
will hopefully work on them later).

Cheers,
mt


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] chicken scheme + gui on Nokia n800 or n810?

2007-12-06 Thread minh thu
John :
> [...]
> In terms of GUI, well I just use GTK+ as IMO it is fairly high-level
> and abstracted enough from raw C that it is pretty easy to use. You
> also get the benefit of cut 'n pasting a lot of pre-written code if
> you go this route. Chicken embeds easily into a GTK+ app. I just do
> the interface code in GTK+ and backend in Chicken.

Do you mean you write the ui with gtk+ in C ? How is the wiring
between that and Chicken done (which one calls the other and how) ?
Thanks
mt


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] chicken scheme + gui on Nokia n800 or n810?

2007-12-06 Thread minh thu
2007/12/6, Elf <[EMAIL PROTECTED]>:
>
> heh, are the n810s out yet?  i wanted to get one and port chicken to it as
> my new organiser...
>
> -elf
I don't know where you are but e.g.
expansys.com
mt


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] synonyms for "module" sought

2007-09-07 Thread minh thu
2007/9/7, Moe Aboulkheir <[EMAIL PROTECTED]>:
>
>
> On Fri, 7 Sep 2007 09:38:12 +0200, felix winkelmann <[EMAIL PROTECTED]> wrote:
> > could came up with these, so far:
> >
> >module   (boring)
> >package
> >structure  (misleading)
> >library (impossible, due to political reasons, and also misleading)
> >component   (nah...)
> >enclosure(...)
> >
> >Has anybody more to suggest?
>
> none are very good:
>
> unit, accessory, ingredient, element, constituent
>

hello, entity, basement, ground, layer, fruit, wire, armature, spark,
neuron, squad,
group, level, to-be-reus'd, stratum, album, aquarium, ball, lingery,
catwalk, page,
bullet, ammo, sorry, hope, it, helps, a, bit, minh thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] preferred gui library

2007-07-09 Thread minh thu

Brandon wrote :


"Lightweight" can be a valid design choice.  I'm just pointing out the
strategic consequences of fixating on that.  I mean, let's face it,
people intoned all those ideas and desires some months ago and nothing
has come of it.



Hehe, only because I'm damn slow ... but I'm still on it (I mean the
opengl only stuff).
It needs lot of cleaning and documentation before I can speak of it...

(I'm still reading the list from time to time but I've no more
permanent access to the internet and, unfortunatly, I'm slow at what I
want to do with chicken)

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Another request (bigger this time)

2007-04-05 Thread minh thu

2007/4/5, felix winkelmann <[EMAIL PROTECTED]>:

On 4/4/07, Kon Lovett <[EMAIL PROTECTED]> wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi,
>
> I just released a fix for Windows that should correct the problem of
> using the C 'timezone' since it is a function w/ Cygwin. I think all
> builds on Windows can use '_timezone'. However I cannot test it since
> I cannot build anymore on Windows.
>
> Please get the current Chicken darcs head & build. Then evaluate the
> following:
>
> csi -n -e '(require-extension posix) (print (build-platform) " -
> "(software-type) " - " (software-version) " : " (seconds->local-time
> (current-seconds)) " : " (seconds->utc-time (current-seconds)) " :
> " (local-time->seconds (seconds->local-time (current-seconds))) " :
> " (utc-time->seconds (seconds->utc-time (current-seconds))) " :
> " (local-timezone-abbreviation))'
>

This might be too late, but:

gnu -
unix - linux : #(46 35 9 5 3 107 4 94 #t -3600) : #(46 35 7 5 3 107 4
94 #f -3600) :
1175758546.0 :
1175758546.0 :
CET

That's Göttingen, Germany, CET +1 (I think)


Yes, CET is GMT + 1 and Germany is in daylight saving time which means
CET + 1, ie. GMT + 2.
Look here:
http://www.timeanddate.com/worldclock/city.html?n=995
http://wwp.european-union-eu.com/germany/time.htm
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Re: Another request (bigger this time)

2007-04-04 Thread minh thu

2007/4/5, John Cowan <[EMAIL PROTECTED]>:

Kon Lovett scripsit:

> Please get the current Chicken darcs head & build. Then evaluate the
> following:

cygwin - windows - unknown : #(32 46 16 4 3 107 3 93 #t 18000) : #(32 46 20 4 3 
107 3 93 #f 18000) : 1175719592.0 : 1175719592.0 : EDT

--
John Cowan  [EMAIL PROTECTED]  http://ccil.org/~cowan
Linguistics is arguably the most hotly contested property in the academic
realm. It is soaked with the blood of poets, theologians, philosophers,
philologists, psychologists, biologists and neurologists, along with
whatever blood can be got out of grammarians. - Russ Rymer


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Hi,
Is the request still active ? I don't know which one is ended in the
Thank you mail.
Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] A request

2007-04-04 Thread minh thu

2007/4/4, Kyle R. Burton <[EMAIL PROTECTED]>:


>
>
> > > Please evaluate the following on your available platforms & send me
> > > the results.
> > >
> > > csi -n -e '(require-extension posix) (print (build-platform) " -
> > > "(software-type) " - " (software-version) " : " (seconds->local-time
> > > (current-seconds)))'
> >
>
>
> gnu - unix - macosx : #(46 14 13 4 3 107 3 93 #t -14400)
> gnu - unix - linux : #(47 18 13 4 3 107 3 93 #t 18000)
>

King of Prussia, PA, USA

(it's near Philadelphia PA)

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users




I'm CEST, UTC/GMT +2 hours
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] A request

2007-04-04 Thread minh thu

2007/4/4, Kon Lovett <[EMAIL PROTECTED]>:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Folks,

Please evaluate the following on your available platforms & send me
the results.

csi -n -e '(require-extension posix) (print (build-platform) " -
"(software-type) " - " (software-version) " : " (seconds->local-time
(current-seconds)))'

Thank you,


You're welcome:
gnu - unix - linux : #(26 0 19 4 3 107 3 93 #t -3600)

thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] QuesoGLC bindings

2007-04-04 Thread minh thu

Hi,


From its homepage, "QuesoGLC is a free (as in free speech)

implementation of the OpenGL Character Renderer (GLC). QuesoGLC is
based on the FreeType library, provides Unicode support and is
designed to be easily ported to any platform that supports both
FreeType and the OpenGL API" [1]. It's under LGPL, the egg under BSD.

The glc egg is a complete (but not already tested) binding for
QuesoGLC 0.6, the latest version (2007-03-13).

This is my first egg release and some things are blurred.
In particular, I'd like to wait feedback from people on Windows and
MacOS before setting the version to 0.1.
If you have time, grep TODO on the sources, there're only four of them :)

I guess the egg will be available through chicken-setup only when I
make a version in /tags. So it's available for now from [2].

[1] http://quesoglc.sourceforge.net/
[2] svn co https://galinha.ucpel.tche.br/svn/chicken-eggs/glc

Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] how to map Scheme string to void* instead of char*

2007-04-04 Thread minh thu

2007/4/4, felix winkelmann <[EMAIL PROTECTED]>:

On 4/4/07, minh thu <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm a bit lost :
> I'm using foreign-parse to write bindings for the QuesoGLC library [1]
> (which I'll release as BSD3 egg; the library itself is LGPL).
> Some functions of this library accept string as argument; the type is
> void*, not char*.
> Building the bindings seems to go well but when I want to use such a function,
> Chicken tells me "bad argument type - not a pointer".
>
> I guess I'll have the same problem with void* return types.
> How should I handle those cases ?
>

How do you wrap those library functions? With easyffi? Then, you can
just change the argument type declarations to "char *".


Yes, with easyffi (I use foreign-parse, so doesn't it imply it's easyffi ?).
Changing C declarations to char* works, thank you.

Can I request a repository for this egg ?
I think 'glc' would be an appropriate name.

Thank you,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] how to map Scheme string to void* instead of char*

2007-04-04 Thread minh thu

Hi,

I'm a bit lost :
I'm using foreign-parse to write bindings for the QuesoGLC library [1]
(which I'll release as BSD3 egg; the library itself is LGPL).
Some functions of this library accept string as argument; the type is
void*, not char*.
Building the bindings seems to go well but when I want to use such a function,
Chicken tells me "bad argument type - not a pointer".

I guess I'll have the same problem with void* return types.
How should I handle those cases ?


[1] http://quesoglc.sourceforge.net/


Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Unicode inside csi

2007-04-03 Thread minh thu

2007/4/3, Thomas Christian Chust <[EMAIL PROTECTED]>:

minh thu wrote:

> [...]
> In particular, why value of line 1 is 195 and value of line 2 is 249 ?
> Actual decimal value for ù is 249.
> [...]

Hello,

by default, CHICKEN's strings are bytestrings, not character strings.
Therefore the string-ref call is returning the first byte of the
extended character marker of UTF-8, not the character itself.

If you want CHICKEN's strings to behave as UTF-8 character strings, have
a look at the utf-8 egg.

cu,
Thomas




Thanks Thomas, Thanks John !
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Re: Unicode inside csi

2007-04-03 Thread minh thu

2007/4/3, minh thu <[EMAIL PROTECTED]>:

Hi,

I try to print correctly unicode on the console (under Linux).
What should I do for this ?

I don't understand the following, can someone explain it ?

Version 2.6 - linux-unix-gnu-x86 - [ libffi dload ptables applyhook ]
(c)2000-2007 Felix L. Winkelmann
; loading /home/mt/.csirc ...
; loading /usr/local/lib/chicken/1/readline.so ...
; loading library regex ...
#;1> (char->integer (string-ref "\u00f9" 0))
195
#;2> #x00f9
249
#;3> (print "ù")
ù
"ù"
#;4> (char->integer (string-ref "ù" 0))
195
#;5> (print (string-ref "ù" 0))
�
#\�
#;6> (print 'ù')
ù
|ù|


Ouch, forget the last one :)



In particular, why value of line 1 is 195 and value of line 2 is 249 ?
Actual decimal value for ù is 249.

Thanks,
thu

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Unicode inside csi

2007-04-03 Thread minh thu

Hi,

I try to print correctly unicode on the console (under Linux).
What should I do for this ?

I don't understand the following, can someone explain it ?

Version 2.6 - linux-unix-gnu-x86 - [ libffi dload ptables applyhook ]
(c)2000-2007 Felix L. Winkelmann
; loading /home/mt/.csirc ...
; loading /usr/local/lib/chicken/1/readline.so ...
; loading library regex ...
#;1> (char->integer (string-ref "\u00f9" 0))
195
#;2> #x00f9
249
#;3> (print "ù")
ù
"ù"
#;4> (char->integer (string-ref "ù" 0))
195
#;5> (print (string-ref "ù" 0))
�
#\�
#;6> (print 'ù')
ù
|ù|

In particular, why value of line 1 is 195 and value of line 2 is 249 ?
Actual decimal value for ù is 249.

Thanks,
thu
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] noobie question about chicken/swig/csi

2007-04-02 Thread minh thu

2007/4/2, Alex Queiroz <[EMAIL PROTECTED]>:

Hallo,

On 4/2/07, Graham Fawcett <[EMAIL PROTECTED]> wrote:
>
> Neat, huh? There's also the easy-ffi, lazy-ffi, etc. Chicken's really
> good at this kind of thing, if you're the kind of person who likes
> having choices.
>

 I guess there are so many ffi choices because it must be a pain
to write pure C extensions, judged by what I've seen from chicken's
output. But I think that's inevitable given how Chicken uses the
machine stack.


Well, in fact I found very practical to made that sort of stuff.
Write your C code then just a bit of Scheme so that Chicken is aware
of the C code. Compile, that's it.

What's more, given chicken-setup, it's also easy to make your library
available to the community.

Graham, I did the example that way because I like to separate C from Scheme :
- if I want to move more to C side for performance, it will be easier
- I keep in my head the possibility to make the library available as
widely as possible by keeping it in C and making bindings for other
languages.

Cheers,
(And I get caught by April 1 :)
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] noobie question about chicken/swig/csi

2007-04-02 Thread minh thu

2007/4/2, minh thu <[EMAIL PROTECTED]>:

2007/4/2, Tato Norren <[EMAIL PROTECTED]>:
> Hi,
> I feel like an idiot asking, but what exactly are the sequence of
> commands needed to make the following C function callable from the
> chicken interpretor? on Linux.
>
> //test.c
> double test(double x){
> return x * x;
> }
>
> //test.i
> %module test
> %{
> double test(double);
> %}
>
> thanks,
> tato
>

Hi,

For simple things like that, don't use swig.
In a .scm file, write this:
(define test
  (foreign-lambda double "test" double))

'test' is the name in Scheme.
"test" is the name in C.
The first double is the return type.
The last double is the arg.

Compile the .scm and the .c files together with csc -s.
Note the -s whiwh will make a shared library : a .so file.
Now assuming the file were called tt.*, you can bring the function in csi with
csi -require-extension tt
or calling (require-extension tt) from a script.

For more complete explanation, see here:
http://chicken.wiki.br/Interface to external functions and variables

There is another way : just use the declaration of your function with
foreign-parse, it will automatically make it available in Scheme.

Use the Search Box and your left on
http://chicken.wiki.br/.

Cheers,
thu



Re,
I forgot to say that you need to declare your function.

Here an example:
[EMAIL PROTECTED]:~/projets/chicken/test$ cat test.c
/* test.c */

double
test( double x )
{
 return x * x;
}

[EMAIL PROTECTED]:~/projets/chicken/test$ cat tt.scm
; test.scm

; you can replace the following with a (foreign-parse ...) 
#>
double test( double );
<#

; ... then you don't need this !
(define test
  (foreign-lambda double "test" double))
[EMAIL PROTECTED]:~/projets/chicken/test$ csc -s test.c tt.scm
[EMAIL PROTECTED]:~/projets/chicken/test$ csi -require-extension tt

 //  /
___ (______ ( ___  ___
||   )| ||___)|___)|   )
|__  |  / | |__  | \  |__  |  /

Version 2.6 - linux-unix-gnu-x86 - [ libffi dload ptables applyhook ]
(c)2000-2007 Felix L. Winkelmann
; loading /home/mt/.csirc ...
; loading /usr/local/lib/chicken/1/readline.so ...
; loading library regex ...
; loading ./tt.so ...
#;1> (test 5)

#;1>
#;1> (test 5)
25.0
#;2> ,q

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] noobie question about chicken/swig/csi

2007-04-02 Thread minh thu

2007/4/2, Tato Norren <[EMAIL PROTECTED]>:

Hi,
I feel like an idiot asking, but what exactly are the sequence of
commands needed to make the following C function callable from the
chicken interpretor? on Linux.

//test.c
double test(double x){
return x * x;
}

//test.i
%module test
%{
double test(double);
%}

thanks,
tato



Hi,

For simple things like that, don't use swig.
In a .scm file, write this:
(define test
 (foreign-lambda double "test" double))

'test' is the name in Scheme.
"test" is the name in C.
The first double is the return type.
The last double is the arg.

Compile the .scm and the .c files together with csc -s.
Note the -s whiwh will make a shared library : a .so file.
Now assuming the file were called tt.*, you can bring the function in csi with
csi -require-extension tt
or calling (require-extension tt) from a script.

For more complete explanation, see here:
http://chicken.wiki.br/Interface to external functions and variables

There is another way : just use the declaration of your function with
foreign-parse, it will automatically make it available in Scheme.

Use the Search Box and your left on
http://chicken.wiki.br/.

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Rewriting Svnwiki in Java or PHP

2007-04-01 Thread minh thu

2007/4/1, Alejandro Forero Cuervo <[EMAIL PROTECTED]>:

I have been having some conversations with Nelson Castillo and other
Svnwiki users and contributors.  Some of us believe that by rewriting
Svnwiki entirely in another programming language the number of
contributions would increase significantly.  A lot of people would
like to contribute but they lack the programming skills required to
learn Scheme.

We are considering rewriting it in either Java or PHP.  I'm leaning
more towards Java but a very good case for PHP has been made by
Arhuaco.  We have also considered Python, Ruby and C#.

There are more details here:

http://wiki.freaks-unidos.net//weblogs/azul/rewriting-svnwiki

It should be said that we haven't made up our minds yet.  The amount
of efforts to rewrite Svnwiki in another language shouldn't be
underestimated.  However, unless a good case is made for keeping it in
Scheme, chances are we will switch to another language.

Thoughts?



It's a sad news : every other project starter could say then : hey,
look, they turned their code to something else for lack of
contribution.

I guess it would not bring as many people than using Java but maybe
you can consider the following:
consider the time of a rewrite and consider the time to make the
extant code be well documented, maybe to some part, looking like a
(Scheme) tutorial.
People like Real World code.

About Ruby or Python, am I wrong by thinking that people who know Ruby
or Python are a good audience for that kind of document ? For example,
in programming.reddit, Haskell, Ruby, Scheme are well represented.

I mean that if you switch to Ruby (not Java), you will gain community
but the *kind* of programmer will be the same (i.e. functionnal or at
least not-main-stream languages lovers). So keeping Scheme might not
be so bad to attract them.

Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Aliasing a module variable with a variable from the user ?

2007-03-30 Thread minh thu

2007/3/29, Graham Fawcett <[EMAIL PROTECTED]>:

On 3/29/07, minh thu <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Say I've a module with a bunch of procedures that use a global variable.
> Call it *global*.
>
> Can I use that module and specify that *global* is an alias of *my-global* ?
> (So that every procedures of the above module now work actually on 
*my-global*.)


Hi Graham,


It might be cleaner to use parameters instead:

(define *global* (make-parameter #f))

;; set the value:
(*global* *my-global*)   ; or whatever

;; use the value
(print (+ 3 (*global*)))


That way, *my-global* is only readable via *global*.
But it's a good idea, I can set *global*, not to *my-global*, but to a
procedure to
read/write *my-global* (in fact, another parameter).


If you're not familiar with parameters, it's worth a quick read of the
docs (in short, they give you dynamic scoping instead of lexical
scoping).


Well I just viewed them as an easy way to have globals.


If you're going to the bother of rewriting all your *global*
references to (*global*) instead, I suppose you could cheat and use
(define-macro (*global*) '*my-global*) instead. But I'd use
parameters.


Just before requiring the module ? I prefer the other way too, but it
might be a good idea.

Thank you,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Aliasing a module variable with a variable from the user ?

2007-03-29 Thread minh thu

Hi,

Say I've a module with a bunch of procedures that use a global variable.
Call it *global*.

Can I use that module and specify that *global* is an alias of *my-global* ?
(So that every procedures of the above module now work actually on *my-global*.)

Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] require-extension

2007-03-28 Thread minh thu

2007/3/28, Alex Queiroz <[EMAIL PROTECTED]>:

Hallo,

 I've seen the function 'require-extension' used in some files but
I can't find it in unit eval. Where can I find it's documentation?

Cheers,
--
-alex


You can see here:
http://galinha.ucpel.tche.br:8080//Non standard macros and special
forms#require-extension

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : [Chicken-users] multiple define from a macro

2007-03-26 Thread minh thu

2007/3/26, Arto Bendiken <[EMAIL PROTECTED]>:

On 3/26/07, minh thu <[EMAIL PROTECTED]> wrote:
>
> (define-macro (csg:make-mode-handler mode)
> ...
> `(define ,press '())
> `(define ,release '())
> `(define (,name+) (print "hello+"))
> `(define (,name-) (print "hello-"
>
> Only the later `(define ...) is produced. How can I have the three
> other ones produced too ?

Wrap the `define' forms in a `begin', like so:

  `(begin
 (define ,press '())
 (define ,release '())
 ...)


Thank you very much!
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] multiple define from a macro

2007-03-26 Thread minh thu

Hi,

I began to write this macro:

(define-macro (csg:make-mode-handler mode)
 (let ((name+   (string->symbol (string-append "bind+/"
(symbol->string mode
   (name-   (string->symbol (string-append "bind-/"
(symbol->string mode
   (press   (string->symbol (string-append "key-press-bindings/"
(symbol->string mode
   (release (string->symbol (string-append
"key-release-bindings/" (symbol->string mode)
   `(define ,press '())
   `(define ,release '())
   `(define (,name+) (print "hello+"))
   `(define (,name-) (print "hello-"

Only the later `(define ...) is produced. How can I have the three
other ones produced too ?

Is it the correct way to achieve this ?

Thanks a lot,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : Re : [Chicken-users] 3D update

2007-03-23 Thread minh thu

2007/3/23, Brandon J. Van Every <[EMAIL PROTECTED]>:

minh thu wrote:
>
> I sought a kind of german demo which featured procedural content to
> make a very small exe that holds everything. It was popular at the
> time but I forgot the name.

.theprodukkt ?  http://www.theprodukkt.com/


Yes  :)
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : [Chicken-users] 3D update

2007-03-23 Thread minh thu

Hi Brandon,

2007/3/22, Brandon J. Van Every <[EMAIL PROTECTED]>:

The Ogre 3D engine bored me to death.  I spent 1 week reading the docs,
feeling pretty miserable about it and not getting any work done.  All I
wanted to do was shove things into vertex buffers, and the engine really
wasn't adding any value for this kind of low level problem at all.  Ogre
is oriented towards loading 3D models from modeling / animation
packages, and I just don't need that right now.  I still think I'm going
to do a lot of game artwork with procedural content, even if I'm not
sure that procedural content actually buys me anything.  I'd just rather
arse around with programming than with 3D modeling packages, even if it
takes the same amount of time.


I sought a kind of german demo which featured procedural content to
make a very small exe that holds everything. It was popular at the
time but I forgot the name.


I'm working on some kind of game in Scheme.  I've adopted a prototyping
mentality, that this project isn't to prove that Chicken Scheme is
actually worth anything to anyone else.  For the past few years I've
been guilty of "premature marketing" in much the same way as I am often
guilty of "premature optimization."  Someone suggested that I undertake
a "7 Day Roguelike (7DRL)" style challenge, get some kind of game done
in 168 hours.  I think I may do it, and I'll start the timer when I've
worked through a few more Scheme idioms.


That seems a good idea to me. And you can ditribute the gruntwork
later around part of already working code.


At some point when I actually have a working game, if I still think
Scheme is gaining me something, I'll refactor the basic 3D engine and
windowing code into some kind of useful library.  This will supplant the
nascent gl-display project.  I don't see any point in cooperating with
others about this right now.  My problems are driven by my game.


Cool but I think the problems adressed by gl-display and a 3d engine
are quite different.


I've decided that C++ is not as important as I thought.  I think, for
getting jobs in the game industry, it's more important to bill myself as
a hardcore 3D engine developer.  Or game author, or AI jock, or
whatever.  The language isn't important.


I can't help you here but your last mail on this list (about the
interview with a game company) said the contrary. I guess that if you
can show thing, the underlying language won't be important. But the
"thing" has to be there.


The main thing I'm trying to figure out right now, is how to replace my
C++ OO instincts with Scheme idioms.  I don't really want to use
TinyCLOS, I want to be free of OO paradigms entirely.  I honestly don't
think OO is worth anything.  Every problem I've ever tried to address as
OO has eventually broken down.  It is really always a relationship
between 2 entities in some environment, with no clear hierarchical
precedence or ownership between the entities.  I think all I've ever
really used OO for is polymorphic interfaces.  If I can figure out how
to get 3D geometry to shove itself into different kinds of vertex
buffers, then I don't need OO anymore.  I'm currently going up the
Closure learning curve.


My view on OO is that it's just a way to organize things. But not the
only one, nor the best one. It all depends on the situation. Thus
using closure is just another tool.
Not the one true way. For that matter, purely functional style would avoid it.

I believe state Vs stateless (parameters threading from procedure to
procedure) are both good.

That's why I like Scheme : you can do what you want. (even if I don't
have lot of experience with it)

(And since I like also C, working with chicken is really enjoyable)


My guiding light, despite Scheme's complications, is that R5RS is only
50 pages long.  I anticipate this will be my sales pitch in the future.
"It's only 50 pages, how bad can it be?"


Still "premature marketing" :)

Also, r5rs misses some data types (can't compete with stl or the big
java api -- am I saying something stupid here ?)

Anyway, the idea of having a small *working* prototype is a good one.

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] how do i set interface for tcp client socket etc.

2007-03-15 Thread minh thu

2007/3/16, felix winkelmann <[EMAIL PROTECTED]>:

On 3/14/07, John Cowan <[EMAIL PROTECTED]> wrote:
> felix winkelmann scripsit:
>
> > >I want to set it so the tcp client will use for example IP addy
> > >192.168.1.2
> > >Also is the way to do same thing for http and xml-rpc client module ?
> >
> > Sorry, John - I must admit that I can't quite follow. Do you mean you
> > want to connect as a TCP client the the mentioned address?
>
> I think the idea is to be able to connect *from* a specific address
> when you are on a box with multiple IP addresses.

Sorry, but I have no idea how that is done. Anybody around who
knows more about socket programming?


[Hoping I'm not saying garbage...]

Hi,

I don't think it makes sense : a host connect to another host through routing.
It means it use the routing tables on the first host to determine the route.
If you can reach the destination by multiple routes, it's the routing
protocol to decide by which interface you will emit. If you want to
use a sepecific interface, you have to change those routing tables.

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] is foreign-parse enum possible ?

2007-03-12 Thread minh thu

Hi list,

Is it possible to FOREIGN-PARSE a C enum ?
And a C struct ?

Otherwise, it's really a nice tool.

Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Re: [Chicken-hackers] egg-post-commit

2007-03-08 Thread minh thu

2007/3/8, Alejandro Forero Cuervo <[EMAIL PROTECTED]>:

> >What if the directory contains multiple eggs ?
> >I ask this because I think I'll end up with lot of eggs for the
> >gl-suite project.
> >Is it better to have, gl-display-*, gl-font, gl-math, gl-repl,
> >gl-samples, gl-etcaetera,
> >or simply gl-suite ?
> >(If the former, Felix, prepare to have more request from me:)
>
> On directory, one egg, please.

Yeah, I totally agree: no directory in Chicken-eggs should have more
than one egg.



:) Fine
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Re: [Chicken-hackers] egg-post-commit

2007-03-08 Thread minh thu

2007/3/8, felix winkelmann <[EMAIL PROTECTED]>:

On 3/7/07, Alejandro Forero Cuervo <[EMAIL PROTECTED]> wrote:
>
> egg-post-commit should only automatically upload an egg if (1) it
> detects a change in the directory for the egg's latest release and (2)
> the egg's directory doesn't have the 'autoupdate' Subversion property
> set to 'no'.
>
> The directory for an egg's latest release would be:
>
> 1. If the egg has a 'tags' directory,
>
> 1.1. If the 'tags' directory has a 'latest' property set to 'foo',
> the directory is 'tags/foo'.
>
> 1.2. Otherwise, the directory under 'tags' corresponding to the
> greatest version number.
>
> 2. The egg's directory.
>

I'll do it exactly that way.


Hi,

What if the directory contains multiple eggs ?
I ask this because I think I'll end up with lot of eggs for the
gl-suite project.
Is it better to have, gl-display-*, gl-font, gl-math, gl-repl,
gl-samples, gl-etcaetera,
or simply gl-suite ?
(If the former, Felix, prepare to have more request from me:)

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : Re : [Chicken-users] Re: [Chicken-hackers] egg-post-commit

2007-03-07 Thread minh thu

2007/3/7, felix winkelmann <[EMAIL PROTECTED]>:

On 3/7/07, minh thu <[EMAIL PROTECTED]> wrote:
>
> When you make a change, don't you up the version ?

No. That's the job of the developer.


I was talking a bout the developer when saying "you"...



> If it's the case, automatic upload would only involve new directory under
tags.
>
> Also, in the .meta file, maybe it would be wise to have an option to
> disable the .meta file.

Good idea.


So, this one means "don't run the script".



>And an option to disable the .meta file after
> one run.

I don't understand this one. Could you explain?


And this one means "run it only once" then change the .meta file so
it's disabled.

I don't know if it would be really convenient but it allows the
developer to set "run once", commit its changes and be sure that its
changes are reflected, but also that it won't happen for the next
changes.

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : [Chicken-users] Re: [Chicken-hackers] egg-post-commit

2007-03-07 Thread minh thu

2007/3/7, felix winkelmann <[EMAIL PROTECTED]>:

On 3/6/07, Kon Lovett <[EMAIL PROTECTED]> wrote:
> >
> > BTW, shouldn't we really start thinking about automatic upload?
>
> Please, what does the above phrase mean? Automatic egg post when the
> svn repo copy of the source is changed? I hope not.
>

Well, (un)fortunately, it means "yes". The problem is that it is gettting
more
and more involved having the proper setup for running egg-post-commit.
Additionally I'd find it more convenient to have automatic uploads on
commit since running the upload script manually can get tedious after
a while. If you prefer to do it manually, I guess we should provide an
option (as an svn property). So my proposal:

- egg-post-commit can still be used as normal
- if an egg has been changed by a commit, has a .meta file, all files
  listed in the .meta file are available and the directory does not have
  a "noautoupload" property (or whatever), then it is uploaded
  automatically to call/cc.org.

Would that be acceptable?


Hi,

When you make a change, don't you up the version ?
If it's the case, automatic upload would only involve new directory under tags.

Also, in the .meta file, maybe it would be wise to have an option to
disable the .meta file. And an option to disable the .meta file after
one run.

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : Re : Re : Re : Re : Re : [Chicken-users] Scheme (LISP) editing

2007-03-06 Thread minh thu

2007/3/4, minh thu <[EMAIL PROTECTED]>:

2007/3/3, Zbigniew <[EMAIL PROTECTED]>:
> There are about a billion ideas flying around and I've lost track of
> your overall intent.  If you want to develop a 3D program
> interactively you can just start it with csi or call (repl) and issue
> GL commands and debug interactively like normal.  For example it is
> easy to run the sdl-gears example and change the lighting
> interactively, just throw the animation loop in its own thread.  If
> you want to make a console in-game for some reason (e.g. you are on an
> embedded system) with full access to your environment, you could do it
> the same way, only modify Felix's repl code to do I/O to your console,
> or use a pseudo terminal to bridge the repl to the console instead.
> Of course on an embedded system, assuming your goal is not just to
> look pretty, you could just use a serial console and retain the full
> interactive development abilities of Emacs on your dev machine.

My intent is pretty close of what you say. I just want to provide a
simple repl directly inside the OpenGL window. I see mostly four
reasons to do this.
- csi + readline + thread is problematic (from my test, maybe I'm wrong).
  Although I say 'simple' some file saving/reading would be great.
  csi without readline is very poor to make real editing session.
- I've to switch from vim to emacs + quack + paredit. In a sense, I'm
switching
  to OpenGL programming with Chicken, that's enough for me for the moment.
  Having the repl in OpenGL is a practical, reusable block of code.
  It can serve in a real program, see autocad, or maya (mel language),
and so on.
- Once it's done, people have ideas to experiment with. That's what make you
  lost track :)
- I've forgot the fourth point, something like "it's fun" :)

Oh, this is my intent regarding the opengl repl. I also want to
provide other simple building blocks. Font system is one.
Camera/projections library is another one.

Editor stuff was just discussions, I'm not going to do it but I
believe once some building blocks are done, people will try to do
things...

> On the other hand if you are just aiming to write a GL-based terminal
> there are plenty of examples out there, and if you're aiming for the
> full Squeak monty, then, good luck :)

I don't know Squeak. I've heard about Morphs (for Smalltalk I think)
but that's all. I need to look at it.

Cheers,
thu

> On 3/3/07, minh thu <[EMAIL PROTECTED]> wrote:
> > By the way, I don't plane to write an IDE neither an editor. But I
> > plane to write a repl. Once it's done (plus some other basic stuff), I
> > thing every body interested could contribute/test/have fun with some
> > *implemented* ideas.
>



Hi folks,

This is a 'private' announce :)
Thanks to Felix, gl-display-glx and gl-font are in svn/chicken-eggs on galinha.
Also, I've added the "project" to the active projects page on the wiki.
I should have waited a bit, but Shawn (and others) showed interest, so...

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : Re : Re : Re : Re : [Chicken-users] Scheme (LISP) editing

2007-03-04 Thread minh thu

2007/3/3, Zbigniew <[EMAIL PROTECTED]>:

There are about a billion ideas flying around and I've lost track of
your overall intent.  If you want to develop a 3D program
interactively you can just start it with csi or call (repl) and issue
GL commands and debug interactively like normal.  For example it is
easy to run the sdl-gears example and change the lighting
interactively, just throw the animation loop in its own thread.  If
you want to make a console in-game for some reason (e.g. you are on an
embedded system) with full access to your environment, you could do it
the same way, only modify Felix's repl code to do I/O to your console,
or use a pseudo terminal to bridge the repl to the console instead.
Of course on an embedded system, assuming your goal is not just to
look pretty, you could just use a serial console and retain the full
interactive development abilities of Emacs on your dev machine.


My intent is pretty close of what you say. I just want to provide a
simple repl directly inside the OpenGL window. I see mostly four
reasons to do this.
- csi + readline + thread is problematic (from my test, maybe I'm wrong).
 Although I say 'simple' some file saving/reading would be great.
 csi without readline is very poor to make real editing session.
- I've to switch from vim to emacs + quack + paredit. In a sense, I'm switching
 to OpenGL programming with Chicken, that's enough for me for the moment.
 Having the repl in OpenGL is a practical, reusable block of code.
 It can serve in a real program, see autocad, or maya (mel language),
and so on.
- Once it's done, people have ideas to experiment with. That's what make you
 lost track :)
- I've forgot the fourth point, something like "it's fun" :)

Oh, this is my intent regarding the opengl repl. I also want to
provide other simple building blocks. Font system is one.
Camera/projections library is another one.

Editor stuff was just discussions, I'm not going to do it but I
believe once some building blocks are done, people will try to do
things...


On the other hand if you are just aiming to write a GL-based terminal
there are plenty of examples out there, and if you're aiming for the
full Squeak monty, then, good luck :)


I don't know Squeak. I've heard about Morphs (for Smalltalk I think)
but that's all. I need to look at it.

Cheers,
thu


On 3/3/07, minh thu <[EMAIL PROTECTED]> wrote:
> By the way, I don't plane to write an IDE neither an editor. But I
> plane to write a repl. Once it's done (plus some other basic stuff), I
> thing every body interested could contribute/test/have fun with some
> *implemented* ideas.




___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : Re : Re : Re : [Chicken-users] Scheme (LISP) editing

2007-03-03 Thread minh thu

2007/3/3, Peter Keller <[EMAIL PROTECTED]>:

On Sat, Mar 03, 2007 at 12:22:34AM +0100, minh thu wrote:
> Do you have an opinion regarding havind bare s-exp or sxml
> representation of the code ?

Honestly, the only thing xml is good for is for interchange of data
since so many people agree on what it looks like--but I'm bitter. :)

If you designed your own s-exp structures for code representation, or you
used sxml, you still have the arduous task of deciding what the actual
information representation structure will look like. You can't escape
that real part of the work and it is just as difficult in either form.

The nice thing about either method is that it will always be convertable
to the other representation form. So, I'd say pick a "native" model
representation form (probably raw s-exp) which best captures the problem
domain of the idea and write everything to use that.  You can always
read/write sxml representations of that model to trade between other
people. I recommend this because the native model view of the problem
domain, if well designed and efficient, means a helluva lot less "data
structure conversion code" to manipulate it.


At first sight, I would use bare s-exp ...


The tricky part is that since this is an editor, it has to be line, and
also, s-exp oriented. Sometimes those might conflict in interesting ways,
especially in terms of incomplete forms or just non-scheme code.


... and add new forms along the line of (comment ...), ...


As for ideas for features the editor (which I'm imagining can be a scheme
IDE) should have, I can spew them forever:

1. Code is never thought about as being in "files". Instead, the user
creates "views" of codes.  Initial (and permanently available) views are
human constructed collections of related code, e.g., all codes relating
to some hash table implementation.  This is a little different than say
eclipse because eclipse only shows one class at a time, and you can't
really group classes into logical blocks (unless they are part of a
package, which might not be the case in your mind), and it is different
than VC++ because that is file oriented, or suffers from the same fine
granularity problem as eclipse with the class view (and friends).

Here is a very subtle psychological observation of how humans write code.
We programmers create a 2 dimensional plane which create a "slice"
through the high dimensional execution space of conceptually linear
algorithms in a (usual) top down fashion on said plane. Function invocations
can be thought of as moving in a direction perpendicular to the plane
of viewing to another plane which contains said implementation.

This is a product of both our reading/language skills and because we
copied those skills when it came time to create computers. In hindsight,
we had no other reason to pick anything different, but to continue it
now is a damn dirty shame

The problem is that while we can write the code that way, debugging
_unanticipated execution flow problems_ (something that happens every
day when writing code) or looking at it from other meaningful slices is
impossibly difficult and done with extreme pain because we are stuck with
the initial (and only) view that we had originally created. An editor like
eclipse tried to solve this by making a 2d view the smallest conceptual
unit possible as defined in the language (a class). In my mind, this
is too damn fine grained, since if a class references a bunch of other
classes (and they always do) you end up having a stack of windows and
digging through them to follow a code path of execution. By the time you
finish clicking the mouse, not only are you lost, but you probably can't
get back to where you were. Traditional vim/emacs goes the other extreme,
you are left with the exact 2D slices you used to create the software
and come hell or high water you will never be able to get a complete
picture of an execution path or other aspect-like query through many
(possibly dozens) of 2D slices. I *HATE* that.


Agreed. It should be possible to edit the code without jumping around
but by following execution, a bit like you edit a sequence diagram :
the diagram is unrolled.


2. With views as a first class entity, now you can start to perform some
extremely powerful source queries, like: give me a view of everyone who
uses a particular function in one "editor pane" (think of a traditional
window of text in an editor), perform a callgraph analysis of this
function and give me an editor pane of all the functions it ever ends
up calling, give me an editor pane of all leaf functions, show me all
functions where I perform recursion, show me all functions which match
a regex, show me all functions which have in them a specified s-exp,
show me all functions where this global variable is accessed, etc,
etc, etc.  It becomes easy to imagine a map/filter like source code
query system:

Re : Re : Re : [Chicken-users] Scheme (LISP) editing

2007-03-02 Thread minh thu

2007/3/2, Peter Keller <[EMAIL PROTECTED]>:

On Fri, Mar 02, 2007 at 02:48:48PM -0700, Shawn Rutledge wrote:
> I was hoping the same words would often reoccur on the display at the
> same time.  There would be a caching scheme, LRU or some such.  Just
> an idea, not sure if it's really better or not.

First off, noone would probably care if you rebind the texture for
every letter, it isn't like there is a bad speed penalty for such small
textures--especially for human reading speeds.

Second, you could make one big texture will all of the letters on it,
and use sub coordinates to pick the letters out as you render them.
Depending on the resolution you want, some cards might not be able to
load the texture, but these days, a 256x256 texture is probably more
than enough. Unicode might be more difficult, but just load more font
pages for what font you'd like to use.

Third, if you wanted individual textures per letter, then you could
sort the letters by frequency, load the first texture and draw all the
letters in the right places on the screen, then bind the next texture.

Seeing on how this is just text that a human reads, and that premature
optimization is the root of all evil, I'd say do option one.

Also, since you have the full bore of a 3d lighted texture mapping
engine behind you, the IDE could be something fantasical to behold. Like
undo buffers could go "into" the screen towards some vanishing point
and you can select your mouse on undo regions to undo certain things
whenver. It'd be sort of a visualization of vim's undo stacks behind
the text, all dimmed down until you need to see it.

Next idea. Ever see the dock on the new macosx? Suppose you have some
code like this:

file1.scm:
(define foobar (thingy 1 2 3))

file2.scm:
(define thingy (x y z) (+ x y z))

Then when editing file1.scm, if you drag your mouse over "foobar"
in context (hell, might as well use chords on the keyboard and add a
stroke interface), then the text all pushes to the sides (in a nice
fluid manner) and the definition for (only) "thingy" fades in enditable
form). You could then edit the definition of thingy (with all aspects of
the editor available to you here), hit the "back" button or whatever,
and go back to the original place you were. It's be like mixing ctags
and hyperlinks. Debugging could be the same deal, "drilling" down into
variables and stack frames and structures with hyperlink-like mouse
clicks would make debugging stuff very awesome and fast.

Then, if you'd like, you can save the entire drill down session as a
virtual workspace on some big texture and move to something else the
posibilities are endless. You'd make eclipse look like ed.

Also, the one awesome thing about writing a scheme editor that can do
all of this is that scheme is already in the ast form. You don't really
have to write a serious parser to understand and catagorize everything
like you do for java or C++. Doing stuff like refactoring on the fly in
those languages is painful. In scheme, it could be much easier. You just
walk the source and fix it in place. Parse errors can just be corrected
to the next valid form and you'd probably get it right 99% of the time.

Then, if someone ever invents a fundamental debugging specification format
for scheme (think dwarf2 or stabs), then your debugger/editor can load
it and present all sorts of awesome visual markup information for you.

Highlighted scheme froms and bouncing parenthesis are so 1975. To bad
that all IDEs _even today_ still basically do that (except type popups
and context completion showed up in the early 90's, but when you conthink
about it, it really only is an incremental evolution) and haven't even
really *began* to touch the code/debugging visualization realms that
only exist in programmer's heads.

If you make this, don't copy what is already done, make something
to behold!

-pete



Gee, I'm really happy to see you see the potential and have ideas !
Do you have an opinion regarding havind bare s-exp or sxml
representation of the code ?

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: Re : [Chicken-users] opengl egg naming scheme

2007-03-02 Thread minh thu

2007/3/2, minh thu <[EMAIL PROTECTED]>:

2007/3/2, Zbigniew <[EMAIL PROTECTED]>:
> Eh, while I'm at it, here's one that converts to a more canonical
> Scheme style.  Again untested.  Not totally happy with it as stuff
> like gl:vertex3iv and gl:tex-coord2iv should probably be gl:vertex/3iv
> and gl:tex-coord/2iv (maybe hyphen instead of slash) for readability.
> This was just an example anyway.
>
> http://3e8.org/pub/opengl-hyphen-shim.scm

Fine !
At gl:ext-blend-color (commas remain), also are gl:THE_CONSTANTS
correct scheme style ?

Sorry, stupid me, I was talking about the token at the far right ...



Cheers,
thu




___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: Re : [Chicken-users] opengl egg naming scheme

2007-03-02 Thread minh thu

2007/3/2, Zbigniew <[EMAIL PROTECTED]>:

Eh, while I'm at it, here's one that converts to a more canonical
Scheme style.  Again untested.  Not totally happy with it as stuff
like gl:vertex3iv and gl:tex-coord2iv should probably be gl:vertex/3iv
and gl:tex-coord/2iv (maybe hyphen instead of slash) for readability.
This was just an example anyway.

http://3e8.org/pub/opengl-hyphen-shim.scm


Fine !
At gl:ext-blend-color (commas remain), also are gl:THE_CONSTANTS
correct scheme style ?

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: Re : Re : [Chicken-users] Scheme (LISP) editing

2007-03-02 Thread minh thu

2007/3/2, Shawn Rutledge <[EMAIL PROTECTED]>:

On 3/2/07, minh thu <[EMAIL PROTECTED]> wrote:
> 2007/3/2, Shawn Rutledge <[EMAIL PROTECTED]>:
> > How are you rendering the text?  The choices are (AFAICT) use freetype
> > to generate bitmaps (maybe build a bitmap for each character/font
> > combination, or maybe render a word at a time or a line at a time) and
> > display them using glBitmap; use freetype to generate antialiased
> > pixmaps (same choices for characters, words or lines) and use them as
> > textures on top of polygons; or somehow convert the font to vertices
> > and render the text entirely as filled triangles.  I didn't see a way
> > that the results of glBitmap can be transformed - it goes straight to
> > the framebuffer, right?  Besides not being antialiased.  The third
> > method (vertices) might be slow (or is it nowadays?)  So I figured the
> > second method (textures) has the most promise.  But ideally it should
> > leverage the power of the GPU somehow, rather than involving Freetype
> > for every line of text every time it's drawn.  If you render a word at
> > a time, you can save them to GPU memory as textures and re-use them
> > every time that word with that font is shown, while still making use
> > of Freetype's hinting.  If you render a character at a time, the set
> > of textures becomes smaller, and you gain the ability to transform
> > each character (like for doing text along a path, for example) but
> > have to do hinting yourself.
>
> From freetype, I'll query each glyph as a pixmap (8bits) and store
> them in a single array of unsigned char. Yes, I do this C side because
> I don't want to write a freetype binding.
> Once it's done, I upload the array into video memory as a single
> texture. Then I create a display list for each char. To render a
> string, just call glCallLists. The c array is released since the

Well you could use display lists for vertices too, so it's nice to be
using the same call either way to actually do the rendering.

> texture is held by opengl.
> (I say "I" but I just used the technique from fltk and/or fox)
>
> One think is a bit problematic : "each" glyph/char means nearly all
> 8bits ascii code, i.e. 256 chars. So there's no utf-8 support right
> now. I don't know yet how to handle it, probably a system of cache.

I understand, thought about that too.  I would want to have UTF-8
support somehow, eventually.  It could be done with code pages
(translate runs of text from UTF-8 to language-specific code pages and
then use different display lists for each code page).  Maybe too much
trouble...and anyway it doesn't work for some Asian languages that
don't fit in 8-bit values.  But if you take the "one big font"
approach, there would be more display lists to have one for each
character, than if you have one per word.  I also suspect it would be
more efficient to render a word at a time (one polygon for each).

> If you find the thing not correct, just keep in mind it's early code
> and I've nearly no experience ... and of course I accept help :)

Yeah we are both hoping to release as open-source in the end.

I was also wondering what you dislike about the existing OpenGL egg?
You started over, right?



Making one polygon per word, you have to create the texture every time
then ? I don't know, in fact I won't try to benchmark that :)
And in this case, since the primary purpose is repl/editor, one
character at a time is fine.

The opengl egg : I don't like its syntax but I'm nitpicking, I use it now :)

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: Re : [Chicken-users] opengl egg naming scheme

2007-03-02 Thread minh thu

2007/3/2, Zbigniew <[EMAIL PROTECTED]>:

Isn't the only difference the lack of a colon?  It would be trivial to
auto-generate a shim file with all the defines in it that you could
simply include with your code.Certainly no more difficult than
renaming the opengl egg in the first place.

*If* I started using the opengl egg seriously, I would have done
something similar to convert everything to hyphenated style, e.g.
gl:load-identity, gl:matrix-mode, and maybe eventually just suggested
a patch.  But I haven't used it enough to mind.

Nevertheless I would prefer you not modify the egg itself to do
glLikeThis as it would just be a step backward (IMHO).


Well, I've reverted my code to use the normal opengl egg (so everybody
can use it as is).
But I like your suggestion.

Are defines enough (so to not generate one more function call) ?

Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : Re : [Chicken-users] Scheme (LISP) editing

2007-03-02 Thread minh thu

2007/3/2, Peter Keller <[EMAIL PROTECTED]>:

On Fri, Mar 02, 2007 at 10:27:41AM -0700, Shawn Rutledge wrote:
> On 3/2/07, minh thu <[EMAIL PROTECTED]> wrote:
> >I'm on the gl-display api, have a working gl-display-glx
> >implementation, have a working gl-font (based on freetype)
> >font-loading and text-printing egg.
>
> Cool!

Wow, that is cool! Talk about HGR days on the Apple //e! It'd be like
having a console for game code without writing one specifically.


Yes, you have all Chicken available behind EVAL.


I wonder if toplevel could be extended to contain things like objects and or
other graphical things that you can manipulate like variables.



Stuff like:

> (gl-define cube (glutWireCube 2.0))
;; cube shows up in the center of the screen.

> (rotate cube 45 1.0 0.0 0.0)
;; cube rotates on screen.

> (set! cube '())
;; the cube is erased

-pete



Hehe :)
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : Re : [Chicken-users] Scheme (LISP) editing

2007-03-02 Thread minh thu

2007/3/2, Shawn Rutledge <[EMAIL PROTECTED]>:

On 3/2/07, minh thu <[EMAIL PROTECTED]> wrote:
> I'm on the gl-display api, have a working gl-display-glx
> implementation, have a working gl-font (based on freetype)
> font-loading and text-printing egg.

Cool!

How are you rendering the text?  The choices are (AFAICT) use freetype
to generate bitmaps (maybe build a bitmap for each character/font
combination, or maybe render a word at a time or a line at a time) and
display them using glBitmap; use freetype to generate antialiased
pixmaps (same choices for characters, words or lines) and use them as
textures on top of polygons; or somehow convert the font to vertices
and render the text entirely as filled triangles.  I didn't see a way
that the results of glBitmap can be transformed - it goes straight to
the framebuffer, right?  Besides not being antialiased.  The third
method (vertices) might be slow (or is it nowadays?)  So I figured the
second method (textures) has the most promise.  But ideally it should
leverage the power of the GPU somehow, rather than involving Freetype
for every line of text every time it's drawn.  If you render a word at
a time, you can save them to GPU memory as textures and re-use them
every time that word with that font is shown, while still making use
of Freetype's hinting.  If you render a character at a time, the set
of textures becomes smaller, and you gain the ability to transform
each character (like for doing text along a path, for example) but
have to do hinting yourself.



From freetype, I'll query each glyph as a pixmap (8bits) and store

them in a single array of unsigned char. Yes, I do this C side because
I don't want to write a freetype binding.
Once it's done, I upload the array into video memory as a single
texture. Then I create a display list for each char. To render a
string, just call glCallLists. The c array is released since the
texture is held by opengl.
(I say "I" but I just used the technique from fltk and/or fox)

One think is a bit problematic : "each" glyph/char means nearly all
8bits ascii code, i.e. 256 chars. So there's no utf-8 support right
now. I don't know yet how to handle it, probably a system of cache.

The fact it's texture (on quads) means you can render in 3d, not only
in screen pixels.
Changing the color is just a call to glColor*.

If you find the thing not correct, just keep in mind it's early code
and I've nearly no experience ... and of course I accept help :)


> Everything is very loose and I will release them later, when I think
> it's worth to be seen (and ready for discussion (The loose aspect
> would make very poor discussion)).

I'd like to see it because I haven't written anything for text display
yet; maybe now I don't need to.


Well, I'll ask to Felix a little place for me svn-side.

Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : [Chicken-users] Scheme (LISP) editing

2007-03-02 Thread minh thu

Thank you for the paredit reference. I wasn't really looking for any
such thing at them moment but I will try it when I get the time to
migrate from BBEdit to Emacs.


I knew about paredit (and tried to use it) but I haven't migrated from
vim to emacs yet, and I don't know if I will...


I'm not entirely sure what Minh Thu is up to but I wanted to remind
him of the enormity of the task of editor creation. Personally I
don't think a "pure" Chicken IDE is a useful goal.


At first, I don't want to write a (general purpose) editor.

I'm on the gl-display api, have a working gl-display-glx
implementation, have a working gl-font (based on freetype)
font-loading and text-printing egg.

Everything is very loose and I will release them later, when I think
it's worth to be seen (and ready for discussion (The loose aspect
would make very poor discussion)).

Now, my goal is to write 3d computer graphics code with Chicken (and C).
And more and more my goal is to write it *inside* Chicken :
I've began to write a gl-repl : it takes keyboard input, shows the
characters with gl-font, then feed the expression to Felix's eval.
It's very basic and I want it to be more practical  and kewl.

What this means : have a 3d application in development in your window
and in the same window you have your repl in overlay. I'd like to have
more than a without-libreadline-like repl. It's OpenGL !! I want to
provide nifty escape sequences to gl-print to have nifty colors (and
more :).

I can do this. But the editor is a wish. Open a file in that OpenGL
window, edit it, feed eval with some s-exp from the file and so on.

Anyway, say I'm crazy enough to begin the task. There're options :
- text (i.e. char array) based.
- direct s-exp based. By direct, I mean the data structure is the same
s-exp that will be fed to eval.
- sxml s-exp based.

At first sight, I want to use one of the s-exp based idea. Of course,
for string editing (i.e. anything not a paren : string, numbers,
comments, ...), the first option has to be present.

- direct s-exp : no need to parse, we have READ.
- sxml s-exp : we have sxpath, sedna, ... a lot of things. We need to
specify the sxml representation for any scheme code. Even the one that
results from user-defined macro ?

With s-exp based editing, I guess especially sxml, we can make an
editor that abstracts away the directory/file organisation, but use
extension/modul/unit/define.
(My knowledge about those is very poor at the moment).

One idea : with a sxml representation, could we have a tool that see
if two procedures do (potentially) the same things ?

--

About the s-exp representation for comments.
What about (comment this is a (silly) comment\) ?
And (cmt> this comment is about the next form) (http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Re: I need some help to edit a tree

2007-02-28 Thread minh thu

2007/2/28, minh thu <[EMAIL PROTECTED]>:

Hi,

I'd like to do something that I thought would be very easy to do with
Scheme but I'm getting lost.

I want to have a global *TREE* symbol to hold nested list. (Each node
is either a string or a list of node, but in this mail I make the
description
with only lists) Initially it is (define *tree* '()), the empty tree.
If I push a node, it becomes '(()).

Now the fun part. I want to keep track of the current (or selected)
node. Initially there's no node, after a first push, the current node
is the inner list.

I want to be able to add a node to the left or to the right of the
current node. Also,
I want to be able to swap two nodes, or push a node outside of its
parent

Now, I take the fisrt case : adding a node to the left of the current one.
To do this, I need to SET! its parent. But of course I've no pointer
to its parent.
So what I've done is to use a *ACCESS-LIST* which contains a list of
'CAR, 'CDR, ... to have the path from the root to the selected node.

Then I can access the current node with
(define (current-node)
  ((apply compose (map eval *access-list*)) *tree*)

(I use a list of symbol because it's niser when printed than )
Similarly, I've defined a PARENT-NODE procedure (just drop-right the
last element of the acces list).
The problem is I can't SET! (PARENT-NODE).

Do you have an idea about how can I manage this ? I guess there's an
elegant way to write tree editing code but I don't see.

Thanks,
thu



Instead of using a SET! at the top, I think I will try a recursive
porcedure on both the tree and the access-list, and then use a SET! a
the place I need.

Anyway, I'm  interested in hearing your ideas.
Thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] I need some help to edit a tree

2007-02-28 Thread minh thu

Hi,

I'd like to do something that I thought would be very easy to do with
Scheme but I'm getting lost.

I want to have a global *TREE* symbol to hold nested list. (Each node
is either a string or a list of node, but in this mail I make the description
with only lists) Initially it is (define *tree* '()), the empty tree.
If I push a node, it becomes '(()).

Now the fun part. I want to keep track of the current (or selected)
node. Initially there's no node, after a first push, the current node
is the inner list.

I want to be able to add a node to the left or to the right of the
current node. Also,
I want to be able to swap two nodes, or push a node outside of its parent

Now, I take the fisrt case : adding a node to the left of the current one.
To do this, I need to SET! its parent. But of course I've no pointer
to its parent.
So what I've done is to use a *ACCESS-LIST* which contains a list of
'CAR, 'CDR, ... to have the path from the root to the selected node.

Then I can access the current node with
(define (current-node)
 ((apply compose (map eval *access-list*)) *tree*)

(I use a list of symbol because it's niser when printed than )
Similarly, I've defined a PARENT-NODE procedure (just drop-right the
last element of the acces list).
The problem is I can't SET! (PARENT-NODE).

Do you have an idea about how can I manage this ? I guess there's an
elegant way to write tree editing code but I don't see.

Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : [Chicken-users] opengl egg naming scheme

2007-02-27 Thread minh thu

2007/2/27, Kon Lovett <[EMAIL PROTECTED]>:

On Feb 27, 2007, at 10:53 AM, minh thu wrote:

> Hi,
>
> At the beginning of my journey with Chicken, I stolen the opengl egg
> and repacked it: I changed its naming gl:UpperCase in glAsInC.
>
> Now I have code I'd like to share that depends on the glAsInC naming.
> It would not be very difficult for me to change it but I find it ugly.
>
> Is there any rationale to keep/change the extant egg ? To provide a
> new one ?
>
> Or is it possible to use the extant egg (the one with gl:Naming) but
> use it as if it was named glLikeThis ?

(define glAsInC gl:UpperCase)


Ouch, that's a lot of defines :)
Thanks
thu


Felix's naming for the glut & opengl eggs is a little odd in that he
follows the C binding CamlCase style - not the Scheme way, especially
since Scheme, up thru R5RS, is case-insensitive.

(See http://community.schemewiki.org/?variable-naming-convention)

Best Wishes,
Kon

>
> Thanks,
> thu
>
>
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/chicken-users





___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] opengl egg naming scheme

2007-02-27 Thread minh thu

Hi,

At the beginning of my journey with Chicken, I stolen the opengl egg
and repacked it: I changed its naming gl:UpperCase in glAsInC.

Now I have code I'd like to share that depends on the glAsInC naming.
It would not be very difficult for me to change it but I find it ugly.

Is there any rationale to keep/change the extant egg ? To provide a new one ?

Or is it possible to use the extant egg (the one with gl:Naming) but
use it as if it was named glLikeThis ?

Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : [Chicken-users] Release candidate for 2.6 available

2007-02-26 Thread minh thu

2007/2/26, John Cowan <[EMAIL PROTECTED]>:

felix winkelmann scripsit:
> Hi!
>
> A release canditate for CHICKEN 2.6 is now available at
> the web-site. If you find the time, please give it a try.

Works fine under Cygwin with CMake.


Is it interesting to mention it works under ubuntu with configure/gnu make ?
Well it works (after recompiling all my eggs... I forgot one and it
coudn't find foreign-parse).

Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : [Chicken-users] Simple GUI features

2007-02-15 Thread minh thu

2007/2/15, Tony Sidaway <[EMAIL PROTECTED]>:

While it may be rather difficult, and possibly even impracticable, to
produce a general super GUI, it should be possible for all Chicken GUI
eggs to provide GUI features in a uniform way.


It's really a good idea. Maybe can we pick a name and have a way to
track versions of this proposal and suggestions. We can use the same
way eggs are documented on the wiki ?

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : [Chicken-users] gui api design -- some thought -- long mail

2007-02-13 Thread minh thu


A simple alternative is that often you just want to call yourself
later.  That is, register a timer which when it expires, will call the
given function which you give when you register the timer.  It can be
a one-shot or a repeating timer.


In my conception of the event queue, each event has a timestamp
indicating when it has to be dispatched. So an event can be inserted
in the queue before already present events.



> b) (which is related) Since a function call results
> from an event, you can't generate an event whose
> callback needs the end of
> the event-generating-computation (i.e. it's not
> asynchronous).
>
> I'd rather like to finish a computation which generates
> an event before processing it.

If you generate the event and put it in the queue, it will be
processed later when the code gets around to checking the queue,
right?


Yes. The code could be a scheduler (provided by the library) or user code.



> c) Also, say you want to code "When the left mouse button
> is pressed (elsewhere than above my two main widgets),
> make the first widget be blue and the second one be red.".
> (Call this the blue-red exemple for later reuse.)
> You'll need to register a callback on the background widget.
> This callback needs to access (to be aware of) the two
> other widgets. I don't like this.

Whereas in an immediate mode UI, the main "do" function is both
finding out that the button is pressed, and drawing the blue and red
widgets directly right?


I guess  so.


An alternative way to get this behavior with callbacks would be to
make it possible for every widget to register interest in any kind of
event, whether or not it would seem relevant to that widget.  The
callback can have an extra parameter to indicate the relevance.  So a
normal button registers only for a click event on himself, and your
special button registers for a click event anywhere, and is given a
"true" when the click is on him, and a "false" if it's somewhere else,
along with coordinates etc.  Or maybe your special button does two
registrations of two different callbacks so that the parameter is not
necessary...


The first part of your description sticks to my idea. Hwever, when you
say 'the widget registers interest', I would say 'you register a
callback that will only cares of one widget'.
So to implement the button, I would make a handler for
'left-mouse-button-pressed which insert a new event,
'that-button-clicked. This step could be hidden for the user of the
GUI.



> "My" Idea.
>
> I call it mine but I don't know .. maybe it's as old
> as the world ?
>
> - The callback mechanism is exposed and made not mandatory.
> - The widgets are aware of events, not the contrary
> (see c) above).
> - The event facility can be used for application-generated
> events.
> - The ol'callback way is still available.
>
>
> How.
>
> An event-queue keeps the not-yet-processed events.
> (For some application, it might be useful to timestamp
> events so they are dispatched later or even keep the
> already-processed events to be able to reverse time.)

That's probably a really good idea.  I think in general the trend is
that as memory gets cheaper (RAM and disk both, and I believe they
will be the same thing some day when nonvolatile RAM is cheap enough),
you can find reasons to keep data around, timestamp it, take diffs,
even build a sort of version control system for some classes of data,
rather than assume that only the latest, most current data is relevant
and letting new stuff overwrite old stuff.  Especially, any text which
the user enters himself ought to be considered sacred and never
garbage-collected unless the user asks for it to be deleted.  The book
"The Humane Interface" makes this point.  I was thinking a few years
ago that a computer's disk ought to be structured as a giant log,
where the data the user creates is appended to the log, and then data
structures which the software creates to organize that data never
duplicate it - they just point to it.  The user enters a stream of
data, and the computer makes sense of it over time.  You would have
built-in version control - edits are actually a special kind of diff
that is appended to the log, so you will have the new version and the
old version at the same time.  Like CVS or subversion but implemented
more efficiently.  That is what early versions of the Xanadu project
were about...but there is more than one way to implement it, and I
can't make up my mind which is the best one (and neither could the
Xanadu guys, which is why it never got done).

Anyway I'm not sure that mouse events have the same kind of perennial
lasting importance that text does, but in graphical documents, like
diagrams, a persistent history would be nice, with unlimited undo and
the ability to compare different versions.  I want to build something
like that when I get the GUI stuff done.


Interesting point. Although it was not clear, I was thinking of some
functions to get events but also query the existence of a 

Re : [Chicken-users] cool 3d logo by Joshua Griffith

2007-02-12 Thread minh thu

2007/2/12, felix winkelmann <[EMAIL PROTECTED]>:

Hi!

Take a look at this funky logo:

http://www.call-with-current-continuation.org/logos/chicken-3d.png

hehe, not really a logo but... :)


Thanks, Joshua!

(I've added it to our logos page at http://chicken.wiki.br/logos -
unfortunately
svnwiki doesn't like me today, so I don't know whether they appear or not)


I see some logos but not the new one.
thu




cheers,
felix


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users




___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Centralized documentation

2007-02-12 Thread minh thu

2007/2/12, Peter Bex <[EMAIL PROTECTED]>:

Hi everybody,

I was having an e-mail discussion with Mario Domenech Goulart about Spiffy
and the conversation turned towards egg documentation.
The discussion started because Spiffy's documentation is starting to
grow beyond what fits comfortably on one webpage (which is the case at this
moment).  We both agreed the best place would probably be on the wiki,
perhaps like lighttpd does it (http://www.lighttpd.net)

Here's the relevant part of the discussion:

- Forwarded message from Mario Domenech Goulart <[EMAIL PROTECTED]>
-
> > > How would [keeping a synched copy of the documentation from the wiki
> > > on call/cc.org] work if we use more than one page?
> >
> > Hmmm. I don't know.  I'd expect we'd have an index page (which would
> > be copied to call/cc.org's eggs directory) and the links would point
> > to galinha.  But I don't know if it is the right way.
>
> What's the point of duplicating the index then?  We could just point to
> galinha and be done with it.

That would be the more atraightforward alternative.

> Saves us the trouble of updating the call/cc page every time.  Maybe
> Felix should think about ditching the egg pages altogether and
> simply linking to Galinha as the one and only resource for egg
> documentation.  It would remove a lot of overhead and duplication,
> IMHO.  I never liked having two systems which do the same thing
> (which is one reason why I despise GNU's policy wrt info pages over
> manpages).  It confuses me.  Where do you look for the most recent
> info?  Who sees what system as authoritative?  Do people think to
> update the other version at all?  Do some people switch their
> standpoint sometime later, changing which system I need to look at?
>
> This is definitely not good for newbies.  They might be scared away in
> confusion.  You might think this is silly, but if I think it, I'm sure
> there are others.

I see your point.  My guess is that Felix wants to keep the official
documentation at call/cc.org.  But it's just a guess.  We have to ask
him.


> > Do you think the Spiffy documentation and this documents containing
> > tips should be the same?
>
> It could be a section in the documentation.  Since it's a wiki, the nature
> of documentation is a lot more volatile.  I'm not sure what's best yet.

Ok.  So let's try to solve the case of the canonical Spiffy
documentation in a way we can accomodate further documents in the
future.
- End forwarded message -

What do you think would be the best way to go from here?  I really believe
one canonical place for documentation is a benefit both for experienced
developers as well as for newbies and the documentation maintainers.
Having two or more places where documentation can be found or generated
(wiki syntax, eggdoc format and plain HTML) causes a lot of confusion
and duplication of work.

The current situation conveys chaos and disagreement to outsiders, I think.
If we want to attract more developers to get more work done (we all agree
on that being a good thing), a sane documentation system would go a
long way towards at least giving the appearance of a well-engineered
and structured project.  (Having a ticket tracking system helps similarly
and I wish to thank Felix and Arto for setting it up.  I agree with Felix
that everybody should register a login there)

Should eggdoc be deprecated in favor of svnwiki?  Should the wiki be
deprecated instead?  Should we stick with the status quo? (IMHO, no,
but I can imagine some people might feel the same about this as about
version control systems)

Any other ideas would be welcome.

Regards,
Peter
--
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
-- Donald Knuth


Hi,
I'm really not aware of the situation but here's two things:

Documentation on a wiki is nice to read and for collaboration but if
it's sufficiently good to be added to the main doc (which ships with
the code/library), it could be ennoying to manage. It would be
practical for the maintainers to see some kind of diff between the
wiki edited doc and the main doc, although for the reader there's no
difference. (From another point of view, wiki pages have to belong to
the doc, not to the wiki. If we add a lib or remove it, its doc is
automatically added or removed)

The fact there's multiple sites must not be a concern for the
maintainer. Any sync has to be performed by the sites themselves, thus
needing one kind of doc system.

Hope it makes sense for the above questions...

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : [Chicken-users] csc -extend with user-preprocessor-pass

2007-02-12 Thread minh thu

2007/2/12, felix winkelmann <[EMAIL PROTECTED]>:

On 2/11/07, minh thu <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying the -extend  option of csc with the following :
>
> (user-preprocessor-pass
>   (lambda form
> (display (car form))
> (newline)
> '(display "..."))
>
> When compiling, the first top level form (of the being compiled file)
> is not displayed.
> Is it normal ?
>

No, that's a silly silly bug. Here's a patch:

--- old-chicken/batch-driver.scm2007-02-12 08:03:19.223978592 +0100
+++ new-chicken/batch-driver.scm2007-02-12 08:03:19.326962936 +0100
@@ -402,7 +402,7 @@
   (let ([proc (user-preprocessor-pass)])
 (when proc
   (when verbose (printf "User preprocessing pass...~%~!"))
-  (set! forms (cons (first forms) (map proc (cdr forms ) )
+  (set! forms (map proc forms

   (print "source" '|1| forms)
   (begin-time)


Sorry.


Well, silly silly question:
What is the patch for ? Is it intended for those who use the latest
tarball? I guess the one who use the svn (or darcs ?) version can just
update ?

Thanks
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] csc -extend with user-preprocessor-pass

2007-02-10 Thread minh thu

Hi,

I'm trying the -extend  option of csc with the following :

(user-preprocessor-pass
 (lambda form
   (display (car form))
   (newline)
   '(display "..."))

When compiling, the first top level form (of the being compiled file)
is not displayed.
Is it normal ?

Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] cross-platform gui toolkit

2007-02-08 Thread minh thu

[snip]
> R&D is a non-issue for OpenGL windowing.  We're not going to do enough
> to get ourselves into trouble.  I'm sure Thu will cook up some event
> handling experiments, and at some point I'll try my own hand at it.

What kind of experiments?



Hi,

I think Brandon talked about the (long) mail I've send about gui api design.
But it's not intended as a Chicken community project (although I've
nothing against).
It's simply something I was thinking for a while and then Felix's gui
project appeared, so I thought I could share with you what I was
thinking.
And if it comes to be a source of ideas for Felix's project, then good !

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] GUI: thoughts on practicality.

2007-02-08 Thread minh thu

2007/2/8, Tony Sidaway <[EMAIL PROTECTED]>:

On 2/8/07, minh thu <[EMAIL PROTECTED]> wrote:
>
> So in your conception, accessing the event queue must be explicitly
> possible ? Usually, you can just provide a callback and wait for the
> system call it.

A translating dispatcher might be used for implementation, basically a
bit of glue code that listens to the native queue and translates to a
standard format, and for some higher level features such as
intercomponent communication a queuing system would be a good >feature.


I find it funny that it's something closer to CSP (or Erlang).
Since Chicken has lightweight multithreading, we could turn it into a
node (in Erlang terminology). In fact it's something I might be
interested in when I'll dig into Chicken's implementation.
Again sorry for my 'random' (Brandon would call it 'insane' :) ideas...
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] GUI: thoughts on practicality.

2007-02-08 Thread minh thu

2007/2/8, Tony Sidaway <[EMAIL PROTECTED]>:

It's been my feeling for some time that it should be possible for a
Scheme programmer to create windows with menus, buttons, and whatnot,
with a reasonable expectation that the details of implementation can
be left to low level drivers.

Furthermore, the Scheme programmer should be able to write simple code
to do simple things.  The code should be simple but the implementation
can be complex.  At the high level I don't care whether the widget I'm
handling is written in C, C++, Java, Common Lisp or Scheme.  I don't
want to have to care whether my code is running on native Windows,
Cygwin, X, Macos or a cellphone GUI. I don't want to have to care
whether the rendering library is Cairo or SDL.  These are
inconsequential fripperies and unwanted dependencies that, if I let
them, will seal my code into a tomb as the years go by.

So it seems to me that the way to produce really good, durable and
reliable Scheme code for GUI programming is to concentrate on a good
high level design.

What I suggest here won't satisfy the requirements of game designers,
or programmers who think the GIMP needs to be rewritten in Scheme, and
it might even fall short of what most people would expect of a modern
GUI.  This is because I think we already have enough Window managers,
skin systems, game toolkits and the like, and nearly all the
successful ones are written in a low level language.  Rather than
duplicate that work, these suggestions are intended to enable a Scheme
programmer to write an event-controlled, graphical user interface so
that he can communicate with the user in a way that the user finds
intuitive. and to do so without tying him to a particular brand of
GUI.

Eventually I will have to wade deeply into all the popular GUI designs
and come up with one that describes the basics of all of them to a
level of detail that would be useful to a high level programmer.  But
for now I'll list some of the things that I think are required in a
useful high level GUI design for Scheme.

* Geometry: the dimensions of each display device must be available to
the high level program.  Both pixels and if physical dimensions.
** If the latter are not available to the driver, it should provide
intelligent estimates and say so.
** The dimensions of GUI objects controlled by the program should be
the size requested by the program, or a reasonable approximation
thereof.
* Color: a reasonable level of color control must be provided.
* Time: the time of each event must be available to the high level
program in a usable form.  srfi-18?
* HIgh level event handlers.  a Scheme closure may be assigned to
handle any event or bundle of events the program is interested in.
* High level containers: there must be a way of expressing a
hierarchical relationship between widgets.  This should be coupled to
the container mechanism of the underlying GUI where possible, but
should not depend on such a mechanism existing.
* Configuration: the application must be reasonably configurable at
run time.  The native configuration tools should *usually* take
precedence, and the high level GUI works within the constraints set by
those tools.  The program *may* be permitted to break this.

Desirables:

* Queues: we need a standard for queues.  whether based on Chicken,
Scheme48, Gauche or whatever.  High level event queues would be based
on that standard.


So in your conception, accessing the event queue must be explicitly
possible ? Usually, you can just provide a callback and wait for the
system call it.

Cheers,
thu


* Time: the external form of this should follow IETF RFC 3339 and any
superseding standard.
* Foreign function interface.  A reasonably abstract foreign function
interface should be provided to enable drivers to be ported from one
Scheme implementation to another.  Adherence to that ffi should not be
mandatory.






___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : Re : [Chicken-users] do I use define-foreign-variable correctly ?

2007-02-07 Thread minh thu

2007/2/7, minh thu <[EMAIL PROTECTED]>:

2007/2/7, Kon Lovett <[EMAIL PROTECTED]>:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On Feb 7, 2007, at 6:41 AM, minh thu wrote:
>
> > #>!
> > #include 
> > #include 
> > <#
> >
> > (define-foreign-variable c-escape-key int "XK_Escape")
> > (define escape-key c-escape-key)
> >
> > Do I need to have those two lines too be able to use escape-key as a
> > Scheme symbol for the C #defined XK_Escape value ?
>
> Umm, depends. Do you want it visible outside of the compilation unit
> (i.e. exportable)?

The escape-key, yes; the c-escape-key, no.


In fact, if I intend the API to be portable above other system, I should export
'ESCAPE without being related to the C counterpart, right ?



> then '(define escape-key (foreign-value
> "XK_Escape" int))' is enough.

Thanks !

> (I might make the symbol uppercase just
> to emphasize it is a constant.)

Ok.

> Also 'define-foreign-variable' has
> overhead that you don't want for a constant, it isn't mutable so
> conversion should only be done once. ('foreign-value' is a wrapper
> around 'define-foreign-variable' that creates the variable, gets its'
> value, & throws away the variable, returning only the value.)

Do I understand correctly : define-foreign-variable has overhead in this
case since I don't need it to be mutable and foreign-value has not
that overhead ?

Thanks,
thu




___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : [Chicken-users] do I use define-foreign-variable correctly ?

2007-02-07 Thread minh thu

2007/2/7, Kon Lovett <[EMAIL PROTECTED]>:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Feb 7, 2007, at 6:41 AM, minh thu wrote:

> #>!
> #include 
> #include 
> <#
>
> (define-foreign-variable c-escape-key int "XK_Escape")
> (define escape-key c-escape-key)
>
> Do I need to have those two lines too be able to use escape-key as a
> Scheme symbol for the C #defined XK_Escape value ?

Umm, depends. Do you want it visible outside of the compilation unit
(i.e. exportable)?


The escape-key, yes; the c-escape-key, no.


then '(define escape-key (foreign-value
"XK_Escape" int))' is enough.


Thanks !


(I might make the symbol uppercase just
to emphasize it is a constant.)


Ok.


Also 'define-foreign-variable' has
overhead that you don't want for a constant, it isn't mutable so
conversion should only be done once. ('foreign-value' is a wrapper
around 'define-foreign-variable' that creates the variable, gets its'
value, & throws away the variable, returning only the value.)


Do I understand correctly : define-foreign-variable has overhead in this
case since I don't need it to be mutable and foreign-value has not
that overhead ?

Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] do I use define-foreign-variable correctly ?

2007-02-07 Thread minh thu

#>!
#include 
#include 
<#

(define-foreign-variable c-escape-key int "XK_Escape")
(define escape-key c-escape-key)

Do I need to have those two lines too be able to use escape-key as a
Scheme symbol for the C #defined XK_Escape value ?

Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] gui api design -- some thought -- long mail

2007-02-07 Thread minh thu

Hi All.

I'm aware of two kinds of GUI event response mechanisms.
(I'm dropping phooey or cello since I don't know them.
Furthermore, their implementation is probably too different
of what I want to talk here.)

The first one is Immediate Mode GUI and the second one is
the so classic Callbacks, event-driven mechanism.

In this text, I'll try to say why I don't like the second
one (I won't talk about the first one.) and provide an idea
that only appeared clearly to me yesterday (although it's
really simple). This idea avoids what I don't like about
the Callbacks while letting the user still use them.

I first thought I would implement it a bit (on top of the
project with Brandon) before talking about it but I need
to write to not forget. Also, those who are interested in
Felix's GUI project might like it (and give some
feedaback !).

Disclaimer: I'm not an expert, I just have some ideas :)
but I hope to say not to much stupid things.


Immediate Mode GUI.

The idea is to have the drawing and event-responsing of
a widget happens at the same time. It thus needs some decent
framerate. It means no callback : the code handling the
event is written alongside the code displaying the widget
(and the code testing the existence of the event). It
can also means no data structure for the widgets (just
like you can write a rectangle with opengl without having
to store a Rectangle object; the code is the object).

Google for references. See also 'A Zero Memory Widget
Library'. ZMW uses a datastructure when traversing the
code; it's necessary if you want to calculate the size
of a widget which is made of other (unknown) widgets.


Callbacks.

Classical GUI libraries let the programmer write an
application that responds to user actions : the A button
is clicked or the Y window is moused-over. The code
is bound to the event by registering a so called callback
(simply a lambda abstraction on this side of the world,
an ugly in-line class instanciation (and interface
implementation) in the Java world).

So basically, a function is called back when a gui
event arises. The mechanism by which events are detected
and functions called back is hidden (transparent for
the programmer).


What I Don't Like About Callbacks.

a) Putted simply, you can't mix gui events with
application specific events.
b) (which is related) Since a function call results
from an event, you can't generate an event whose
callback needs the end of
the event-generating-computation (i.e. it's not
asynchronous).

I'd rather like to finish a computation which generates
an event before processing it.

c) Also, say you want to code "When the left mouse button
is pressed (elsewhere than above my two main widgets),
make the first widget be blue and the second one be red.".
(Call this the blue-red exemple for later reuse.)
You'll need to register a callback on the background widget.
This callback needs to access (to be aware of) the two
other widgets. I don't like this.


"My" Idea.

I call it mine but I don't know .. maybe it's as old
as the world ?

- The callback mechanism is exposed and made not mandatory.
- The widgets are aware of events, not the contrary
(see c) above).
- The event facility can be used for application-generated
events.
- The ol'callback way is still available.


How.

An event-queue keeps the not-yet-processed events.
(For some application, it might be useful to timestamp
events so they are dispatched later or even keep the
already-processed events to be able to reverse time.)
For some event, the current state is kept. Exemple:
You might not want to have code run each time the
 key is pressed but only want to be able to
query its state; is it pressed ? Or you might want
to be able to respond to the many events that have
appeared before your code is run.

You already see the moment when an event is generated
and the moment when it is processed are no tied.
Also, sampling for events and processing them are
not tied.

The base API let you test the existence of an event.
The test can be blocking or not. It can removes the
event from the queue or not. (The api has to be
extended so an event can be removed automatically
when every interested widget has already received it.)

(This last point let you write the blue-red program:
the two widgets are aware of the events.)

At this point, we have access to events. But how (when)
the code accessing the events is run ? How the gui
event-polling is done ?

Here again we gain some flexibility. You can write
yourself a loop that calls one API function to
pump gui events then calls the event-testing-related
API functions. Or you can use an API function set
to let you register functions to be called regularly
(independently of events) and then launch an API-
provided main loop. Or register functions to
be called only for some specific events.

Yep, we approached the well-known callback mechanism.
To make it really feels like that, we can provide a
function which makes the widget generate an event
*and* register

Re : [Chicken-users] cross-platform gui toolkit

2007-02-07 Thread minh thu

2007/2/7, Daniel Sadilek <[EMAIL PROTECTED]>:

> Fully understandable, but Qt is big and I fear that a complete wrapper
> will end up as a huge lump that has continuously be maintained (to stay
> complete). The qt egg is explicitly meant as a lightweight facility for
> exploiting the meta-object protocol of Qt - sort of an experiment (but
> still quite useful).

Hm, I think a "cross-platform gui toolkit" is a big thing anyway?


I think not exactly. I see it this way.
- a Scheme interface (i.e. an API) is designed. This api is meant to
provide things that we know will be available in most GUIs.
- the interface is implemented in a number of way. It could be from
scratch, on Qt, whatever.

The first point is a matter of careful examinations, and then choices.
The second one, especially the 'number' word, is what makes Felix's
idea practical and your statement semi-valid : the implementations can
be made as they're needed, or as people have time to provide one more.

Take the example of the SAX API. It's provided in a lot of languages.
Or I see from time to time GUI that are designed following Java's SWT.

Furthermore, if the API is designed to do it, you could provide more
widgets (is there anything else ?) (either in a specific imlementation
or as an additional extension for a specific implementation).

Cheers,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : [Chicken-users] idiomatic/usual way of file-based configuration in Scheme

2007-02-06 Thread minh thu

2007/2/6, Tony Sidaway <[EMAIL PROTECTED]>:

On 2/6/07, minh thu <[EMAIL PROTECTED]> wrote:
>
> It would just amount to read a list of key/value pairs in Scheme
> syntax. Or maybe a triple if the type is given.
>
> What do you use ?
>
As I think you realise, this is a capability that is as old as Lisp
itself.  A property list is just a specialized form of s-expression.
I'm not aware of any formal standards for this, but it's pretty much a
matter of basic Scheme.


Yes of course, but it was the 'standard' part of your response that
interested me.



Key-value tuples as given by other respondents ((locale ca)(lang
fr)(user-data "paul" "users")), use read to read the list of key-value
pairs, (with-output-to-file "properties" write to write it.

(define property-list (with-input-from-file "properties" read))

...

(with-output-to-file "properties" (write property-list))

And to perform lookup, (let ((value-list (assq 'locale property-list)))
...)

Your first value would be (cadr value-list), the third (caddr
value-list) and so on.  (car value-list) holds the matching lookup
key.

An alternative would be to use lists of pairs ((locale . en)(lang .
fr)).  The only difference is that you use cdr to address the value,
not car.  Remember that '(a b c) is exactly the same as '(a . (b c)),
so you can mix both notations in the same list as long as your
software (and anyone who edits the list by hand) knows which form to
use for a given property.

To update, use something like this:

(define my-age 64)
...
(let ((value-list (assq 'age property-list)))
  (set-cdr! value-list (list my-age)))

To delete an entry, use SRFI-1 delete or delete! (normally you'd use
eq? as a comparison operator for this, to compare by keyword).

(delete! 'lang property-list (lambda (key value-list) (eq? key (car
value-list

If your keys can't be represented as symbols, surround them in string
quotes and use assoc rather than assq.

An association list can contain any serializable Scheme data,
including other association lists.

For very large collections of keyed data that you will need to lookup
frequently, consider using SRFI-69 hash tables for the internal
representation.  Procedures alist->hash-table and hash-table->alist
are provided for this purpose.  This kind of heavy duty tool shouldn't
be needed for normal property lookups, however.


Thank you very much Tony.
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re : [Chicken-users] idiomatic/usual way of file-based configuration in Scheme

2007-02-06 Thread minh thu

2007/2/6, Kon Lovett <[EMAIL PROTECTED]>:

On Feb 6, 2007, at 2:49 AM, Mario Domenech Goulart wrote:

> Hello Thu,
>
> On Tue, 6 Feb 2007 10:52:36 +0100 "minh thu" <[EMAIL PROTECTED]> wrote:
>
>> I was wondering if there was something like Java's properties files
>> that is commonly used in Scheme. (The reference to Java is because I
>> learned it, not because I like it :)
>>
>> It would just amount to read a list of key/value pairs in Scheme
>> syntax. Or maybe a triple if the type is given.
>>
>> What do you use ?
>
> A simple approach would be dumping the representation of scheme
> objects (e.g., lists) to a file:
>
>   csi> (define my-list '((1 2 3) (4 5 6) ("a" "b" "c")))
>   csi> (with-output-to-file "my-file" (lambda () (pp my-list)))
>   csi> (with-input-from-file "my-file" read)
>   ((1 2 3) (4 5 6) ("a" "b" "c"))
>
> There is also the s11n egg:
> http://www.call-with-current-continuation.org/eggs/s11n.html
>
> PS: I don't know what Java's properties files are, I considered the
> second paragraph from your message.
>
> Best wishes,
> Mario

Take a look at the SRFI-29 egg.


Although I was not asking about for l10n issue, it might become handy.
Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] idiomatic/usual way of file-based configuration in Scheme

2007-02-06 Thread minh thu

Hi folks,

I was wondering if there was something like Java's properties files
that is commonly used in Scheme. (The reference to Java is because I
learned it, not because I like it :)

It would just amount to read a list of key/value pairs in Scheme
syntax. Or maybe a triple if the type is given.

What do you use ?

Thanks,
thu


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


  1   2   >