[Chicken-users] fnmatch egg

2014-07-27 Thread Caolan McMahon
I've just written some bindings to fnmatch(3), which provides
shell-style wildcard pattern matching for filenames. Much like `glob`
from the posix module, only it matches two strings, returning a
boolean rather than descending directories and returning a list of
matching filenames.

https://github.com/caolan/chicken-fnmatch

This is fairly trivial, but doesn't appear to be available anywhere
else on the egg index. If someone could add it I'd appreciate it.

Thanks,

Caolan

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


Re: [Chicken-users] fnmatch egg

2014-07-27 Thread Peter Bex
On Sun, Jul 27, 2014 at 11:54:07AM +0100, Caolan McMahon wrote:
> I've just written some bindings to fnmatch(3), which provides
> shell-style wildcard pattern matching for filenames. Much like `glob`
> from the posix module, only it matches two strings, returning a
> boolean rather than descending directories and returning a list of
> matching filenames.
> 
> https://github.com/caolan/chicken-fnmatch
> 
> This is fairly trivial, but doesn't appear to be available anywhere
> else on the egg index. If someone could add it I'd appreciate it.

Cool, thanks!  I've added it to egg-locations, it should be available
from chicken-install in an hour or so.

Cheers,
Peter
-- 
http://www.more-magic.net

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


[Chicken-users] New leveldb eggs

2014-07-27 Thread Caolan McMahon
I published leveldb bindings a while ago. It turns out the
implementation had some issues with mangled keys in some
circumstances. I've now fixed these issues and created some additional
eggs to compliment leveldb. The new eggs are as follows:

level - provides the leveldb interface (put/get etc)
https://github.com/caolan/chicken-level

leveldb - an implementation of the 'level' api, using libleveldb to store data
https://github.com/caolan/chicken-leveldb

sublevel - an implementation of the 'level' api which provides
namespaced access to another implementation
https://github.com/caolan/chicken-sublevel

I'm hoping to write (or encourage someone else to write) a memory-only
implementation of the 'level' API, which would be useful for testing
or other circumstances where you want to use a module written to the
'level' interface without persisting data.

A small backwards compatibility note on the `level` API - the
`db-stream` procedure now returns a lazy-seq instead of requiring a
thunk which accepts a lazy-seq. It uses set-finalizer! to clean up the
iterator after you've finished with the lazy sequence.

If someone could add the new `level` and `sublevel` eggs to the egg
index that would be great!

Thanks,

Caolan

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


Re: [Chicken-users] New leveldb eggs

2014-07-27 Thread Peter Bex
On Sun, Jul 27, 2014 at 12:34:08PM +0100, Caolan McMahon wrote:
> I published leveldb bindings a while ago. It turns out the
> implementation had some issues with mangled keys in some
> circumstances. I've now fixed these issues and created some additional
> eggs to compliment leveldb. The new eggs are as follows:
> 
> level - provides the leveldb interface (put/get etc)
> https://github.com/caolan/chicken-level

Added, thanks!

> leveldb - an implementation of the 'level' api, using libleveldb to store data
> https://github.com/caolan/chicken-leveldb

This egg was already added.  Looks like you just made a new release,
but that should automatically appear for download.

> sublevel - an implementation of the 'level' api which provides
> namespaced access to another implementation
> https://github.com/caolan/chicken-sublevel

Added, thanks!

> I'm hoping to write (or encourage someone else to write) a memory-only
> implementation of the 'level' API, which would be useful for testing
> or other circumstances where you want to use a module written to the
> 'level' interface without persisting data.

Sounds useful.  And perhaps some integration with a relational DB, or
other types of stores (memcached?) could be added.

Cheers,
Peter
-- 
http://www.more-magic.net

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


Re: [Chicken-users] New leveldb eggs

2014-07-27 Thread Caolan McMahon


>> I'm hoping to write (or encourage someone else to write) a
>memory-only
>> implementation of the 'level' API, which would be useful for testing
>> or other circumstances where you want to use a module written to the
>> 'level' interface without persisting data.
>
>Sounds useful.  And perhaps some integration with a relational DB, or
>other types of stores (memcached?) could be added.

Yes, that would be great. There are already key value store eggs based on 
sqlite in the egg index, perhaps one of those could be adapted to an egg 
exposing the level api...

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

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


Re: [Chicken-users] New leveldb eggs

2014-07-27 Thread John Cowan
Caolan McMahon scripsit:

> I'm hoping to write (or encourage someone else to write) a memory-only
> implementation of the 'level' API, which would be useful for testing
> or other circumstances where you want to use a module written to the
> 'level' interface without persisting data.

It would be trivial to layer this on top of the rb-tree egg.  Since
all is in memory, you don't have to bother with the subtleties of
constructing a "proper" lazy sequence: just use fold(i) to get an
ordinary list and then use list->lazy-seq.

The only issue is that the rb-tree egg is GPL3, but that shouldn't
matter for testing purposes.  You could also ask the author, Ivan Raikov,
for a license exception.

-- 
John Cowan  http://www.ccil.org/~cowanco...@ccil.org
"Why yes, I'm ten percent Jewish on my manager's side."
--Connie Francis

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


Re: [Chicken-users] sxml and more

2014-07-27 Thread Jim Ursetto
I've got a couple of blog posts on SXML and namespaces, if you haven't already 
seen them:

http://3e8.org/blog/2010/07/30/namespaces-in-sxml-part-1/
http://3e8.org/blog/2010/07/31/namespaces-in-sxml-part-2/
http://3e8.org/blog/2010/08/01/default-namespaces-in-sxml/

but these are higher-level and so perhaps not useful to you.

