# Tag Info

19

What research have you done to answer that question? I just plugged it as it is in Google, and got as second answer (the first may be as good, I did not check) a reference to a section of a bible on your topic: Hal Abelson's, Jerry Sussman's and Julie Sussman's Structure and Interpretation of Computer Programs (MIT Press, 1984; ISBN 0-262-01077-1), aka the ...

17

So, can stack-based programming languages be concurrent? Sure. Could they achieve concurrency by using multiple stacks at the same time or something alike? Already for normal languages multi-threading usually means having multiple "call" stacks. It would be completely natural to give each thread its own data stack. It would be straightforward to have an ...

8

I know a bit about FORTH so I will confine myself to that. It is a low level language, giving you as programmer access to all the hardware resources. So you can do whatever you like. Concurrency In order to have parallell programs (edit: used to say real concurrent programs) you need at least two execution units (CPU-s). It would be rather trivial to ...

6

Those definitions are saying the same thing (at the level of precision of the English description). An example from the book Normal-order evaluation goes “fully expand and then reduce”, meaning that function calls are expanded before reducing the arguments, and the reduction only happens when the value is needed. Let's take one of the examples in the book: ...

5

Call-by-value evaluates the arguments to a function exactly once. Call-by-name evaluates the arguments to a function, zero, once, or more times. Call-by-need evaluates the arguments to a function zero or once, but not more than once. The trick you are looking for here is a case where call-by-value needs to evaluate an argument once while call-by-name does ...

4

EDIT: An addendum: if you want to "simulate" call by value-result in Pascal (or in another language that supports only call by reference); you can use this trick: procedure p(var x, y : Integer); // simulates call by value-result var xtmp, ytmp : Integer; procedure p_hidden(var x, y : Integer); // nested "hidden" procedure begin ... YOUR ORIGINAL ...

3

This is a bit simpler (in OCaml notation): (fun x => 42) (let rec f x = f x in f ()) It loops in call-by-value and returns 42 in call-by-name and call-by-need.

3

(Summary of my explanations in the comments under the questions) I think that you did not parse the term correctly. It should be read as $(λx.(x\;(λx.x)))\;(u\;r)$, not as $((λx.x)\;(λx.x))\;(u\;r)$. In the former, $(λx.(x\;(λx.x)))$ corresponds to a function taking as input a function (argument $x$), which is applied to the identity function $λx.x$ (or $α$-...

3

The term (λx. x(λx. x)) (u r) parses as (λx. M) N where M=(x (λx. x)) and N=(u r) so, we can perform a $\beta$ step and obtain M{N/x} = (x (λx. x)){(u r) / x} = (x{(u r) / x} (λx. x){(u r) / x}) = ((u r) (λx. x){(u r) / x}) = ((u r) (λx. x)) The last term is also usually written as (u r) (λx. x) or even u r (λx. x). A tricky part of this step is ...

3

Short-circuit evaluation is based on lazy-evaluation (call-by-need evaluation) of the arguments of some function or operator. This is all described in various wikipedia articles. The idea is that the function call defers requesting evaluation of its arguments until they are actually needed, possibly never evaluating them if the computation may proceed ...

3

Your game is equivalent to the PSPACE-complete problem TQBF. The quantified Boolean formula corresponding to your example is $$\forall x \forall y \exists z (x \land y) \lor (y \land z) \lor (\lnot y \land \lnot z).$$ Since it is PSPACE-complete, in particular it is NP-hard, and you there is no efficient general way to find out who wins in this game. ...

3

When you call a function, it gets the arguments. In math, as well as "pure" functional languages, the function can look at those arguments and compute things based on them, then return a result. The complication comes from how, in most languages, computation can have side-effects: variables can have their values changed (mutated). So, for example, if I ...

2

Consider this program: f (m : Nat) x y = (x, if H(m,m) then x else y) my_f = f my_number my_f hard harder where H(x,x) returns True if Turing machine number x halts on input x and False otherwise. Detecting duplicate work (always) would mean solving the halting problem, no matter whether you want to do the analysis statically or dynamically. Hence, no ...

2

Let's call your proposal X, instead: X = lambda f : (lambda x : f( lambda z: x(x) (z) )) (lambda x : f(x(x))) For convenience, we can rewrite it as M = (lambda x : f(x(x))) # depends on f X = lambda f : (lambda x : f( lambda z: x(x) (z) )) M Now, when we invoke X(f), we get X(f) = (lambda x : f( lambda z: x(x) (z) )) M = f( lambda z: M(M) (z) ) ...

2

Odds are, you can't. That's a judgement call, and it's notoriously hard to get other people to change their judgement. The path is to find new evidence or facts they might not be aware of; assemble a persuasive argument; and see what happens. But in this case, without knowing anything about the domain, I suspect the reviewers might be right. Why would a ...

1

You note " but with more than one prototype per class/cluster." We often call this a polymorphic class. Consider the analogue in text.. C1 = { dpacekfjklwalkflwalkklpacedalyutekwalksfj} C2 = { jhjhleapashljumpokdjklleaphfleapfjjumpacgd} Here the class 1 prototypes are polymorphic {walk OR pace}, and so is class 2 {leap or jump}. You can learn these ...

1

You've divided the x values into 10 columns, and divided the y values into 10 rows, so we have a 10x10 grid. Take any row that is already covered by some already evaluated point, and remove it from the set of rows. Do the same with the columns. In your picture, we are left with 6 rows and 6 columns. Consider the 6x6 grid obtained by looking only at those ...

1

You can't. You can't squeeze blood out of a stone. If you want to evaluate how well your method will work on real documents, you need real documents. With synthetically/artificially generated documents, you'll never know if they have the same characteristics as real documents. You don't necessarily need a standard benchmark that others have used -- but ...

1

Notice that the first quote contains a definition of normal-order evaluation, but the second one treats normal-order languages, i.e. languages that use normal-order evaluation. The nice answer by @Gilles explains in detail the difference between the applicative-order and normal-order evaluations, and shows that normal-order evaluation delays evaluation of ...

1

Using the variables are boxes analogy. //a := 1 | 1 | <-- Variable a, with holding the value 1 |_______| procedure f(x: Integer)... Call by value: On a call f(a), the value of a is loaded (copied into the function f's very own box x. It receives a copy of the value. //f(a) a -> | 1 | -- copying --> | 1 | <- x |...

1

I'm not very familiar with Pascal, but there are some scoping issues. The 2nd line of p modifies global variable a. When you pass by reference, line 1 of p also modifies x which is the same as global a. When you pass by value, line 1 does not modify global a, but line 2 still does, using the local value of x, which is global a + 2. If you can, using a ...

Only top voted, non community-wiki answers of a minimum length are eligible