[Top][All Lists]
[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))
- Unicode chars in scheme?, Tao Cumplido, 2009/06/23
- Re: Unicode chars in scheme?, Trevor Daniels, 2009/06/24
- Re: Unicode chars in scheme?, Tao Cumplido, 2009/06/24
- Re: Unicode chars in scheme?, Mark Polesky, 2009/06/24
- Re: Unicode chars in scheme?, Tao Cumplido, 2009/06/24
- Re: Unicode chars in scheme?, Mark Polesky, 2009/06/24
- Re: Unicode chars in scheme?, Tao Cumplido, 2009/06/24
- Re: Unicode chars in scheme?,
Mark Polesky <=
- Re: Unicode chars in scheme?, Tao Cumplido, 2009/06/25
- Re: Unicode chars in scheme?, Neil Puttock, 2009/06/24