Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
47 views

I am building SQL where clause like expression in pure Kotlin. I am facing problem in detecting if user has used starting parenthesis in their code or not. I have created a working and replicable ...
Azim Ansari's user avatar
1 vote
1 answer
88 views

I'm working on implementing a parser that is supposed to process the input string, extracting its components, validating them, and then creating a SQL Alchemy query from it. At the moment, I'm working ...
PyJaGa's user avatar
  • 23
1 vote
1 answer
72 views

Is it possible in ocaml to define an operator like the array set function which can be written a.(n)<-v? The OCaml manual explains how to define 2-parameters infix operators but not 3-parameters ...
Pierre NEILLO's user avatar
-1 votes
2 answers
240 views

I am attempting to write up the following algorithm (provided in ordinary English) in Python for converting simple mathematical expressions from infix form to postfix form: Create a new empty list, '...
user829347's user avatar
0 votes
0 answers
34 views

There is some eror in input precedence value and stack precedence value for conversion of infix expression to prefix expression(in the table). Please provide the corrected value: |Symbol| Stack | ...
user23435187's user avatar
0 votes
0 answers
51 views

I am doing a project where i take in an infix expression and change it to a postfix expression using a string array. I have passed several of the test cases and am having a hard time understanding ...
Jared Davis's user avatar
1 vote
1 answer
222 views

