<commit_before>(define-library (srfi 17)

  (define-library (rename set!)
    (import (scheme base))
    (export (rename set! %set!)
            define
            quasiquote
            letrec
            let
            error
            apply
            define-syntax
            syntax-rules
            lambda
            if
            quote
            begin
            vector-ref
            string-ref
            bytevector-u8-ref
            vector-set!
            string-set!
            bytevector-u8-set!
            list-set!))
  
  (import (rename set!)
          (srfi 1))
  
  (define-syntax set!
    (syntax-rules ()
      ((_ (proc args ...) val)
       ((setter proc) args ... val))
      ((_ var val)
       (%set! var val))))

  (define setter-alist '())

  (define setter
    (letrec ((setter
              (lambda (proc)
                (let ((probe (assv proc setter-alist)))
                  (if probe
                      (cdr probe)
                      (error "No setter for " proc)))))
             (set-setter!
              (lambda (proc setter)
                (set! setter-alist
                      (alist-cons proc setter setter-alist)))))
      (set-setter! setter set-setter!)
      (set-setter! car set-car!)
      (set-setter! cdr set-cdr!)
      (set-setter! caar (lambda (p v) (set-car! (car p) v)))
      (set-setter! cadr (lambda (p v) (set-car! (cdr p) v)))
      (set-setter! cdar (lambda (p v) (set-cdr! (car p) v)))
      (set-setter! cddr (lambda (p v) (set-cdr! (cdr p) v)))
      (set-setter! vector-ref vector-set!)
      (set-setter! string-ref string-set!)
      (set-setter! bytevector-u8-ref bytevector-u8-set!)
      (set-setter! list-ref list-set!)
      setter))

  (define (getter-with-setter get set)
    (let ((proc (lambda args (apply get args))))
      (set! (setter proc) set)
      proc))

  (export set!
          setter
          getter-with-setter
          setter-alist))<commit_msg>implement by using (picrin attribute)<commit_after>(define-library (srfi 17)

  (import (except (scheme base) set!)
          (rename (prefix (only (scheme base) set!) %))
          (picrin dictionary)
          (picrin attribute)
          (srfi 1)
          (srfi 8))
  
  (define-syntax set!
    (syntax-rules ()
      ((_ (proc args ...) val)
       ((setter proc) args ... val))
      ((_ var val)
       (%set! var val))))

  (define setter
    (letrec ((setter
              (lambda (proc)
                (receive (setter exists) (dictionary-ref (attribute proc)
                                                         'setter)
                  (if exists
                      setter
                      (error "No setter found")))))
             (set-setter!
              (lambda (proc setter)
                (dictionary-set! (attribute proc) 'setter setter))))
      (set-setter! setter set-setter!)
      setter))

  (define (getter-with-setter get set)
    (let ((proc (lambda args (apply get args))))
      (set! (setter proc) set)
      proc))

  (set! (setter car) set-car!)
  (set! (setter cdr) set-cdr!)
  (set! (setter vector-ref) vector-set!)
  (set! (setter string-ref) string-set!)
  (set! (setter bytevector-u8-ref) bytevector-u8-set!)
  (set! (setter list-ref) list-set!)

  (export set!
          setter
          getter-with-setter))
{'fraction_non_alphanumeric': 0.13619963920625375, 'fraction_numerical': 0.0039085989176187615, 'mean_word_length': 1.5261958997722096, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2051815', 'n_tokens_mistral': 1080, 'n_tokens_neox': 1045, 'n_words': 280}