[CM] mark-explode modifications

rm@fabula.de rm@fabula.de
Thu, 24 Jun 2004 14:12:41 +0200


On Thu, Jun 24, 2004 at 01:57:47PM +0200, rm@fabula.de wrote:
> On Wed, Jun 23, 2004 at 12:19:35PM -0700, cristopher pierson ewing wrote:
> > So here's my stab at the facility of naming exploded sounds after the
> > original sound they were created from:
> > 
> > ;;;------find-char
> > (define (find-char string char)
> > 	(do ((position 0)
> > 		 (i 0 (+ i 1)))
> > 		((= i (string-length string)) position)
> > 	  (if (char=? char (string-ref string i))
> > 	  	(set! position i))))
> 
> 
> You might want to use 'string-index'
> 
>  guile> (string-index "A long and uggly string" #\i)
>  20
> 
> You can find such gems with:
> 
>  (apropos "string")
> 
>  ......
> 
> For string handling i suggest using the SRFI module for strings:
> 
>  guile> (use-modules (srfi srfi-13))
>  guile> (define (trim-name name)
>  ...      (string-drop-right name (- (string-length name) (string-index name #\.))))
>  guile> (trim-name "a-sound.afi")
>  "a-sound"

Hate to follow up my own posts:

  guile> (use-modules (srfi srfi-13))
  guile> (define (trim-name name)
  ...      (string-take name (string-index name #\.)))
  guile> (trim-name "a-sound.aif")
  "a-sound"

HTH RalfD


> HTH Ralf Mattes
> 
> _______________________________________________
> Cmdist mailing list
> Cmdist@ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist