wdl icon indicating copy to clipboard operation
wdl copied to clipboard

Add array `contains` function

Open jdidion opened this issue 2 months ago • 2 comments

Checklist

  • [x] Pull request details were added to CHANGELOG.md
  • [x] Valid examples WDL's were added or updated to the SPEC.md (see the guide on writing markdown tests)

jdidion avatar Apr 08 '24 23:04 jdidion

@jdidion do we need to make any comments here on how equality works and whether type coerced objects are equal?

Ie would the following be truthy?


File Foo = "foo"
Array[String] bar = ["foo"]

patmagee avatar Apr 09 '24 01:04 patmagee

@patmagee yes type coercion should apply here. String -> File is one of the officially supported coercions, but not File -> String.

Array[File] files = ["/foo/bar"]
contains(files, "/foo/bar")  # true

Array[String] strings = ["/foo/bar"]
File foobar = "/foo/bar"
contains(strings, foobar)  # false
contains(strings, "~{foobar}")  # true

jdidion avatar Apr 09 '24 19:04 jdidion