<commit_before>;;; hygienic macros
(define-library (picrin macro)
  (import (scheme base))

  (define (sc-macro-transformer f)
    (lambda (expr use-env mac-env)
      (make-syntactic-closure mac-env '() (f expr use-env))))

  (define (rsc-macro-transformer f)
    (lambda (expr use-env mac-env)
      (make-syntactic-closure use-env '() (f expr mac-env))))

  (export sc-macro-transformer
          rsc-macro-transformer))

;;; bootstrap utilities
(define-library (picrin bootstrap-tools)
  (import (scheme base))

  (define (cadar p) (car (cdar p)))
  (define (caddr p) (car (cddr p)))
  (define (cdddr p) (cdr (cddr p)))

  (export cadar caddr cdddr))

;;; core syntaces
(define-library (picrin core-syntax)
  (import (scheme base)
          (picrin macro)
          (picrin bootstrap-tools))

  (define-syntax let
    (er-macro-transformer
     (lambda (expr r compare)
       (if (symbol? (cadr expr))
           (begin
             (define name (cadr expr))
             (define bindings (caddr expr))
             (define body (cdddr expr))
             (list (r 'let) '()
                   (list (r 'define) name
                         (cons (r 'lambda) (cons (map car bindings) body)))
                   (cons name (map cadr bindings))))
           (begin
             (define bindings (cadr expr))
             (define body (cddr expr))<commit_msg>Revert "Revert "suppress duplicate definition warnings, variables are hoisted""<commit_after>;;; hygienic macros
(define-library (picrin macro)
  (import (scheme base))

  (define (sc-macro-transformer f)
    (lambda (expr use-env mac-env)
      (make-syntactic-closure mac-env '() (f expr use-env))))

  (define (rsc-macro-transformer f)
    (lambda (expr use-env mac-env)
      (make-syntactic-closure use-env '() (f expr mac-env))))

  (export sc-macro-transformer
          rsc-macro-transformer))

;;; bootstrap utilities
(define-library (picrin bootstrap-tools)
  (import (scheme base))

  (define (cadar p) (car (cdar p)))
  (define (caddr p) (car (cddr p)))
  (define (cdddr p) (cdr (cddr p)))

  (export cadar caddr cdddr))

;;; core syntaces
(define-library (picrin core-syntax)
  (import (scheme base)
          (picrin macro)
          (picrin bootstrap-tools))

  (define-syntax let
    (er-macro-transformer
     (lambda (expr r compare)
       (if (symbol? (cadr expr))
           (begin
             (define name (cadr expr))
             (define bindings (caddr expr))
             (define body (cdddr expr))
             (list (r 'let) '()
                   (list (r 'define) name
                         (cons (r 'lambda) (cons (map car bindings) body)))
                   (cons name (map cadr bindings))))
           (begin
             (set! bindings (cadr expr))
             (set! body (cddr expr))
{'fraction_non_alphanumeric': 0.13603732950466618, 'fraction_numerical': 0.0, 'mean_word_length': 2.2596491228070175, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5653089', 'n_tokens_mistral': 931, 'n_tokens_neox': 880, 'n_words': 269}