FluxML / FluxML/MacroTools.jl

sourcewalk (etc) drops all but the first character in replacements

Open
#122 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
320
Forks
84
PR merge metrics
No merged PRs in 30d

Description

This is hard to explain.
here is a demo

I want to remove the second argument of a 3 argument function.

```
julia> using MacroTools: textwalk

julia> code = """
test_scalar(cos, x -> -sin(x), x)
test_scalar(tan, x -> 1 + tan(x)^2, x)
test_scalar(sec, x -> sec(x) * tan(x), x)
test_scalar(csc, x -> -csc(x) * cot(x), x)
""";

julia> function twoarg(expr)
@capture(expr, t_(f_, d_, x_)) && t==:test_scalar && return :(test_scalar($(f), $x))
return expr
end
twoarg (generic function with 1 method)

julia> textwalk(twoarg, code) |> println
test_scalar(c, x)
test_scalar(t, x)
test_scalar(s, x)
test_scalar(c, x)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Julia textwalk example from the issue and then inspect the textwalk/sourcewalk replacement path. Done means the transformation removes the second argument while preserving each complete function name, rather than reducing names to their first character.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.