Questions tagged [infix-notation]

Operators are written infix-style when they are placed between the operands they act on (e.g. 2 + 2).

0
votes
1answer
44 views

Invalid conversion from 'char' to 'char* (*)()' [on hold]

I have written a code to convert infix to post fix but I have some error in the main here: while(!s.empty() && prcd(s.stacktop(),symb)) What does this mean and how can I fix it? #include &...
0
votes
0answers
27 views

Problems in converting Infix to Postfix using stacks and queues in java

It works if the equation contains any variant of NUM +/-/*// NUM. However adding more operators will cause it to not work, and brackets will cause an infinite loop. I was hoping someone could tell me ...
0
votes
0answers
22 views

Infix to postfix conversion using stacks in C language

I am building a function to take the an infix expression from user and return its value. The input will be a postfix. Please can you find the error I made in the code because when I try to insert ...
0
votes
0answers
58 views

Trying to convert infix to postfix returns backwards output

I am creating a Reverse Polish Notation calculator that converts an infix expression to a postfix expression. However, my operators are outputting backwards. For example, I have entered the infix as "...
2
votes
1answer
120 views

Testing for too many operands on C++ postfix to infix stack

I'm currently trying to test for if there are too many operands but cannot figure out the condition for when a postfix expression has too many operands. Could someone give me any pointers on what to ...
-1
votes
1answer
47 views

writing infix to postfix, cannot tell why my code is throwing an out of bounds exception

I am trying to do this without using java's built in stack, so i made a class with functions (listed below). I cannot figure out for the life of me where my mistake in logic causes the error. package ...
-3
votes
0answers
17 views

Why do you think Dijkstra offered an algorithm from converting from infix to postfix notation even after computer support postfix notation?

Why do you think Dijkstra offered an algorithm (Shunting yard) from converting from infix to postfix notation even after computer support postfix notation?
1
vote
1answer
22 views

Arithmetically incorrect evaluation and KeyDict errors when evaluating infix expression using stacks;

My program is supposed to evaluate given infix expressions and evaluate them. It is assumed that only the operators in the method calls at the bottom of the code will be used for any given infix ...
1
vote
2answers
70 views

Haskell infix notation taking 2 arguments on the left

In Haskell, infix notation allows us to do the following: divide :: Double -> Double -> Double divide x y = x / y foo = divide 10.0 3.0 bar = 10.0 `divide` 3.0 -- infix -- foo and bar are ...
0
votes
0answers
25 views

Error in infix to postfix conversions using stack [duplicate]

I am performing an infix expression to postfix expression conversion using a stack. However, the following errors occur upon execution: Exception in thread "main" java.lang.NullPointerException ...
0
votes
2answers
55 views

Catching a missing operand or operator in stack while converting to postfix from infix

I have been attempting to figure out how to be able to catch a missing operand or operator while converting from infix to postfix. e.g.) Tall = Y would print out Tall Y = I thought about ...
0
votes
3answers
41 views

How do I properly check for null on nullable infix receivers?

I have a Kotlin infix function stubbed out thusly: private fun statementMeetsConditions(policy: PolicyStatement, per: PolicyEnforcementRequest): Boolean { return policy.conditions areMetBy per....
0
votes
1answer
28 views

How to add an infix function to a package?

I want to add a infix function to a package but the %%s challenge me. I found this solution but unfortunately it doesn't explain where exactly the line export("%IN%") should be added. I didn't get ...
0
votes
2answers
38 views

Infix algorithm returning last number only

I have the following class to evaluate a formula and return result.It uses infix algorithm and 2 different stacks to push the values and operators. when the formula has spaces separating characters eg:...
0
votes
1answer
31 views

Improve infix isNullOrEmpty

I'm trying to improve some code by using infix : Working code (but kinda ugly...) : fun test (possibleEmptyString: String?, anotherPossibleEmptyString : String?): String { var test: String? = ...
-2
votes
1answer
310 views

C++ Infix to Postfix Conversion and Calculator

I'm new to stackoverflow, and have final project for my Data Structures class in college. For my project, I am creating a calculator that takes a mathematical expression from input, such as (11-2)/3*(...
0
votes
1answer
66 views

What are the legal names for infix operators?

There seem to be a number of symbols that can act as infix operators; e.g. ints: (+), (-), (*), (/), mod floats: (+.), (-.), (*.), (/.) comparison: (=), (<>), (<), (<=), (>), (>=) ...
1
vote
1answer
20 views

Trouble with regex patterns for UNSIGNED_DOUBLE

I have trouble with compiling a code that converts an infix expression to a postfix expression. I suspect the following two lines of code to be giving me the issue: public static final Pattern ...
0
votes
1answer
37 views

Kotlin - Move infix function inside other function out of it

I use a property observable delegate. var state: State by Delegates.observable(START as State, fun(prop: KProperty<*>, old: State, new: State) { infix fun State.into(...
0
votes
0answers
31 views

How to make a (TABLE) of converting infix to postfix in Python?

I can't find any solution to change my output into a table in Python. Can someone help? Thanks. I've try search for Python Lists Modul, but it doesn't help. I didn't find any suggestion to input the ...
0
votes
0answers
31 views

Converting infix to postfix

I am trying to convert some data from infix to posfix but the problem that I am having is that the supposedly converted postfix is not printing anything. This is what i have public static void main (...
0
votes
0answers
46 views

How to calculate an arithmetic conversion after converting from postfix to infix?

I am writing a program that takes a postfix expression and converts it to an infix expression and outputs the result. This is the code I have written so far but I can't figure out how to do the ...
0
votes
2answers
49 views

Operators are misplaced in the output of postfix notation of an infix expression given as a String

Here is a Java code that takes as an input infix expression string with multiple levels of braces and mixing operands and outputs as one long postfix expression. I converted the infix notation String ...
0
votes
0answers
70 views

Separate an infix expression using recursive method

im trying to create a recursive method to separate an String that is an infix expression, im using 2 Queues and 1 stack to use the Shunting-yard algorithm , the problem is that im confused separating ...
0
votes
1answer
64 views

reversing operator precedence in infix expression

Write a program which accepts a valid infix expression and provide its corresponding postfix expression. Consider following assumptions: • There are 5 operators (+,-,*,/ and ^). • + and – ...
0
votes
1answer
50 views

Scala infix notation for generics

Can generics be used in Scala infix notations? For example: // Example from play-json Json.obj("name" -> "Joe") \ "name" as[String] // Generics in infix notation ...
0
votes
0answers
200 views

conversion infix to postfix in python

I have created an infix conversion program to postfix, but I want to display the stack results like this:enter image description here def operator(op1): if op1 =="^": return 4 elif op1 ==...
0
votes
3answers
216 views

Reverse Polish to Infix Notation optimization in java

I am trying to solve a programming challange that involves converting reverse polish notation to infix notation. For example: 1 3 + 2 4 5 - + / would be: ((1+3)/(2+(4-5))) My solution so far does work,...
0
votes
0answers
26 views

Kotlin infix functions using generics are not enforcing type

When using generics in infix functions it doesn't seem to be enforcing type infix fun <T> T.assertEquals(value: T) { assertk.that(this, equalTo(value)) } The following code compiles and ...
1
vote
1answer
130 views

prefix to infix in C

#include<stdio.h> #include <stdlib.h> #include <string.h> struct Node{ char* data; struct Node* next; }; typedef struct Node NODE; NODE* push(NODE* top, char* item){ ...
0
votes
0answers
99 views

What is an 'infix modifier' for a 'setOnClickListner'?

I created a button with: cookieButton = findViewById(R.id.cookieImageButton) cookieButton!!.setOnClickListener { println("Clicked") val intent = Intent(this, RecipeGridView::class....
0
votes
1answer
44 views

Evaluating infix expressions of unsigned integers using 2 stacks and getting wrong answer

I'm writing a program for class, that as the title says, evaluates infix expressions of unsigned integers using two stacks. The division should be integer division which is why the numbers are ...
-1
votes
1answer
53 views

implementing a infixToPostfix method, but don't know why do I push '(' at first time

I didn't implement whole infixTopostFix method yet. but I have a question about it. I am figuring out it still. (notice: My infixToPostfix method is not complete yet) #include <stdio.h> #...
0
votes
1answer
58 views

Partially apply the infix operator with map

I have the following function g g :: Int -> Int -> Int g x y = x + y * y I use g in the following three ways but don't quite understand what they each do. map (g 10) [1,2,3,4,5] -- 1 map (...
0
votes
1answer
117 views

Common lisp and infix package

There is the infix package for common lisp (see http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/syntax/infix/infix.cl), which transforms infix form to prefix. For example: (...
0
votes
1answer
46 views

infix to postfix expressrion not showing any output

infix to posfix expresion where a+b is converted in ab+. i have been staring at the code for hours and wondering why is not showing any output at all. i tried reviewing it by line to the best that i ...
1
vote
0answers
242 views

Prefix to Infix?

In my class one of our assignments is to convert a prefix equation to infix. After reading that section I still have no idea what I'm doing. The book had some code that will solve a prefix equation ...
0
votes
0answers
56 views

Infix to Postfix function using stacks, but without using peek method

so i wrote a function to convert from infix to postfix. It works for most inputs, but gives a null pointer exception if i try to convert any string that has two open parenthesis back to back (ex: 2*((...
0
votes
0answers
46 views

How to verify a mathematical expression? [duplicate]

I'm writing a scientific calculator, and am currently on the stage of tokenising the infix string. I've also implemented a working Dijkstra's Method (I think this is also known as the Shunting-Yard ...
0
votes
0answers
404 views

Infix to Prefix algorithm

I need to transform a Infix expression into a Prefix expression. My algorithm works for expression without parenthesis, but when I add parenthesis this algorithm doesn't work anymore. The problem is ...
1
vote
1answer
75 views

R calling infix function with more than 2 parameters

I liked so much index search of xts that I created one for data.frame. "%d%"=function(df1,dt,col='dt_pregao') { if(regexpr('/',dt)>0){ dt=strsplit(dt,'/')[[1]] return(df1[df1[,col] %&...
1
vote
2answers
62 views

How to replace a character with a word in Java

I have an input string like so which takes in infix expressions: String str ="-(4-2)"; My output string returns a string value in the form of postfix expressions: 4 2 - - How can I replace the - ...
0
votes
1answer
40 views

Correct spacing between expressions after converting from infix to postfix expression

Currently I have a program that converts infix expressions to postfix. However, I want my postfix output to be like so: Infix expression: (11+11)*(11+11) Current postfix expression: 11 11+ 11 11+* ...
0
votes
0answers
216 views

How to use ANTLR4's BaseListener class to convert infix expression to postfix expression

So in ANTLR I have written grammar for infix expression and now I want to convert the infix expression input to postfix expression and then output the result to a text file. Unless I am wrong, I ...
0
votes
4answers
69 views

infix to postfix with non-commuting operators

I have a question when it comes to - / operators in postfix vs infix. From the assignment The input string 5 4 + 3 10 * + is equivalent to the infix expression (5 + 4) + (3 * 10) The answer is ...
1
vote
1answer
311 views

Converting postfix (reverse polish notation) expressions to infix with minimal parentheses

I am looking for an algorithm to convert a postfix expressions to infix expressions but with minimal parentheses. I am asking it here after searching Google Les Vesti. I only found a single ...
0
votes
0answers
46 views

Infix to Postfix program doesn't work as intended

This is my attempt to write a program that can convert any expression in infix to postfix format. I assign -1 to the top to indicate the stake is empty. When push the top+1 ,when pop, the top-1....
-1
votes
1answer
44 views

Polish Notation Expression (need little help) **/^a-bc+d*ef**

/^a-bc+d*ef I am little bit confused about this expression *ef=(e*f) +d*ef=d+(e*f) -BC=(b-c) /^a? if it is ^23= 2^3 here I am confused, what should I do? please need help. /^a-bc+d*ef /^a-bc+...
-1
votes
1answer
149 views

Empty Stack Exception for Infix Expression Solver

So this program is suppose to take a syntactically correct infix expression that contain integer operands and the four arithmetic operators (+ - * /) from a GUI and display the results. Im having ...
0
votes
1answer
61 views

Empty Stack Exception in Infix Expression Solver

So my program is suppose to take an syntactically correct infix expressions that contain integer operands and the four arithmetic operators (+ - * /) from a GUI and display the results. Unfortunately, ...

http://mssss.yulina-kosm.ru