infix-notation Questions
1
Solved
I'm trying to make a Haskell datatype a bit like a python dictionary, a ruby hash or a javascript object, in which a string is linked to a value, like so:
data Entry t = Entry String t
type Dictio...
Imeldaimelida asked 18/11, 2014 at 17:11
1
Solved
A mathematical expression is usually expressed in infix notation. For evaluation purposes, we can change it to postfix (reverse polish) notation (using algorithms like Shunting-Yard) and then evalu...
Blouse asked 26/12, 2013 at 5:32
1
Solved
Given an input like this: 3+4+
Algorithm turns it in to 3 4 + +
I can find the error when it's time to execute the postfix expression.
But, is it possible to spot this during the conversion?
(Wi...
Burkley asked 5/5, 2013 at 0:29
1
Solved
I have an associative operation >>. The problem is that its cost linearly depends on the size of its left operand. So an expression formed by a sequence of n applications of >> like
a ...
Participle asked 13/3, 2013 at 12:1
1
Solved
I want user to be able to input like this:
5+6*t+sin(2*t)
, so it will get converted to this:
(+ 5 (* 6 t) (sin (* 2 t)))
, so I can eval it to some function that will be JITted and executed ...
Marginalia asked 8/8, 2012 at 22:40
4
I started learning Clojure recently. Generally it looks interesting, but I can't get used to some syntactic inconveniences (comparing to previous Ruby/C# experience).
Prefix notation for nested ex...
Coomb asked 24/4, 2012 at 0:1
2
I'm reading a following datatype:
data Ne
= NVar Id
| Ne :.. (Clos Term)
| NSplit Ne (Bind (Bind (Clos Term)))
| NCase Ne (Clos [(Label, Term)])
| NForce Ne
| NUnfold Ne (Bind (Clos Term))
...
Pazia asked 3/4, 2012 at 15:42
2
Solved
Let f x y = x * y. We can apply this function in two ways: f 5 6, or, using infix notation, 5 `f` 6. Do the operator rules apply to this last expression? What precedence will this application have?...
Coal asked 15/11, 2011 at 15:48
3
Solved
val m = scala.collection.mutable.Map[String, Int]()
// this doesn't work
m += ("foo", 2)
// this does work
m += (("foo", 2))
// this works too
val barpair = ("bar", 3)
m += barpair
So what's the ...
Harappa asked 12/10, 2011 at 17:47
3
Solved
One of the nice things about Haskell is the ability to use infix notation.
1 : 2 : 3 : [] :: Num a => [a]
2 + 4 * 3 + 5 :: Num a => a
But this power is suddenly and sadly lost when the ope...
Dictaphone asked 12/10, 2011 at 15:34
2
Solved
I am a new Scheme/Racket student, so please excuse any blatant syntax errors.
It came up in class today that the scheme list '(a, b, c) should be invalid, but when we ran it, it returned:
>'(...
Matter asked 16/9, 2011 at 20:9
4
Solved
When programming in Scala, I do more and more functional stuff. However, when using infix notation it is hard to tell when you need parenthesis and when you don't.
For example the following piece ...
Kangaroo asked 8/4, 2011 at 8:45
2
Solved
I'm quite new to Scala programming language, and was trying something out stucked in my mind while I was following the lecture notes at here.
I think I couldn't really understand how cons operator...
Jocko asked 5/7, 2010 at 19:26
2
Solved
in Scala, if I want to implement a DSL, is there a way to do the following:
I have an Object called "Draw" which contains the function def draw(d:Drawable)
how can I make it so that I can import ...
Encephaloma asked 19/5, 2010 at 18:40
3
I want to evaluate one expression in C++. To evaluate it, I want the expression to be converted to prefix format.
Here is an example
wstring expression = "Feature1 And Feature2";
Here are poss...
Polymorphous asked 1/4, 2010 at 4:41
43
Solved
Challenge
Here is the challenge (of my own invention, though I wouldn't be surprised if it has previously appeared elsewhere on the web).
Write a function that takes a single
argument...
Antrorse asked 29/5, 2009 at 23:43
4
Solved
I've been mulling over creating a language that would be extremely well suited to creation of DSLs, by allowing definitions of functions that are infix, postfix, prefix, or even consist of multiple...
Ratib asked 9/1, 2009 at 4:8
2
Solved
I would like to add a method to a built-in type (e.g. Double), so that I can use an infix operator. Is that possible?
Archaeology asked 18/11, 2008 at 7:43
© 2022 - 2024 — McMap. All rights reserved.