Code Monkey home page Code Monkey logo

frb's Issues

A public method to evaluate FRB expressions

I often have problems writing, understanding and debugging FRB expressions. Is there a public method that would look something like:

evaluateExpression(scope, expression)

For example:

evaluateExpression({
    folks: [
        {id: 4, name: "Bob"},
        {id: 2, name: "Alice"},
        {id: 3, name: "Bob"},
        {id: 1, name: "Alice"},
        {id: 1, name: "Alice"} // redundant
    ]
}, "folks.map{[id, this]}.toMap()") // {4: "Bob", 2: "Alice", 3: "Bob", 1: "Alice"}

It would help me enormously.

null operand semantics hide changes

"If any operand is null or undefine, a binding will not emit an update. Thus, if a binding’s source becomes invalid, it does not corrupt its target but waits until a valid replacement becomes available."

This poses a problem when I expect the null or undefined to get passed along, to deal with the "corruption" at the endpoint.

e.g. In Montage I'd like some default handling for null or undefined src on the Image component but when a binding that had been a valid url becomes null the image never knows.

I have worked around this on a binding by binding basis by capping a.Potentially.Null.Path || nullPlaceholderValue

But this gets to be a little painful having to solve it on each binding.

I'd prefer to flip the convention to shield less-resilient objects from undefined/null while expecting objects to be tolerant by default.

MapChange event should send old and new value

Is there a specific reason this isn't already done? Adding two listeners just to get before and after seems avoidable. Looking through the code, I think I could get this to work, but wanted to check before I started the work.

Support ; or , operator in FRB expressions

Such that classList.(has("x"); has("y")) <-> z is equivalent to classList.has("x") <-> z; classList.has("y") <-> z, except that the bindings would be both directly asserted when classList changes, instead of independently.

browserify chokes

I wanted to see what browsers this code supported so I tried to browserify the entry point.

➜  frb git:(master) ✗ browserify bindings.js -o bundle.js
Error: Parsing file /Users/paulgrenier/GitHub/frb/language.js: Line 31: Unexpected string

I was able to get through this by turning "if" into a constant. However, getting the tests to run is significantly harder--there are several references to other reserved words like 'with' and 'delete'.

Is there an expectation that these tests run on the client? If so, which browsers are supported?

I cant get this equation system acts like a perceptron:

The libraries are these:

<script src="https://cdn.jsdelivr.net/npm/nerdamer@latest/nerdamer.core.js"></script>
<script src="https://cdn.jsdelivr.net/npm/nerdamer@latest/Algebra.js"></script>
<script src="https://cdn.jsdelivr.net/npm/nerdamer@latest/Calculus.js"></script>
<script src="https://cdn.jsdelivr.net/npm/nerdamer@latest/Solve.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/index.min.js"></script>

The equation system thats works like a perceptron with that libraries is this:

[
    //perceptron

    'r1=b+(m1*x11)+(m2*x12)',
    'r2=b+(m1*x21)+(m2*x22)',
    'r3=b+(m1*x31)+(m2*x32)',

    //entrenamiento

    'r1=0',
    'x11=0',
    'x12=0',

    'r2=0',
    'x21=1',
    'x22=0',

    'r3=0',
    'x31=0',
    'x32=1',

    //soluciones

    'r4=b+(m1*x41)+(m2*x42)',

    'x41=0',
    'x42=0',

    'r5=b+(m1*x51)+(m2*x52)',

    'x51=1',
    'x52=0',

    'r6=b+(m1*x61)+(m2*x62)',

    'x61=0',
    'x62=1',

    'r7=b+(m1*x71)+(m2*x72)',

    'x71=1',
    'x72=1',
]

And the document doesnt print the solutions:

image

Any help? Thanks anyway!

Possible to bind to parentElement's offsetWidth?

In a component definition:

this.addPathChangeListener(
  "_element.parentElement.offsetWidth",
  this,
  "handleResize"
);

Will only trigger this.handleResize() once. offsetWidth is definitely changing by checking this way and resizing viewport:

setInterval((function () {
  console.log(this._element.parentElement.offsetWidth);
}).bind(this), 1000);

Is this possible?

syntax doesn't parse with latest pegs

The last time the grammar was compiled with pegjs was probably in 2013/2014. I don't believe our grammar changed since, but pegjs has. We should do a git bisect between the last version of pegjs that parses it correctly and now to identify what commit of pegjs introduce the issue so we can reach out to pegjs' author for some insight.

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.