Code Monkey home page Code Monkey logo

Comments (5)

raghav135 avatar raghav135 commented on May 25, 2024

+1

from feel.

pragyandas avatar pragyandas commented on May 25, 2024

@gustavomick This is an invalid expression. According to the FEEL grammar, the right-hand side token in a "simple positive unary test" (the type of expression as mentioned) can only be a literal or a variable (called a name in FEEL) and cannot be an expression. But <= ( 1 + 2 ) can be achieved by assigning (1 + 2) to a context variable, and using the variable name in the expression as illustrated in the below example,

const FEEL = require('./dist/feel');

var context = '{a : (1 + 2)}'
var text = '>= a';
var parsedContext = FEEL.parse(context);
var parsedGrammar = FEEL.parse(text);

parsedContext.build().then(ctx => {
    return parsedGrammar.build(ctx);
}).then(result => {
    console.log(result(4));
}).catch(err => console.log(err));

from feel.

gustavomick avatar gustavomick commented on May 25, 2024

Thanks for the explanation, i checked that ( page 108 ).
My example thou was may be too trivial, i was thinking more about setting a threshold/alarm example, where if X <= ( Y * 1.10 ) => True.
if you don't mind to give me your thoughts on this. thanks.

from feel.

pragyandas avatar pragyandas commented on May 25, 2024

I think you can do "if X <= ( Y * 1.10 ) then true else false" and take X and Y as part of context or payload.

from feel.

gustavomick avatar gustavomick commented on May 25, 2024

@pragyandas thanks but in this context i have 2 inputs, X and Y , both are numbers, so i have to return X if my expression is at column X so that rule resolves as true / valid. "if X <= ( Y * 1.10 ) then X else !X" is like that??
this example is related to discussion on usability, where something that should be very trivial to write for user, ends convoluted bc spec has maturity few pendings. thinking out loud thou, appreciate your feedback on this matter. thanks

from feel.

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.