Welcome to the CHICKEN Scheme pasting service

char->utf8-length added by Kooda on Sun Aug 9 01:35:33 2020

;; Shameless edit of ##sys#char->utf8-string

(define (char->utf8-length c)
  (let ([i (char->integer c)])
    (cond ((<= i #x7F) 1)
          ((<= i #x7FF) 2)
          ((<= i #xFFFF) 3)
          ((<= i #x1FFFFF) 4)
          (else
           (error "UTF-8 codepoint out of range:" i)))))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which module provides `define-foreign-type'?
Visually impaired? Let me spell it for you (wav file) download WAV