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

@arr bugs #70

Open
zenna opened this issue Oct 17, 2017 · 2 comments
Open

@arr bugs #70

zenna opened this issue Oct 17, 2017 · 2 comments

Comments

@zenna
Copy link
Owner

zenna commented Oct 17, 2017

Looking to replace some of the code with @arr

@arr function inv_add(x::Float64, θadd::Float64)
  (z - θadd, θadd)
end

yields the following error (I imagine because you use z as a standard output ( should probably change this to out_1, out_2 if we can't infer it.

julia> Arrows.@arr function inv_add(z::Float64, θadd::Float64)
         (z - θadd, θadd)
       end
ERROR: ArgumentError: name duplicates: Arrows.Name[Arrows.Name(:z), Arrows.Name(:θadd), Arrows.Name(:z)]
Stacktrace:

Using another name yields another error

julia> Arrows.@arr function inv_add(x::Float64, θadd::Float64)
         (x - θadd, θadd)
       end
Expr
  head: Symbol tuple
  args: Array{Any}((2,))
    1: Expr
      head: Symbol call
      args: Array{Any}((3,))
        1: Symbol -
        2: Symbol x
        3: Symbol θadd
      typ: Any
    2: Symbol θadd
  typ: Any
ERROR: DomainError:
Stacktrace:
 [1] transform_expr_prim!(::Expr, ::Dict{Symbol,Arrows.SubPort}, ::Arrows.CompArrow, ::Bool) at /home/zenna/.julia/v0.6/Arrows/src/macros/arr_macro.jl:127
 [2] transform_function(::Expr) at /home/zenna/.julia/v0.6/Arrows/src/macros/arr_macro.jl:155

@jburroni

@jburroni
Copy link
Collaborator

@zenna do we want to be able to do this:

  carr, f = Arrows.@arr function f(x, y)
    if x == y
      (2x + y, 1)
    else
      (2, 3x + y)
    end
  end

?
If so, we would need to create a TupleArrow + IndexingArrow

@jburroni jburroni self-assigned this Oct 18, 2017
@zenna
Copy link
Owner Author

zenna commented Oct 18, 2017

Yeah. It's not a priority yet, and also we don't need any more arrows to do it: img_20171017_235103

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

No branches or pull requests

2 participants