Right now this is my code: precedence = { "+": 1, "-": 1, "*": 2, "/": 2, "": 0 } def is_operator(token): ope = set(['+', '-',...
vale383's user avatar
  • 119
0 votes
2 answers
120 views

Title says it all. Seen lots of answers where folks have implemented f @ g, but this requires wrapping f, g in some infix decorator or class. Is it possible to get this to work? Maybe by patching some ...
Brendan Langfield's user avatar
1 vote
1 answer
537 views

I am trying to convert a given infix expression to prefix expression in c. But i am encountering a problem in it. The value in postfix is not getting updated. Please help me understand what the issue ...
Dhairya Gupta's user avatar
1 vote
0 answers
103 views

First of all, I started learning Ruby only 2 weeks ago, so please do not judge too harshly. I wrote a script that does not work correctly with mathematical expressions containing parentheses. The ...
dennyk's user avatar
  • 11
9 votes
1 answer
130 views

This code works as expected: sub infix:<mean>(*@a) { @a.sum / @a.elems } sub Mean (*@a) { @a.sum / @a.elems } say EVAL 'Mean 2, 6, 4'; # Output: 4 say EVAL '2 mean 6 mean 4'; # ...
Jim Bollinger's user avatar
0 votes
2 answers
75 views

I am looking to programmatically apply a typically infixed operation (eg: +, -, *, /) on two integers, where the operation is specified via a string. I have had success accessing the method itself ...
MolarFox's user avatar
1 vote
1 answer
177 views

I am having a problem converting from postfix to infix in C. I know where the problem is, but I don't know how to fix it. #include <stdlib.h> #include <string.h> #include <ctype.h> ...
Alaa Zaabat's user avatar
3 votes
3 answers
919 views

To use an infix operator as a prefix function in OCaml, you can put parenthesis around it. for example, 1 + 2 is equivalent to (+) 1 2. How do you do the opposite? For example, in Haskell, a prefix ...
Daniel Jung's user avatar
0 votes
0 answers
96 views

I've been stuck on this program for about a week and I can't see what I'm doing wrong. I can't get the operands and operators to print in the proper spot and the '(' ')' won't delete. Here's what I ...
Tiara Grier's user avatar
1 vote
1 answer
483 views

I'm working on a billing application where users can enter arbitrary mathematical expressions. For example, a line item might be defined as (a + b) * c. pyparsing handles the order of operations well ...
Big McLargeHuge's user avatar
0 votes
0 answers
106 views

I am using the .editorconfig file in order to configure my IntellijIDEA IDE to reformat Scala code in a specific way. I specified a right margin, and specified for it not to be exceeded, however, this ...
MrRobot's user avatar
  • 511
-1 votes
1 answer
228 views

I need to define the semantic actions required to translate infix notation to postfix notation by embedding semantic actions as Java code in the g4 grammar file. For example, when I try to input "...
bam's user avatar
  • 3
-2 votes
1 answer
62 views

#include <stdio.h> char infix[200]; char stack[200]; char queue[200]; int count_stack = 0; int count_queue = 0; int precedence(char x) { switch (x) { case '^': return 2; ...
Geek's user avatar
  • 91
0 votes
0 answers
139 views

My problem is that my evaluatePostfix() function is not calculating operands. It only returns the top of the stack in the converted postfix expression. So for example, my output is: Enter a infix ...
evantuazon's user avatar
0 votes
0 answers
2k views

I was hoping you will be free and could help me solve my codes. I'm entirely new to python programming so I'm at the phase of learning on my own or self-study. So bare with me if my code seems really ...
Matthew Finx's user avatar
3 votes
1 answer
1k views

I have seen Haskell code like this: infix 4 ~= (~=) :: Double -> Double -> Bool x ~= y = abs (x-y) < epsilon where epsilon = 1 / 1000 Despite that I know what this code is doing, I would ...
j.j.3's user avatar
  • 35
-1 votes
1 answer
616 views

#include<bits/stdc++.h> using namespace std; int prec(char c){ if(c=='^'){ return 3; }else if(c=='*' || c=='/'){ return 2; }else if(c=='+' || c=='-'){ return ...
Devansh Garg's user avatar
1 vote
1 answer
282 views

I was trying to make a calculator for my university homework. to calculate the results I use infix to postfix convention. but this code doesn't take only decimal point (.) as a result, it crashes ...
c.dipu0's user avatar
  • 103
0 votes
4 answers
676 views

Try to write a simple Kotlin infix function for plus operation. What's wrong with generic type? infix fun <T : Number> T.myPlus(that: T): T = this + that
lenriq's user avatar
  • 361
1 vote
1 answer
113 views

Basically, I'm trying to get rid of ++ or -- from an infix expression by incrementing the value that's applied to it, but the code gives a weird output. I also used a shifting function to delete the ++...
kenjicharlie's user avatar
1 vote
0 answers
60 views

I'd like something to convert pretty basic math expressions, having nested parentheses and fractions, to LaTeX notation. Like mathquill, but a function (or even the building blocks of one). There seem ...
dholstius's user avatar
  • 1,017
1 vote
1 answer
232 views

I am trying to parse expressions with pyparsing, and can do that with infix_notation, but the problem is that it matches lines that have no operations, and just match the base_expr argument. This is a ...
John Glen's user avatar
  • 966
1 vote
1 answer
99 views

I am trying to make a function to convert from prefix to infix implementation in C: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #define type ...
Anas Mostafa's user avatar
1 vote
0 answers
392 views

What would be a good algorithm to convert infix to postfix of an expression which uses user-defined functions: For example: def get_random_integer(a, b, c): import random return random.choice([...
visuman's user avatar
  • 140
-3 votes
1 answer
301 views

The question is to convert a postfix expression to an infix expression using stacks and without stack library. Im getting a statement after i run it and enter my postfix expression saying : "...
Aryan Raveshia's user avatar
1 vote
1 answer
270 views

In scala, how can I call a single parameter method using space in the body of the anonymous class? add "Answer3" below is not working trait Question { def add(answer:String):Unit = { ...
ams1's user avatar
  • 153
2 votes
1 answer
145 views

infixr 5 :-: data List a = Empty | a :-: (List a) deriving (Show, Read, Eq, Ord) we just wrote a :-: (List a) instead of Cons a (List a). Now, we can write out lists in our list type like so: ...
SpringArt's user avatar
1 vote
1 answer
231 views

below is the code of infix to postfix conversion using stack.The code executes an infinite loop printing stack underflow in one of the pop function ,i have tried commenting pop function call in right ...
SWAPNIL SRIVASTAVA's user avatar
2 votes
2 answers
104 views

Unfortunately I have been facing a strange error. It happens while using infix with data constructor. I am new to Haskell. Can any one help me in this regard ? Prelude> data L a = Cons a (L a) | ...
John's user avatar
  • 2,761
0 votes
1 answer
84 views

We are making a program to convert an input from infix to postfix. This is my code: import javax.swing.*; import java.util.Stack; public class InfixToPostfix { public static int Precedence(char c)...
John Silver's user avatar
1 vote
0 answers
121 views

I was trying to write a code to convert infix expression into postfix expression , I have the source code here and when I compile and give the input say 'a+b' it returns 'ab?' as the answer it does ...
A_01_Abhilash S Hathwar's user avatar
-1 votes
1 answer
538 views

My code is able to compile and run, however the process returns -1. I have drawn out various test cases manually and believes it works, so I am not sure which part of my logic is wrong. I ask the user ...
user avatar
0 votes
0 answers
1k views

Can anyone please help me with this code? I'm trying to convert from infix to postfix using a linked list. With an array, I can easily solve this, that solution is also similar to this one. But I'm ...
Rakib Hasan's user avatar
1 vote
0 answers
339 views

We are supposed to write a program using the stack class that converts a string from infix to postfix using JOptionPane as the input method. We are supposed to do it all in one big for loop and one ...
John Silver's user avatar
0 votes
1 answer
146 views

I am trying to create a infix notation as a extension function of (Int) -> Int function which is used to nest a function to another. For example: class Entry { companion object { ...
Langua's user avatar
  • 3
0 votes
0 answers
47 views

The problematic to resolve: Given a string that contains a mathematical expression, I need a function on C# language that receives that string and returns its decimal result that respects the ...
Decker's user avatar
  • 1
0 votes
0 answers
77 views

#include<iostream> using namespace std; struct stackint{ int top; int size; int a[50]; void push(int x){ if(top==size-1){ cout<<"stack is full"...
Prashanth Bairu's user avatar
0 votes
1 answer
144 views

-2^2 (infix notation) should translate to -2 2 ^ (postfix notation). It does as expected however when evaluating that postfix it evaluates to 4 not -4 which is what is expected. I'm using Lua and here'...
imp's user avatar
  • 13
1 vote
1 answer
924 views

I have read Kotlin docs as well as the wikipedia links (https://en.wikipedia.org/wiki/Infix_notation#:~:text=Infix%20notation%20is%20the%20notation,plus%20sign%20in%202%20%2B%202), but unfortunately I ...
user avatar
4 votes
0 answers
82 views

In Haskell, we can use an infix operator as a parameter name, e.g.: f :: (Int -> Int -> Int) -> Int f (|+|) = 3 |+| 4 Is it possible to do something similar in Idris 2? I tried the following:...
Cactus's user avatar
  • 27.8k
1 vote
1 answer
98 views

data BB a = L | K (BB a) a (BB a) deriving (Show) foldrpBB :: (a -> b -> b) -> b -> BB a -> b foldrpBB f b L = b foldrpBB f b (K l r a) = foldrpBB f (f r (foldrpBB f b a)) l foldrprBB ...
ppch's user avatar
  • 35
7 votes
1 answer
294 views

According to David MacQueen in his Reflections on Standard ML report1, Lexically-scoped infix directives were an ill-advised legacy from Pop-2. They complicate parsing and they do not work well with ...
Moth's user avatar
  • 264
0 votes
1 answer
279 views

First time here, anyone know what this postfix expression would be in infix? s s * x y z * * sqrt s t - / s t * + Where sqrt is square rooting. My current guess is: (sqrt ((s * s) (x * y * z))) / (s - ...
Lex's user avatar
  • 43
0 votes
0 answers
500 views

I'm trying to do a expression tree from a infix string with recursive approach but when Parser threw an nullpointerexception but idk why, so if someone can help me, i will thank u. Every operator with ...
Crxwler's user avatar

1
2 3 4 5
11