<commit_before>(define (universal-grader possibilities) possibilities)

; TODO(peter): redefine graders to return ordered lists of possibilities, not
; single words. The following graders are broken:

(define (first-pick possibilities)
  (if (null? possibilities)
    #f
    (car possibilities)))

(define (random-choice possibilities)
  (if (null? possibilities)
    #f
    (let* ((count (length possibilities))
           (index (random count))
           (item (list-ref possibilities index)))
      item)))

(define (most-syllables possibilities)
  (if (null? possibilities)
    #f
    (let loop ((longest #f)
               (possibilities possibilities))
      (let ((test (car possibilities))
            (remaining (cdr possibilities)))
        (if (null? remaining)
          longest
          (loop
            (if (or (not longest)
                    (> (word-num-syllables test)
                       (word-num-syllables longest)))
              test
              longest)
            remaining))))))<commit_msg>Fixed graders<commit_after>(define (universal-grader possibilities) possibilities)

(define (random-choice possibilities)
  (define (shuffle lst)
    (sort lst
	  (lambda (x y)
	    (equal? 0 (random 2)))))
  (shuffle possibilities))

(define (most-syllables possibilities)
  (define (compare-syllables word1 word2)
   (let ((syllables1 (word-num-syllables word1))
	 (syllables2 (word-num-syllables word2)))
     (> syllables1 syllables2)))
  (quick-sort possibilities compare-syllables))
{'fraction_non_alphanumeric': 0.11690885072655217, 'fraction_numerical': 0.0066050198150594455, 'mean_word_length': 2.7969924812030076, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3977249', 'n_tokens_mistral': 435, 'n_tokens_neox': 426, 'n_words': 125}