Giter Site home page Giter Site logo

Switch to more local `@_` about underscores.jl HOT 5 CLOSED

c42f avatar c42f commented on May 10, 2024
Switch to more local `@_`

from underscores.jl.

Comments (5)

MasonProtter avatar MasonProtter commented on May 10, 2024 2

Since this would be a major departure from how this package works, I think I'll close this in favour of just making a new package: https://github.com/MasonProtter/SimpleUnderscores.jl

from underscores.jl.

mcabbott avatar mcabbott commented on May 10, 2024 1

Oh that's pretty magical, I didn't know we could return "naked" tuples. Splat at production not consumption. Mathematica has something like this, but I thought Julia didn't.

julia> map(@_ _^2, [1 2 3])
1×3 Matrix{Int64}:
 1  4  9

julia> @macroexpand1(@_ _^2, [1 2 3])
:(((var"##x#301"->begin
              #= REPL[12]:12 =#
              var"##x#301" ^ 2
          end), [1 2 3])...)

julia> dump(ans)
Expr
  head: Symbol ...
  args: Array{Any}((1,))
    1: Expr
      head: Symbol tuple

from underscores.jl.

MasonProtter avatar MasonProtter commented on May 10, 2024

I feel quite silly because I've known we could do this for years, but never made the connection that it could be used to bypass JuliaLang/julia#36547

from underscores.jl.

tpapp avatar tpapp commented on May 10, 2024

Oh that's pretty magical, I didn't know we could return "naked" tuples.

Is this documented anywhere?

from underscores.jl.

c42f avatar c42f commented on May 10, 2024

Sounds good!

from underscores.jl.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.