<commit_before>#lang racket

(require casio/common)
(require casio/alternative)
(require casio/points)

(provide
 (contract-out (make-alt-table (pcontext? alt? . -> . alt-table?))
	       (atab-all-alts (alt-table? . -> . pair?))
	       (atab-add-altns (alt-table? (listof alt?) . -> . alt-table?))
	       (atab-pick-alt (alt-table? #:picking-func ((listof alt?) . -> . alt?)
					  . -> . (values alt? alt-table?)))
	       (atab-completed? (alt-table? . -> . boolean?))
	       (atab-context (alt-table? . -> . pcontext?))
	       (split-atab (alt-table? (non-empty-listof any/c) . -> . (listof alt-table?)))))

;; Public API

(struct alt-table (point->alts alt->points alt->done? context) #:prefab)

(define atab-context alt-table-context)

(define in-atab-pcontext (compose in-pcontext atab-context))

(define (make-alt-table context initial-alt)
   (alt-table (make-immutable-hash
	       (for/list ([(pt ex) (in-pcontext context)]
			  [err (alt-errors initial-alt)])
		 (cons pt (point-rec err (list initial-alt)))))
	      (hash initial-alt (for/list ([(pt ex) (in-pcontext context)])
				  pt))
	      (hash initial-alt #f)
	      context))

(define (atab-add-altns atab altns)
  (pipe atab (map (curry curryr atab-add-altn) altns)))

(define (atab-pick-alt atab #:picking-func [pick car])
  (let* ([picked (pick (atab-not-done-alts atab))]<commit_msg>Reformatted Contracts<commit_after>#lang racket

(require casio/common)
(require casio/alternative)
(require casio/points)

(provide
 (contract-out
  (make-alt-table (pcontext? alt? . -> . alt-table?))
  (atab-all-alts (alt-table? . -> . pair?))
  (atab-add-altns (alt-table? (listof alt?) . -> . alt-table?))
  (atab-pick-alt (alt-table? #:picking-func ((listof alt?) . -> . alt?)
			     . -> . (values alt? alt-table?)))
  (atab-peek-alt (alt-table? #:picking-func ((listof alt?) . -> . alt?)
			     . -> . (values alt? alt-table?)))
  (atab-completed? (alt-table? . -> . boolean?))
  (atab-context (alt-table? . -> . pcontext?))
  (split-atab (alt-table? (non-empty-listof any/c) . -> . (listof alt-table?)))))

;; Public API

(struct alt-table (point->alts alt->points alt->done? context) #:prefab)

(define atab-context alt-table-context)

(define in-atab-pcontext (compose in-pcontext atab-context))

(define (make-alt-table context initial-alt)
   (alt-table (make-immutable-hash
	       (for/list ([(pt ex) (in-pcontext context)]
			  [err (alt-errors initial-alt)])
		 (cons pt (point-rec err (list initial-alt)))))
	      (hash initial-alt (for/list ([(pt ex) (in-pcontext context)])
				  pt))
	      (hash initial-alt #f)
	      context))

(define (atab-add-altns atab altns)
  (pipe atab (map (curry curryr atab-add-altn) altns)))

(define (atab-pick-alt atab #:picking-func [pick car])
  (let* ([picked (pick (atab-not-done-alts atab))]
{'fraction_non_alphanumeric': 0.1960923623445826, 'fraction_numerical': 0.0, 'mean_word_length': 3.0752532561505066, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, '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': '614075', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1062, 'n_words': 237}