<commit_before>
(load-relative "loadtest.ss")

(Section 'kw)

(require (lib "kw.ss")
         mzscheme)

(let ()
  (define-syntax t
    (syntax-rules (=> <= :rt-err: :st-err:)
      [(t E => :rt-err:) (err/rt-test E)]
      [(t E => :st-err:) (syntax-test #'E)]
      [(t (f x ...) => res) (test res f x ...)]
      [(t E => R more ...) (begin (t E => R) (t more ...))]
      [(t R <= E more ...) (t E => R more ...)]))

  ;; make sure that lambda/kw behaves as lambda
  (t ((lambda/kw () 1)) => 1
     ((lambda/kw (x) 1) 0) => 1
     ((lambda/kw x x)) => '()
     ((lambda/kw x x) 1 2) => '(1 2)
     ((lambda/kw (x . xs) xs) 0 1 2) => '(1 2))
  ;; even with keywords
  (t ((lambda/kw () #:x)) => #:x
     ((lambda/kw (x) #:x) #:y) => #:x
     ((lambda/kw x x) #:x #:y) => '(#:x #:y)
     ((lambda/kw (x . xs) xs) #:z #:x #:y) => '(#:x #:y))

  ;; just using #:rest is the same as a dot
  (let ([f (lambda/kw (#:rest r) r)])<commit_msg>avoid requiring mzscheme<commit_after>
(load-relative "loadtest.ss")

(Section 'kw)

(require (lib "kw.ss")
         (prefix-in mz: mzscheme))

(let-syntax ([#%datum (syntax-rules () [(_ . xs) (mz:#%datum . xs)])]
             [#%app   (syntax-rules () [(_ . xs) (mz:#%app   . xs)])])
  (define-syntax t
    (syntax-rules (=> <= :rt-err: :st-err:)
      [(t E => :rt-err:) (err/rt-test E)]
      [(t E => :st-err:) (syntax-test #'E)]
      [(t (f x ...) => res) (test res f x ...)]
      [(t E => R more ...) (begin (t E => R) (t more ...))]
      [(t R <= E more ...) (t E => R more ...)]))

  ;; make sure that lambda/kw behaves as lambda
  (t ((lambda/kw () 1)) => 1
     ((lambda/kw (x) 1) 0) => 1
     ((lambda/kw x x)) => '()
     ((lambda/kw x x) 1 2) => '(1 2)
     ((lambda/kw (x . xs) xs) 0 1 2) => '(1 2))
  ;; even with keywords
  (t ((lambda/kw () #:x)) => #:x
     ((lambda/kw (x) #:x) #:y) => #:x
     ((lambda/kw x x) #:x #:y) => '(#:x #:y)
     ((lambda/kw (x . xs) xs) #:z #:x #:y) => '(#:x #:y))

  ;; just using #:rest is the same as a dot
  (let ([f (lambda/kw (#:rest r) r)])
{'fraction_non_alphanumeric': 0.28171091445427726, 'fraction_numerical': 0.01376597836774828, 'mean_word_length': 2.135593220338983, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 35, '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': '899549', 'n_tokens_mistral': 954, 'n_tokens_neox': 862, 'n_words': 271}