Re: [Chicken-users] http server example question

2008-03-03 Thread Jim Ursetto
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.

Check out trunk if you can, otherwise I will release a new version.

On 2/28/08, minh thu <[EMAIL PROTECTED]> wrote:
> 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 mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Error building universal on 10.5

2008-03-03 Thread Jim Ursetto
On 2/29/08, Greg <[EMAIL PROTECTED]> wrote:
> On Feb 29, 2008, at 7:45 PM, Heinrich Taube wrote:
> > export MACOSX_DEPLOYMENT_TARGET=10.4
> > make PLATFORM=macosx ARCH=universal

> Thanks! That fixed it. Shouldn't this then be added to the OS X
> Makefile? I don't know if any of chicken's maintainers read this
> list...

It's in the README, in the universal build section.  Quote:
-
On Leopard (10.5), an extra step is required before `make':

   export MACOSX_DEPLOYMENT_TARGET=10.4
   make PLATFORM=macosx ARCH=universal
-

Jim


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


Re: [Chicken-users] INI files in Scheme? (or something similar)

2008-03-03 Thread Mario Domenech Goulart
Hi Hans,

On Mon, 03 Mar 2008 20:22:11 -0500 Hans Nowak <[EMAIL PROTECTED]> wrote:

> Is there a "standard" way to do INI files (or similar kinds of
> initialization files, ala .bashrc etc) in Scheme?  For example,
> something like this:
> 
> [config.ini]
> --->8---
> [Keys]
> Developer=INSERT_DEV_ID
> Application=INSERT_APP_ID
> Certificate=INSERT_CERT_ID
> 
> [Server]
> ; This is for the development sandbox
> URL=api.sandbox.foobar.com
> Directory=/ws/api.dll
> 
> [Authentication]
> ; blah blah blah
> Token=INSERT_USER_TOKEN
> --->8---
> 
> 
> I understand that this could easily be done in Scheme itself, e.g.
> 
> (define developer INSERT_DEV_ID)
> (define url "api.sandbox.foobar.com")

Another approach would be translating the .ini syntax to Scheme, and
having a program to read the conf file as a list:

,[ config.ini ]
| (keys
|  (developer "INSERT_DEV_ID")
|  (application "INSERT_APP_ID")
|  (certificate "INSERT_CERT_ID"))
| 
| (server
|  (url "api.sandbox.foobar.com")
|  (directory "/ws/api.dll"))
| 
| (authentication
|  (token "INSERT_USER_TOKEN"))
`

