Jump to content

Auto opening parenthesis when doing math


MRR

Recommended Posts

When typing a closing parenthesis, I would like Alfred to add an opening parenthesis at the start of the field.

 

Typing this:

20+8)

results in:

(20+8)

 

 

 

For an example, let's say you're doing a calculation in Alfred. 

20+8

and you want to divide that result by 3

20+8/3

is incorrect because PEDMAS/BODMAS interprets it as: 8/3 + 20

 

So you add a closing paragraph:

20+8)

and then you have to go back to the start and add the opening paragraph and then go back and divide by 3 and I know it sounds lazy to request an automatic opening paragraph mark but isn't automating lazy the whole point of Alfred? 

 

 

Here's how it should work:

When a ")" is added, Alfred should look back in the statement and add a parenthesis at a previous math statement (+-/*)

ex:

4+9*8)

results in:

4+(9*8)

or, not finding that, at the start of the statement.

9*8)

results in:

(9*8)

 

 

Thank you and have a wonderful day.

Link to comment
Share on other sites

  • 1 year later...

That's really odd, cause I'm pretty certain that in the past I wouldn't have to have the open parenthesis

1.45-.78)*300

would show the answer of 201

 

(as now my workflow is: ) 

1.45-.78)* backspace alt-left-arrow ( alt-right arrow * 300

This new workflow is such a pain that's why I thought I was doing this prior. I wonder what I was actually doing then?. Hmm.

 

Anyway, possible to add this to the feature list? There's gotta be some regex that would correctly assume the basic usage of a missing opening parenthesis, as I'm sure a pretty complex expression would be hard, but then again, something that complex one wouldn't be using Alfred for a quick answer.

 

Thanks for the app.

Powerpack Mega supporter

Link to comment
Share on other sites

6 minutes ago, dmayo2 said:

I wonder what I was actually doing then?

 

In your example, you could do:

1.45-.78=*300

As for adding auto parenthesis, it's very difficult to second guess what people would actually want when it comes to opening bracket positioning. In the example given, what's to say that 4+9*8) should be auto completed to (4+9*8).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...