Skip to content

Commit cb291e0

Browse files
committed
Fix composition output to julia code
1 parent 146f576 commit cb291e0

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/composition.jl

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,16 @@ function generate(c::Composition, name, ::Val{:Julia})
5353
"""
5454

5555
output = """
56-
function $name(x; X = zeros(length(x), $tr_length), param=nothing, dom_size)
57-
$(CN)tr_in(Tuple($tr), X, x, param)
58-
for i in 1:length(x)
59-
X[i,1] = $ar(@view X[i,:])
60-
end
61-
return $ag(@view X[:, 1]) |> (y -> $co(y; param, dom_size, nvars=length(x)))
62-
end
63-
"""
64-
return documentation * format_text(output, BlueStyle(), pipe_to_function_call = false)
56+
function $name(x; X = zeros(length(x), $tr_length), param=nothing, dom_size)
57+
$(CN)tr_in(Tuple($tr), X, x, param)
58+
X[:, 1] .= 1:length(x) .|> (i -> $ar(@view X[i, 1:$tr_length]))
59+
return $ag(@view X[:, 1]) |> (y -> $co(y; param, dom_size, nvars=length(x)))
60+
end
61+
"""
62+
return documentation * format_text(output, BlueStyle(); pipe_to_function_call=false)
6563
end
6664

67-
function composition_to_file!(c::Composition, path, name, language =:Julia)
65+
function composition_to_file!(c::Composition, path, name, language=:Julia)
6866
output = code(c, language; name)
6967
write(path, output)
7068
return nothing

0 commit comments

Comments
 (0)