Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipe cannot interact with other macros #25

Open
bertulli opened this issue Jun 22, 2023 · 0 comments
Open

Pipe cannot interact with other macros #25

bertulli opened this issue Jun 22, 2023 · 0 comments

Comments

@bertulli
Copy link

Hi! Thanks for you work, loved the package so far. I was working with some DataFrames and I got this problem with StatsPlots' @df macro working with @pipe:

julia> @pipe @df df_pair_temp zip(cols(instruction_pair_first_sym), cols(:first_encoding))

zip(["adc_r0_r0_r0", "adc_r0_r0_r0", "adc_r0_r0_r0", "adc_r0_r0_r0", "adc_r0_r0_r0", "adc_r0_r0_r0", "adc_r0_r0_r0", "adc_r0_r0_r0", "adc_r0_r0_r0", "adc_r0_r0_r0"    "udiv_r3_r2", "udiv_r3_r2", "umlal_r0_r1_r2_r3", "umlal_r0_r1_r2_r3", "umlal_r0_r1_r2_r3", "umlal_r0_r1_r2_r3", "umull_r0_r1_r2_r3", "umull_r0_r1_r2_r3", "umull_r0_r1_r2_r3", "umull_r0_r1_r2_r3"], String15["eb400000", "eb400000", "eb400000", "eb400000", "eb400000", "eb400000", "eb400000", "eb400000", "eb400000", "eb400000"    "fbb3f3f2", "fbb3f3f2", "fbe20103", "fbe20103", "fbe20103", "fbe20103", "fba20103", "fba20103", "fba20103", "fba20103"])

works, as you can see. df_pair_temp is my DataFrame, and instruction_pair_first_sym is a Symbol. Adding the first function

julia> @pipe @df df_pair_temp zip(cols(instruction_pair_first_sym), cols(:first_encoding)) |>
               collect
706-element Vector{Tuple{String, String15}}:
 ("adc_r0_r0_r0", "eb400000")
 ("adc_r0_r0_r0", "eb400000")
 ("adc_r0_r0_r0", "eb400000")
 ("adc_r0_r0_r0", "eb400000")
 ("adc_r0_r0_r0", "eb400000")
 ("adc_r0_r0_r0", "eb400000")
 ("adc_r0_r0_r0", "eb400000")
 ("adc_r0_r0_r0", "eb400000")
 ("adc_r0_r0_r0", "eb400000")
 ("adc_r0_r0_r0", "eb400000")
 ("adc_r0_r0_r0", "eb400000")
 ("adc_r0_r1_r2", "eb410002")
 ("adc_r0_r1_r2", "eb410002")
 ("adc_r0_r1_r2", "eb410002")
 ("adc_r0_r1_r2", "eb410002")
 ("adc_r0_r1_r2", "eb410002")
 
 ("udiv_r3_r2", "fbb3f3f2")
 ("udiv_r3_r2", "fbb3f3f2")
 ("udiv_r3_r2", "fbb3f3f2")
 ("udiv_r3_r2", "fbb3f3f2")
 ("udiv_r3_r2", "fbb3f3f2")
 ("udiv_r3_r2", "fbb3f3f2")
 ("udiv_r3_r2", "fbb3f3f2")
 ("udiv_r3_r2", "fbb3f3f2")
 ("umlal_r0_r1_r2_r3", "fbe20103")
 ("umlal_r0_r1_r2_r3", "fbe20103")
 ("umlal_r0_r1_r2_r3", "fbe20103")
 ("umlal_r0_r1_r2_r3", "fbe20103")
 ("umull_r0_r1_r2_r3", "fba20103")
 ("umull_r0_r1_r2_r3", "fba20103")
 ("umull_r0_r1_r2_r3", "fba20103")
 ("umull_r0_r1_r2_r3", "fba20103")

BUT

julia> @pipe @df df_pair_temp zip(cols(instruction_pair_first_sym), cols(:first_encoding)) |>
               collect(_)
ERROR: syntax: all-underscore identifier used as rvalue
Stacktrace:
 [1] top-level scope
   @ REPL[31]:1

even though they should be the same. Expanding with @macroexpand also gives

julia> @macroexpand @pipe @df df_pair_temp zip(cols(instruction_pair_first_sym), cols(:first_encoding)) |>
               collect(_)
:(((var"##374"->begin
          ((var"##range#375", var"##range#376"), var"##377") = (StatsPlots).extract_columns_and_names(var"##374", instruction_pair_first_sym, :first_encoding)
          (StatsPlots).add_label(["zip(cols(instruction_pair_first_sym), cols(first_encoding))", "collect(_)"], |>, zip(var"##range#375", var"##range#376"), collect(_))
      end))(df_pair_temp))

Maybe this is related to #20 and #21 . Can I do anything to fix this?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant