In Julia, from a certain version onwards, the following syntax is possible
julia> (x...,y)=(1,2,3,4)
(1, 2, 3, 4)
julia> x
(1, 2, 3)
julia> y
4
I tried, expecting it to be possible, to use it in the following way within the minilanguage.
But perhaps because I did not use the appropriate form or perhaps for some other reason it does not seem to work.
I wonder if this is an inconsistency or if my expectation is not well founded.
g(x,wt)=x->[c' * wt/sum(wt) for c in x]'
combine(gdf, [Cols(Not([:model,:cyl,:wt]))...,:wt] => (x...,wt)->g(x,wt) => AsTable )
ERROR: syntax: invalid "..." on non-final argument around c:\Users\sprmn\.julia\environments\v1.10.5\DF_func_2_rows.jl:140
Stacktrace:
[1] top-level scope
@ c:\Users\sprmn\.julia\environments\v1.10.5\DF_func_2_rows.jl:140
Another problem (?) that I encounter if I try to go the following way is that no method matching iterate(::Cols{Tuple{InvertedIndex{Vector{String}}}})
julia> mw(wt)=x->[c'*wt/sum(wt) for c in x]'
mw (generic function with 1 method)
julia> combine(gdf, ["wt",names(mtcars, x->!in(x, ["model","cyl","wt"]) )...] => ((wt,x...)->mw(wt)(x)) => names(mtcars, x->!in(x, ["model","cyl","wt"]) ) )
3Γ10 DataFrame
Row β cyl mpg disp hp drat qsec vs β―
β Int64 Float64 Float64 Float64 Float64 Float64 Float64 β―
ββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
1 β 4 25.935 110.35 83.3945 4.03126 19.3804 0.914887 β―
2 β 6 19.6458 185.239 121.558 3.56917 18.122 0.621219
3 β 8 14.8064 362.125 209.373 3.20566 16.8853 0.0
3 columns omitted
julia> combine(gdf, ["wt",Cols(Not(["model","cyl","wt"]) )...] => ((wt,x...)->mw(wt)(x)) => names(mtcars, x->!in(x, ["model","cyl","wt"]) ) )
ERROR: MethodError: no method matching iterate(::Cols{Tuple{InvertedIndex{Vector{String}}}})
Closest candidates are:
iterate(::XLSX.SheetRowStreamIterator)
@ XLSX C:\Users\sprmn\.julia\packages\XLSX\vzApD\src\stream.jl:78
iterate(::XLSX.SheetRowStreamIterator, ::Union{Nothing, XLSX.SheetRowStreamIteratorState})
@ XLSX C:\Users\sprmn\.julia\packages\XLSX\vzApD\src\stream.jl:78
iterate(::Pkg.Resolve.NodePerm, Any...)
@ Pkg C:\Users\sprmn\.julia\juliaup\julia-1.10.6+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Pkg\src\Resolve\maxsum.jl:240
...
Stacktrace:
[1] top-level scope
@ c:\Users\sprmn\.julia\environments\v1.10.5\DF_func_2_rows.jl:148