Questions tagged [computation-expressions]

10 questions
12
votes
5 answers

When is short-circuit evaluation bad?

To be a bit more clear, I'll state that I've spent lots of time with different languages. But until now it's been either it'll use it all the time or it doesn't support it at all. Now work has me starting on projects that require VB.net and I see…
Kit Ramos
  • 231
  • 2
  • 6
6
votes
3 answers

Is there a way to created nested computation expressions?

In F#, I want to build a hierarchical data structure in a way with a minimum amount of language noise. The actual problem is trying to build an RSpec inspired framework using F#. RSpec allows the construction of tests in a nested way. For…
Pete
  • 8,916
  • 3
  • 41
  • 53
5
votes
1 answer

Alternative for eval() in javascript for expression evaluation

I'm looking at the alternative that can substitute the use of eval() and new Function() javascript techniques. I'm developing a solution build with javascript and the platform on which it is built (Salesforce) recently has announced they're…
Maciek Simm
  • 151
  • 1
  • 1
  • 2
3
votes
1 answer

Handling continuations within a priority queue

I am attempting to determine the best way to handle actions that must occur in passes. Many of these actions use objects that were created in a previous pass. The solution I have come up with is to implement a computation builder. let actions = …
MI3Guy
  • 250
  • 1
  • 6
2
votes
1 answer

Functional Approaches to Serializing Objects to Variable-length Byte Array Output

I have a large number of record types derived from a binary format specification. So far, I've already written a computation expression builder that let’s me read structures from the files easily: type Data = { Value: … } // Data record let…
1
vote
2 answers

How to concat lists with logical ANDs and ORs

Having multiple lists of integers, like e.g.: var p1 = new[] { 3, 9, 5, 8, 9 }; var p2 = new[] { 12, 1, 18, 27, 103, 99, 4 }; var p3 = new[] { 23, 930, 15 }; // ... I want to concatenate them with logical AND and OR operations, like e.g.: var…
Uwe Keim
  • 347
  • 4
  • 13
1
vote
7 answers

Is the sum or subtraction of two positive machine numbers exact?

If you have two positive numbers that can be represented exactly by the finite arithmetic of your computer, that is, two machine numbers, if you perform their sum or subtraction with perfect arithmetic, is the result a machine number aswell? I…
1
vote
1 answer

Using streams to connect programming languages

I'm trying to run a computation-heavy program that creates an image on a website. Is it possible to compute in C++ and have an output stream that connects to an input stream in Node.js to display an image, or alternatively, stream is to the user and…
0
votes
1 answer

When should an expression tree hold pointers and when should it hold values of subexpressions?

I was thinking it should hold pointers: struct Expr { string sym; Expr*[] sub; this(self, string sym) { this.sym = sym; } @property auto dup() const { auto e = new Expr(sym); foreach (s; sub) { …
0
votes
1 answer

Big O notation for the algorithm

What would be the big o for the algo: for (i=0; i < n*n; i++) for(j=0; j
new
  • 3
  • 1