infix-notation Questions

6

Solved

I want to know if there is a way to solve infix expressions in a single pass using 2 stacks? The stacks can be one for operator and the other for operands... The standard way to solve by shunt-yar...
Imprescriptible asked 16/11, 2012 at 17:23

1

Solved

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'; # Output: 4 ...
Rosenbaum asked 2/7, 2023 at 0:36

3

Solved

I am looking for algorithm postfix to infix notation which will produce the minimum number of the parentheses. I have found that but it will produce many, many parentheses: http://tajendrasengar....
Manouch asked 3/4, 2013 at 6:59

1

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 wi...
Pacifica asked 6/6, 2021 at 0:8

2

Solved

In APL there is the power operator ⍣, which if applied to a function f superimposes the application of f. How to implement that operator in Raku? For example, with this definition of f: sub f(Int:D...
Joyance asked 1/5, 2021 at 13:39

7

Solved

I'm trying to replicate, roughly, the dplyr package from R using Python/Pandas (as a learning exercise). Something I'm stuck on is the "piping" functionality. In R/dplyr, this is done using the pi...
Compressor asked 11/11, 2015 at 19:29

9

long story short my lecturer is crap, and was showing us infix to prefix stacks via an overhead projector and his bigass shadow was blocking everything so i missed the important stuff he was refer...
Nymphalid asked 29/9, 2010 at 19:17

2

Solved

I'm trying to implement a forward pipe functionality, like bash's | or R's recent %>%. I've seen this implementation https://mdk.fr/blog/pipe-infix-syntax-for-python.html, but this requires that...
Wizened asked 23/3, 2015 at 20:20

1

Solved

How do I convert negative numbers from infix to postfix ? Suppose I have a expression a = - b - (-c-d) In some places I read that you can parathesize the negative numbers like a = (-b) - (-c-...
Unfasten asked 21/10, 2017 at 7:56

4

Solved

Is there a best practice for one over the other? I've been reading the Scala book by Odersky, et al. and it seems like infix is used for a lot of the Collections API functions, whereas dot is reser...
Valenti asked 19/4, 2012 at 17:12

1

Solved

I'm trying to convert python math expressions to postfix notation using the AST python module. Here's what I got so far: import parser import ast from math import sin, cos, tan formulas = [ "1+2...

6

Suppose the user inputs an infix expression as a string? What could be the easiest ( By easiest I mean the shortest) way to evaluate the result of that expression using C language? Probable ways a...
Bagnio asked 30/7, 2009 at 15:8

1

Compiler accept infix+generic methods, but what is the syntax to use it ? Example, given those 2 identical methods (modulo arbitrary generic type) : infix inline fun Int1.plus1(i: Int1) = Int1(thi...
Mitchmitchael asked 22/1, 2017 at 21:44

3

Solved

I enjoy common lisp, but sometimes it is really painful to input simple math expressions like a(8b^2+1)+4bc(4b^2+1) (Sure I can convert this, but it is kind of slow, I write (+ () ()) first, an...

2

Solved

does OCaml support infix functions defined in plaintext ? arg1 `plus` arg2 = arg1 + arg2 thanks
Unmerciful asked 1/7, 2016 at 14:22

1

Solved

I'm new to haskell. If I type in GHCi (7.10.3): :info (:) I get result: *** Parser: data [] a = ... | a : [a] -- Defined in ‘GHC.Types’ infixr 5 : data [] a = ... | a : [a] -- Defined in ‘GHC...
Amice asked 7/3, 2016 at 23:34

2

Solved

One of the weirder corner cases of C is that functions can be declared within other functions, e.g. void foo(void) { void bar(void); // Behaves as if this was written above void foo(void) bar();...
Atilt asked 22/3, 2016 at 9:20

2

Solved

I've seen this done, but I just can't wrap my head around it. Somehow, seemingly magically, some infix functions work fine, but others simply won't compile. For example: As you see here, my then...
Revanchism asked 26/1, 2016 at 15:4

1

For example, this does not type check \cons nil -> 5 `cons` 3 `cons` nil nor does this \(#) -> 5 # 3 # nil Although both of these do \cons nil -> 5 `cons` nil \(#) nil -> 5 # nil...
Jumbala asked 5/12, 2015 at 18:14

2

Solved

As I understood call-by-name parameters of a method, the corresponding argument expression will not be evaluated when passing it to the method, but only when (and if) the value of the parameter is ...
Node asked 11/11, 2015 at 17:42

1

Solved

Let us assume we have an expression in LaTeX form: var latex =\frac{x}{\frac{y}{y}} So output required is: output= (x)/((y)/(y)); I tried out an example as stated in the link: Convert LaTeX t...
Tripper asked 23/7, 2015 at 12:53

2

Solved

Suppose I have two custom infix operators in R: %foo% and %bar%. I have expressions that use both operators, such as: x %foo% y %bar% z How can I determine the operator precedence of %foo% an...
Lazaro asked 25/6, 2015 at 8:21

1

Solved

Why is f <$> g <$> x equivalent to (f . g) <$> x although <$> is not right-associative? (This kind of equivalence is valid in a popular idiom with plain $, but currently $ ...

2

Solved

I'm playing with the infixr, infixl and infix declarations. I understand how infixr and infixl works: -- Test expression: 40 +++ 20 +++ 50 +++ 10 * 10 -- infixr 8 +++ -- Calculated as: (40 +++ (2...
Cory asked 4/1, 2015 at 20:39

1

Given a function for infix usage: let f a b = (a+10, b) f 4 5 => (14,5) 4 `f` 5 => (14,5) The arguments can be flipped by defining a helper function: let g = flip f 4 `g` 5 => (15,4) ...
Trappings asked 21/11, 2014 at 9:57

© 2022 - 2024 — McMap. All rights reserved.