,[ config-reader.scm ]
| (define conf-file "config.ini")
| 
| (define read-conf
|   (let ((data #f))
| (lambda ()
|   (unless data
| (set! data (with-input-from-file conf-file read-file)))
|   data)))
| 
| (define (conf-section section)
|   (alist-ref section (read-conf)))
| 
| (define (conf-item section item #!optional default)
|   (cond ((alist-ref item (conf-section section))
|  => (lambda (i) (car i)))
| (else default)))
|   
| (print (conf-item 'server 'url))
`

Or using parameters:

,[ config.ini ]
| (conf:keys-application "something")
`

,[ config-reader.scm ]
| (define conf-file "config.ini")
| (define conf:keys-developer (make-parameter "INSERT_DEV_ID"))
| (define conf:keys-application (make-parameter "INSERT_APP_ID"))
| ;; ... other defaults here
| 
| (load conf-file)
| 
| (print (conf:keys-application))
`


Of course, there are many other ways.

Best wishes,
Mario


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


Re: [Chicken-users] INI files in Scheme? (or something similar)

2008-03-03 Thread Shawn Rutledge
On Mon, Mar 3, 2008 at 6:22 PM, Hans Nowak <[EMAIL PROTECTED]> wrote:
>  Is there a "standard" way to do INI files (or similar kinds of initialization
>  files, ala .bashrc etc) in Scheme?  For example, something like this:

My first idea would be put an alist in the conf file:

((developer . dev_id)
 (application . app_id) ... )

then to get the values, write a function like this:

(define conf-or-default #f)
(let ([alist #f])
  (set! conf-or-default (lambda (key default)
(unless alist (... read the file into alist ...))
(let ([ret (assq alist key)])
   (if (pair? ret) (cdr ret) default

It can read the whole file the first time it is needed, in one swoop,
and expect that it has only one s-expression in it.  (Sorry if there
are any mistakes, I didn't test it)

>  I understand that this could easily be done in Scheme itself, e.g.
>
>  (define developer INSERT_DEV_ID)
>  (define url "api.sandbox.foobar.com")

It depends whether you can think of any use cases for the user to
write some code in this file as well as just defining values.  That
can be quite useful: e.g. the user could write callbacks for some
events that your app exposes, just like JavaScript allows the web page
author to do this; and also dangerous: the user can use set! to
redefine variables that your app depends on, and create arbitrary
bugs.  But you can mitigate that by loading the config file inside a
restricted environment, so that some things can be redefined and some
not.  You are comparing to .bashrc, which can do both (set environment
variables and also execute arbitrary code).

Either way, it's possible to avoid parsing the conf file line-by-line, at least.


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


Re: [Chicken-users] INI files in Scheme? (or something similar)

2008-03-03 Thread Jean-Philippe Theberge

Hi,

I use parameters for this kind of stuff

(Developer "INSERT_DEV_ID")
(Application "INSERT_APP_ID")
(Certificate "INSERT_CERT_ID")

see: http://www.call-with-current-continuation.org/eggs/miscmacros.html

Hans Nowak wrote:


Hi,

Is there a "standard" way to do INI files (or similar kinds of 
initialization files, ala .bashrc etc) in Scheme?  For example, 
something like this:


[config.ini]
--->8---
[Keys]
Developer=INSERT_DEV_ID
Application=INSERT_APP_ID
Certificate=INSERT_CERT_ID

[Server]
; This is for the development sandbox
URL=api.sandbox.foobar.com
Directory=/ws/api.dll

[Authentication]
; blah blah blah
Token=INSERT_USER_TOKEN
--->8---


I understand that this could easily be done in Scheme itself, e.g.

(define developer INSERT_DEV_ID)
(define url "api.sandbox.foobar.com")

...and all that, but is that a common way to do it?  If not, what is?  
(I didn't see any eggs dealing with this issue.)


Thanks,

--Hans



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





--
BuddyPilots 
*Jean-Philippe Théberge*
*Programmeur Architecte*
Tel: (514) 353-2307





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


[Chicken-users] INI files in Scheme? (or something similar)

2008-03-03 Thread Hans Nowak


Hi,

Is there a "standard" way to do INI files (or similar kinds of initialization 
files, ala .bashrc etc) in Scheme?  For example, something like this:


[config.ini]
--->8---
[Keys]
Developer=INSERT_DEV_ID
Application=INSERT_APP_ID
Certificate=INSERT_CERT_ID

[Server]
; This is for the development sandbox
URL=api.sandbox.foobar.com
Directory=/ws/api.dll

[Authentication]
; blah blah blah
Token=INSERT_USER_TOKEN
--->8---


I understand that this could easily be done in Scheme itself, e.g.

(define developer INSERT_DEV_ID)
(define url "api.sandbox.foobar.com")

...and all that, but is that a common way to do it?  If not, what is?  (I didn't 
see any eggs dealing with this issue.)


Thanks,

--Hans



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


Re: chicken literary spoofs (was: Re: argument against using '() for null values? ([Chicken-users] DBI))

2008-03-03 Thread Elf

On Mon, 3 Mar 2008, Shawn Rutledge wrote:


On Mon, Mar 3, 2008 at 2:40 PM, Graham Fawcett <[EMAIL PROTECTED]> wrote:

 Fortunately, Chicken Literary and his friends visited the fox, Henry
 Baker, who reminded them that their stacks are GC'd frequently. All
 was well again in Chicken Literary Land!

 But when he added that function-calls never return, Chicken Literary
 and friends lapsed into an existential stupor. And Henry the Fox ate
 them.


You handled the continuation very well, congratulations.  Not a very
happy ending though.  After (eat ...) I suppose the return value is
undefined, isn't it...



nah, its not undefined.  there is no return value, remember?  and the 
continuation is clearly 'eat -> burp -> digest'


-elf


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


Re: chicken literary spoofs (was: Re: argument against using '() for null values? ([Chicken-users] DBI))

2008-03-03 Thread Shawn Rutledge
On Mon, Mar 3, 2008 at 2:40 PM, Graham Fawcett <[EMAIL PROTECTED]> wrote:
>  Fortunately, Chicken Literary and his friends visited the fox, Henry
>  Baker, who reminded them that their stacks are GC'd frequently. All
>  was well again in Chicken Literary Land!
>
>  But when he added that function-calls never return, Chicken Literary
>  and friends lapsed into an existential stupor. And Henry the Fox ate
>  them.

You handled the continuation very well, congratulations.  Not a very
happy ending though.  After (eat ...) I suppose the return value is
undefined, isn't it...


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


Re: chicken literary spoofs (was: Re: argument against using '() for null values? ([Chicken-users] DBI))

2008-03-03 Thread Graham Fawcett
On Mon, Mar 3, 2008 at 4:00 PM, Shawn Rutledge
<[EMAIL PROTECTED]> wrote:
> Chicken Literary is all in a panic that the stacks are falling.

lol!

Fortunately, Chicken Literary and his friends visited the fox, Henry
Baker, who reminded them that their stacks are GC'd frequently. All
was well again in Chicken Literary Land!

But when he added that function-calls never return, Chicken Literary
and friends lapsed into an existential stupor. And Henry the Fox ate
them.

G


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


Re: chicken literary spoofs (was: Re: argument against using '() for null values? ([Chicken-users] DBI))

2008-03-03 Thread Shawn Rutledge
Chicken Literary is all in a panic that the stacks are falling.


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


Re: [Chicken-users] record-type-name in SRFI-9

2008-03-03 Thread felix winkelmann
On Mon, Mar 3, 2008 at 4:17 PM, Peter Danenberg <[EMAIL PROTECTED]> wrote:
> > Does SRFI-9 specify it? I can't find any reference.
>
>  Under "accessors for record types," Felix, the implementation defines
>  it along with record-type-field-tags; is the implementation
>  non-binding?

The SRFI specifies only the "define-record-type" syntax - at least
that's how I read it.


cheers,
felix


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


Re: [Chicken-users] record-type-name in SRFI-9

2008-03-03 Thread Peter Danenberg
> Does SRFI-9 specify it? I can't find any reference.

Under "accessors for record types," Felix, the implementation defines
it along with record-type-field-tags; is the implementation
non-binding?

We all severely lament your departure, by the way.


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


Re: [Chicken-users] Syntax of case expressions

2008-03-03 Thread Alaric Snell-Pym


On 3 Mar 2008, at 12:33 pm, Tobia Conforto wrote:


LOL at the S combinator, the most obscure invention of computer
science (or was it lambda calculus?) to date.  I've never fully
understood it.


Ah, that's easy...

The idea of combinators, as I understand it, is that you can get rid
of lambdas by rewriting them all into applications of a small set of
basic constant lambdas, which are then known as combinators.

There's a few sets of basic combinators you can work with, but IIRC
the S/K/I set is popular, although I vaguelly recall you can get by
with just two.

Now, this stuff all applies to the *pure* lambda calculus, where the
only type is a closure, and syntax consists merely of lambdas,
symbols that refer to things bound by lambdas, and applications.

We can define S, K, and I as:

(define (I x) x)
(define (K x y) x)
(define (S x y z) (x z (y z)))

Well, pure lambda calculus has only single-arg lambdas, and you
curry, so that's really:

(define ((K x) y) x)
(define (((S x) y) z) (x z (y z)))

Ah yes, you can define I interms of K and S:

(define I ((S K) K))

((S K) K) = (lambda (z) ((K z) (K z)))

((K z) (K z)) = z (by the definition of K). So ((S K) K) = (lambda
(z) z) = I.

"combinator" seems to have come to mean any function whose arguments
are all functions, I gather.

The rest gets hairy, but any lambda expression can, it appears, be
turned into a string of Ss and Ks.

http://en.wikipedia.org/wiki/K_combinator#Completeness_of_the_S-K_basis

http://en.wikipedia.org/wiki/SKI_combinator_calculus

But it implies that any program can be rewritten as a bunch of Ss and
Ks, with nesting of parantheses as required.

This has been (ab)used to produce a fantastically unpleasant
language, Unlambda:

http://en.wikipedia.org/wiki/Unlambda

Here is a typical Unlambda program:

`r```.H.e.l.l.o. .w.o.r.l.di

That's Hello World, in case you'd not guessed.

"Unlambda's one flow control construction is call with current
continuation, denoted c"

Heheheh. Feeling ill yet?


Anyways, I was joking.


Oh, good ;-)


A shortest code programming contest, on the other hand...


If scored on shortness and clarity - let's call the combination
"conciseness" - I'm all up for that :-)



Tobia




ABS

--
Alaric Snell-Pym
Work: http://www.snell-systems.co.uk/
Play: http://www.snell-pym.org.uk/alaric/
Blog: http://www.snell-pym.org.uk/?author=4




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


Re: [Chicken-users] Syntax of case expressions

2008-03-03 Thread Tobia Conforto

Alaric Snell-Pym wrote:
it'd be too easy: Start by (set! ...)ing a load of common globals   
to other things in an ever-shifting sea of misleading bindings,  
define a macro called + that implements the S combinator in some  
bizarre way, bind "quote" to a function so "'a" means something  
quite odd, etc, etc...


LOL at the S combinator, the most obscure invention of computer  
science (or was it lambda calculus?) to date.  I've never fully  
understood it.


Anyways, I was joking.
A shortest code programming contest, on the other hand...


Tobia


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


Re: [Chicken-users] RFC: stable/unstable release cycles for eggs?

2008-03-03 Thread felix winkelmann
On Sun, Mar 2, 2008 at 12:48 PM, Alejandro Forero Cuervo
<[EMAIL PROTECTED]> wrote:
>
>  Felix, do you think it would address the need that originally prompted
>  you to change the layout of the chicken-eggs repository?

This doesn't look so bad.


cheers,
felix


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


Re: [Chicken-users] Syntax of case expressions

2008-03-03 Thread Alaric Snell-Pym


On 3 Mar 2008, at 12:11 am, Tobia Conforto wrote:


PS: we need an Obfuscated Scheme Contest



No!!

Anyway, it'd be too easy: Start by (set! ...)ing a load of common
globals  to other things in an ever-shifting sea of misleading
bindings, define a macro called + that implements the S combinator in
some bizarre way, bind "quote" to a function so "'a" means something
quite odd, etc, etc...

ABS

--
Alaric Snell-Pym
Work: http://www.snell-systems.co.uk/
Play: http://www.snell-pym.org.uk/alaric/
Blog: http://www.snell-pym.org.uk/?author=4




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


Re: [Chicken-users] record-type-name in SRFI-9

2008-03-03 Thread felix winkelmann
On Mon, Mar 3, 2008 at 6:53 AM, Peter Danenberg <[EMAIL PROTECTED]> wrote:
> I'm trying to dispatch on SRFI-9 record types; and I notice that
>  although SRFI-9 provides record-type-name, chicken doesn't export it.

Does SRFI-9 specify it? I can't find any reference.

>
>  Short of abusing cond, it seems like my only option is the
>  non-standard define-record-printer combined with an
>  with-output-to-string hack; do you concur?

Non-standard in any case, but you can get the type name
(a symbol) like this:

(define (get-record-type-name rcrd) (##sys#slot rcrd 0))


cheers,
felix


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


Re: [Chicken-users] benchmark mode misteries

2008-03-03 Thread felix winkelmann
On Sat, Mar 1, 2008 at 9:20 AM, Michele Simionato
<[EMAIL PROTECTED]> wrote:

>  I am just curious to know which optimization I am breaking and
>  why the compiler cannot be smart enough. Any idea?

In the first case, the compiler can see that all references to fac
are call sites: the value of "fac" is only used in positions where
the compiler can be absolutely sure it is a call. In the second case
the value of fac is passed to "call" (and the compiler is not clever
enough to trace the value through the execution of "call" - this
would need flow analysis). So in the first case, a specialized
representation of fac can be used ("direct" lambdas, i.e. direct-style
calls which are very fast).

Compiling with "-debug o" and/or "-debug 7" can also be very instructive.


cheers,
felix


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