There's definitely very little documentation and only marginally more code 
examples.  Most of this I reverse engineered from docs I pieced together and 
the original code itself.  Peter did a great job at adding a lot of 
documentation, for example to the sxpath low-level functions, but there are 
still large gaps.  There's also bugs and missing functionality.  And as noted, 
it's a grab-bag of parts which don't necessarily work together, or provide an 
80% solution.  Case in point, the lack of namespace support in sxml-modify.

If you have specific questions you could try asking here, or on the Sourceforge 
list.  I haven't used sxml-modify myself.  Which low-level tools did you want 
to learn about?

On Jul 25, 2014, at 1:54 PM, Nathaniel Rudavsky-Brody  wrote:

> Hello,
> 
> Since this is my first post, let me say how happy I've been since I 
> discovered Chicken: thanks everyone for creating such a well-thought-out 
> environment.
> 
> I've got a general question about the sxml tools. I've been using the 
> top-level functions for a while now, for tasks I could do in XSLT, but prefer 
> doing in Scheme. I've always found the lower-level interface(s) a bit 
> intimidating. 
> 
> But recently I got stuck on the lack of namespaces in sxml-modify, and 
> started wondering if it would be possible to rewrite it, and then... well 
> more generally, whether it's worth learning how to use the low-level tools, 
> and what I could do with them. Or are pre-post-order and sxpath and sxml-path 
> as good as it gets, for an average user like me? When I search around the 
> web, I can't seem to find examples of more advanced uses of the tools (or at 
> least, well-documented ones...).
> 
> Many thanks for your thoughts,
> 
> Nathaniel
> 
> 
> 
> -- 
> Caractères mobiles
> production ebook artisanale
> http://studio.cm
> +32 (0) 485 136 458
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users

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


Re: [Chicken-users] Using epsilon in test egg

2014-07-27 Thread Alex Shinn
On Sun, Jul 27, 2014 at 10:03 AM, Matt Gushee  wrote:

> Hmm, just realized something. The test egg documentation also says:
>
>   "Percentage difference allowed ..."
>
> So if the expected value is 0, then no variance is allowed? If that's
> true, then epsilon isn't what I want anyway. I need to allow an
> absolute amount of variance that is independent of the values being
> tested.
>

By the way, in general you do _not_ want absolute differences.
The test egg is doing the right thing for general comparisons.
Arguably it may be better to use ULPs (Units in the Last Place),
but they're harder to get at in portable Scheme and not clearly
better.  For more than you ever wanted to know about the subject
see:

http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm

The solution is definitely not to write your own comparison function,
and trust that the test egg is doing the right thing.

-- 
Alex


> Anyway, I'd appreciate help in understanding how this is supposed to work
> ...
>
> On Sat, Jul 26, 2014 at 6:42 PM, Matt Gushee  wrote:
> > Hi, folks--
> >
> > I am working on an application that does a lot of floating-point
> > calculations, and I'm having trouble with the test suite. The program
> > is based on the imlib2 egg, and it does some fairly simple image
> > processing for web applications, so the numbers in question are RGBA
> > color values. Internally I am handling all the numbers as floats in
> > the range 0-1, because the blending and compositing formulas are much
> > more straightforward that way compared to using integers 0-255.
> >
> > So I have a number of functions that produce lists of numbers like these:
> >
> >   '(0.323 0.788834 0.12 0.4)
> >   '(0 0 0 1.0)
> >   '(0.67 0.4 0.562 0.0)
> >
> > And given the above, a moderate degree of imprecision in the results
> > is perfectly acceptable - I haven't yet confirmed this with actual
> > images, but I'm thinking as much as 0.5% variance should work fine
> > (basically, as long as the colors in the generated images look as
> > expected to a casual observer, the result should be acceptable). So of
> > course I want the test results to reflect this.
> >
> > I am using the following procedure to compare number lists:
> >
> >   (define (list= l1 l2)
> >   (and (= (length l1) (length l2))
> >(let loop ((l1* l1) (l2* l2))
> >  (cond
> >((null? l1*) #t)
> >((= (car l1*) (car l2*)) (loop (cdr l1*) (cdr l2*)))
> >(else #f)
> >
> > And for the tests that use this predicate, I set
> >
> >   (current-test-epsilon 0.005)
> >
> > [or 0.002 or 0.001 - it doesn't seem to make any difference]
> >
> > But I'm finding that certain tests still fail unexpectedly, e.g.
> >
> >  2.03.10: (parse-color "167,215,51" #f) => '(0.655 0.843 0.200 1.0)  [
> FAIL]
> >   expected (0.655 0.843 0.2 1.0)
> >   but got (0.654901960784314   0.843137254901961 0.2 1.0)
> >
> > But:
> >
> >   (/ 0.654901960784314 0.655) => 0.999850321808113
> >   (/ 0.843137254901961 0.843) => 1.0001628172028
> >
> > So it would appear that the epsilon value does not apply to these tests.
> >
> > I can certainly define a custom equality predicate that will do what I
> > need, but this is bugging me. I guess I don't really understand how
> > epsilon is supposed to work. The test egg documentation says that
> > applies to 'inexact comparisons', but I can't find a definition of
> > 'inexact comparison'. I have also read that '=' may be unreliable for
> > inexact numbers, but I don't know what else to use. Perhaps 'fp=' from
> > the Chicken library? Then I would have to ensure that all numbers are
> > expressed as floats, whereas currently my code has a number of cases
> > where 1 and 0 are expressed as integers.
> >
> > So ... do I understand the problem correctly? Any recommendations?
> >
> > Matt Gushee
>
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users