# Questions tagged [infix-notation]

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

**-1**

votes

**1**answer

33 views

### Infix to Postfix with parentheses where 'operands' are not single tokens

I have to write a program that mimics the terminal bash shell where you can put commands together using connectors. An example input would be:
(echo "hello world" && ls -a) || (echo "hello ...

**1**

vote

**1**answer

35 views

### Kotlin coding conventions, infix functions, and bitwise operations

The Kotlin coding conventions, in the section Using infix functions, says:
Declare a function as infix only when it works on two objects which play a similar role. Good examples: and, to, zip. Bad ...

**0**

votes

**0**answers

6 views

### Converting from Prefix to (infix) to Postfix

i have a project on converting a given string from prefix to postfix and so i plan on first converting the given prefix to infix expression and then converting to it postfix expression.
So far i have ...

**0**

votes

**1**answer

33 views

### android - kotlin infix not working on one parameter extension function

take a look at this simple extension function i have infix:
infix fun View.isValidColor(hexColor: String?): Boolean {
var isValid = true
return hexColor?.let {
try {
Color....

**-1**

votes

**0**answers

39 views

### expressions in infix and postfix printing operators

Only using a switch case, how can I get my operators to show in the evaluation of my expression? This problem is showing infix and postfix in c and the evaluation of them.
I have written a header ...

**0**

votes

**0**answers

17 views

### stack converting to postfix from infix only half works

first I want to start by saying I have read all the posts on here related and it still did not help my answer. my code is working for some of the equations but not all. I hav changed the || to &&...

**2**

votes

**1**answer

30 views

### I need help to convert from infix to postfix in C

I was practising some data structures problems that I did previously but this time I don't know what is going wrong in my code. I looked over a long time but I did not found the mistake. When I'm ...

**0**

votes

**1**answer

33 views

### Infix to Postfix ' StringIndexOutOfBoundsException' error [duplicate]

I am setting up a method that turn a infix string into a postfix equation with a custom LinkStack.
I have tried to to check if the charAt(i) was null and a if statement to check if i is greater than ...

**0**

votes

**0**answers

48 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

**0**answers

33 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

**0**answers

63 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

**1**answer

134 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

**1**answer

48 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 ...

**1**

vote

**1**answer

25 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

**2**answers

77 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

**0**answers

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

**2**answers

76 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

**3**answers

46 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

**1**answer

33 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

**2**answers

40 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

**1**answer

34 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? = ...

**-1**

votes

**1**answer

590 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

**1**answer

72 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

**1**answer

21 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

**1**answer

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(...

**-3**

votes

**1**answer

49 views

### About c++ convert infix to postfix when it contains two power signs (^^)

My goal is to convert infix expression to postfix expression.
I've got a problem with this line:
while(precedence(stack[top])>=precedence(symbol))
Condition is (and should be) satisfied when it ...

**0**

votes

**0**answers

58 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

**0**answers

33 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

**0**answers

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

**2**answers

51 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

**0**answers

99 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

**1**answer

67 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

**1**answer

55 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

**0**answers

343 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

**3**answers

237 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

**0**answers

35 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

**1**answer

154 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

**0**answers

115 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

**1**answer

51 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

**1**answer

55 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

**1**answer

60 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

**1**answer

125 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

**1**answer

49 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

**0**answers

301 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

**0**answers

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

**0**answers

446 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

**1**answer

82 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

**2**answers

67 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

**1**answer

47 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

**0**answers

242 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 ...