Apparently, ,c expressions yielding characters, single-character strings
or re-char-sets are not always coerced into char-sets by the rx
machinery. Here are a few more data points:
Welcome to scsh 0.6.4 (Olin Shivers)
Type ,? for help.
> (rx (- any #\x))
'#{re-char-set}
> (let ((x (char-set #\x))) (rx (- any ,x)))
'#{re-char-set}
> (let ((x #\x)) (rx (- any ,x)))
Error: Not a char-set
#\x
#{Procedure 8372 (char-set-difference in srfi-14)}
1>
In other words, the quick fix is to say (until-char (char-set #\.)) in
your code fragment, which works with both definitions of until-char.
Matthias
Jan Alleman wrote:
> Why an error in the second form in the trace below?
> Should it not behave as in the first form?
>
>
>
> Welcome to scsh 0.6.5 (0.6.6)
> Type ,? for help.
>
>>(let ((until-char (lambda (c) (rx (~ ,c) ,c))))
>
> (rx ,(until-char #\.)))
> '#{Re-seq}
>
>>(let ((until-char (lambda (c) (rx (- any ,c) ,c))))
>
> (rx ,(until-char #\.)))
>
> Error: Not a char-set
> #\.
> #{Procedure 8374 (char-set-difference in srfi-14)}
> 1>
|