Giter Club home page Giter Club logo

Comments (4)

co1emi11er2 avatar co1emi11er2 commented on June 11, 2024 1

Awesome! Thanks. This seems to be working!

from pluto.jl.

Pangoraw avatar Pangoraw commented on June 11, 2024

The problem here is calling eval(x) in the macro body which results in the literal value of x being put in the returned expression. Pluto only analyzes the @macroexpand @handcalc expr expression and cannot therefore see that x is referenced. Using something like Expr(:($), esc(x)) would be more Pluto friendly as the symbol contained in x would appear in the expanded expression.

from pluto.jl.

co1emi11er2 avatar co1emi11er2 commented on June 11, 2024

Substituting in Expr(:($), esc(x)) results in an error. I believe it is because it is returning something latexify can not evaluate since it is not a number. This is what is returns for example a.
image

I don't think this is being evaluated either anyway, because doing something like this causes similar issues. When I change that respective value (a), the printed terminal line goes away.
image

I guess what is Jupyter doing differently? I change the value of lets say a in Jupyter and then rerun the @handcalc h = (-b + sqrt(b^2 - 4*a*c))/(2*a) cell, and everything is updated and works.

I thought all Pluto did was rerun any cell that is dependent on a. I know it re-runs the cell, because the value of h changes properly as seen in the original video. It just seems strange that I get three different results when I change the a cell, then I manually re-run the handcalc cell, and then finally manually re-running the handcalc macro cell.

from pluto.jl.

Pangoraw avatar Pangoraw commented on June 11, 2024

It seems escapping is not needed so replacing eval(x) only with Expr(:($), x) appear to do what is expected and trigger reactivity.

I thought all Pluto did was rerun any cell that is dependent on a.

Yes, but it cannot know that the cell is dependent on a if a is not present in the expanded expression. The difference with Jupyter, is that every run will re-trigger macro expansion whereas it only happen in Pluto when the run button is explicitely clicked for that cell.

from pluto.jl.

Related Issues (20)

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.