Masatake YAMATO | 3 Mar 2009 02:24
Picon
Favicon

A typo in the documentation of string-replace

Hi,

Could you apply this very small patch?

Masatake YAMATO

Index: doc/modsrfi.texi
===================================================================
--- doc/modsrfi.texi	(revision 6571)
+++ doc/modsrfi.texi	(working copy)
 <at>  <at>  -2430,7 +2430,7  <at>  <at> 
  <at> subsection Other string operations
  <at> c NODE 他の文字列操作

- <at> defun string-replace s1 s2 start1 end2 &optional start2 end2
+ <at> defun string-replace s1 s2 start1 end1 &optional start2 end2
 [SRFI-13]
  <at> end defun

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
Shiro Kawai | 3 Mar 2009 23:41
Favicon

Re: A typo in the documentation of string-replace

Fixed.  Thanks.

--shiro

From: Masatake YAMATO <yamato <at> redhat.com>
Subject: [Gauche-devel] A typo in the documentation of string-replace
Date: Tue, 03 Mar 2009 10:24:09 +0900 (JST)

> Hi,
> 
> Could you apply this very small patch?
> 
> Masatake YAMATO
> 
> Index: doc/modsrfi.texi
> ===================================================================
> --- doc/modsrfi.texi	(revision 6571)
> +++ doc/modsrfi.texi	(working copy)
>  <at>  <at>  -2430,7 +2430,7  <at>  <at> 
>   <at> subsection Other string operations
>   <at> c NODE 他の文字列操作
>  
> - <at> defun string-replace s1 s2 start1 end2 &optional start2 end2
> + <at> defun string-replace s1 s2 start1 end1 &optional start2 end2
>  [SRFI-13]
>   <at> end defun
>  

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
(Continue reading)

Jens Thiele | 23 Mar 2009 00:05
Picon

emacs scheme mode not getting confused by regular expressions?

Hi,

which emacs scheme mode do you use? (or which version?)

especially which emacs scheme mode doesn't get confused by regular
expression reader syntax?

example (stolen from gauche/lib/text/sql.scm):

