diff options
author | Arun Isaac | 2025-01-24 18:44:37 +0000 |
---|---|---|
committer | Arun Isaac | 2025-01-24 20:47:30 +0000 |
commit | 604ec469667f1bff32c8043729ea0bfd93ee61e3 (patch) | |
tree | fb9cbe3f9b1d28317e8cd1a08ce7457bc4e8b065 | |
parent | 6e5c3f6032f969cfb0f07d2ca3c19227759d96c6 (diff) | |
download | ravanan-604ec469667f1bff32c8043729ea0bfd93ee61e3.tar.gz ravanan-604ec469667f1bff32c8043729ea0bfd93ee61e3.tar.lz ravanan-604ec469667f1bff32c8043729ea0bfd93ee61e3.zip |
command-line-tool: Support float and double types.
* ravanan/work/command-line-tool.scm (object-type, match-type):
Support float and double types.
* ravanan/command-line-tool.scm (command-line-binding->args): Handle
float arguments.
-rw-r--r-- | ravanan/command-line-tool.scm | 2 | ||||
-rw-r--r-- | ravanan/work/command-line-tool.scm | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm index 3493db1..958d99e 100644 --- a/ravanan/command-line-tool.scm +++ b/ravanan/command-line-tool.scm @@ -339,7 +339,7 @@ in which the G-expressions are inserted." (list (case type ((string) value) - ((int) + ((int float) #~(number->string #$value)) ((File) #~(assoc-ref* #$value "path")) diff --git a/ravanan/work/command-line-tool.scm b/ravanan/work/command-line-tool.scm index 4787e3d..9e5c8a1 100644 --- a/ravanan/work/command-line-tool.scm +++ b/ravanan/work/command-line-tool.scm @@ -1,5 +1,5 @@ ;;; ravanan --- High-reproducibility CWL runner powered by Guix -;;; Copyright © 2024 Arun Isaac <arunisaac@systemreboot.net> +;;; Copyright © 2024, 2025 Arun Isaac <arunisaac@systemreboot.net> ;;; ;;; This file is part of ravanan. ;;; @@ -52,13 +52,17 @@ directory after THUNK returns." thunk (cut chdir original-current-directory)))) -;; TODO: Support float types. (define (object-type obj) "Return the type of @var{obj}." (cond ((eq? obj 'null) 'null) ((boolean? obj) 'boolean) - ((integer? obj) 'int) + ((and (number? obj) + (inexact? obj)) + 'float) + ((and (number? obj) + (integer? obj)) + 'int) ((string? obj) 'string) ;; For vector objects, we use the first element to guess at the ;; subtype. @@ -86,6 +90,10 @@ example, when @var{type} is a union type." (match obj ((or 'null #()) 'null) (_ #f))) + ;; Treat floats and doubles as the same thing. It is unclear to me why the + ;; CWL specification needs separate types for these. + ((eq? type 'double) + (match-type obj 'float)) ;; Recursively match type of every element of array. ((array-type? type) (and (vector? obj) |