[Chicken-users] Question about forks, pipes and sigchld handling

2012-10-03 Thread Peter Bex
Hi all,

I'm trying to figure out the behavior of process-fork and the
handling of signal/chld (SIGCHLD).  Here's a simple program
which simply sets up a pipe and forks.  The parent process reads
from the pipe, the child writes to it.


(use posix)

#;(set-signal-handler! signal/chld void)

(receive (in out)
  (create-pipe)
  (process-fork (lambda ()
  (file-close in) ; close receiving end
  (with-output-to-port (open-output-file* out)
(lambda ()
  (display hello, world\n)
  ;; If we don't use exit, buffers are discarded by _exit
  (exit)
  (file-close out) ; close sending end
  (pp (read-lines (open-input-file* in


This program works just fine and prints (hello, world).
If I uncomment the signal handler code (which should just be a no-op),
it hangs.  I don't understand the reason for this.  Could anyone
enlighten me as to what's happening here?

Cheers,
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

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


Re: [Chicken-users] Question about forks, pipes and sigchld handling

2012-10-03 Thread Peter Bex
On Wed, Oct 03, 2012 at 06:21:45PM +0200, Peter Bex wrote:
 Hi all,
 
 I'm trying to figure out the behavior of process-fork and the
 handling of signal/chld (SIGCHLD).  Here's a simple program
 which simply sets up a pipe and forks.  The parent process reads
 from the pipe, the child writes to it.

[program elided]

 This program works just fine and prints (hello, world).
 If I uncomment the signal handler code (which should just be a no-op),
 it hangs.  I don't understand the reason for this.  Could anyone
 enlighten me as to what's happening here?

Turns out this was a bug in Chicken core's handling of EINTR in getc()
calls: 
http://lists.nongnu.org/archive/html/chicken-hackers/2012-10/msg00010.html

Cheers,
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

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


[Chicken-users] [ANN] New egg for SCSH process notation

2012-10-03 Thread Peter Bex
Hi everyone,

As most of you know, we had a Chicken meetup in the UK, which was great fun.
Thanks to Alaric and Sarah for their hospitality and the great food!

During this meetup I wrote a reimplementation of SCSH's UNIX process
notation macros for Chicken.  This has now been released as an egg.
It is fully documented at http://wiki.call-cc.org/eggref/4/scsh-process

This code is pretty much a quick hack and I'm sure there are lots of
bugs in it, so beware!  While working on it I've also found two bugs
in Chicken's posix unit related to interrupted system calls, which may
cause problems with this egg.  If you encounter strange issues, consider
running the testsuite and perhaps applying the patches I posted to the
chicken-hackers mailinglist.

Suggestions are welcome, especially related to threading and process
reaping.  Currently threading isn't really supported as it can interfere
with the proper functioning of child processes.  Process reaping is a
massive hack which looks like it works well enough, for now.

Cheers,
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

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


Re: [Chicken-users] chicken-4.8.0rc3, check : invalid encoded literal format - execution terminated

2012-09-13 Thread Peter Bex
On Wed, Sep 12, 2012 at 09:38:04PM -0400, Claude Marinier wrote:
 uname -a
 Linux hibou 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686 GNU/Linux

Hi Claude,

Did you install Chicken before running make check?

Cheers,
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

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


Re: [Chicken-users] profile data: calls too high

2012-09-13 Thread Peter Bex
On Wed, Sep 12, 2012 at 09:12:55PM -0400, Claude Marinier wrote:
 Hi,

Hi Claude,

 I am new to profiling. I am surprized by the high count of the first
 function in the table: make-date. When I grep for make-date, it confirms
 that it appears in only one file. I have attached this file. From this, I
 expect make-date to be called as often as time-stamp and make-time which
 are called three times.

Which version of Chicken is this?  IIRC, 4.7.0 is known to produce bogus
profiles.

Cheers,
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

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


Re: [Chicken-users] nested definitions

2012-09-05 Thread Peter Bex
On Wed, Sep 05, 2012 at 02:12:31PM -0700, Andy Coolware wrote:
 Hi,

Hi Andy,

  (define ((A)) 1)
 #void
  A
 #procedure:A
  (A)
 #procedure
  ((A))
 1
 
 For my taste, a lot of happen here besides defining A. Scheme somehow
 is able to figure out and destruct A from ((A)) in order to make it
 possible. Interestingly enough:
 
 http://schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-8.html#%_sec_5.2
 does not seem to cover that case.

Indeed, because this is a nonstandard Chicken extension.
This is documented in the manual, here:
http://wiki.call-cc.org/man/4/Extensions%20to%20the%20standard#curried-definitions

 So my question is, what really happens here?

It's a generalisation of the idea that
(define (x) ...) is shorthand for (define x (lambda () ...)).
(define ((x)) ...) is shorthand for (define x (lambda () (lambda () ...)))

(x) looks just like an application would look at a call
site, ((x)) is also what a full call would look like.

Cheers,
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

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


[Chicken-users] [SECURITY] Inconsistent NUL byte handling

2012-09-03 Thread Peter Bex
Hello Chicken users,

Recently a vulnerability was found in some of Chicken's string processing
code.  As you know, NUL bytes are representable by Scheme strings, but
not by C strings (where they are treated as terminators).  This mismatch
is properly handled by the FFI by throwing an exception when it finds
embedded NUL bytes.

Most of Chicken's internal code either uses the FFI or the underlying
procedure that performs this check.  However, in a few places this didn't
happen.  Notably the standard R5RS file procedures do not check for
embedded NUL bytes.  The list of affected procedures is as follows:

- From unit posix:
* process
* process-execute
* process-run
* get-environment-variable (via C_get_environment_variable)
- From unit library:
* system (via C_execute_shell_command)
* ##sys#message (via C_message)
* string-number (via C_a_i_string_to_number)
* ##sys#open-file-port (via C_open_file_port) and its clients:
   - open-input-file
   - open-output-file
   - call-with-input-file and its clients:
   - include
   - load
   - read-file (from extras)
   - read-all (from utils)
   - with-input-from-file
   - call-with-output-file and its clients:
   - create-temporary-file (from files)
   - with-output-to-file

If you are using any of these procedures or the underlying C procedures,
you might be vulnerable to a poisoned NUL byte attack.  The fix is to
either check manually in your program for embedded NUL bytes or apply
git revision d9f2ad87b42f.  This patch is also available in 4.8.0rc3
(but not rc2!) and will make it into the final 4.8.0 release.

Finally, ##sys#halt is affected too, but only under Windows in GUI mode.
This is currently unpatched.  ##sys#halt will halt the process,
displaying a message, so abuse of this procedure is extremely unlikely
(it can result in truncated error messages).  After the release, we will
try to come up with a more complete approach to fixing these problems.

Kind regards,
The Chicken Team

References
--
http://www.phrack.org/issues.html?issue=55id=7#article
http://www.ouah.org/nullbyte.html

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


Re: [Chicken-users] [ANN] New egg: dummy-user

2012-09-03 Thread Peter Bex
On Mon, Sep 03, 2012 at 11:20:15AM -0600, Matt Gushee wrote:
 Hello, all--

Hi Matt!

 Well, here's my first egg. It wasn't going to be: I am developing an egg
 that provides a framework for interactive command-line programs. But I
 realized in order to test that egg, I'd need a way to simulate user input.
 Hence ... dummy-user!

Cool :)

 And if the powers that be would be so kind as to add my little egg to the
 list ... the code is on GitHub; here's the location of the release info
 file.

I've added it.  This means it should appear for download by chicken-install
within the hour, I think.

Cheers,
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

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


Re: [Chicken-users] Trouble loading source file in csi

2012-08-26 Thread Peter Bex
On Sat, Aug 25, 2012 at 02:47:33PM -0600, Matt Gushee wrote:
  I am developing a chicken library, and attempting to perform some
  rudimentary tests in csi as I go. However, when I try to load the file
 
(load text-menu.scm)
 
  I get the following error:
 
  :   ; loading text-menu.scm ...
  :
  :Error: history entry index out of range: 0
 
 
 Apparently the problem was that I wrote '#' instead of '#f' in a couple of
 places. So the REPL did right to catch my error. I'd still be interested to
 know why the file would load without error (and seemingly function
 normally)

Hi Matt,

The reason it accepts this is that #n is special reader syntax in the
interpreter which means give me the nth expression's result value.
Example:

$ csi -q
#;1 (+ 1 2)
3
#;2 (+ #1 7)
10
#;3 (+ #2 2)
12

So it's the number printed in the prompt, which can always be used
to recall the result value of the expression typed at that particular
prompt.  (this is also why the number doesn't increase when the
expression causes an error -- it never returned anything, so the
prompt's numbered expression got no value)

A lone hash in Chicken seems to return the previous expression's
value (I didn't know about this either):

#;4 #
12

This is of course also documented.
See http://wiki.call-cc.org/man/4/Using%20the%20interpreter#history-access
for more info.  I hope this clarifies this strange behaviour :)

Cheers,
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

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


Re: [Chicken-users] can't get phoghorn running

2012-08-21 Thread Peter Bex
On Tue, Aug 21, 2012 at 01:47:55PM +0200, Markus Klotzbuecher wrote:
 Now when browse to localhost:8080/galleries/ I see the contexts of
 index.ssp (apparently as a result of executing index.sspx)

You'll need to wrap that code in whatever you've set ssp-long-open-tag
and ssp-close-tag to.  By default ?scheme ... ?

Please note that the ssp and web-scheme handlers are deprecated.
If you still want to use these, I can put them in a separate egg, but
otherwise they will disappear in the next release.

Cheers,
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

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


Re: [Chicken-users] can't get phoghorn running

2012-08-20 Thread Peter Bex
On Mon, Aug 20, 2012 at 10:11:04PM +0200, Markus Klotzbuecher wrote:
 Hi All,
 
 I would like to try the phoghorn image gallery generator, but I just
 can't get the egg compiled. It fails because it can't find the epeg
 library and epeg-config. I can't find it either, not as a debian
 package nor as sources on the net.
 
 Is the epeg code still developed?

No, epeg is dead, even more dead than imlib2.  I think the current
replacement library from the E project for both these libraries
is the evas library.  I had plans to convert phoghorn to evas
someday (and make an evas egg), but I don't currently use phoghorn
anymore.

 From looking at the phoghorn code it seems that imlib2 is also
 supported. Could it be used with the latter only?

I think you could easily hack out the epeg bits; imlib2 supports
jpeg as well, I think.

Cheers,
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

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


[Chicken-users] [ANN] Chicken at T-DOSE 2012

2012-08-08 Thread Peter Bex
Hello everyone,

I'm pleased to announce that Chicken will be represented once again
at T-DOSE (Technical Dutch Open Source Event), the Netherlands.
Our booth request was accepted today!

This year's event will be held the 27th and 28th of October, at the
usual location; the Fontys University of Applied Sciences in Eindhoven.
Anyone who happens to be there is invited to drop by and talk Chicken
with us!

For more information, see http://www.t-dose.org/ (no schedule yet)


Let me close with a friendly reminder:

Several people from the Chicken community will also be present at
Quasiconf, the Lisp subconference at this year's FrOSCon in
St. Augustin, Germany on August 25th  26th.
See http://quasiconf.twoticketsplease.de/ for details about Quasiconf
and http://www.froscon.org/ about the FrOSCon conference in general.

Another great opportunity to meet some Chicken fans will be at the
Chicken UK meeting, at Alaric's home in Gloucester, from September 28
until the 1st of October.
See http://wiki.call-cc.org/event/chicken-uk-2012 for more information.
I'm sure Alaric will appreciate it if you could let him know in advance
if you'll be there.

Cheers,
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

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


Re: [Chicken-users] ANN: Lowdown, a pure Chicken Markdown parser

2012-08-06 Thread Peter Bex
On Mon, Aug 06, 2012 at 04:40:44PM -0300, Stephen Eilert wrote:
 Cool!
 
 I must apologize, btw. I was written something that required a Markdown
 parser and I didn't feel like going on this huge detour to write a Markdown
 parser in Scheme, so I just used the Discount library and that's it.

That's perfectly fine.  Writing a parser yourself is a lot of work, and
you probably had bigger fish to fry at the time.  Remember, Chicken is 
*practical* Scheme system.  We get shit done around here!

 And reading and emitting strings is actually a nicer interface than what you'd
 normally write with Discount - took me a while to backtrack and redo it, it
 was going to be something much more complex to begin with.
 
 In any case, I am not to sad to see the Discount egg die. Give it an
 horrible death.

If this is how you feel about the egg, I think it's probably a good idea
to change its category to deprecated, and put a note on the wiki page
pointing people to the lowdown egg.  This provides some transparency
about the egg's status, and guides people's expectations.

Cheers,
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

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


Re: [Chicken-users] ANN: Lowdown, a pure Chicken Markdown parser

2012-08-05 Thread Peter Bex
On Sun, Aug 05, 2012 at 07:27:48PM +0200, Moritz Heidkamp wrote:
 Fellow Chickeneers,
 
 yesterday I released the first version of Lowdown, a Markdown parser
 written in pure Chicken Scheme. The only other Markdown parser egg we
 had so far, discount, requires the corresponding C library and can only
 read and emit strings. Lowdown doesn't have any foreign dependencies,
 can read from strings or input ports (well, any lazy-seq of chars,
 really) and emits SXML.

So it's parens all the way (low)down  Great work, Moritz!

 It passes all 22 tests of MarkdownTest version
 1.0.3. I also started implementing a very basic extension API but that's
 not ready for public consumption, yet. For more information, check the
 documentation at the usual place: http://wiki.call-cc.org/eggref/4/lowdown

Unlike the discount parser (and the original Markdown.pl for that matter)
 it passes all 22 tests of the MarkdownTest suite

And I seem to recall you mentioned it's faster than the original
Markdown.pl too.  Man, those guys are probably crapping their pants now.
Perl, whipped by Scheme at its own game of text processing :)

Cheers,
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

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


Re: [Chicken-users] Printing procedures returned from call/cc

2012-07-31 Thread Peter Bex
On Tue, Jul 31, 2012 at 03:24:16PM +0200, Thomas Chust wrote:
 On Tue, 31 Jul 2012, Jeronimo Pellegrini wrote:
 I was wondering why this happens in Chicken (recent checkout from git):
 
 (let ((lst (call/cc (lambda (x)
  (print 'something)
  (call/cc (lambda (y)
 (list x y)))
  (print lst)
  (print (eq? (car lst) (cadr lst)))
  (print (eqv? (car lst) (cadr lst)))
 
 this is really strange!
 
 Since the second lambda expression is in tail position with respect to the
 first, the two continuations x and y are actually equivalent, so at first
 I was less surprised by their printed representation than by the results
 of the equality predicates.

Same here.  I think what we're seeing here is the same procedure but
different closure objects (one has access to 'x', the other to 'y').
Only the procedure name is printed.

Cheers,
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

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


Re: [Chicken-users] Neophyte in scheme: string-split not quite what I want

2012-07-20 Thread Peter Bex
On Fri, Jul 20, 2012 at 03:05:39PM +0400, Дмитрий wrote:
 Hello.
 
 Does IrRegex support Unicode character classes?

Generally, it does and there are at least a few tests for these.
However, I've never worked with these kinds of characters myself,
so I don't know how well they're supported. The docs also explicitly
have a warning that case insensitive matches do not work for non-ASCII
characters, so YMMV.

 E.g. Will IrRegex consider accented letters (á) or Cyrillic letters (я) as 
 alpha? Wil IrRegex consider Chinese wide space ( ) as space? Will IrRegex 
 consider Chinese brackets (「」【】) as punct?

No, almost all of the named character classes are ASCII only.

 If it doesn't, the regexp is going to be EXTREMELY messy [in fact, I believe 
 it may better to build such a regexp automatically then].

There are a few (undocumented?!) helper character classes like
utf8-tail-char, utf8-2-char, utf8-3-char and utf8-4-char.  See the source
for details.

I don't know what Alex's plan is for UTF8 support, but if you're willing
to put in the effort to define character classes for the ranges you
mentioned, possibly you could contribute them to the (upstream) irregex
project.  If the definition of these sets are big, maybe we could turn it
into an optional add-in library.

 I’m on Windows, so I can’t check it (when I use UTF-8 console via chcp 65001, 
 for some reason Chicken seems to fail on every string with operation 
 non-ascii string — even on a simple (display Привет)).

This could be due to terminal and locale settings.

Cheers,
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

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


Re: [Chicken-users] 500 eggs!

2012-06-14 Thread Peter Bex
On Thu, Jun 14, 2012 at 07:49:01PM +0200, Peter Bex wrote:
 Here are some additional figures for all you number freaks:
 
 430 eggs are hosted at code.call-cc.org (svn)
  38 eggs are hosted at github.com (git)
  21 eggs are hosted at bitbucket.org (git: 5, hg: 15)

Sorry, 16 eggs in hg, not 15.  That's a silly manual addition error :)

Cheers,
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

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


[Chicken-users] [SECURITY] Buffer overrun vulnerability in Chicken's scheduler

2012-06-11 Thread Peter Bex
Hello Chicken users,

Recently a buffer overrun error was discovered in Chicken's thread
scheduler.  This buffer overrun is triggered on UNIX-like OSes when a
file descriptor with an integer value higher than FD_SETSIZE gets
opened due to the way the POSIX select() function is currently being
used.

Every Chicken program which accepts a potentially unlimited number of
incoming network connections or otherwise opens an unlimited number of
file descriptors is potentially vulnerable to an application crash.

Currently a patch is being developed.  In the meanwhile an effective
workaround is to limit the maximum number of open descriptors using
the Unix ulimit -n command.

Please verify the maximum number of descriptors supported safely by
Chicken by compiling following one-line program using csc and then
running the resulting binary:

(print (foreign-value FD_SETSIZE int))

Simply ensure that the programs you want to protect run under a maximum
number of open files ulimit that matches this number (or lower).

lease note that this bug also affects people using the
high-load-scheduler egg, which provides an alternative scheduler
implementation.

On Windows, there is no buffer overrun danger, but there is a potential
problem of threads never waking up; there is currently no known
workaround for this.

References
--

https://lists.ubuntu.com/archives/ubuntu-devel/2010-September/031446.html
http://sourceware.org/bugzilla/show_bug.cgi?id=10352
http://pubs.opengroup.org/onlinepubs/007908799/xsh/poll.html
http://netbsd.gw.com/cgi-bin/man-cgi?select++NetBSD-current

Kind regards,
The Chicken team

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


Re: [Chicken-users] [SECURITY] Buffer overrun vulnerability in Chicken's scheduler

2012-06-11 Thread Peter Bex
On Mon, Jun 11, 2012 at 12:33:28PM +0200, Peter Bex wrote:
 Currently a patch is being developed.  In the meanwhile an effective
 workaround is to limit the maximum number of open descriptors using
 the Unix ulimit -n command.

For those feeling adventurous, please test the attached patch.  We are
currently debating whether it should be applied, but unsure because
there could be some potential portability problems with it as well as
the fact that it's a reasonably large change to a core component of
Chicken which is pretty subtle.

It would be especially useful if people using anything *other* than
Linux or BSD could report back success or failure.

Cheers,
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
From 52e581254a713daa2f19693108af35a859ec7ebd Mon Sep 17 00:00:00 2001
From: Peter Bex peter@xs4all.nl
Date: Fri, 8 Jun 2012 22:08:40 +0200
Subject: [PATCH] Fix scheduler so it can handle file descriptors over
 FD_SETSIZE (which occurs in practice on systems where
 ulimit -n has a higher value)

---
 NEWS  |1 +
 scheduler.scm |   98 ++--
 2 files changed, 60 insertions(+), 39 deletions(-)

diff --git a/NEWS b/NEWS
index 7ec6431..725dddc 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@
   - on 64-bit machines the random procedure no longer truncates result
 values (which caused very nonrandom results for very large values).
 Note that random shouldn't be used for security-critical code.
+  - Fixed select()-calls to accommodate more than FD_SETSIZE open files.
 
 - Build system
   - version information has been moved into a separate unit to make the
diff --git a/scheduler.scm b/scheduler.scm
index e3a96bc..c28ed16 100644
--- a/scheduler.scm
+++ b/scheduler.scm
@@ -31,9 +31,8 @@
   (hide ready-queue-head ready-queue-tail ##sys#timeout-list
##sys#update-thread-state-buffer ##sys#restore-thread-state-buffer
remove-from-ready-queue ##sys#unblock-threads-for-i/o 
##sys#force-primordial
-   fdset-input-set fdset-output-set fdset-clear
-   fdset-select-timeout fdset-set fdset-test
-   create-fdset stderr
+   current-fdset-size fd-iset fd-oset fdset-extend fdset-clear make-fdset
+fdset-select-timeout fdset-set fdset-test create-fdset stderr
##sys#clear-i/o-state-for-thread! ##sys#abandon-mutexes) 
   (not inline ##sys#interrupt-hook)
   (unsafe)
@@ -74,9 +73,16 @@ C_word C_msleep(C_word ms) {
   return C_SCHEME_TRUE;
 }
 #endif
+/* These two should be defined by select.h, but are not standardized... */
+#ifndef howmany
+#definehowmany(x, y)   (((x)+((y)-1))/(y))
+#endif
+#ifndef NFDBITS
+#define NFDBITS (sizeof (fd_mask) * 8)
+#endif
+
 static fd_set C_fdset_input, C_fdset_output;
-#define C_fd_test_input(fd)  C_mk_bool(FD_ISSET(C_unfix(fd), C_fdset_input))
-#define C_fd_test_output(fd)  C_mk_bool(FD_ISSET(C_unfix(fd), C_fdset_output))
+#define C_fd_test(fd,set)  C_mk_bool(FD_ISSET(C_unfix(fd), (fd_set 
*)C_data_pointer(set)))
 EOF
 ) )
 
@@ -344,46 +350,61 @@ EOF
 
 (define ##sys#fd-list '()) ; ((FD1 THREAD1 ...) ...)
 
+(define current-fdset-size 64)
+(define fd-iset (make-fdset current-fdset-size))
+(define fd-oset (make-fdset current-fdset-size))
+
 (define (create-fdset)
-  (fdset-clear)
-  (let loop ((lst ##sys#fd-list))
-(unless (null? lst)
-  (let ((fd (caar lst)))
-   (for-each
-(lambda (t)
-  (let ((p (##sys#slot t 11)))
-(fdset-set fd (cdr p
-(cdar lst))
-   (loop (cdr lst))
+  (let* ((max (foldl (lambda (max x) (fxmax max (car x))) 0 ##sys#fd-list))
+(size (let lp ((s current-fdset-size)) ; Find next power of two
+(if (fx max s) (lp (fxshl s 1)) s
+(when (fx size current-fdset-size) ; Adjust set sizes if neccessary
+  (set! current-fdset-size size)
+  (set! fd-iset (make-fdset size))
+  (set! fd-oset (make-fdset size)))
+(fdset-clear fd-iset)
+(fdset-clear fd-oset)
+(let loop ((lst ##sys#fd-list))
+  (unless (null? lst)
+   (let ((fd (caar lst)))
+ (for-each
+  (lambda (t)
+(let ((p (##sys#slot t 11)))
+  (fdset-set fd (cdr p
+  (cdar lst))
+ (loop (cdr lst)
+max))
 
 (define fdset-select-timeout
-  (foreign-lambda* int ([bool to] [double tm])
+  (foreign-lambda* int ((int maxfd) (bool to) (double tm)
+(scheme-pointer iset) (scheme-pointer oset))
 struct timeval timeout;
 timeout.tv_sec = tm / 1000;
 timeout.tv_usec = fmod(tm, 1000) * 1000;
-C_return(select(FD_SETSIZE, C_fdset_input, C_fdset_output, NULL, to ? 
timeout : NULL

Re: [Chicken-users] Wiki search results page is missing next/previous links

2012-06-11 Thread Peter Bex
On Sat, Jun 02, 2012 at 04:36:30PM -0500, John Croisant wrote:
 When searching the Chicken wiki, a maximum of 10 results are shown. For 
 example, searching for free text symbol:
 
[...]

 It seems like there were supposed to be links like Next 10 results and 
 Previous 10 results which would allow the user to browse all the 
 results, but those links are currently missing.

That's right.  Looks like I started to add paging and meant to add a
pager but got distracted or something.

Thanks for bringing this to my attention!  I've fixed it in qwiki trunk,
which is now running on wiki.call-cc.org.

The pager needs some additional CSS tweaking, but we'll get that fixed in
the next couple of days (something else needs straightening out first)

Cheers,
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

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


Re: [Chicken-users] mysql-client egg not working

2012-05-19 Thread Peter Bex
On Sat, May 19, 2012 at 04:57:16AM -0700, Albert Hoenigmann wrote:
 Here is the additional information on my mysql-client egg not working
 in macosx Lion 10.7.3 after sudo chicken-install mysql-client was
 successful:
 
 Output from: chicken-status mysql-client:
 chicken-status mysql-client
 mysql-client  version: 0.6

You never said which version of Chicken you're running.

Cheers,
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

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


Re: [Chicken-users] Problems with rationals

2012-04-09 Thread Peter Bex
On Mon, Apr 09, 2012 at 09:00:10PM +0100, Mark Carter wrote:
 Is this a bug in chicken?
   (rational? 6/10) = #f

Chicken by itself doesn't support ratnums.  You'll need the
numbers egg to get the full numeric tower (including arbitrarily
large numbers and complex numbers).

 Also
   (* 1.0 5/2)
 produces
 Error: (*) bad argument type: 5/2

If I want to reproduce this, do I need to type in anything else?
It doesn't happen here.

Cheers,
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

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


Re: [Chicken-users] Problems with rationals

2012-04-09 Thread Peter Bex
On Mon, Apr 09, 2012 at 09:39:06PM +0100, Mark Carter wrote:
  If I want to reproduce this, do I need to type in anything else?
  It doesn't happen here.
 
 After some experimenting, the statistics eggs seems to introduce some 
 peculiarity. Here's a session:
 
 --
 #;1 (* 1.0 5/2)
 
 Warning: cannot represent exact fraction - coerced to flonum: 5/2
 2.5
 #;2 (use statistics)
 #;3 (* 1.0 5/2)
 
 Error: (*) bad argument type: 5/2
 
 Call history:
 
 syntax  (* 1.0 5/2)
 eval(* 1.0 5/2)   --
 #;3 (use numbers)
 #;4 (* 1.0 5/2)
 2.5

This is a known problem with the numbers egg, see Thomas's post.
I didn't expect it to turn up in this particular way; a more common
way is to have a library/module that uses numbers which passes the
number to procedures in a library which doesn't, and then tries to
perform calculations on it.

The only way to truly fix this is to add numbers to core; the
way it extends the reader is a bit of a hack and it doesn't truly
replace the procedures from the Scheme module.  Even if it did, compiled
code often calls C functions directly which bypasses any overwriting
the numbers egg might do at the Scheme level; that's why it doesn't
even try to do this at all.

Cheers,
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

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


Re: [Chicken-users] Spiffy - ssp-handler - how to extend ssp-eval-environment

2012-03-27 Thread Peter Bex
On Mon, Mar 26, 2012 at 07:08:38PM -0300, Arthur Maciel wrote:
 Dear Peter, thanks for the info!
 
 What I would like when doing web programming (and specially when using
 Awful, which should be called Wonderful) is to have a clear separation
 between data processing and its presentation (model/controller vs view
 separation) and ssp-handler seemed to do this for me.

ssp encourages mixing your logic with your presentation, just like PHP or
ERB does.

 I believe a good way to do this would be to have page definitions with
 Awful 'define-page' procedure, that at the end would call a procedure that
 would hold all the view part (html-tags code for example) with an alist
 with parameters.

That's fine and you don't need ssp for that.

 Am I doing it Wrong(TM)? Is the above example to PHPcentric or imperative?

Not at all.  In fact, it's a great way of doing things, and you don't need
ssp for that at all.  You can define the code in regular .scm files, which
can live outside the docroot (which is much more secure).

Then you can load this code from your Spiffy startup file.  If you want
reloadable code, you could look into the system egg for that.

Cheers,
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

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


Re: [Chicken-users] Spiffy - ssp-handler - how to extend ssp-eval-environment

2012-03-26 Thread Peter Bex
On Mon, Mar 26, 2012 at 12:02:13AM -0300, Arthur Maciel wrote:
 Hello!

Hi!

 I would like to know how it is possible to extend 'ssp-eval-environment' to
 add variables that could be accessed when processing .ssp files with
 'ssp-stringize' or 'ssp-include'.

It's a regular old environment object that gets passed to eval.
It used to be that you could extend these environments, but I'm unsure
about the current state of first-class environments.  It used to be that
you could use the environments egg to extend these, but they've had
a major overhaul and I think that egg no longer functions.

Please note that ssp is deprecated and ugly as hell.  If you want
to program PHP, use the real thing and get the full experience ;)

Cheers,
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

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


Re: [Chicken-users] From inexact to exact using the - procedure?

2012-03-23 Thread Peter Bex
On Fri, Mar 23, 2012 at 04:37:06PM -0300, Jeronimo Pellegrini wrote:
 Hello,
 
 I'm not sure if this is a bug or a feature:
 
 #;1 (use numbers)
 #;2 (define y (* 0.1 1+1i))
 #;3 (define a (+ 1 y))
 #;4 (define b (+ 2 y))
 #;5 (- a b)
 1.0
 #;6 (exact? (- a b))
 #f

With numbers trunk:

#;1 (use numbers)
#;2 (define y (* 0.1 1+1i)) 
#;3  (define a (+ 1 y))
#;4 (define b (+ 2 y))
#;5 (- a b)
-1.0
#;6 (exact? (- a b)) 
#f

 That's what I expected... The imaginary part vanished,
 but it's like doing (- 0.1 0.1) -- it's not exact!
 
 Now...
 
 #;7 (- 1+0.1i 2+0.1i)
 -1
 #;8 (exact?  (- 1+0.1i 2+0.1i))
 #t

trunk:

#;7  (- 1+0.1i 2+0.1i)
-1.0
#;8 (exact?  (- 1+0.1i 2+0.1i))
#f

 Well, that's supposed to be exactly the same thing,
 so why is it exact? Is this an optimization?

It's a bug.  There are many, many bugs in the current release
of the numbers egg.  I'm working hard on a new release, which
should be done soonish.

In the meanwhile, could you please use numbers trunk?  It would
be very helpful to actually have users testing it before I make
yet another broken release :)

Quoting from another mail I posted to chicken-hackers yesterday:
I know these fixes have been a long time coming, and I'm sorry that it's
taking so long, however I hope to tag a new numbers release soonish.
There have been many many bugs fixed in this new version, and it will
include (*limited*) support for extended number syntax in _compiled_ code.

Along with this, it will include a types database to support
scrutiny/specialization so that at least for flonum operations things
will be as fast as core Chicken, and it will help to find bugs in code
much easier when compiling.  Thanks to Felix for pushing me to support
this and developing the initial types database!

I will make a release once I've convinced myself that the numbers
database is complete and correct.  This will probably involve extending
the test suite some more (as I've been doing the past two weeks).

You can get the trunk version of numbers like this:

$ svn co --username anonymous --password '' \
   https://code.call-cc.org/svn/chicken-eggs/release/4/numbers/trunk numbers
$ cd numbers
$ chicken-install

I'm truly sorry for the inconvenience!

Cheers,
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

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


Re: [Chicken-users] Internal compiler error on use bindings

2012-03-20 Thread Peter Bex
On Tue, Mar 20, 2012 at 01:11:14PM +, Mark Carter wrote:
 Here's one for your mystery file:
 
 foo.scm:
   (use bindings)
   (bind (a b c) '(1 2 3)
   (print a))
   (write-line Finished)
 
 
 $ csj -bq foo.scm
 1
 Finished
 
 BUT:
 
 $ csc foo.scm
 
 Error: [internal compiler error] type of literal not supported: #procedure
 
 Call history:
 
 syntax  (##core#begin (write-line Finished))
 syntax  (write-line Finished)   --

That's a bug in the bind egg.  It is a macro that returns procedure
objects instead of the name that refers to the procedure.

In the interpreter that's allowed but the compiler doesn't know
how to serialize them.

You can easily see this in the interpreter by typing ,x (bind ...):
#;2 ,x (bind (a b c) '(1 2 3)  

 
(print a))  
 
(##core#let
  ((a ('#procedure '(1 2 3) 0))
   (b ('#procedure '(1 2 3) 1))
   (c ('#procedure '(1 2 3) 2)))
  (if (and ('#procedure ('#procedure '(1 2 3) 3)))
(begin (print a))
(#%error
  'bind
  (#%sprintf
(sub)sequence in ~A too long to match (sub)pattern in ~A~%
'(1 2 3)
'(a b c)

The if for example is easy to fix:
(and ,@(map (lambda (x) `(',empty? ,x)) checks))
I think this should be:
(and ,@(map (lambda (x) `(empty? ,x)) checks))

I don't know if Juergen (the bindings maintainer) is reading this
mailinglist, otherwise it's probably a good idea to file a bug in trac
and/or mail him about it.

Cheers,
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

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


Re: [Chicken-users] Postgresql egg - usage for mortals?

2012-03-19 Thread Peter Bex
On Mon, Mar 19, 2012 at 10:34:14AM -0700, Matt Welland wrote:
 Yup, I think that is what I want. Once I saw your example it became
 apparent that (query ...) is similar to prepare in the perl dbi api,
 however I think I was confused since the paragraph describing query also
 mentions prepare. As far as I can tell there is actually no prepare
 statement.

Indeed.  However, you can prepare a statement by issuing a normal
prepare command.  Then later you can execute this statement using
(query 'my-prepared-statement)

I re-read the docs and I agree they're worded very badly.  I'll try
and improve the bit under query.

 Perhaps a sentence clarifying what query does would help. An example
 where the query is done prior to the row-for-each would probably have
 triggered understanding for me.

I did add an example to row-for-each after replying to your previous
mail.  Hopefully that'll help.

 On the other hand just removing or explaining the reference to prepare in
 the query description is probably enough.

Yeah, the current paragraph is just mumbling about prepare but
not explaining anything.

Cheers,
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

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


Re: [Chicken-users] cannot import from undefined module

2012-03-07 Thread Peter Bex
On Wed, Mar 07, 2012 at 01:03:41PM +, Mark Carter wrote:
 If I try to import srfi-6 in my module, like so:
 
 (module 
  mccsl ( define-simple-syntax)
  (import scheme chicken)
  (import srfi-6)
   ...
 )
 
 I get the compilation error
 Syntax error (import): cannot import from undefined module

That's because (import ...) only loads the import library.
Chicken is a compiler which uses separate compilation, which means we
also support cross-compilation. To get all this to work properly,
the import libraries are separated from the actual libraries.

The import library only contains macro stuff and information about
available symbols.

To load the library itself, you should use the USE clause:

(module mccsl (define-simple-syntax)
  (import chicken scheme)
  (use srfi-6)
  ...)

 What do I do to fix this? It's all proving to be an uphill battle.

We'd appreciate if you could provide hints about how to improve the
documentation.  This is often a problem for newbies, so we should really
try and fix this.

Cheers,
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

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


Re: [Chicken-users] case vs. eq? - just curious ....

2012-03-03 Thread Peter Bex
On Fri, Mar 02, 2012 at 06:57:56PM -0700, Matt Welland wrote:
 I'm trying to convert a comparison operator to the equivalent text. These
 are not symbols. I think case treats the target list as if it was created
 with a quote: '(). Thus things are all symbols in the list and the eqv?
 returns false.
 
  (case  (() yup)(else nope))
 nope
  (cond ((eqv?  ) yup)(else nope))
 yup
 
 The cond does what I need just fine, I just didn't understand why case
 didn't also work.

Like others have said before, case implicitly quotes its arguments,
comparing the input to symbols.  Your cond is doing something entirely
different; taking the value of the identifiers and comparing the input to
those.

 Is there a more schemeish way to convert any of the operators to the text
 representation?
 
 (define gt )
 (op-string gt)
  = 

I think you're perhaps confused about the difference between one of many
possible textual representations of a program and its semantical meaning.

How is Scheme supposed to know the canonical name of a random lambda?
The only way is whatever arbitrarily chosen assignment you've decided on
in your program.  Having said that, you can extract the initial name
of a procedure, which is the name of the surrounding define when the
lambda was first introduced (or its C name in some cases):

#;1 (define (bar x) 1)
#;2 (define foo (lambda (y) y))
#;3 (let ((whatever (lambda (z) z)))
   ;; set! global value
   (set! qux whatever))
#;4 (##sys#lambda-info-string (##sys#lambda-info bar))
(bar x)
#;5 (##sys#lambda-info-string (##sys#lambda-info foo))
(foo y)
#;6 (##sys#lambda-info-string (##sys#lambda-info qux))
(whatever z)
#;7 (##sys#lambda-info-string (##sys#lambda-info +))
C_plus
#;8 ;; But look at this:
(use numbers)
#;9 (##sys#lambda-info-string (##sys#lambda-info +))
(numbers#+ . args176)

As you can see, this canonical name isn't something you
can easily influence.  Another way to solve this particilar
issue is to make an alist or hash table mapping your desired
canonical names to procedures, and op-string look up names
in this table.  A macro might also help in reducing work,
as it allows you to list just the canonical names of
procedures once and have it generate a case statement:

#;1
(define-syntax define-op-converter
  (syntax-rules ()
((_ name op0 ...)
 (define (name op)
   (select op
 ((op0) (symbol-string 'op0))
 ...
 (else (error unknown operator op)))
#;2 (define-op-converter op-string   + -)
#;3 (op-string )

#;4 ;; But there are many limitations:
(use numbers)
#;5 (op-string )
Error: unknown operator: #procedure (numbers# x11875 x21876 . xs1877)

Depending on what exactly you're trying to do in the bigger
picture, perhaps rethinking your approach is a better solution
than trying to work around this.

Cheers,
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

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


Re: [Chicken-users] case vs. eq? - just curious ....

2012-03-03 Thread Peter Bex
On Sat, Mar 03, 2012 at 11:14:34AM -0700, Matt Welland wrote:
 It sounds like the answer I was looking for is that there is no scheme
 introspection that maps a procedure to the bound name.

It was part of my point that there is no the bound name, there
can be several.  What would this return?

(define x (lambda (y) (lambda () y)))
(name-of (x))

Or this:

(define (a b c) (apply b c))
(define gt )
(a (list gt))

There can be many things that are aliases for the same procedure.

 Thanks for the detailed analysis. I probably should have been clearer, I
 was merely wondering if there was some slick introspection available in
 scheme that would make this general and easy.

Contrary to popular belief and other Lisps, Scheme is really quite a
static language and lacks many of the more dynamic introspection
facilities of languages and systems like CLOS, Ruby or (shudder!) PHP.

This is generally a good thing, as it allows for pretty efficient
compilation and these introspection things only allow people to paint
themselves into a corner. Introspection allows cutting through the
language's abstraction barriers (which are there for a reason!) which
makes it too easy to write code riddled with assumptions about how the
other person's code is supposed to work.  Of course this kind of code
breaks the minute the other code makes internal changes (think
monkey-patching).

But the disadvantage is of course that it also means you can't use the
power of these facilities when they are called for (see also the lack of
general SLIME integration for Scheme).

 Although for the reasons you pointed out I won't be using it I did get to
 learn something.

I'm glad to hear that I've provided some useful insights!

Cheers,
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

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


Re: [Chicken-users] case vs. eq? - just curious ....

2012-03-03 Thread Peter Bex
On Sat, Mar 03, 2012 at 02:06:56PM -0500, John Cowan wrote:
 Don't forget Python, where even definitions are executable.  Though modern
 Scheme is not as static as R4RS or ISLisp, where there is not even `eval`.
 (Of course these languages are not static in the sense of static typing.)

I don't have more than a passing familiarity with Python, so I had to
look up what you meant by definitions are executable, and I didn't
like what I found :)

Guide himself talks about this here:
http://python-history.blogspot.com/2009/03/how-everything-became-executable.html

PHP has this problem as well.  PHP even allows included
files and EVALed code to access local lexical variables in the
calling function.  I've often seen newbies in #scheme or #chicken
who were confused by this, and tried to graft similar functionality
on top of Scheme (which is utterly doomed to fail, of course)

And don't get me started on Javascript with its idiotic hoisting concept...

Cheers,
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

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


[Chicken-users] Hash table equality pitfall

2012-03-01 Thread Peter Bex
Hi all!

I ran into some very tricky behavior with hash tables that I'd like to
document for posterity.

Turns out that (equal? (make-hash-table) (make-hash-table)) no longer
always returns #t in the current master, but it did in Chicken 4.7.0.

This is because of obscure internal details: the hash table's internal
hashing function is a closure which contains the randomization fixnum,
which usually differs between tables.

In Chicken 4.7.0 and earlier, equal? only *appears* to work correctly for
hash tables.  In fact, it works if the table is filled such that buckets
contain at most one value, or if they were filled in the same order:

#;1 (use srfi-69)
; loading library srfi-69 ...
#;2 (define x (make-hash-table size: 2))
#;3 (define y (make-hash-table size: 2))
#;4 (equal? x y)
#t
#;5 (hash-table-set! x 'a 1)
#;6 (hash-table-set! x 'b 2)
#;7 (hash-table-set! x 'c 3)
#;8 (hash-table-set! y 'a 1)
#;9 (hash-table-set! y 'b 2)
#;10 (hash-table-set! y 'c 3)
#;11 (equal? x y)
#t

However, if we change the fill order, it no longer compares equal:

#;1 (use srfi-69)
; loading library srfi-69 ...
#;2 (define x (make-hash-table size: 2))
#;3 (define y (make-hash-table size: 2))
#;4 (hash-table-set! x 'a 1)
#;5 (hash-table-set! x 'a 2)
#;6 (hash-table-set! x 'b 2)
#;7 (hash-table-set! x 'c 3)
#;8 (hash-table-set! y 'c 3)
#;9 (hash-table-set! y 'b 2)
#;10 (hash-table-set! y 'a 1)
#;11 (equal? x y)
#f

The reason for this is that equal? is a very generic procedure, which
knows about core datatypes and compares record type values field by field.
A hash table is just a record type, and it contains some internal
slots with the configuration details as well as a vector which holds the
hash table's buckets.  The bucket contents themselves are alists, which
are filled simply using alist-cons when you use hash-table-set!.  That's
why the ordering differs.

Of course, from the end-user perspective this is *very* tricky behaviour,
so I've added a note to the manual about this.  I checked the SRFI, but
it doesn't mention anything about hash tables having to compare equal to
eachother so Chicken's behaviour is strictly not in violation of any
standard :)  The only other implementation I was able to test with was
Racket (why is SRFI-69 so uncommon in Schemes?) and there hash tables
also don't compare with equal?

Luckily, with the new version the mistake of thinking that equal? is
defined for hash-tables is a lot harder to make since the randomization
factor will ensure they are almost always different.

Cheers,
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

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


Re: [Chicken-users] Hash table equality pitfall

2012-03-01 Thread Peter Bex
On Thu, Mar 01, 2012 at 12:03:25PM -0500, John Cowan wrote:
 In addition, the following Schemes support SRFI-69 with `equal?`
 descending into hash tables:  Kawa, Chibi.

What does this mean in practice?  Do they do a dumb comparison like
Chicken does (ie, producing different results depending on the insertion
order) or do they check whether the hash tables have exactly the same
keys, each with identical corresponding values?

If they do it correctly, how do they deal with differences in initial
bucket size, and what do they do with hash tables having identical
key/values but different hashing or different comparison procedures?

 I think the main reason SRFI 69 doesn't have much support is its fairly
 recent date (2005).  It would probably be straightforward to layer it
 over the native support in most Schemes, but people haven't bothered to
 do so.

That's rather odd, considering there were quite a few people discussing
it, judging by the SRFI discussion archive (not as much as some other
SRFIs, but still a few).  It's also a very useful thing to have.
I guess that's just a Chickeneer's way of looking at it :)

 In addition, the reference implementation is more of a proof of
 concept than a drop-in implementation like those provided with SRFI-1,
 SRFI-2, SRFI-43, etc.

Why is it not drop-in?  Maybe I'm missing something, but from a quick
glance the implementation doesn't really look too different from
Chicken's implementation, conceptually.

  Luckily, with the new version the mistake of thinking that equal?
  is defined for hash-tables is a lot harder to make since the
  randomization factor will ensure they are almost always different.
 
 I think that's good.  The behavior of `equal?` is primarily historical
 anyway; people can and should write their own equivalence predicates to
 solve their own problems.

You could easily argue either way, but it's good that it doesn't seem to
be correct when you first try it.

Cheers,
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

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


Re: [Chicken-users] Hash table equality pitfall

2012-03-01 Thread Peter Bex
On Thu, Mar 01, 2012 at 12:45:57PM -1000, Derrell Piper wrote:
 Um, your 5th line resets 'a to 2, which is why they're not comparing
 equal?.  Removing that yields the expected results on 4.7.0.5-st:

Whoops, thanks for pointing that out, Derrel.  I overlooked it (that's
what you get while quickly writing up such things on the sly at work!).

The fact is that it sizes the hash table only in terms of the next value
in hash-table-prime-lengths, which means it'll be 307 items big.

However, this does not invalidate my main point.  If you insert either
more than 307 items in different order or manage to hash two objects
to the same value you get this problem:

#;1 (use srfi-69)
; loading library srfi-69 ...
#;2 (define x (make-hash-table))
#;3 (hash-table-set! x a 1)
#;4 (hash-table-set! x \x00a 1)
#;5 (define y (make-hash-table))
#;6 (hash-table-set! y \x00a 1)
#;7 (hash-table-set! y a 1)
#;8 (equal? x y)
#f

while in 4.5.0,

#;1 (use srfi-69)
; loading library srfi-69 ...
#;2 (define x (make-hash-table))
#;3 (hash-table-set! x a 1)
#;4 (hash-table-set! x \x00a 1)
#;5 (define y (make-hash-table))
#;6 (hash-table-set! y a 1)
#;7 (hash-table-set! y \x00a 1)
#;8 (equal? x y)
#t

Cheers,
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

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


Re: [Chicken-users] ssax troubles

2012-02-19 Thread Peter Bex
On Sun, Feb 19, 2012 at 10:16:50AM -0600, sramsay@gmail.com wrote:
 
 This is basically identical to the issue described here: 
 http://lists.nongnu.org/archive/html/chicken-users/2009-10/msg00070.html
 
 In that thread, the maintainer (I assume) of the ssax egg offers a patch to 
 the ssax-chicken.scm file, but that patch doesn't seem to have made it into 
 the ssax egg itself

I'm not the maintainer of ssax.  Actually, it has no official maintainer,
it's more or less a community effort :)  I guess this fix slipped
through the cracks.
Anyway, I've applied the patch by Taylor to the trunk version and pushed
a new 5.0.6 release which should appear shortly.

Thanks for reporting the bug (again)!

 (though I'm not sure how to verify that, since I can't seem to figure out how 
 to grab the source for an egg and install it manually).

Unless otherwise stated on the egg's wiki page, most eggs are kept
in the eggs repository in subversion.  You can check this out via

https://code.call-cc.org/svn/chicken-eggs/release/4/ssax/trunk

If you have no account, you can use the anonymous username with an
empty password to get read-only access.

This information can also be found on http://code.call-cc.org/ which is
linked from the wiki and the main site.

 I guess my broader question is: Is ssax busted?  I'm basically trying to do 
 the same thing as the person in the earlier thread (i.e. run some example 
 code).

It's not really busted; it's just not as well-maintained as most other eggs.

Cheers,
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

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


Re: [Chicken-users] compiling chicken on (crippled) embedded platforms

2012-02-13 Thread Peter Bex
On Mon, Feb 13, 2012 at 07:09:11PM +0600, Attila Lendvai wrote:
 dear schemers,
 
 so, finally a real question: is it possible to compile chicken with a
 gcc that doesn't have float.h? or with one that doesn't have any kind
 of float support?

No, not currently and AFAIK there are no plans to add this.

Chibi would seem a more likely candidate, but I don't see an option
to compile that without floating-point support right now, either.

Of course, patches are welcome if they're not too ugly or invasive,
which this kind of thing unfortunately can be.  Perhaps a good
starting point is the -msoft-float compiler option - at least this
should allow us to keep floating-point support.

Cheers,
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

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


Re: [Chicken-users] Compilation time

2012-01-21 Thread Peter Bex
On Fri, Jan 20, 2012 at 08:35:30AM +0100, Felix wrote:
 Hi!
 
 Try -debug p - it will show you which compiler pass is currently running.

Thanks a bunch!

I didn't know about that option, but it really helped me to pinpoint
the performance bottleneck.  I'll post a patch to chicken-hackers soon.

Cheers,
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

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


[Chicken-users] Compilation time

2012-01-17 Thread Peter Bex
Hi all,

I'd like to make the tests for numbers compile so that it tests not just
the library itself but also the newly added types database (I know, the
tests need more work to be able to actually test this properly, but bear
with me).

However, compilation time goes through the roof!  At first, I thought it
was expansion time in this horrible numbers syntax test which was also
put in Chicken itself, but it turns out not to be the case.

Just compiling the tests that I took from Gauche takes over a minute:

$ time csc numbers-test-gauche.scm
csc numbers-test-gauche.scm  70.82s user 1.23s system 98% cpu 1:13.24 total

(master and 4.7.0 take long)  The r4rs tests also take rather long;
about 32 seconds.  But it gets worse!
When you combine the whole bunch by running csc run.scm (which contains
INCLUDE statements for all the separate test scripts), it takes
7.5 *minutes* to compile (and lots of memory; 256MB - but I consider
that less important at the moment), which is of course not acceptable
just to run a bunch of tests!

It looks like we have a bad case of exponential complexity somewhere
in the compiler, since I had expected the total compilation time to be
in the ballpark of the sum of the individual compilation times.

I was wondering if someone could provide some insight in how to figure
out what causes it to take so long to compile.  I've already pinpointed
that the behaviour is somewhere in the analyzer / code emitter since
csc -P numbers-test-gauche.scm takes about 1.46 seconds but
csc -A numbers-test-gauche.scm takes about 10 seconds and
csc -t numbers-test-gauche.scm takes about 64 seconds.

It turns out that compiling with -O0 doesn't change this much and it
actually gets worse, so it's probably not some part of the optimizer,
which I initially expected.

The complexity figures for the whole bulk of run.scm are similar;
about a quarter of the compilation time is spent in the analyzing phase.

Cheers,
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

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


Re: [Chicken-users] Bug in numbers egg -- log function

2012-01-10 Thread Peter Bex
On Tue, Jan 10, 2012 at 03:36:04AM +0100, Alexander Shendi wrote:
 Dear Chicken users,
 
 I have encounterd what seems to be a bug in the numbers egg. The problem
 occurs when I evaluate (log 297.0+0.1i).

Please try the attached patch (or numbers trunk, as of r25802).

#;1 (use numbers)
#;2 (log 297.0+0.1i)
5.69373219548625+0.000336700323976755i

Cheers,
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
Index: numbers.scm
===
--- numbers.scm (revision 25798)
+++ numbers.scm (working copy)
@@ -1359,15 +1359,17 @@
 (define exp %exp)
 
 (define (%log x)
-  (cond
-   ((% x 0.0 'log) ; avoid calling inexact-exact on X here (to avoid 
overflow?)
-(##core#inline_allocate (C_a_i_log 4) (%exact-inexact x)))
-   ((%= x 0.0)
-(if (%exact? x)
-(log0 'log x)
-   (##core#inline_allocate (C_a_i_log 4) (%exact-inexact x
-   (else ; negative
-(%+ (%log (%magnitude x)) (* (make-complex 0 1) (%angle x))
+  (let ((type (%check-number x)))
+(cond
+ ;; avoid calling inexact-exact on X here (to avoid overflow?)
+ ((or (eq? type COMP) (% x 0.0 'log)) ; General case
+  (%+ (%log (%magnitude x)) (* (make-complex 0 1) (%angle x
+ ((eq? x 0); Exact zero?  That's undefined
+  (log0 'log x))
+ ((eq? type NONE)
+  (bad-number 'exp x))
+ (else ; Simple real number case
+  (##core#inline_allocate (C_a_i_log 4) (%exact-inexact x))
 
 (define log %log)
 
Index: tests/numbers-test.scm
===
--- tests/numbers-test.scm  (revision 25798)
+++ tests/numbers-test.scm  (working copy)
@@ -418,6 +418,13 @@
  (test log of exp = 1 1.0 (log (exp 1)))
  (test log of -1 (string-number 0.0+3.141592653589793i) (log -1))
 
+ (test log with complex number
+   (string-number 0.0+1.5707963267948966i)
+   (log (string-number +i)))
+
+ (test exp(log(x)) = x
+   (string-number 2.0-3.0i) (exp (log (string-number 2.0-3.0i
+
  (letrec ((fac (lambda (n)
  (if (zero? n)
  1
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] bit-set? seems to be buggy

2012-01-06 Thread Peter Bex
On Fri, Jan 06, 2012 at 11:38:11AM +0100, obscurolocon...@googlemail.com wrote:
 Gambit:
 $ gsi -e '(display (bit-set? 1 2))(newline)'
 #t
 
 Chicken:
 $ csi -e '(display (bit-set? 1 2))(newline)'
 #f
 

Chicken's bit-set? is not from SRFI-60.  It has a swapped argument order.
See the manual:
http://api.call-cc.org/doc/library/bit-set%3F

If you want, you can use the SRFI-60 egg to get compatible behaviour:
http://wiki.call-cc.org/eggref/4/srfi-60

(by the way, it would be nice if its author could put the docs in a wiki
 page so that api.call-cc.org can pick up on it)

Cheers,
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

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


Re: [Chicken-users] bit-set? seems to be buggy

2012-01-06 Thread Peter Bex
On Fri, Jan 06, 2012 at 12:12:57PM +0100, obscurolocon...@googlemail.com wrote:
 2012/1/6 Peter Bex peter@xs4all.nl:
 
  Chicken's bit-set? is not from SRFI-60.  It has a swapped argument order.
  See the manual:
  http://api.call-cc.org/doc/library/bit-set%3F
 
  (by the way, it would be nice if its author could put the docs in a wiki
   page so that api.call-cc.org can pick up on it)
 
 It is probably easer to do it just like the rest of the Scheme world does it.

Agreed. However, it's too late now; changing this procedure's signature
while maintaining backwards-compatibility is impossible.

Cheers,
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

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


Re: [Chicken-users] with-input-from-request does not close SSL socket

2011-12-16 Thread Peter Bex
On Fri, Dec 16, 2011 at 11:39:56AM +0100, obscurolocon...@googlemail.com wrote:
 2011/12/15 Peter Bex peter@xs4all.nl:
 I would say the GC must close the connection. How will you ever be
 able to close the socket in this case:
 
 (use tcp)
 (let ((p (tcp-connect localhost 25)))
   (if #f #f))
 
 All references are lost. But the socket is still open.
 
 But you are right. It is the same for file handles. This will also
 leak resources:
 
 (let ((p (open-input-file /bin/bash)))
   (if #f #f))
 
 And Bigloo, Gambit and Guile do not close them either.
 
 But this sounds somehow broken to me. File descriptors are a resource
 like memory. It is a bit strange that memory gets collected but file
 descriptors not. Is there a reason for this?

This could be done, but adding finalizers to them would cause quite a
performance hit, and it wouldn't *really* fix anything.  It would just
sweep the problem deeper under the rug.  For example, if you open a
lot of files in a program that doesn't do any (or much) allocating, the
GC wouldn't be triggered and you would start getting out of
filedescriptors errors.

  Have you checked that there's no trailing data?
 
 I think the kernel function close does not care about any data not
 read when closing a socket. Is this different in Chicken?

Not sure.  Just try it, if it helps we can think about why it helps.

  If you are still having trouble, please post a full example including
  the URI that's doing this.  I can't reproduce this with for example
 
 I can not post the URI because it is an internal service of the
 company I am working for. But I was able to solve the problem with the
 function I have posted. So it is ok for me.

Can you reproduce it on another service?

Cheers,
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

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


Re: [Chicken-users] srfi-18 documentation for thread-sleep!

2011-12-16 Thread Peter Bex
On Fri, Dec 16, 2011 at 01:43:01PM +0100, Sascha Ziemann wrote:
 The documentation for the thread-sleep! function in the srfi-18
 documentation mentions a function called current-time. But that can
 not be found:
 
 http://wiki.call-cc.org/search?text=ident=current-time

What do you mean?  I see one result, which links to
http://wiki.call-cc.org/man/4/Unit%20srfi-18
where it is documented.

Also, the API docs work better when you try to search
for something:
http://api.call-cc.org/doc/srfi-18/current-time

Cheers,
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

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


Re: [Chicken-users] with-input-from-request does not close SSL socket

2011-12-15 Thread Peter Bex
On Wed, Dec 14, 2011 at 08:15:30PM +0100, obscurolocon...@googlemail.com wrote:
 2011/12/14 Peter Bex peter@xs4all.nl:
 
  Hm, that ought to work.  Perhaps there's a bug in the openssl egg.
 
 Yes it is a openssl problem.
 
 I was able to solve the problem by replacing http-client with the
 following code:
 
[snip]
 
 Without explicitly closing the two ports, I got the same socket leaking.

That's normal for any socket, even for regular tcp sockets. You have
to close both ends before the underlying connection is closed.
This also exactly what http-client is doing when you call the
close-connection! procedure.

Have you checked that there's no trailing data?  I believe ssax:xml-sxml
reads only until the closing tag of the root node.  Maybe there's a
newline or a space following that which is not consumed, and hence the
socket stays open until you clear out all data.

If you are still having trouble, please post a full example including
the URI that's doing this.  I can't reproduce this with for example

(with-input-from-request https://bitbucket.org; #f read-lines)

This immediately closes the socket (I guess bitbucket prefers HTTP/1.0
or uses Connection: close, I didn't bother to check).

(with-input-from-request https://github.com; #f read-lines)

This server seems to keep around the connection for a while via HTTP/1.1
but as soon as I run (close-connection! (uri-reference https://github.com;))
the socket disappears from /proc/PID/fd.

Cheers,
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

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


Re: [Chicken-users] with-input-from-request does not close SSL socket

2011-12-14 Thread Peter Bex
On Wed, Dec 14, 2011 at 03:16:57PM +0100, obscurolocon...@googlemail.com wrote:
 I use the http-client egg to send queries to a HTTPS server:
 
 (with-input-from-request
 https://server/some/url;
 search
 (lambda ()
   (ssax:xml-sxml (current-input-port) '()
 
 For every connection I get an CLOSE_WAIT with 38 bytes in the receive queue:
 
 Proto Recv-Q Send-Q Local Address               Foreign Address
      State
 tcp       38      0 2.11.152.42:45237           10.100.26.82:443
      CLOSE_WAIT
 
 This looks to me as if with-input-from-request fails to close the
 socket, which is probably a bug.

This is expected.  The http-client egg tries to use HTTP/1.1 if it's
supported and re-use the connection to pipeline requests.  This saves
on TCP/IP handshake overhead and in the case of SSL saves even more
overhead for the SSL negotiation.

 As a work around I need a way to close the socket. How can I access
 the socket to force closing it?
 
 I tried to use close-connection! this way:
 
   (let ((result (with-input-from-request
  uri search
  (lambda ()
(ssax:xml-sxml (current-input-port) '())
 (close-connection! uri)
 result))
 
 But this does not have any effect.

Hm, that ought to work.  Perhaps there's a bug in the openssl egg.
I'll have a look at it later.

Cheers,
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

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


Re: [Chicken-users] unbound variable: sxml:sxml-xml

2011-12-07 Thread Peter Bex
On Wed, Dec 07, 2011 at 04:47:03PM +0100, Vok Vojwo wrote:
 The documentation of the sxpath egg describes the sxml:sxml-xml
 function. But when I try to call it, I get an error:

It's mentioned under the heading sxpath-lolevel.  This is a separate
module that you need to load.

 csi -R sxpath -e (display (sxml:sxml-xml '()))

Try this instead:

csi -R sxpath-lolevel -e (print (sxml:sxml-xml '()))

Cheers,
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

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


Re: [Chicken-users] unbound variable: sxml:sxml-xml

2011-12-07 Thread Peter Bex
On Wed, Dec 07, 2011 at 05:35:37PM +0100, Christian Kellermann wrote:
  Why is it not included if it is there?
  
  Or why is there an sxml-serializer egg if the code is already part of
  the SSAX libs, which is part of the sxpath egg?
 
 As I understood the egg is just a wrapper around the upstream code.
 I guess that the original author did not do a complete wrapping
 here.  If this is useful to you, we would not mind a patch enhancing
 the sxpath extension.

Actually, the main reason is that SSAX is a horrible mess which has
many completely unrelated procedures all mixed together.
There are several egg that provide different sets of procedures
from the SSAX project.  Most eggs include all files from the SSAX
project to make it easy to update them, but they don't install them
all.

The proper place to do this is in the sxml-serializer egg, and
we definitely should *not* be adding random procedures to sxpath.

(the *REALLY* proper way would be to drop SSAX and create a sane
and consistent XML library from scratch, maybe reusing some algorithms
from SSAX, but that's a whole other story...)

Cheers,
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

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


Re: [Chicken-users] Spiffy SSL Connection handshake error

2011-12-05 Thread Peter Bex
On Mon, Dec 05, 2011 at 11:05:31AM +0100, Christian Kellermann wrote:
 This message is generated by spiffy's exception handler in spiffy.scm
 line 562.
 
 However I could run your test program below without errors on a 64
 bit linux machine running
 
 openssl . version: 1.5.1
 spiffy ... version: 4.12
 
 with chicken master Version 4.7.4 (rev d439343)
 
 Which version did you use to try this?
 
 Maybe Peter has a better understanding of what's going on.

The SSL egg is a mess I don't fully understand either.  The code the OP
pasted looks correct, so you're right about checking the versions.

Cheers,
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

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


Re: [Chicken-users] gmake check fails on OpenBSD 5.0

2011-11-06 Thread Peter Bex
On Sat, Nov 05, 2011 at 07:08:20PM -0500, Jim Ursetto wrote:
  starting with 1232 symbols
  interning 1 symbols ...
  Segmentation fault (core dumped)
 
 This one I am not sure of, we will have to look into it.  I assume this is 
 occurring only on OpenBSD; I don't know if it's been fixed in the master 
 branch.
 
 In the meantime I created a ticket for you:
 https://bugs.call-cc.org/ticket/724

Actually, it also happens on NetBSD, and I think Moritz mentioned
yesterday that he got the same error on Arch Linux.  It's known to
be broken.  Oddly, the error is not properly reproducible; it only
happens some of the time.

Cheers,
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

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


Re: [Chicken-users] A proposal for egg category reassignment

2011-10-11 Thread Peter Bex
On Tue, Oct 11, 2011 at 12:51:29PM +0900, Ivan Raikov wrote:
 
 Hi all,
 
It seems that the egg categories Uncategorized or invalid and
 Miscellaneous have swelled quite a bit since the last time there was a
 major reorganization.
 
So I propose to reassign the categories of the eggs listed below to
 what I like to believe are more sensible categories. If an egg belongs
 to you, and you do NOT want me to change the category, please let me
 know within a week or so. If you think a different category is a better
 match, then please let me know as well. Thanks,

Note that not all eggs may be hosted on Subversion, and you may not have
access to them all.  Furthermore, the new system requires eggs to be
tagged before the category is changed (it shows the information from the
latest release, ie that which you will get if you simply chicken-install
it).

Cheers,
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

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


Re: [Chicken-users] A proposal for egg category reassignment

2011-10-11 Thread Peter Bex
On Tue, Oct 11, 2011 at 12:51:29PM +0900, Ivan Raikov wrote:
 
 efax - Networking
 smsmatrix - Networking

I don't really consider sending fax or SMS messages networking.
Both happen to use a webservice to do this, but does that make it
a networking egg?

Of course I can change the category if Miscellaneous really is not
the correct category for this.

Cheers,
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

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


Re: [Chicken-users] A proposal for egg category reassignment

2011-10-11 Thread Peter Bex
On Tue, Oct 11, 2011 at 04:44:19PM +0900, Ivan Raikov wrote:
 
 
Of course, these are just suggestions. Networking was the closest to
 Communication which would have been a more appropriate category for
 smsmatrix and efax.  It's not that Miscellaneous is not correct, I
 would just like to keep it from becoming too populous, if possible.

Maybe we should consider revising the category list, to accommodate some
of the new eggs that don't fit in.  Communication sounds like an
excellent candidate category.

Cheers,
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

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


Re: [Chicken-users] another news from the valgrind front

2011-10-11 Thread Peter Bex
On Tue, Oct 11, 2011 at 03:24:45PM +0200, Jörg F. Wittenberger wrote:
 Peter,
 
 I've got one more issue fixed wrt. the fix I posted recently 
 https://lists.nongnu.org/archive/html/chicken-users/2011-10/txtQD3AT30Qxp.txt
 
 Since I'm recovering from a big mess I made out of my build envt.
 Here only a description:
 
 In C_a_i_string_to_number there is exactf declared but (as the only
 one) not initialised.  Thus we have another case for valgrind to complain
 when it's used.

This seems like an odd bug in the generated code then, since exactf is
*always* checked before checking exactpf (like  (exactpf  exactf)),
so this should never cause a Valgrind error.

But maybe it's a bit tricky so I'll add an initializer just in case.

Cheers,
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

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


[Chicken-users] Reminder: Chicken at T-DOSE 2011

2011-10-06 Thread Peter Bex
Hello everyone,

This is just a friendly reminder that Chicken will again be represented
at this year's T-DOSE (Technical Dutch Open Source Event) in Eindhoven,
the Netherlands.  It's in the weekend of 5 and 6 November.

The organisation has recently released the schedule of talks at
http://www.t-dose.org/2011/schedule

If you're in the neighboorhood or just interested to meet up with some
of those crazy Chicken hackers you see on this list, feel free to drop
by at our booth!

Cheers,
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

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


Re: [Chicken-users] valgrind - more details

2011-10-06 Thread Peter Bex
On Thu, Oct 06, 2011 at 12:47:25PM +0200, Jörg F. Wittenberger wrote:
 On Oct 5 2011, Christian Kellermann wrote:
 Today I re-read the R5RS, which left me wondering.  Would it be
 #bi101010.1 or whould it be #b#i101010.1 ?

The latter. See the Lexical Syntax section, it has these productions:

prefix R - radix R exactness | exactness radix R

exactness - empty | #e | #i

radix 2 - #b
radix 8 - #o
radix 10 - empty | #d
radix 16 - #x

 Furthermore: 
 Also I changed my mind: I'm afraid numbers in Scheme are complex
 enough to use a real parser to read them.

I agree.  There's pure Scheme code for parsing numbers syntax in trunk
of the numbers egg (and the latest release has it too).  It's not very
simple either, but it doesn't have any dependencies.

When I posted my patches to fix some of the more esoteric syntax details
in Chicken, I initially also tried my Scheme code, but it is about twice
as slow as this C code, that's why I decided against switching.

Also, this code needs to be callable from C because decode_literal()
relies on it. (but that could maybe be worked around)

 However let me reiterate: it does not fix valgrind's compaint.

I think the patch is a good improvement in readability of the core code,
so why not put it in? (of course after fixing the while/if mistake)

Cheers,
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

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


Re: [Chicken-users] two minor tweaks to runtime.c

2011-09-27 Thread Peter Bex
On Tue, Sep 27, 2011 at 03:22:06PM +0200, Jörg F. Wittenberger wrote:
 While I've been looking at the code I wondered if the C compiler
 will fur sure pull that one test out of the for-loop.
 
 Maybe it's better no have it there at the first place.
 IMHO the code is not more confusing to read this way and should
 run better in case the C compiler is not smart enough.

I'm firmly opposed to any such change that makes the code
much less readable for very little gain.

Cheers,
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

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


Re: [Chicken-users] a memory issue; mildly scaring to me

2011-09-26 Thread Peter Bex
On Mon, Sep 26, 2011 at 03:16:07PM +0200, Jörg F. Wittenberger wrote:
 While it does not fix the problem at hand:
 
 There is a suspicious line in regex-core.scm :
 
 it reads:
 
(printing or graphic whitespace)
 
 IMHO it should read:
 
(printing . (or graphic whitespace))
 
 BTW: I know that those are the same.  It's just confusing the reader,
 when the same list is written both styles.

Maybe. This can be fixed, but it's not the issue here.

 Ah: since parameter checking might be off in the chicken core (is it?),
 what would happen, if we use a parameter, which has not been passed?
 Might that be the uninitialized value from a stack allocation, which
 I see from valgrind?

 What should be done?

Why don't you try your regex code with upstream irregex itself?

Just (load irregex.scm) and then run your regex match.
Then it will run with all checks enabled, at slow speed, but at least
it'll fail when something is broken.

All this speculation is kind of pointless without a proper testcase.

Cheers,
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

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


Re: [Chicken-users] a memory issue; mildly scaring to me

2011-09-25 Thread Peter Bex
On Sun, Sep 25, 2011 at 12:36:23PM +0200, Jörg F. Wittenberger wrote:
 I'm still kinda lost.
 
 Is there any documentation I could read to understand a little more of 
 irregex code? The source says it should run on any Scheme; just not how. 
 ;-)

The *portable* and upstream version of irregex is at
http://code.google.com/p/irregex/
The in-tree version we have for Chicken is hacked up for performance,
so it is no longer portable.

I think this is probably a huge red herring; the equal? code you
mentioned does seem to have an off-by-one error.  Have you tried just
returning true instead of the assignments and goto loop; at the end?

Cheers,
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

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


Re: [Chicken-users] Compiling modules

2011-09-24 Thread Peter Bex
On Fri, Sep 23, 2011 at 10:43:23PM -0400, blakes...@gmail.com wrote:
 I'm having some trouble compiling modules and one main file into a binary. I'm
 using 4.7.0. I have 3 modules, a, b and c. Module c depends on b and a while b
 depends on a.
 
 Right now I'm trying:
 
 $ csc -c -unit module-a module-a.scm
 $ csc -c -uses module-a module-a.o module-b.scm

Units are a really old way of doing module-like things.
The reason the module is undefined when you load it is because
you don't have an import library.

Try:

$ csc -s -j module-a module-a.scm
# or csc -J module-a.scm
$ csc -s module-a.import.scm

I don't know about linking it statically.

Cheers,
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

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


Re: [Chicken-users] a memory issue; mildly scaring to me

2011-09-24 Thread Peter Bex
On Sat, Sep 24, 2011 at 06:08:13PM +0200, Jörg F. Wittenberger wrote:
 Hi,
 
 I tried to change the procedure and instead of those 3 lines
 I left a return 1; there.  This seems at least to work well
 for some simple checks in csi.  But my app will now: a) run
 without valgrinds complaint b) into an endless loop.
 
 Taking into account that while compiling the DEBUGBUILD I ignored
 a ton of warnings about type issues in irregex.scm, I'm kinda
 alarmed that those calls to the questionable equal? originated from
 irregex.

Please try the current master first; it contains some bugfixes to
the types database, which make those irregex errors go away
(changeset 0fbbba9d5fc0dcce7b2364beaf3396d501967d0e).

Cheers,
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

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


Re: [Chicken-users] Compiling modules

2011-09-24 Thread Peter Bex
On Sat, Sep 24, 2011 at 05:48:58PM -0400, Blake Sweeney wrote:
 Thanks for the help but I'm still lost. I tried:
 
 $ csc -J module-a.scm

I think there's a -s missing (you want to compile to a shared
library object).  Sorry, I made this mistake in my second example
too.

 I read a little and it seemed like you include import libraries that aren't in
 the normal path by using the extend option when compiling. Was I wrong? Could
 you give me a more help?

I don't have much experience loading local libraries, but AFAIK it
should be possible to just   (use module-a)  or (require-extension module-a)
and it'll try to load from the current directory or the system path.

Cheers,
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

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


Re: [Chicken-users] git rm write-line?

2011-09-21 Thread Peter Bex
On Wed, Sep 21, 2011 at 10:37:51AM +0200, Christian Kellermann wrote:
 Well, now the choice is manyfold. One can whine about the slowness
 or improve the current situation or something completely different
 like shopping...
 
 I prefer improvement.

Who doesn't?

 Either way thanks for the nice test case, let's see if we can speed
 up thing in a way that makes it nicer. I am not sure why we check
 the string here, or why we check the port for being a port, since
 display will do it all over again.
 
 Can someone enlighten me on this?

Probably for the (kind of lame) reason that the error location would
otherwise show display, which the user never called.

This could be solved by using an internal ##sys#display or something
which gets called by both display and write-line, with the correct
location.

The scrutinizer could probably rewrite this not to use the check
at all and call the underlying unsafe displaying routine directly.

Cheers,
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

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


Re: [Chicken-users] Code for parsing multipart/form-data

2011-09-20 Thread Peter Bex
On Tue, Sep 20, 2011 at 08:49:24AM +0530, Santosh Rajan wrote:
 Hi,
 
 I am looking for chicken code for parsing multipart/form-data. Can anyone
 point me to the code please? Sure it must be there somewhere, at least in
 the web server code.

Unfortunately there isn't any currently because it's something nobody
has needed yet, and doing this properly and elegantly is not easy.

There was a http-form-posts egg which used a port of Gauche's MIME
code for Chicken 3 which is still available from svn at 
https://anonym...@code.call-cc.org/svn/chicken-eggs/release/3/http-server-form-posts

And Alex Shinn's hato library also includes some MIME handling code
you might want to use: http://synthcode.com/scheme/hato
(note that the link to the docs are wrong, they should point to
http://synthcode.com/scheme/hato/doc/hato-manual.html)

The latest release of the http-client egg (v0.5, released a few days ago)
contains some hacky code to deal with multipart form posts, though.

Cheers,
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

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


Re: [Chicken-users] Chicken vs Perl

2011-09-20 Thread Peter Bex
On Tue, Sep 20, 2011 at 02:11:41PM +0200, Sascha Ziemann wrote:
 I tried to use Chicken for a job I would use normally Perl for to find
 out whether Chicken might be a useful alternative.

A great test!

 And now hold on tight! It takes more than one minute for the same data:
 
 real  1m16.540s
 user  1m14.849s
 sys   0m0.664s
 
 And there is almost no significant performance boost by compiling it:
 
 real  0m1.810s
 user  0m1.664s
 sys   0m0.140s

The most important question is: which version of Chicken is this?
There have been massive optimizations done to irregex (the regex
engine used in Chicken) between 4.6.0 and 4.7.0

 So the questions are:
 
 - What is wrong with the Chicken code?

At first glance it looks fine.

 - How can I profile the code?

Build it with csc -profile ..., then run it.  It will
produce a profile file which you can read with chicken-profile.

 - Why is there no difference between csi and csc?

Probably because the inefficiency is in irregex, which is already
compiled; the bottleneck is not in your code, so making it faster
by compiling it won't help.

Cheers,
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

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


Re: [Chicken-users] Chicken vs Perl

2011-09-20 Thread Peter Bex
On Tue, Sep 20, 2011 at 02:11:41PM +0200, Sascha Ziemann wrote:
 The job is: go through a web site mirror and report a unique list of
 all domains from all hrefs.

Also, you didn't say which site it was.  The testset itself may also be
an important factor.

Cheers,
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

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


Re: [Chicken-users] Chicken vs Perl

2011-09-20 Thread Peter Bex
On Tue, Sep 20, 2011 at 10:08:16PM +0900, Daishi Kato wrote:
 Hi,
 
 My situation is pretty similar to yours, meaning I used to use Perl
 and later started using Chicken for my job.
 
 Running your scripts on my machine produced similar result
 (about 10 times difference).
 
 -unsafe option in csc-4.6.0 didn't work (no change).
 -unsafe-libraries in csc-4.0.0 did work (a little faster),
 but it's not available in csc-4.6.0 (does anybody know why?).
 
 I also tried with csc-4.7.0, and guess what, it's a little slower
 (at least on my test data. I partially crawled wiki.call-cc.org).
 Peter, how could this happen?

This probably depends on the nature of your regex.  We made the
tradeoff that large consecutive ranges of characters are stored
more efficiently as a range instead of as separate characters.
This means that if you are using a regex with many separate chars
it could be slightly slower.

In some cases regexes can't be compiled to DFA but need to use
backtracking, which is comparatively slow.   That's not the case
in Sascha's regex (I checked), but might be the reason it's slow
for you.

Cheers,
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

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


Re: [Chicken-users] Chicken vs Perl

2011-09-20 Thread Peter Bex
On Tue, Sep 20, 2011 at 03:54:32PM +0200, Sascha Ziemann wrote:
 2011/9/20 Christian Kellermann ck...@pestilenz.org:
 
  You can add -profile to csc's options. If you need any eggs and
  want those profiled too, recompile them also with -profile.
 
 How to do that?
 
 I have installed them with chicken-install. As far as I can see there
 are no options to specify compilation options.

The environment variable CSC_OPTIONS controls how csc works, even
when invoked through chicken-install, so just do

$ CSC_OPTIONS=-profile chicken-install [SOME-EGG]

Cheers,
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

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


Re: [Chicken-users] [ANN] SRFI-99 record types for CHICKEN

2011-09-15 Thread Peter Bex
On Thu, Sep 15, 2011 at 10:46:30AM +0200, Thomas Chust wrote:
 Hello,
 
 my implementation of SRFI-99 is now available as an egg.

Congrats on the release.

 The egg is served directly from its Fossil repository (check the
 release information file at
 http://www.chust.org/fossils/srfi-99/doc/trunk/srfi-99.release-info
 for details). In contrast to what the CHICKEN wiki claims, it is
 possible to serve raw files and packaged releases identified by
 symbolic tags from Fossil repositories!

Cool!  This used to not be the case, but I guess newer versions support it.
Would you be willing to update the wiki instructions for Fossil?

 As a sidenote, I first tried to specify a URL pointing to a .zip file
 of the egg in the release information file but that results in
 henrietta serving an empty directory of released files. Specifying a
 .tar.gz file instead works fine. If .zip files are not implemented,
 maybe they shouldn't be mentioned in the documentation on the wiki.

zip files are supported, just like tarballs but there was a bug in
Henrietta-cache which caused it to fail on zip files when the tempdir
was mounted on a different filesystem than the final cache dir, but it
should work now.  If it still won't work, let me know and I'll look into it.

Cheers,
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

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


Re: [Chicken-users] [ANN] SRFI-99 record types for CHICKEN

2011-09-15 Thread Peter Bex
On Thu, Sep 15, 2011 at 12:36:02PM +0200, Thomas Chust wrote:
 Hello Peter,
 
 in fact, I think it was always the case, but several aspects of it are
 poorly documented in the Fossil manual. For example, you could always
 use symbolic tags in any place where a changeset ID was expected, but
 figuring that out required a look into Fossil's own source code or
 trial and error.

Ah, that's quite possible!

 Anyway, I have updated the wiki page at
 https://wiki.call-cc.org/releasing-your-egg#fossils-default-web-ui
 with instructions how Fossil can be set up analogously to the other
 VCSs mentioned. I hope this makes the lives of future egg author
 generations easier ;-)

Thanks a lot!

Cheers,
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

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


Re: [Chicken-users] Porting modules to Chicken from other Schemes?

2011-09-10 Thread Peter Bex
On Sat, Sep 10, 2011 at 02:09:22PM +0900, Ivan Raikov wrote:
 
 Hello,
 
It depends on whether the module uses features specific to the other
 Scheme implementation. I find that the biggest impediments to porting to
 Chicken are non-hygienic macros, object oriented systems (often
 implemented as non-hygienic macros :-), and elaborate FFI constructs,
 which unfortunately vary widely between implementations.

I agree with what Ivan said.  Aside from looking at other Schemes and
OCaml, I personally have started to look at Common Lisp more closely.
Common Lisp programs are also often easy to port; it's a familiar
language with many idioms that map easily to Scheme, and low-level
defmacro macros are straightforward to port to ER or IR macros.
The library functions are straightforward to port, and often it's easy
to find similar functions.

Even if you don't translate programs directly from CL, some good ideas
can be stolen from CL libraries, since it's so similar ;)

The same could probably be true for Clojure.  Although the language
itself is syntax-heavy and not really *that* Lispy, there appear to be
some decent libraries there which are written in the Lisp spirit.

If you would like help porting something interesting, I'd be willing to
help out as well.  If you have questions, just drop by in #chicken on
freenode; people are generally friendly and helpful.
(I think I saw you join yesterday but it was at a time when most of us
are offline; it was at 6 in the morning in Europe :P )

Cheers,
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

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


Re: [Chicken-users] wiki pages and h1 title

2011-09-10 Thread Peter Bex
On Sat, Sep 10, 2011 at 12:56:59PM -0400, John Gabriele wrote:
 Hi all,
 
 I've noticed that some of the wiki pages have an h2 title at the top,
 some don't. For the ones that have have a table of contents, some have
 an h2 above the toc, some have it below.

Yeah, this is up to each individual author.

 I think pages look a bit odd if they have no title at the very top.
 
 Looking at the source for a few pages, I haven't seen any h1 tags anywhere.
 
 The [editing help](https://wiki.call-cc.org/edit-help) page says not
 to use = title, as h1's are reserved for use by the wiki itself.

I think this is historical; svnwiki probably used to do this.
However, the svnwiki-sxml parser used by qwiki only recognises == as
section markers; a line starting with a single = is invalid syntax and
rendered literally.

 I think most pages would probably look best if there's always an h1
 title at the top which is not part of the table of contents (if there
 is indeed a toc).
 
 Is the wiki indeed using h1's for anything?

A quick grep tells me it uses them on the search result page as a
heading and for the this page does not exist yet heading when you
try to open a page that doesn't exist.

So it doesn't use them in front of user-generated content.

 Does the wiki generate a portion of a page's title tag using the
 first h2 on the page?

It picks the very first section marker, whatever level it is.
If none is found, it uses the filename.

 I think it would make sense for every page to have an h1 (= Page
 Title) at the top, which would not be part of a toc (if present),
 which would be rendered at the top of the page body (above the toc, if
 present), and which would be used to generate the first portion of the
 page's title. What do you think?

I think that is ugly since it would repeat this title:

== foo
blabla

gets rendered to

h1foo/h1
h2foo/h2

Cheers,
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

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


Re: [Chicken-users] wiki pages and h1 title

2011-09-10 Thread Peter Bex
On Sat, Sep 10, 2011 at 01:42:51PM -0400, John Gabriele wrote:
 I don't understand what you mean. I'd expect this wiki markup:
 
 
 = Title Goes Here
 
 [[toc:]]
 
 == Intro
 
 Some content here.
 
 
 to produce something like:
 
 
 html
 headtitleTitle Goes Here - The Chicken Scheme Wiki/title/head
 body
 h1Title Goes Here/h1
 
 { ... toc ...}
 
 h2Intro/h2
 pSome content here./p
 /body
 /html
 
 
 Where the only duplication is Title Goes Here lands in the title
 as well as in the h1, which I believe is as it should be.

I obviously misunderstood what you meant, then :)

This wiki page syntax will work if you add one = in front of all your
items.  The wiki page in your example doesn't work because svnwiki-sxml
does not allow section headings to start with one =.

Of course we could also raise all the levels so that the highest
level is h1.  This would cause all the existing pages to get their
section depths decreased by one.

The main problem is that nobody marks up their wiki pages the way
you'd like.  See my reply to your other mail.

Cheers,
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

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


Re: [Chicken-users] wiki pages and h1 title

2011-09-10 Thread Peter Bex
On Sat, Sep 10, 2011 at 02:29:13PM -0400, John Gabriele wrote:
 On Sat, Sep 10, 2011 at 12:56 PM, John Gabriele jmg3...@gmail.com wrote:
  {...}
  I think it would make sense for every page to have an h1 (= Page
  Title) at the top, which would not be part of a toc (if present),
  which would be rendered at the top of the page body (above the toc, if
  present), and which would be used to generate the first portion of the
  page's title. What do you think?
 
 Here's a good example issue: the eggs tutorial page
 http://wiki.call-cc.org/eggs%20tutorial .
 
 Currently, when I have that page open, it doesn't say anywhere that
 it's the Eggs Tutorial page. My browser window title says
 Introduction - The Chicken Scheme Wiki and my browser tab says
 Introduction. Looking at the page, there's no indication to the
 reader what page they're looking at unless they check the actual url.
 
 I'd bet many pages start with an Introduction, Overview, or Getting
 Started section.

Yes, and I've already fixed a lot of these.

 I could add == Eggs Tutorial to the top of the eggs tutorial page
 (above the `[[toc:]]`), and it would kinda' look right, except:
 
 1. Eggs Tutorial would be at the same level (h2) as the other
 sections, but it shouldn't be -- it's the title of the page, and

Well, that's easy; just increase the level of all the others by adding
an extra = in front of all of them.

 2. The ToC would list it as section 1, containing no content, followed
 by section 2, Introduction.

Actually if you put all the other sections down by one the TOC will show
a tree that says:

- Eggs tutorial
  - Introduction
  - ...

 which might be acceptable, and wouldn't require any work, but I don't
 think it's optimal.

I don't really understand what you want; even if we changed svnwiki-sxml
to allow = to mean h1 (or == to mean h1, === to mean h2 etc),
it's still up to the users of the wiki to add a title heading to their
pages.  This doesn't happen now, so I don't see why people will do this
after this rather trivial change of raising all the levels by 1.

Cheers,
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

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


Re: [Chicken-users] New project

2011-09-10 Thread Peter Bex
On Sat, Sep 10, 2011 at 01:02:05PM -0700, Steve Graham wrote:
 Although I have programmed for decades, I am new to Scheme.  I thought that I 
 would use a project I've been contemplating as a help in learning the 
 language.
 
 There is a website of scriptures which I wish to download.  Some of the 
 webpages, of course, are indices into books and then chapters.  So I would 
 need to follow the links until I got to the actual text, which I would then 
 file into a database by volume, book, chapter and verse.
 
 I would appreciate any hints as to how to do this.  I'm thinking I would need 
 some pointers with downloading web pages, stripping HTML and saving to a 
 database.

Well, that's an extremely broad and open-ended question.  You probably
want to start by becoming familiar with the libraries that can help
you with this task.

For downloading web pages you can use the http-client egg, for parsing
HTML into SXML you can use html-parser or htmlprag and for stripping the
tags you can hand-roll something or use one of the sxml-transforms or
sxpath eggs.

To store it in a database you should probably first determine which
database you want to use.  Which egg you can use will then be an
easy choice.

If you have more specific questions, feel free to ask.  There are
many helpful people here on the mailinglist and also on Freenode's
#chicken IRC channel!

Cheers,
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

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


Re: [Chicken-users] wiki pages and h1 title

2011-09-10 Thread Peter Bex
On Sat, Sep 10, 2011 at 06:46:01PM -0400, John Gabriele wrote:
 What I want (what I think would benefit the wiki) is this:
 
 http://www.unexpected-vortices.com/temp/eggs-tutorial-2.html
 
 instead of this:
 
 http://www.unexpected-vortices.com/temp/eggs-tutorial.html
 
 The stopgap measure though, would appear to be this:
 
 https://wiki.call-cc.org/eggs%20tutorial (I just now added the h2
 heading to it.)

What if you increase the level of all headings after the first?

This would give you the same structure as your example, with two
differences: the H1 is a H2, and the title appears in the TOC.

Cheers,
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

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


Re: [Chicken-users] git build broken?

2011-09-04 Thread Peter Bex
On Sun, Sep 04, 2011 at 08:57:26PM +0200, Jörg F. Wittenberger wrote:
 Hi,
 
 I just did a git pull and found irregex.scm not compiling.
 wrong argument (car) passed to not or so.
 
 The quick quess: revert to the old types.db to compile this
 single file seems to work out.

Did you build a bootstrap compiler and retry?
Lately there've been quite a few changes that break bootstrapping
in annoying ways, but once you have a working bootstrap compiler you
can compile a bootstrap compiler from git, and with that build Chicken
from git.

I built a chicken this afternoon and it worked, AFAIK there have been
no new commits pushed since then.

Cheers,
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

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


Re: [Chicken-users] Results of the Chicken survey

2011-08-25 Thread Peter Bex
On Thu, Aug 25, 2011 at 11:24:59AM +0900, Ivan Raikov wrote:
 
 Dear all,
 
   Thanks to everybody who responded to the Chicken survey. I have posted
 the results here:
 
 http://wiki.call-cc.org/survey2011
 
 Please let me know if you have any comments or suggestions on how to
 improve the survey. Thanks,

Interesting results!  Thank you for this survey, Ivan.

One minor note: 
http://call-cc.org/survey/2011/HowLongHaveYouBeenUsingChicken.png
seems to be missing.

Cheers,
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

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


Re: [Chicken-users] Egg - Chicken version compatibility

2011-08-19 Thread Peter Bex
On Fri, Aug 19, 2011 at 02:08:01PM +0100, Alaric Snell-Pym wrote:
 Looks like the message-digest egg passes
 - -no-procedure-checks-for-toplevel-bindings to csc, which this old
 version of it doesn't like.
 
 Now, there's several easy fixes to that (I'm compiling a more recent
 chicken from git as we speak), but it's a bad precedent IMHO that people
 might install chicken from their system package manager and then find
 they can't run Chicken apps. I'd like to be able to confidently say
 Wanna use Ugarit? Install chicken then type 'chicken-setup -s ugarit'
 and you're away! rather than expect people to install from source or
 from funny packages.

Agreed.

 In this case, I think that optimisation flags should all be ignored by
 csc if it doesn't understand them.

In principle that's a good suggestion. I'd like to add that it's probably
good to emit a warning, so people get notified of typos instead of
scratching their heads to try to understand why their flag didn't have an
effect.

But the real reason it went wrong in this particular case is that people
should NOT be using these hyper-specific flags for compiling eggs
intended for public consumption unless there's a really good reason to
do so.

It's just an optimization flag, and I think if people need to squeeze
every last drop of performance for an egg it's probably better to expect
them to pass this option when compiling the egg through CSC_OPTIONS.

I think egg authors should be cautious and generally only use the
switches -O1, -O2 etc (that's O the letter, not the number :P)
by default.

Cheers,
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

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


Re: [Chicken-users] wiki 500

2011-07-08 Thread Peter Bex
On Thu, Jul 07, 2011 at 11:49:50PM -0400, David N Murray wrote:
 Hi,
 
 I'm not sure where to direct this to, but entering io:event-dispatch
 in the Identifier search field generates a 500 error.

Normally, bugreports can be filed on bugs.call-cc.org, but if you
don't have an account this mailinglist is fine.

Thank you for the report.

 http://wiki.call-cc.org/search?text=ident=io:event-dispatch

It looks like there's a strange problem in the debugging Chicken
we have installed on the server.  We're looking into it.

Cheers,
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

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


Re: [Chicken-users] wiki 500

2011-07-08 Thread Peter Bex
On Fri, Jul 08, 2011 at 10:05:14PM +0200, Peter Bex wrote:
  I'm not sure where to direct this to, but entering io:event-dispatch
  in the Identifier search field generates a 500 error.

The bug itself was a bug in qwiki and has now been fixed in qwiki trunk.

 Normally, bugreports can be filed on bugs.call-cc.org, but if you
 don't have an account this mailinglist is fine.

While trying to figure out the cause we found an inconsistency in
Chicken's irregex handling of overlapping character sets.  I've
filed ticket #636 to track this.

Thanks again for your report!

Cheers,
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

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


Re: [Chicken-users] Problem w/ a new egg

2011-07-06 Thread Peter Bex
On Wed, Jul 06, 2011 at 07:53:14AM +0200, Felix wrote:
 From: Kon Lovett konlov...@gmail.com
 Subject: [Chicken-users] Problem w/ a new egg
 Date: Tue, 5 Jul 2011 20:05:24 -0700
 
  Hi Folks,
  
  Having a me too stupid problem:
  
  I added an egg - csv-xml - to the svn repo Sat. Attempts to install
  yield:
  
  Warning: extension `csv-xml' has no .meta file - assuming it has no
  dependencies

If it's a new egg, you will need to add an entry to the egg-locations
file in order to get it picked up.
Just copy one of the other entries of an egg that's maintained in svn
and replace the egg name.

  My initial save did not list the .meta in the files manifest so the
  above msg made some sense. I quickly remedied the oversight. But I
  still get the msg. (And yes, chicken-install works with -transport
  local.)
  
  Any ideas before I dig into the chicken-install source?
  
 
 This must be some henrietta-cache issue. It probably didn't pick
 up your new 0.10.0, since the tag didn't change. Tagging a higher
 version (0.10.1) may trigger generation of a new tarball. Just
 a guess, but sounds likely.

Yes. Changing existing tags is not done (never has been) and is not
supported anymore by henrietta-cache.

Let me know if you have more questions.

Cheers,
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

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


Re: [Chicken-users] reload .so in csi?

2011-07-04 Thread Peter Bex
On Fri, Jul 01, 2011 at 04:21:05PM -0400, David N Murray wrote:
  That is probably the best solution.  The other solution is to use (load
  foo.so) but it may not work on all platforms.  (I sent that last bit
  in private mail but forgot to copy the list)
 
 (load foo.so) appears to do the same thing as
 #;4 ,l foo.so
 ; loading foo.so
 #;4
 
 but, the new function I'm exporting still isn't visible, so it doesn't
 look like changes are being picked up.

That sounds like you're loading a file with a module in it.  If you
change the module definition, you will need to import it again after
loading.  LOAD simply reloads the module, but doesn't affect
the identifiers already imported previously in your running code.

If you just change the definition, a LOAD is enough.

Cheers,
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

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


Re: [Chicken-users] where move-file is?

2011-06-30 Thread Peter Bex
On Thu, Jun 30, 2011 at 10:04:39AM -0300, Hugo Arregui wrote:
 Hi guys,
 
 I want to use move-file procedure, (
 http://api.call-cc.org/doc/chicken/eggs/move-file ), but i cannot find
 it as an egg or as an procedure. I mean, seems an egg, but
 chicken-install cannot find it, and doesn't seems installed already.

It's actually part of the available procedures inside a setup-script
for eggs (see http://wiki.call-cc.org/man/4/Extensions#move-file)

It is available in setup-api. (use setup-api)

Cheers,
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

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


Re: [Chicken-users] Taking the distributed egg repository into production

2011-06-27 Thread Peter Bex
On Sat, Jun 18, 2011 at 08:52:40PM +0200, Peter Bex wrote:
 Hello everyone,
 
 The distributed egg repository system is now ready for production.
 We would like to make the switch to this system soon.  For users, this
 should be a completely transparent change.

This has now been done.  All distributed eggs are now available to
all users of Chicken.

These are the following:

chickumber
combinator-birds
dict
easy-args
freetds
henrietta-cache
hmac
kalaha
log5scm
missbehave
nomads
pastiche
pseudo-meta-egg-info
sendfile
srfi-71
ssql
syslog
tagged-netstring
uri-dispatch
versions

There are also two eggs that will become available when a release is
tagged; smsmatrix and server-test.

Cheers,
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

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


Re: [Chicken-users] Should http-client automatically consume unconsumed input? [Was: Re: ssax examples could not run]

2011-06-22 Thread Peter Bex
On Tue, Jun 21, 2011 at 09:53:45PM +0200, Peter Bex wrote:
 Hi again,
 
 Also, about this piece of code:
 
  (pp (call-with-input-request
   http://modis.ispras.ru/Lizorkin/XML/poem.xml;
   #f (lambda (p)
(let ((sxml (ssax:xml-sxml p '(
  ;; Consume the rest of the stream, ssax does not
  ;; fully read until the end.
  (read-string #f p)
  sxml
 
 Does it make sense to have http-client automatically consume any
 remaining data after the user-supplied reader returns?
 What about continuations?  Or perhaps it should be read when the
 *next* request is done?

I've just implemented this in http-client trunk.

This means that it's now enough to do:

(pp (call-with-input-request
  http://modis.ispras.ru/Lizorkin/XML/poem.xml;
  #f (lambda (p) (ssax:xml-sxml p '()

and there will be no error on the next request because of leftovers
from the previous request.

 Thoughts? Opinions?

Probably not, everyone keeps ignoring me anyway.  *mutters to himself
and wanders off in search of a beer*

Cheers,
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

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


Re: [Chicken-users] ssax examples could not run

2011-06-21 Thread Peter Bex
On Tue, Jun 21, 2011 at 01:58:08PM -0400, HP wei wrote:
 I installed chicken.4.7.0
 and ssax, sxpath
 
 Then I tried to follow the examples pointed to in the ssax homepage
 in
 http://modis.ispras.ru/Lizorkin/sxml-tutorial.html

Generally, the Chicken documentation takes precedence over the
documentation of the upstream project (this goes for all eggs).
In this case, http://wiki.call-cc.org/egg/ssax

 Specifically,
 When I run this in csi,
 (use ssax)
 (use sxpath)
 
 (sxml:document http://...html;)
 
 I got
 Error: unbound variable: sxml:document

Yes, sxml:document isn't part of the SSAX parser itself, but of
the xlink sublibrary of sxml-tools.  Chicken's ssax egg packages
up purely the SSAX parser.

Sorry about the confusion, the upstream SSAX project is just a holy mess
of stuff which is split up in a way that's not very orthogonal.

We did our best to try to split it up into chunks that make sense for a
user so you don't have to make a choice to include everything and the
kitchen sink whenever you need *some* subfunctionality provided by the
SSAX project.

 Another example, after installing htmlprag
 
 (*html-sxml* http://modis.ispras.ru/Lizorkin/Apidoc/htmlprag.html
 
  (open-input-resource http://html
 http://modis.ispras.ru/Lizorkin/XML/amorphis.html))
 
 -- gives
 Error: unbound variable: open-input-resource

This is a very weird one; it doesn't exist _anywhere_ in the SSAX
project:

$ cvs -z3 -d:pserver:anonym...@ssax.cvs.sourceforge.net:/cvsroot/ssax co -P 
sxml-tools
...
$ cvs -z3 -d:pserver:anonym...@ssax.cvs.sourceforge.net:/cvsroot/ssax co -P SSAX
...
$ grep -r open-input-resource SSAX sxml-tools
sxml-tools/xlink.scm: (let* ((port (open-input-resource req-uri))
sxml-tools/xlink.scm: (let* ((port (open-input-resource req-uri))
sxml-tools/xlink.scm: (let* ((port (open-input-resource req-uri))
sxml-tools/xlink.scm: (let* ((port (open-input-resource req-uri))

Only usage points, no definition at all!

On Dmitry Lizorkin's website there's this definition:
http://modis.ispras.ru/Lizorkin/Apidoc/access-remote.html#codefunc60351
which links to a http-transaction procedure here:
http://modis.ispras.ru/Lizorkin/Apidoc/http.html#codefunc26928

but neither of these exist in the SSAX source tree itself.
It can't really, since SSAX is (mostly) portable Scheme code,
but you can't portably open a network connection (scroll down
on that page to see cond-expand code that makes this available
in a sort-of portable way).

You could copy/paste this code, and it should probably work
unmodified, but read on for a better solution.

 Do I need to use wget in the shell to download the html page
 and then come back to csi to parse it ??

No, you can also use http-client, which provides a procedure which is
similarly high-level as open-input-resource:

(pp (call-with-input-request
 http://modis.ispras.ru/Lizorkin/XML/poem.xml;
 #f (lambda (p)
  (let ((sxml (ssax:xml-sxml p '(
;; Consume the rest of the stream, ssax does not
;; fully read until the end.
(read-string #f p)
sxml
=
(*TOP* (*PI* xml version='1.0')
   (poem (@ (title The Lovesong of J. Alfred Prufrock)
(poet T. S. Eliot))
 (stanza
   (line Let us go then, you and I,)
   (line When the evening is spread out against the sky)
   (line Like a patient etherized upon a table:))
 (stanza
   (line In the room the women come and go)
   (line Talking of Michaelangelo.

For more information, see http://wiki.call-cc.org/egg/http-client

I hope this helps!

Cheers,
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

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


[Chicken-users] Should http-client automatically consume unconsumed input? [Was: Re: ssax examples could not run]

2011-06-21 Thread Peter Bex
Hi again,

Also, about this piece of code:

 (pp (call-with-input-request
  http://modis.ispras.ru/Lizorkin/XML/poem.xml;
  #f (lambda (p)
   (let ((sxml (ssax:xml-sxml p '(
 ;; Consume the rest of the stream, ssax does not
 ;; fully read until the end.
 (read-string #f p)
 sxml

Does it make sense to have http-client automatically consume any
remaining data after the user-supplied reader returns?
What about continuations?  Or perhaps it should be read when the
*next* request is done?

Thoughts? Opinions?

Cheers,
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

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


[Chicken-users] Taking the distributed egg repository into production

2011-06-18 Thread Peter Bex
Hello everyone,

The distributed egg repository system is now ready for production.
We would like to make the switch to this system soon.  For users, this
should be a completely transparent change.

For egg authors, this means more freedom to use whatever code hosting
site you'd prefer to use.  For more information on how to release
your egg, there's documentation at
http://wiki.call-cc.org/releasing-your-egg

If there are no objections to this switch, we would like to take the
system into production at the end of this week.

Cheers,
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

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


Re: [Chicken-users] Chicken segfault

2011-06-16 Thread Peter Bex
On Thu, Jun 16, 2011 at 04:36:16PM +0200, Sven Hartrumpf wrote:
 Hi all.
 
 How should I investigate this problem?

Tried gdb?

 Or is this a known problem?

AFAIK no, but just to chime in and let you know, I've also gotten
some random segmentation faults in csi which I haven't been able
to put a finger on yet.  Here's hoping that it's possibly the same
cause...

Cheers,
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

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


Re: [Chicken-users] still parameterize bug

2011-06-13 Thread Peter Bex
On Mon, Jun 13, 2011 at 09:25:33PM +0900, Joo ChurlSoo wrote:
 #;1 (define p (make-parameter 10 number-string))
 #;2 (p)
 10
 #;3 (parameterize ((p 100)) (p))
 
 Error: (number-string) bad argument type: 10

Not surprising. The ticket is still open: http://bugs.call-cc.org/ticket/473

-- 
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

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


Re: [Chicken-users] Chicken logo license

2011-06-06 Thread Peter Bex
On Mon, Jun 06, 2011 at 12:32:44PM -0500, Joshua Griffith wrote:
 Peter,
 
 I used the Creative Commons licensing form that John Cowan suggested and 
 placed the license texts within the image source directory:
 
 http://joshuagriffith.com/chicken/logo/license.html
 http://joshuagriffith.com/chicken/logo/license.txt
 
 Will this work for you?

Fantastic, thank you!

(You might want to put your name in the license.txt file too, BTW.
 This make attribution easier)

You can see the result here:
http://en.wikipedia.org/wiki/Chicken_%28Scheme_implementation%29
Clicking on the logo gives you the full SVG image, which can be rescaled
at will for any other page.

Cheers,
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

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


Re: [Chicken-users] Different factorial results

2011-06-03 Thread Peter Bex
On Fri, Jun 03, 2011 at 12:49:26PM -0400, John Cowan wrote:
 Steve Graham scripsit:
 
  Thanks, Mario.  Worked like a charm.  Why is that not part of the base
  package?
 
 Licensing.  The numbers egg has to be GPL, because it depends on the GMP
 (GNU Multi-precision Library) which is GPL.

This is no longer true and hasn't been for over a year now.
The current numbers code is a heavily modified version of Scheme48's
code, which is itself based on the MIT Scheme code which was BSD-licensed
at some point in time.

 The overall license for Chicken, however, is BSD.
 There are alternatives to the GMP, but it is
 the gold standard: fast, accurate, space-conserving.

The GMP-based numbers egg was actually very slow because it made heavy
use of finalizers and malloc()ed memory.  The new code is a bit faster.
Probably a GMP-based numbers egg which uses Chicken-managed memory would
be faster still, but the license annoys me and I still have hopes to get
bignums in Chicken core someday :)

It's not in core mostly because it would make things slower (though I'm
not 100% convinced of that; there's type dispatching for fixnums/flonums
already anyway) and because it is an extra-large additional pile of code.

Cheers,
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

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


Re: [Chicken-users] ANN: Test version of new egg release system available

2011-06-02 Thread Peter Bex
On Mon, Apr 04, 2011 at 12:05:01AM +0200, Peter Bex wrote:
  There are still a few rough spots; it would be nice if releasing an
  egg would be more automated (with a shellscript, for example), so you
  don't need to manually maintain the meta-file and release-info file.
  This will be worked on during the rest of this week.
 
 I've now added this for two VCSes: subversion and mercurial.
 
 There's a chicken egg called svn-egg-author now:
 http://wiki.call-cc.org/eggref/4/svn-egg-author

I've improved on this so that svn-egg-author is no longer necessary for
eggs hosted on call-cc.org.  This means less chance of mistakes and
other errors, and less work if you're not using svn-egg-author.
It also means that the eggs by everyone who isn't using the new system
will still be installable by everyone who is.

In short: The old workflow of simply tagging an egg now also works under
the new distributed system.

I've removed all release-info files from svn since they're no longer
used or neccessary.  If you would like more control over which releases
are actually available (if it's a subset of the tags, for example) or
the files shouldn't all be downloaded, you can still override this.
Just drop me a note and I'll update the egg-locations file to point to
your custom release-info file again.

If you would like to host your eggs in svn on your *own* server, you
can install the pseudo-meta-egg-info egg to make releasing eggs as
easy as it is on call-cc.  For those willing to experiment, it should
in principle also be possible to run pseudo-meta-egg-info for
alternative version control systems like Mercurial or Git.  Because
popular code hosting sites have a way to download tarballs of tagged
releases, it isn't as necessary for those systems though.

Documentation for pseudo-meta-egg-info lives on the wiki, as usual:
http://wiki.call-cc.org/eggref/4/pseudo-meta-egg-info
(this egg is only available under the new system!)

Cheers,
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

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


Re: [Chicken-users] Possible numbers bug

2011-06-01 Thread Peter Bex
On Sun, May 29, 2011 at 11:39:31PM +0200, Peter Bex wrote:
 On Fri, May 27, 2011 at 10:58:04AM +0200, Dominic Pearson wrote:
  Hello folks,
  
  I am trying to compute the sum i = 0 to n where n = 1000 of n^n, but
  chicken seems to return the incorrect answer.
  
  http://paste.call-cc.org/paste?id=e0884580a684d1220f3dedb819f63201b6f5eb1a
  
  Racket and scheme48 both seem to give different answers too.
 
 I figured out where it goes wrong.  expt calls the base Chicken expt and
 if that returns a fixnum, this result is used (if it's a flonum it might've
 overflowed and is inexact anyway so it will use a different path).
 
 This algorithm is sound.

No, it's not.  The pow() function in C doesn't set errno when it drops
some digits so there's apparently no way to detect this.

I've ripped out the expt code and it now uses the same path for bignums
and fixnums.  This has been released as version 2.5 of the numbers egg.

Thanks for reporting this!

Cheers,
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

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


[Chicken-users] Renamed identifier not imported

2011-05-29 Thread Peter Bex
Hi,

When importing a renamed identifier in module A and then loading that
library from another module B, I get the following with Chicken 4.7.0:

Warning: renamed identifier not imported: (define-external old-define-external)

This doesn't seem to be right; module B shouldn't need to know that module A
uses a renamed version of define-external.  Is this a bug, or did I do
something wrong?

Cheers,
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

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


Re: [Chicken-users] Possible numbers bug

2011-05-29 Thread Peter Bex
On Fri, May 27, 2011 at 10:58:04AM +0200, Dominic Pearson wrote:
 Hello folks,
 
 I am trying to compute the sum i = 0 to n where n = 1000 of n^n, but
 chicken seems to return the incorrect answer.
 
 http://paste.call-cc.org/paste?id=e0884580a684d1220f3dedb819f63201b6f5eb1a
 
 Racket and scheme48 both seem to give different answers too.

I figured out where it goes wrong.  expt calls the base Chicken expt and
if that returns a fixnum, this result is used (if it's a flonum it might've
overflowed and is inexact anyway so it will use a different path).

This algorithm is sound. However, base Chicken produces wrong results
for some values (and this also depends on the platform, 64 bits NetBSD libc
in this case):

#;1 (expt 999 6)
994014980014993920

This should be:
gosh (expt 999 6)
994014980014994001

Scheme48 and Racket concur with Gauche.

The reason this goes wrong is that Chicken core does not check errno
after calling C's pow() function.

I am unsure how to fix this.  It can be worked around easily in numbers
by always choosing the slow path, but I think this should really be
fixed in core.  Maybe core should return +nan or +inf in cases where
errno was modified?

Cheers,
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

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


Re: [Chicken-users] Possible numbers bug

2011-05-28 Thread Peter Bex
On Sat, May 28, 2011 at 11:03:41AM -0700, Matt Welland wrote:
 What was the final word on this? Is it a real issue on some platforms?

Probably. I will look into it when time allows.

 Anyhow, I found this whole exercise pretty interesting and played with
 it a bit more and observed a couple curious things:
 
 2. Taking the inverse exponent (i.e. result^(1/n) ) runs into trouble
 at n=144. Anyone care to explain why that is and is there a numerical
 methods trick to work around it?

You divide the inexact 1.0 by the number.  Try doing an exact division
like (/ 1 n) or just (/ n). This will produce a rational number which
is exact and not limited in any way.

 3. Why do guile, scm and STk put out +inf.0 and chicken puts out +inf
 (gauche gives #i1/0)? My hazy understanding is that +inf.0 is not the
 same as +inf.

I think it's the same.  Only flonums can be +inf and hence the .0 is
superfluous.

Cheers,
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

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


Re: [Chicken-users] [wish list] chicken-install: show available eggs, upgrade all installed eggs?

2011-05-09 Thread Peter Bex
On Mon, May 09, 2011 at 10:25:27PM +0900, Alex Shinn wrote:
 On Thu, May 5, 2011 at 7:18 PM, Peter Bex peter@xs4all.nl wrote:
 
  With Lisp/Scheme code, the only sensible indentation style really is
  spaces.  With braces-like languages like C it makes sense to use tabs
  if used consistently, but even there it's a good source of flamewars.
 
 You get exactly the same problem in C with nested function
 applications:
 
   foo(some_long_function_call1(...),
 some_long_function_call2(...),
 ...);

Yeah. You can still use tabs to align things within block though!
To get completely consistent results you'd need to indent using tabs
up till you're aligned with foo and use spaces to indent the arguments.

I think the TabsAreEvil page describes this too.

Cheers,
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

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


Re: [Chicken-users] [wish list] chicken-install: show available eggs, upgrade all installed eggs?

2011-05-08 Thread Peter Bex
On Sun, May 08, 2011 at 12:52:36PM +0200, Felix wrote:
  
  I'm not crazy at getting bleeding edge eggs.. However, I do like to upgrade
  `chicken' itself whenever a newer release comes out.  Only realize that i 
  have
  to find out and reinstall all eggs again. (Because at least all the eggs 
  have to
  be recompiled using the new chicken?)
 
 Not always, only if some incompatibility has been introduced, particularly in
 the C runtime system or header-files.
 
 I have added an option called -reinstall to chicken-install (see 
 experimental
 branch). This will reinstall all installed eggs, using the same versions. Only
 minimally tested, though.

I don't think this will help much.  If there's an incompatibility,
generally the ABI version is increased too (the 5 in /usr/lib/chicken/5/),
so reinstall would reinstall all 0 eggs you have under the new directory :)

Cheers,
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

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


<    2   3   4   5   6   7   8   9   10   11   >