#!/bin/sh
#| -*- mode: scheme; coding: utf-8; -*- |#
:; exec gosh -- $0 "$ <at> "
(define (main args)
  (let* ((s (ref args 0))
	 (c (ref s 0)))
    (cond
     [(char=? c #\') (scan-string s r)]
     [(char=? c #\") (scan-delimited s r)]
     [(#/^[+-]?(?:\d+(?:\.\d*)?|(?:\.\d+))(?:[eE][+-]?\d+)?/ s)
            => (lambda (m)
                 (entry (m 'after) (cons `(number ,(m)) r)))]
   [else #f]))
   0)

the last regular expression confuses stock scheme.el
(at least the one included in debian/lenny emacs¹)

looking at emacs.el it seems the following line may be the problem?

    ;; These characters are delimiters but otherwise undefined.
(Continue reading)

Jens Thiele | 23 Mar 2009 00:22
Picon

Re: ANN: dyncomp 0.2.0

"KOGURO, Naoki" <naoki <at> koguro.net> writes:

> Hi all.
>
> dyncomp 0.2.0 is released.
>
> dycomp is a module that enables to create C function with
> gauche.cgen.cise (C in S expression). This function is compiled to
> native code with Tiny C Compiler (http://bellard.org/tcc/), so you can
> create a fast function.
>
> The change from the previous version is:
>     - Gauche module has bindings of C symbols, so different gauche  
> modules can associate different binding to the same C symbol.
>     - Added some macros (define-cfn, dyncomp-reset!).
>
> See http://homepage.mac.com/naoki.koguro/prog/dyncomp/index.html for
> more details.

Regarding the current state of tcc (especially with respect to x86_64
(amd64) and other non-x86 platforms) it would be nice if one could just
use the "default compiler" of the platform (for example gcc). Of course
compilation would be slower.
Regarding the size: I once compiled a stripped down tool-chain for a arm
platform and was quite surprised how small you can get it (and still
being useful).

PS:
I (tried) to use tcc in a similar scenario and had some trouble with multiple
tcc states at that time (don't know wheter this was fixed - but i think i
(Continue reading)

Shiro Kawai | 23 Mar 2009 09:38
Favicon

Sparse data structures and large hash tables

If you are monitoring Gauche svn trunk, you might have noticed
that a new extension module util.sparse was added recently
(under ext/sparse).  There are some design decisions I have to
make on it, and I'd like to get input from you.

Abstract:

   I added data structures to provide sparse verctor and
   alternative hash tables, somewhat similar to Clojure's
   array and hashtables (though mine is mutable).  It seems
   to behave well in large data situation.  Should I provide
   them as an extention module as it is now, or should I
   incorporate it into the core and replace existing hashtables?

Detail discussion:

The util.sparse module provides data structures backed by a
compact trie.  It is a trie with 32 alphabets (i.e. each
tree node can have up to 32 branches).  Given integer key,
it takes every 5 bits from LSB as the selector.  If you know
Clojure's implementation, you may notice it is similar to
how Clojure implements hashtables and arrays.  Though util.sparse
provides mutable structure, instead of immutable one like Clojure's.

Each node of the trie is compressed using bitmaps; one bitmap
represents which branch the node has, and another keeps whether
that branch points to a leaf or another node.  And the node only
keeps pointers to existing branches; that is, if the node has
two children, it occupies two 32bit bitmaps plus two pointers = 
four words in 32bit architecture.  Thus it is memory efficient
(Continue reading)

Andrew Gwozdziewycz | 23 Mar 2009 11:50
Picon
Gravatar

Re: emacs scheme mode not getting confused by regular expressions?

I tried the example you sent with quack.el from Neil Van Dyke
(http://neilvandyke.org/quack) and it seemed to work correctly. You
might want to give it a try. There's also cmuscheme mode, but I can't
vouch for that.

On Sun, Mar 22, 2009 at 7:05 PM, Jens Thiele <karme <at> berlios.de> wrote:
> Hi,
>
> which emacs scheme mode do you use? (or which version?)
>
> especially which emacs scheme mode doesn't get confused by regular
> expression reader syntax?
>
> example (stolen from gauche/lib/text/sql.scm):
>
> #!/bin/sh
> #| -*- mode: scheme; coding: utf-8; -*- |#
> :; exec gosh -- $0 "$ <at> "
> (define (main args)
>  (let* ((s (ref args 0))
>         (c (ref s 0)))
>    (cond
>     [(char=? c #\') (scan-string s r)]
>     [(char=? c #\") (scan-delimited s r)]
>     [(#/^[+-]?(?:\d+(?:\.\d*)?|(?:\.\d+))(?:[eE][+-]?\d+)?/ s)
>            => (lambda (m)
>                 (entry (m 'after) (cons `(number ,(m)) r)))]
>   [else #f]))
>   0)
>
(Continue reading)

Raffael Cavallaro | 23 Mar 2009 14:12
Picon

Re: Sparse data structures and large hash tables


On Mar 23, 2009, at 4:38 AM, Shiro Kawai wrote:

> Yet I don't want too long name like <compact-trie-hash-table>.
> Any ideas?
>
> --shiro

<trie-table> ?

Raffael Cavallaro, Ph.D.
raffaelcavallaro <at> mac.com

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
KOGURO, Naoki | 23 Mar 2009 16:40

Re: ANN: dyncomp 0.2.0

On 2009/03/23, at 8:22, Jens Thiele wrote:

> Regarding the current state of tcc (especially with respect to x86_64
> (amd64) and other non-x86 platforms) it would be nice if one could  
> just
> use the "default compiler" of the platform (for example gcc). Of  
> course
> compilation would be slower.
> Regarding the size: I once compiled a stripped down tool-chain for a  
> arm
> platform and was quite surprised how small you can get it (and still
> being useful).
>
> PS:
> I (tried) to use tcc in a similar scenario and had some trouble with  
> multiple
> tcc states at that time (don't know wheter this was fixed - but i  
> think i
> saw some related work...)

Exactly, the default compiler like gcc is better than tcc in cross- 
platformness and generated-code quality. But why I've used tcc is to  
generate native code in REPL environment. I don't want to discard  
interactiveness when I use C, so I've made dyncomp.

tcc can't handle multiple tcc states (at least ver 0.9.24 can't handle  
them) in real, so I modified it to handle multiple states and to be  
able to relocate binary any times. tcc's code is small and easy to  
understand and it's easier to modify than gcc.

(Continue reading)

Jens Thiele | 23 Mar 2009 17:49
Picon

Re: emacs scheme mode not getting confused by regular expressions?

Andrew Gwozdziewycz <apgwoz <at> gmail.com> writes:

> I tried the example you sent with quack.el from Neil Van Dyke
> (http://neilvandyke.org/quack) and it seemed to work correctly. You
> might want to give it a try. 

Thanks, that works. Small change I use to get let1 and let-optionals*
recognized below. (I already had an older quack.el installed, but the
require was missing in my .emacs - hmm I think I disabled it at some
point again ... if I only could remember)

diff -u /home/jens/develop/emacs/quack.el.orig /home/jens/develop/emacs/quack.el
--- /home/jens/develop/emacs/quack.el.orig	2009-02-24 21:54:57.000000000 +0100
+++ /home/jens/develop/emacs/quack.el	2009-03-23 17:38:16.000000000 +0100
 <at>  <at>  -807,7 +807,7  <at>  <at> 
     "call-with-input-file" "call-with-output-file" "call/cc" "case"
     "case-lambda" "class" "cond" "delay" "do" "else" "exit-handler" "field"
     "for-each" "if" "import" "inherit" "init-field" "interface" "lambda" "let"
-    "let*" "let*-values" "let-values" "let-syntax" "let/ec" "letrec"
+    "let*" "let1" "let-optionals*" "let*-values" "let-values" "let-syntax" "let/ec" "letrec"
     "letrec-syntax" "map" "mixin" "opt-lambda" "or" "override" "protect"
     "provide" "public" "rename" "require" "require-for-syntax" "syntax"
     "syntax-case" "syntax-error" "syntax-rules" "unit/sig" "unless" "when"
 <at>  <at>  -3146,6 +3146,8  <at>  <at> 
 (put 'lambda/kw          'scheme-indent-function 1)
 (put 'let*-values        'scheme-indent-function 1)
 (put 'let+               'scheme-indent-function 1)
+(put 'let1               'scheme-indent-function 2)
+(put 'let-optionals*     'scheme-indent-function 2)
 (put 'let-values         'scheme-indent-function 1)
(Continue reading)

John Kilburg | 23 Mar 2009 18:51

Re: Sparse data structures and large hash tables

>If I know that the bucket+chain hashtables behaves poorly, should I
>replace the default hashtable with compact trie one?  Or at least to
>switch from bucket+chain to compact trie once the number of elements
>goes over some threshold?  That adds the compexity of the core
>implementation (libgauche), which I don't like to happen.

The compact trie needs testing like all new code.  If you make compact
trie the core hashtable algorithm then it will get tested. :)

Is it easily possible to make a configure option to allow a compile-time
decision?

Something like:

configure --bucket-hash
configure --trie-hash

Hopefully this would not add too much complexity to the Gauche build
system.

							-john

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com

Gmane