<commit_before>;;
;; Cyclone Scheme
;; Copyright (c) 2014, <NAME>
;; All rights reserved.
;;
;; This module performs Scheme-to-Scheme transformations, and also contains
;; various utility functions used by the compiler.
;;

(define *version* "0.0.1 (Pre-release)")

(define *version-banner* 
 (string-append "
              :@ 
            @@@  
          @@@@:  
        `@@@@@+  
       .@@@+@@@      Cyclone  
       @@     @@     An experimental Scheme compiler
      ,@             https://github.com/justinethier/cyclone
      '@        
      .@        
       @@     #@     (c) 2014 <NAME>
       `@@@#@@@.     Version " *version* "
        #@@@@@   
        +@@@+    
        @@#      
      `@.  
     
"))

(define *c-file-header-comment* 
  (string-append "/**
 ** This file was automatically generated by the Cyclone scheme compiler
 **
 ** (c) 2014 <NAME>
 ** Version " *version* "
 **
 **/
"))

;; Features implemented by this Scheme
(define *features* '(cyclone))

;; Built-in functions
;; TODO: relocate these somewhere else, like a lib.scm!!!
;; TODO: Longer-term, we will want to insert all these but then have an 
;;   algorithm in place to remove the definitions that are not used.
;;   Basically, after the expansion phase but before alpha conversion,
;;   there should be enough information to figure out what is unused, and
;;   discard it. Obviously this may be a no-go in certain situations, such
;;   as if a (read (eval)) REPL is present. Although maybe not, since that
;;   would use the interpreter.
(define *built-ins* `(
  (define *Cyc-version-banner* ,*version-banner*)
  ;; TODO: The whitespace characters are space, tab, line feed, form feed (not in parser yet), and carriage return.
  (define (char-whitespace? c) (member c '(#\tab #\space #\return #\newline)))
  (define (char-numeric? c) (member c '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)))
  (define (foldl func accum lst)
    (if (null? lst)
      accum
      (foldl func (func (car lst) accum) (cdr lst))))
  (define (foldr func end lst)
    (if (null? lst)
      end
      (func (car lst) (foldr func end (cdr lst)))))
  (define (list? obj)
    (cond
      ((null? obj) #t)
      ((pair? obj)
       (list? (cdr obj)))
      (else #f)))
  (define (list . objs)  objs)
  (define (map func lst)
    (foldr (lambda (x y) (cons (func x) y)) '() lst))
  (define (not x) (if x #f #t))
  (define (reverse lst)   (foldl cons '() lst))
  (define (error msg . args)
    (raise (cons msg args)))
  (define (raise obj)
    ((Cyc-current-exception-handler) (list 'raised obj)))
  (define (raise-continuable obj)
    ((Cyc-current-exception-handler) (list 'continuable obj)))
  (define (with-exception-handler handler thunk)
    (let ((result #f)
          (my-handler 
            (lambda (obj)
              (let ((result #f)
                    (continuable? (and (pair? obj) <commit_msg>Added (append)<commit_after>;;
;; Cyclone Scheme
;; Copyright (c) 2014, <NAME>
;; All rights reserved.
;;
;; This module performs Scheme-to-Scheme transformations, and also contains
;; various utility functions used by the compiler.
;;

(define *version* "0.0.1 (Pre-release)")

(define *version-banner* 
 (string-append "
              :@ 
            @@@  
          @@@@:  
        `@@@@@+  
       .@@@+@@@      Cyclone  
       @@     @@     An experimental Scheme compiler
      ,@             https://github.com/justinethier/cyclone
      '@        
      .@        
       @@     #@     (c) 2014 <NAME>
       `@@@#@@@.     Version " *version* "
        #@@@@@   
        +@@@+    
        @@#      
      `@.  
     
"))

(define *c-file-header-comment* 
  (string-append "/**
 ** This file was automatically generated by the Cyclone scheme compiler
 **
 ** (c) 2014 <NAME>
 ** Version " *version* "
 **
 **/
"))

;; Features implemented by this Scheme
(define *features* '(cyclone))

;; Built-in functions
;; TODO: relocate these somewhere else, like a lib.scm!!!
;; TODO: Longer-term, we will want to insert all these but then have an 
;;   algorithm in place to remove the definitions that are not used.
;;   Basically, after the expansion phase but before alpha conversion,
;;   there should be enough information to figure out what is unused, and
;;   discard it. Obviously this may be a no-go in certain situations, such
;;   as if a (read (eval)) REPL is present. Although maybe not, since that
;;   would use the interpreter.
(define *built-ins* `(
  (define *Cyc-version-banner* ,*version-banner*)
  ;; TODO: The whitespace characters are space, tab, line feed, form feed (not in parser yet), and carriage return.
  (define (char-whitespace? c) (member c '(#\tab #\space #\return #\newline)))
  (define (char-numeric? c) (member c '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)))
  (define (foldl func accum lst)
    (if (null? lst)
      accum
      (foldl func (func (car lst) accum) (cdr lst))))
  (define (foldr func end lst)
    (if (null? lst)
      end
      (func (car lst) (foldr func end (cdr lst)))))
  (define (list? obj)
    (cond
      ((null? obj) #t)
      ((pair? obj)
       (list? (cdr obj)))
      (else #f)))
  ; append accepts a variable number of arguments, per R5RS. So a wrapper
  ; has been provided for the standard 2-argument version of (append).
  ;
  ; We return the given value if less than 2 arguments are given, and
  ; otherwise fold over each arg, appending it to its predecessor. 
  (define (append . lst)
    (define append-2
            (lambda (inlist alist)
                    (foldr (lambda (ap in) (cons ap in)) alist inlist)))
    (if (null? lst)
        lst
        (if (null? (cdr lst))
            (car lst)
            (foldl (lambda (a b) (append-2 b a)) (car lst) (cdr lst)))))
  (define (list . objs)  objs)
  (define (map func lst)
    (foldr (lambda (x y) (cons (func x) y)) '() lst))
  (define (not x) (if x #f #t))
  (define (reverse lst)   (foldl cons '() lst))
  (define (error msg . args)
    (raise (cons msg args)))
  (define (raise obj)
    ((Cyc-current-exception-handler) (list 'raised obj)))
  (define (raise-continuable obj)
    ((Cyc-current-exception-handler) (list 'continuable obj)))
  (define (with-exception-handler handler thunk)
    (let ((result #f)
          (my-handler 
            (lambda (obj)
              (let ((result #f)
                    (continuable? (and (pair? obj) 
{'fraction_non_alphanumeric': 0.15344582873363824, 'fraction_numerical': 0.008673710771171739, 'mean_word_length': 2.393258426966292, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '1391218', 'n_tokens_mistral': 2132, 'n_tokens_neox': 2060, 'n_words': 718}