<commit_before>;;;
;;; Basic procedures used in the definition of records.
;;; 

;; Note: these procedures are actually used by the compiler

;; Returns true if obj is a record
(define (record? obj) (asm(obj) record?))


;; The internals of define-record-type
(define (record-type-factory . args)
  ;; creates an a record primitive with the given size
  (define (make-record size)
    (asm (size) record))

  (define (record-type-id rec)
    (asm 0 (rec) idx@))

  (define (set-record-type-id rec type)
    (asm 0 (type) (rec) idx! ()))

  ;; extract clauses
  (define name-clause (car args))
  (define const-clause  (car (cdr args)))
  (define pred-clause (car (cdr (cdr args))))
  (define fields-list (cdr (cdr (cdr args))))

  ;; Setup the constructor
  (define field-count (- (length const-clause) 1))

  (display "Setting up define-record")
  (newline)
  (display "Name:")
  (display nam-clause)
  (newline)
  (display "Const:")
  (display const-clause)
  (newline)
  (display "Predicate:")
  (display const-clause)
  (newline)
  (display "Fields:")
  (display const-clause)
  (newline))
<commit_msg>record-type-factory did not need the . in its definition.<commit_after>;;;
;;; Basic procedures used in the definition of records.
;;; 

;; Note: these procedures are actually used by the compiler

;; Returns true if obj is a record
(define (record? obj) (asm(obj) record?))


;; The internals of define-record-type
(define (record-type-factory rec-def)
  ;; creates an a record primitive with the given size
  (define (make-record size)
    (asm (size) record))

  (define (record-type-id rec)
    (asm 0 (rec) idx@))

  (define (set-record-type-id rec type)
    (asm 0 (type) (rec) idx! ()))

  ;; extract clauses
  (define name-clause (car rec-def))
  (define const-clause  (car (cdr rec-def)))
  (define pred-clause (car (cdr (cdr rec-def))))
  (define fields-list (cdr (cdr (cdr rec-def))))

  ;; Setup the constructor
  (define field-count (- (length const-clause) 1))

  (display "Setting up define-record")
  (newline)
  (display "Name:")
  (display name-clause)
  (newline)
  (display "Const:")
  (display const-clause)
  (newline)
  (display "Predicate:")
  (display const-clause)
  (newline)
  (display "Fields:")
  (display const-clause)
  (newline))

{'fraction_non_alphanumeric': 0.15079365079365079, 'fraction_numerical': 0.0026455026455026454, 'mean_word_length': 3.7270833333333333, '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': '6837782', 'n_tokens_mistral': 798, 'n_tokens_neox': 763, 'n_words': 255}