function,haskell,infix-notation

Not really, no. On the other hand, you could perfectly well define a different operation that provides the default argument, e.g. withDef data2 = {- your default value -} <*> data2 If you really want to use a name that would otherwise be an operator, you can still name this...

haskell,syntax,infix-notation,applicative,infix-operator

Why is f <$> g <$> x equivalent to (f . g) <$> x ...well, this isn't so much a functor-thing as a Haskell-thing. The reason it works is that functions are functors. Both <$> operators work in different functors! f <$> g is in fact the same as...

tl;dr The r and l refer to the associativity, the number you specify refers to the operator precedence. When you don't specify the associativity you get an operator that can be associated only by explicit parenthesis or when the associativity is non-ambiguous. Our test data structure Let's use a data...

c++,linked-list,stack,postfix-notation,infix-notation

Here's an issue: (expression[i]=='*'||'+'||'-'||'/' This does not do what you think it does. The fix: (expression[i] == '*' || expression[i] == '+' || expression[i] == '-' || expression[i] == '/') Edit 1: Searching strings Another method is: char c = expression[i]; const std::string operators="*+-/"; if (operators.find(c) != std::string::npos) { //...

It's just a small error. In this code you look for '(' in the "in" array which makes no sense. You only want to look for it on the stack. else if(in[j]==')'){ int k=j; while(in[k]!='(' && !st.empty() ){ char ch=st.pop().toString().charAt(0); if(ch!='('&&ch!=')') out.append(ch); k--; } } Just change it to this...

haskell,operators,priority,infix-notation

infixl specifies left associative operators and infixr specifies right associative operators. Exponation is right associative and multiplication is left associative for instance. The haskell report contains examples of using it. Note that you can assign to standard names (like mod) too....

scala,infix-notation,language-theory

Because the expression is ambiguous. From Scala's (somewhat outdated) spec P94: http://www.scala-lang.org/docu/files/ScalaReference.pdf An expression(of syntactic category Expr) may contain embedded underscore symbols _ at places where identifiers are legal. Such an expression represents an anonymous function where subsequent occurrences of underscores denote successive parameters. Since lst map _.toString is a...

c++,infix-notation,shunting-yard

Debugging code is a valuable skill to learn, it's my opinion that it should form a much more important part of curricula in schools. For example, if you modify your code to output all the stack and queue operations thus: int main() { stack<char> tokenStack; queue<char> tokenQueue; string expression= "",...

scala,postfix-notation,infix-notation

A way to do it is to use Dijkstra's Shunting Yard algorithm. Here is one implementation in Scala.

javascript,postfix-notation,infix-notation

Your check y===("+" || "-" || "*" || "/" || "(" || ")")) is just y==="+" You either needs to break it up as if (y==="+" || y==="-" || ...) or you can use indexOf with an array or sting. if (["+","-","*","/","(",")"].indexOf(y) > -1) or a regular expression...

yacc,infix-notation,lalr,shift-reduce-conflict,ocamlyacc

Leaving out a lot of your grammar, you have the following productions, all of which could be simultaneously feasible. atom: LPAREN expr RPAREN expr: expr PLUS expr section: LPAREN atom PLUS RPAREN So let's say we've just read ( 0 -- that is, an LPAREN and an INT -- and...

function,haskell,operator-keyword,infix-notation,precedence

Function application (denoted by "juxtaposition", putting a function and its argument next to each other) has to be parsed somehow, and it needs to be either left-associative or right-associative in order to be parsed unambiguously.1 Function application is actually left-associative, so what you wrote is equivalent to ((((take 50) iterate)...

java,infix-notation,postfix-operator,infix-operator

Spaces You are not putting any spaces on your postfix variable. You are only checking if the current character is one of the "interesting" characters (digits, operators), but not whether it's a space. As a result, if the current character is a space, you just skip it and you don't...

r,operators,operator-precedence,infix-notation

I don't think this is explicitly documented, but implicit in the R language documentation is that infix operators are all of equal precedence and so are executed from left to right. This can be demonstrated as follows: `%foo%` <- `+` `%bar%` <- `*` 1 %bar% 2 %foo% 3 #5 1...

c,pointers,c-strings,postfix-notation,infix-notation

The problem is that you process p_newStr without initializint it, and only performing pointer arithmetic on it. I guess, that you wanted to see it as a string, adding chars to it. So first initialisze it: char* p_newStr = newStr; // It was unitinitalised, pointing at random location Then note...