lilypond-user
[Top][All Lists]
Advanced

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

Re: Unicode chars in scheme?


From: Mark Polesky
Subject: Re: Unicode chars in scheme?
Date: Wed, 24 Jun 2009 12:38:44 -0700 (PDT)

Tao Cumplido wrote:
> #(define (super-string s)
>   (if (string? s)
>     (let ((n (string-length s))
>           (s2 ""))
>       (do ((i 0 (1+ i))) ((= i n))
>         (let* ((c (cdr (assoc (string-ref s i) super-ref char=?)))
>             (l (string-length c)))
>       (do ((a 0 (1+ a))) ((= a l))
>         (set! s2 (string-append s2 (string (string-ref c a)))))))
>       s2)))
>
> It's a little chaotic but it works.
> A minimal sample of (super-ref) could be:
>
> #(define super-ref
>   (list
>     (cons #\A "Ø")
>   ))

Nice work! Here's one way to simplify it.
- Mark

(define super-ref
  (list
    (cons #\A "Ø")
  ))

(define (char->special x)
  (assoc-ref super-ref x))

(define (super-string str)
  (let ((new ""))
    (string-for-each
      (lambda (x) (set! new (string-append new (char->special x))))
      str)
    new))







reply via email to

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