Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #23671 > unrolled thread

Expresson evaluation in javascript

Started byjonas.thornvall@gmail.com
First post2014-03-25 11:24 -0700
Last post2014-03-30 05:01 -0400
Articles 5 on this page of 25 — 10 participants

Back to article view | Back to comp.lang.javascript


Contents

  Expresson evaluation in javascript jonas.thornvall@gmail.com - 2014-03-25 11:24 -0700
    Re: Expresson evaluation in javascript jonas.thornvall@gmail.com - 2014-03-25 11:43 -0700
      Re: Expresson evaluation in javascript jonas.thornvall@gmail.com - 2014-03-25 11:44 -0700
    Re: Expresson evaluation in javascript Danny <dann90038@gmail.com> - 2014-03-25 14:04 -0700
    Re: Expresson evaluation in javascript Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-03-25 18:40 -0300
    Re: Expresson evaluation in javascript Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-25 23:49 +0100
      Re: Expresson evaluation in javascript jonas.thornvall@gmail.com - 2014-03-25 22:43 -0700
        Re: Expresson evaluation in javascript jonas.thornvall@gmail.com - 2014-03-25 23:29 -0700
          Re: Expresson evaluation in javascript Jim T. <x@y.z> - 2014-03-28 11:48 -0500
            Re: Expresson evaluation in javascript jonas.thornvall@gmail.com - 2014-03-28 10:03 -0700
              Re: Expresson evaluation in javascript Jim T. <x@y.z> - 2014-03-28 13:12 -0500
              Re: Expresson evaluation in javascript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-28 18:33 +0100
                Re: Expresson evaluation in javascript jonas.thornvall@gmail.com - 2014-03-28 10:50 -0700
                  Re: Expresson evaluation in javascript jonas.thornvall@gmail.com - 2014-03-28 10:59 -0700
                    Re: Expresson evaluation in javascript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-28 20:38 +0100
                    Re: Expresson evaluation in javascript "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-03-29 19:49 -0700
                  Re: Expresson evaluation in javascript Ed Jay <edMbj@aes-intl.com> - 2014-03-29 10:53 -0700
        Re: Expresson evaluation in javascript "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-03-29 19:45 -0700
          Re: Expresson evaluation in javascript jonas.thornvall@gmail.com - 2014-03-30 09:21 -0700
          Re: Expresson evaluation in javascript jonas.thornvall@gmail.com - 2014-03-30 09:24 -0700
            Re: Expresson evaluation in javascript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-30 21:19 +0200
            Re: Expresson evaluation in javascript "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-03-30 14:20 -0700
    Re: Expresson evaluation in javascript John Harris <niam@jghnorth.org.uk.invalid> - 2014-03-26 14:58 +0000
    Re: Expresson evaluation in javascript "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2014-03-29 19:33 -0700
    Re: Expresson evaluation in javascript Norman Peelman <npeelman@cfl.rr.com> - 2014-03-30 05:01 -0400

Page 2 of 2 — ← Prev page 1 [2]


#23748

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2014-03-30 21:19 +0200
Message-ID<XnsA300D8E32DD68eejj99@194.109.133.133>
In reply to#23747
jonas.thornvall@gmail.com wrote on 30 mrt 2014 in comp.lang.javascript:

> Is there any convention how one should acknowledge that one copied the
> code from the Rosetta site? 

This has to expressed in at least conventional 3 languages,
Egyptian hieroglyphs, demotic and ancient greek.

The original Rosetta site being near the town 
of Rashid (= Rosetta) in the Nile Delta.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#23749

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2014-03-30 14:20 -0700
Message-ID<9b3ced92-08d4-4bce-8a28-316864b41645@googlegroups.com>
In reply to#23747
On Sunday, March 30, 2014 11:24:30 AM UTC-5, jonas.t...@gmail.com wrote:
> 
> Is there any convention how one should acknowledge that one copied the code from the Rosetta site?

Rosetta Code uses the following license:

<http://www.gnu.org/licenses/fdl-1.2.html>

Related:
<https://simple.wikipedia.org/wiki/GNU_Free_Documentation_License>

Personally, I consider the snippet to be too trivial to bother crediting beyond a link to the original location. But it's up to you of course. If you change a significant portion of the implementation, I don't see why one would bother anyway. 

[toc] | [prev] | [next] | [standalone]


#23684

FromJohn Harris <niam@jghnorth.org.uk.invalid>
Date2014-03-26 14:58 +0000
Message-ID<jlq5j9h8sele4mfecf0feiphdlj73h0240@4ax.com>
In reply to#23671
On Tue, 25 Mar 2014 11:24:41 -0700 (PDT), jonas.thornvall@gmail.com
wrote:

>In python i beleive mathematical expression can be directly evaluated, if in correct form. 
>
>Javascript do not have eval?

I wish you'd look at ECMA 262, the ECMAScript standard, when asking
yourself this sort of question. You might not understand the
technicalities in the standard but a quick search would show you that
it talks about the eval function.

  John

[toc] | [prev] | [next] | [standalone]


#23742

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2014-03-29 19:33 -0700
Message-ID<0ad9d2b5-2716-459d-bdb0-03596fc7cab6@googlegroups.com>
In reply to#23671
On Tuesday, March 25, 2014 1:24:41 PM UTC-5, jonas.t...@gmail.com wrote:
> In python i beleive mathematical expression can be directly evaluated, if in correct form. 
>
> Javascript do not have eval?

It has an eval function but it has different semantics:
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval>

> If not, how do one go ahead evaluate something with two constant operands but where the operator is a variable? 
> 
> z=*;   x=3z5
> 
> z=/    x=3z3
>
> z=+    x=3z3
> 
> z=-    x=3z3

Something like the following could be useful for you but at the cost of efficiency and at the cost of operator precedence:

Number.prototype['+'] = function(rhs){
    return this + rhs;
}
Number.prototype['-'] = function(rhs){
    return this - rhs;
}
Number.prototype['*'] = function(rhs){
    return this * rhs;
}
Number.prototype['/'] = function(rhs){
    return this / rhs;
}

var z, x;

z = '*'; x = 3[z](5);
z = '/'; x = 3[z](3);
z = '+'; x = 3[z](3);
z = '-'; x = 3[z](3);

[toc] | [prev] | [next] | [standalone]


#23745

FromNorman Peelman <npeelman@cfl.rr.com>
Date2014-03-30 05:01 -0400
Message-ID<lh8mgp$rce$1@dont-email.me>
In reply to#23671
On 03/25/2014 02:24 PM, jonas.thornvall@gmail.com wrote:
> In python i beleive mathematical expression can be directly evaluated, if in correct form.
>
> Javascript do not have eval?
>
> If not, how do one go ahead evaluate something with two constant operands but where the operator is a variable?
>
> z=*;   x=3z5
>
> z=/    x=3z3
>
> z=+    x=3z3
>
> z=-    x=3z3
>
>
> Will there be a eval function in future javascript?
>


z = "*"; rslt = eval(3 + z + 5);

or

z = "*"; rslt = eval("3" + z + "5");


-- 
Norman
Registered Linux user #461062
AMD64X2 6400+ Ubuntu 10.04 64bit

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.javascript


csiph-web