-
Notifications
You must be signed in to change notification settings - Fork 25
/
set-impl.rkt
30 lines (25 loc) · 863 Bytes
/
set-impl.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#lang racket
(require setup/setup)
(define config-file-path
(collection-file-path "local.cfg" "malt"))
(define set-impl
(λ (impl)
(when (not (member impl '(learner
nested-tensors
flat-tensors
uniform-tensors)))
(error "Unknown implementation: ~a~%" impl))
(setup #:collections (list (list "malt")) #:clean? #t)
(write-implementation-to-config-file impl)
(setup #:collections (list (list "malt")))))
(define write-implementation-to-config-file
(λ (impl)
(let ((port #f))
(dynamic-wind
(λ ()
(set! port (open-output-file config-file-path #:exists 'truncate)))
(λ ()
(fprintf port "(tensor-implementation ~a)~%" impl))
(λ ()
(close-output-port port))))))
(provide set-impl)