jrsonnet icon indicating copy to clipboard operation
jrsonnet copied to clipboard

std.foldr doesn't work for strings

Open Duologic opened this issue 8 months ago • 1 comments

From https://github.com/google/go-jsonnet/blob/master/testdata/foldr_string.jsonnet:

std.foldr(function(v, i) i + v + v, 'bcd', 'a')
[I] ➜ cjsonnet -e "std.foldr(function(v, i) i + v + v, 'bcd', 'a')"
"addccbb"

[I] ➜ jsonnet -e "std.foldr(function(v, i) i + v + v, 'bcd', 'a')"
"addccbb"

[I] ➜ jrsonnet -e "std.foldr(function(v, i) i + v + v, 'bcd', 'a')"
type error: expected array, got string
    argument <arr> evaluation
    <cmdline>:1:1-49: function <builtin_foldr> call

Duologic avatar Apr 29 '25 20:04 Duologic

@Duologic Thank you , when test your code, I found a bug in sjsonnet;)

He-Pin avatar May 16 '25 07:05 He-Pin