Closed gergelyattilakiss closed 3 days ago
Did you implement the automatic aside for some functions, or you mean the @aside macro? This also an issue with Chain, it seems to be a parsing error. Maybe @aside rewrites the code too much?
julia> using Chain
julia> @chain df begin
@generate y = log(x)
@aside s = @summarize y
@collapse mean_y = mean(y)
end
ERROR: LoadError: ArgumentError: Exactly one argument is required for this command: @summarize
Stacktrace:
[1] |>(x::ArgumentError, f::typeof(throw))
@ Base ./operators.jl:917
[2] generate_command(command::Kezdi.Command; options::Vector{Symbol}, allowed::Vector{Any})
@ Kezdi ~/Tresorit/Mac/code/julia/Kezdi.jl/src/codegen.jl:17
[3] generate_command
@ ~/Tresorit/Mac/code/julia/Kezdi.jl/src/codegen.jl:1 [inlined]
[4] rewrite(::Val{:summarize}, command::Kezdi.Command)
@ Kezdi ~/Tresorit/Mac/code/julia/Kezdi.jl/src/rewrites.jl:15
[5] rewrite(command::Kezdi.Command)
@ Kezdi ~/Tresorit/Mac/code/julia/Kezdi.jl/src/rewrites.jl:2
[6] |>(x::Kezdi.Command, f::typeof(Kezdi.rewrite))
@ Base ./operators.jl:917
[7] var"@summarize"(__source__::LineNumberNode, __module__::Module, exprs::Vararg{Any})
@ Kezdi ~/Tresorit/Mac/code/julia/Kezdi.jl/src/macros.jl:33
in expression starting at REPL[30]:3
julia> @chain df begin
@generate y = log(x)
@aside @summarize y
@collapse mean_y = mean(y)
end
ERROR: LoadError: ArgumentError: Exactly one argument is required for this command: @summarize
Stacktrace:
[1] |>(x::ArgumentError, f::typeof(throw))
@ Base ./operators.jl:917
[2] generate_command(command::Kezdi.Command; options::Vector{Symbol}, allowed::Vector{Any})
@ Kezdi ~/Tresorit/Mac/code/julia/Kezdi.jl/src/codegen.jl:17
[3] generate_command
@ ~/Tresorit/Mac/code/julia/Kezdi.jl/src/codegen.jl:1 [inlined]
[4] rewrite(::Val{:summarize}, command::Kezdi.Command)
@ Kezdi ~/Tresorit/Mac/code/julia/Kezdi.jl/src/rewrites.jl:15
[5] rewrite(command::Kezdi.Command)
@ Kezdi ~/Tresorit/Mac/code/julia/Kezdi.jl/src/rewrites.jl:2
[6] |>(x::Kezdi.Command, f::typeof(Kezdi.rewrite))
@ Base ./operators.jl:917
[7] var"@summarize"(__source__::LineNumberNode, __module__::Module, exprs::Vararg{Any})
@ Kezdi ~/Tresorit/Mac/code/julia/Kezdi.jl/src/macros.jl:33
in expression starting at REPL[31]:3
julia> @chain df begin
@generate y = log(x)
@summarize y
@collapse mean_y = mean(y)
end
ERROR: Expected DataFrame as first argument
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] macro expansion
@ ~/Tresorit/Mac/code/julia/Kezdi.jl/src/rewrites.jl:98 [inlined]
[3] top-level scope
@ REPL[32]:4
julia> @chain df begin
@generate y = log(x)
@aside @mockmacro y
@collapse mean_y = mean(y)
end
ERROR: LoadError: UndefVarError: `@mockmacro` not defined
in expression starting at REPL[33]:3
julia> @chain df begin
@generate y = log(x)
@aside Kezdi.@mockmacro y
@collapse mean_y = mean(y)
end
1×1 DataFrame
Row │ mean_y
│ Float64
─────┼─────────
1 │ 1.51044
julia> @chain df begin
@generate y = log(x)
@aside s = Kezdi.@mockmacro y
@collapse mean_y = mean(y)
end
1×1 DataFrame
Row │ mean_y
│ Float64
─────┼─────────
1 │ 1.51044
julia> s
Kezdi.Command(:mockmacro, :y, (), nothing, ())
You are right I used confusing naming by using @aside
instead of aside
, I implement our automatic aside
functionality. That is almost done I just want to add the last functionality that prints the value of an aside
run, if it is not the last.
aside
commands are returning their operations return value and not the previous input.