does anyone understands why this does not return the expected result

        (define *texu/reserved-characters*
          ;; % \ { } ~ $ & # ^ _
          '(
            #\%         ;; comments
            #\\         ;; command(follows by a space)
            #\{         ;; definition of treatment block(main_arg)
            #\}         
            #\~         ;; indivisible space
            #\$         ;; mathematical mode 
            #\&         ;; tabulation ...
            #\#         ;; symbol of parameter zone
            #\^         ;; exponent
            #\_         ;; index
            )
          )

        (define (texu/prep-str-for-tex str)
          (let ((str-lst (string->list str))
                (result (list)))
            (for-each (lambda (chr)
                        (if (member chr *texu/reserved-characters*)
                            (set! result (cons chr (cons #\\ result)))
                            (set! result (cons chr result))))
                      str-lst)
            (reverse-list->string result)
            ))

        (texu/prep-str-for-tex ";; % \ { } ~ $ & # ^ _")
        ";; \\%  \\{ \\} \\~ \\$ \\& \\# \\^ \\_"

[the \ disapeared rather then being escaped]

                


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user

Reply via email to