chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Chicken Gazette - Issue 3


From: Alaric Snell-Pym
Subject: [Chicken-users] Chicken Gazette - Issue 3
Date: Fri, 10 Sep 2010 21:03:53 +0100
User-agent: Mozilla/5.0 (X11; U; NetBSD amd64; en-US; rv:1.9.1.9) Gecko/20100520 Lightning/1.0b2pre Shredder/3.0.4


     _/_/_/  _/        _/            _/
  _/        _/_/_/          _/_/_/  _/  _/      _/_/    _/_/_/
 _/        _/    _/  _/  _/        _/_/      _/_/_/_/  _/    _/
_/        _/    _/  _/  _/        _/  _/    _/        _/    _/
 _/_/_/  _/    _/  _/    _/_/_/  _/    _/    _/_/_/  _/    _/

--[ Issue 3 ]-------------------------------------- G A Z E T T E
                               brought to you by the Chicken Team


== 0. Introduction

Welcome to issue 3 of the Chicken Gazette!

There is work afoot to improve the build system, so we would very much like
testing and feedback on the Cygwin, Solaris and Haiku ports. If you have
access
to any of these operating systems, please check out the `make-refactoring`
branch of chicken-core from git and tell us if it works well for you; append
any feedback to ticket 167 in trac (http://bugs.call-cc.org/ticket/167).

== 1. Infrastructure

Salmonella is now running on Chicken 4.6.0rc1, and a drive to attract
attention to broken eggs has brought our current failing egg count
(http://tests.call-cc.org/2010/09/10/salmonella-report/) down to a mere
FOUR,
which may well be the lowest it's ever been (since we only /had/ four
eggs, at
least).

For those who find git is not to their taste, there is now a
regularly-updated
bzr mirror of the chicken core at https://code.launchpad.net/~chicken, and
the git repository can also be accessed via the git protocol (as well as the
existing git-over-http) at git://code.call-cc.org/chicken-core. Now you
have no
excuse not to track the development releases!

== 2. The Hatching Farm - New Eggs & The Egg Repository

There have been no new eggs this week, but many commits - most
notably, Ivan Raikov has done a great job of moving egg documentation
to the wiki from various legacy formats, so they'll all appear in
chicken-doc and chickadee.

== 3. The Core - Bleeding Edge Development

The week started with Felix fixing a bug reported by Sven Hartrumpf,
where `-optimize-level 2` was causing chicken to die with "Error: (=)
bad argument type - not a number: #f". Not to be outdone, Felix then
went and fixed the Cygwin build system, so even those of us
unfortunate enough to be shackled to Windows can enjoy tasty Chicken
goodness without needing to ssh into a real computer.

There's been non-stop fun out on the branches, too, with Peter Bex
instigating a massive refactoring of the build system on the
`make-refactoring` branch, and Felix doing optimizer and arithmetic
work on the `experimental` and `overflow-detection` branches.

== 4. Chicken Talk

The Chicken Users list has been fairly busy this week, starting with
the aforementioned optimizer bug report. An issue was raised with the
tinyclos egg using the `-no-procedure-checks-for-toplevel-bindings`
flag to csc, only introduced in version 4.5.2, while 4.5.0 is the
latest stable release. It was pointed out that chicken-install will
gladly install older versions of eggs with the following syntax:

    chicken-install tinyclos:<version>

However, in future, it would probably be a good idea if egg authors held
off of
releasing versions of their eggs that use features from development
builds of
Chicken!

Alaric Snell-Pym (your faithful Gazette editor this week) suggested
adding links to browse the source code and to discuss each egg on the
egg index (http://wiki.call-cc.org/chicken-projects/egg-index-4.html)
page; there was a positive response to the idea of the source code
links as long as it doesn't clutter things, but it was felt that users
should be encouraged to raise egg suggestions and questions on the
mailing list. A patch is in the pipeline to add the source browser
links, so we can decide if it's a good idea in practice.

== 5. Omelette Recipes - Tips and Tricks

One of my favourite eggs is fmt (http://wiki.call-cc.org/eggref/4/fmt).
There are two reasons for this. One is that I like what it does; neat text
formatting is difficult, and is usually a distraction from the core problem
your application is trying to solve; the fmt egg makes things like
columns and
justification easy. The second is that I like how it works.

Common Lisp has the format function, which works much like C's printf
function: a format string is provided containing static text with
special control sequences where values should be inserted at run
time. Naturally, format far exceeds printf in power; it being /Common
Lisp/, they of course had to include such features as Roman numerals
alongside more immediately useful features such as formatting lists
neatly. However, format is not extensible; it has a fixed library of
control sequences that tell it how to format things like lists,
numbers, and strings; and various formatting operations such as left
or right alignment, padding to fixed widths, and so on. People who
wish to have different formatting modes for arbitrary objects (such as
user-defined types), or specific formatting operations (such as
flowing text into a circular frame), had to abandon format and write
their own from scratch.

And that's no fun.

fmt abandons the "format string" approach, and is instead based on a
library of formatting combinators. Thanks to this architecture, new
combinators can be defined in terms of the existing combinators. It
comes with a rich library of combinators, supporting such things as
SRFI-38 compliant pretty-printing of sexprs with shared structure, the
full range of number formats (from customisable decimal points,
thousand separators and scientific notation through to - you guessed
it - Roman numerals (in two flavours!)), list formatting, decimal
alignment for tables of numbers, trimming and padding to align columns
(with configurable behaviour for values that won't fit in their
columns, including using an ellipsis to warn the reader of omitted
content), and support for wrapped columns of multi-line values
(including justification).

Perhaps my favourite example from the manual is:

    (define func
      '(define (fold kons knil ls)
         (let lp ((ls ls) (acc knil))
           (if (null? ls) acc (lp (cdr ls) (kons (car ls) acc))))))

    (define doc
      (string-append
       "The fundamental list iterator.  Applies KONS to each element "
       "of LS and the result of the previous application, beginning "
       "with KNIL.  With KONS as CONS and KNIL as '(), equivalent to
REVERSE."))

    (fmt #t (columnar (pretty func) " ; " (justify doc)))

The glorious output of this is:

    (define (fold kons knil ls)           ; The    fundamental   list
 iterator.
      (let lp ((ls ls) (acc knil))        ; Applies   KONS  to  each
element  of
        (if (null? ls)                    ; LS  and  the  result  of
the previous
            acc                           ; application,   beginning
with  KNIL.
            (lp (cdr ls)                  ; With  KONS  as  CONS and
KNIL as '(),
                (kons (car ls) acc)))))   ; equivalent to REVERSE.

The fmt egg makes beautifully-formatted text output from your applications
easy. Give it a try!

== 6. About the Chicken Gazette

The Gazette is produced weekly by a volunteer from the Chicken community.
The latest issue can be found at http://gazette.call-cc.org or you can
follow it in your feed reader at http://gazette.call-cc.org/feed.atom.
If you'd like to write an issue, check out the instructions
(http://bugs.call-cc.org/browser/gazette/README.txt) and come and find us in
#chicken on Freenode!

[ --- End of this issue --- ]



































Nobody puts Chicky in a henhouse!!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]