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


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

Trying to create array of object literals

Started bybit-naughty@hotmail.com
First post2018-04-12 12:17 -0700
Last post2018-04-13 04:08 -0700
Articles 20 on this page of 81 — 12 participants

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


Contents

  Trying to create array of object literals bit-naughty@hotmail.com - 2018-04-12 12:17 -0700
    Re: Trying to create array of object literals bit-naughty@hotmail.com - 2018-04-12 12:26 -0700
    Re: Trying to create array of object literals Maik Koenig <usenetspam@maikkoenig.de> - 2018-04-12 21:47 +0200
    Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-12 12:49 -0700
    Re: Trying to create array of object literals Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-13 10:27 +0200
      Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-13 10:57 +0100
        Re: Trying to create array of object literals Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-13 23:38 +0200
          Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-14 11:22 +0100
            Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-14 07:25 -0700
              Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-14 09:09 -0700
                Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-16 09:43 +0100
                  Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-16 02:04 -0700
                  Re: Trying to create array of object literals "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-04-16 11:23 +0200
                    Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-16 19:32 +0100
                      Re: Trying to create array of object literals "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-04-17 23:37 +0200
                        Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-18 16:18 +0100
                          Re: Trying to create array of object literals "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-04-19 23:08 +0200
                            Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-20 10:17 +0100
                              Re: Trying to create array of object literals "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-04-20 12:45 +0200
                                Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-20 19:08 +0100
                Re: Trying to create array of object literals "c.l.js" <trollhunter@curiosity.kills.no> - 2018-04-20 17:04 -0300
                  Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-20 13:15 -0700
                  Is JS a functional programming language? (was: Trying to create array of object literals) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-21 02:35 +0200
                    Re: Is JS a functional programming language? (was: Trying to create array of object literals) Julio Di Egidio <julio@diegidio.name> - 2018-04-21 01:36 -0700
                      Re: Is JS a functional programming language? (was: Trying to create array of object literals) "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-21 11:46 -0700
                        Re: Is JS a functional programming language? (was: Trying to create array of object literals) "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-21 11:48 -0700
                        Re: Is JS a functional programming language? (was: Trying to create array of object literals) Julio Di Egidio <julio@diegidio.name> - 2018-04-21 23:53 -0700
                          Re: Is JS a functional programming language? (was: Trying to create array of object literals) "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-22 10:33 -0700
                            Re: Is JS a functional programming language? (was: Trying to create array of object literals) Julio Di Egidio <julio@diegidio.name> - 2018-04-23 00:27 -0700
                              Re: Is JS a functional programming language? (was: Trying to create array of object literals) "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-23 11:50 -0700
                                Re: Is JS a functional programming language? (was: Trying to create array of object literals) Julio Di Egidio <julio@diegidio.name> - 2018-04-23 12:00 -0700
                                  Re: Is JS a functional programming language? (was: Trying to create array of object literals) "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-23 15:07 -0700
                                    Re: Is JS a functional programming language? "Christoph M. Becker" <cmbecker69@arcor.de> - 2018-04-24 00:47 +0200
                                      Re: Is JS a functional programming language? Julio Di Egidio <julio@diegidio.name> - 2018-04-23 16:12 -0700
                                        Re: Is JS a functional programming language? "Christoph M. Becker" <cmbecker69@arcor.de> - 2018-04-24 01:30 +0200
                                      Re: Is JS a functional programming language? Julio Di Egidio <julio@diegidio.name> - 2018-04-23 16:45 -0700
                                      Re: Is JS a functional programming language? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-24 09:54 +0100
                                        Re: Is JS a functional programming language? Tim Streater <timstreater@greenbee.net> - 2018-04-24 10:17 +0000
                                      Re: Is JS a functional programming language? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-24 12:02 -0700
                                        Re: Is JS a functional programming language? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-25 05:04 +0200
                                          Re: Is JS a functional programming language? Julio Di Egidio <julio@diegidio.name> - 2018-04-25 02:16 -0700
                                            Re: Is JS a functional programming language? Julio Di Egidio <julio@diegidio.name> - 2018-04-25 02:20 -0700
                                            Re: Is JS a functional programming language? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-25 18:22 +0100
                                              Re: Is JS a functional programming language? Jon Ribbens <jon+usenet@unequivocal.eu> - 2018-04-25 17:25 +0000
                                              Re: Is JS a functional programming language? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-25 14:50 -0700
                                          Re: Is JS a functional programming language? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-25 14:39 -0700
                                            Re: Is JS a functional programming language? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-29 20:44 +0200
                                              Re: Is JS a functional programming language? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-04-29 13:45 -0700
                    Re: Is JS a functional programming language? "c.l.js" <trollhunter@curiosity.kills.no> - 2018-04-21 19:51 -0300
                      Re: Is JS a functional programming language? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-22 01:18 +0200
                        Re: Is JS a functional programming language? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-22 02:19 +0200
                          Re: Is JS a functional programming language? "Mark-" <nospam@mapson.xyz> - 2018-04-22 01:52 +0000
                            Re: Is JS a functional programming language? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-22 04:30 +0200
                              Re: Is JS a functional programming language? "Mark-" <nospam@mapson.xyz> - 2018-04-22 02:45 +0000
                                Re: Is JS a functional programming language? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-22 05:55 +0200
                                  Re: Is JS a functional programming language? "Mark-" <nospam@mapson.xyz> - 2018-04-22 04:04 +0000
                                    Re: Is JS a functional programming language? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-04-22 10:59 +0200
                                      Re: Is JS a functional programming language? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-22 11:03 +0100
                                        Re: Is JS a functional programming language? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-04-22 12:50 +0200
                                          Re: Is JS a functional programming language? John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-23 09:19 +0100
                                      Re: Is JS a functional programming language? "Mark-" <nospam@mapson.xyz> - 2018-04-22 12:58 +0000
              Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-16 10:02 +0100
                Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-16 02:05 -0700
                  Re: Trying to create array of object literals "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-04-16 11:27 +0200
                    Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-16 02:33 -0700
                      Re: Trying to create array of object literals "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-04-16 14:03 +0200
                      Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-16 19:40 +0100
                        Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-17 09:45 +0100
                        Re: Trying to create array of object literals Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-18 03:25 +0200
                          Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-18 15:50 +0100
                          Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-18 16:08 +0100
                            Re: Trying to create array of object literals Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-19 03:34 +0200
                              Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-19 10:37 +0100
                          Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-19 19:02 +0100
                        Re: Trying to create array of object literals Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-04-19 03:25 +0200
                  Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-16 19:37 +0100
                    Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-16 11:48 -0700
                      Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-17 09:52 +0100
                        Re: Trying to create array of object literals Julio Di Egidio <julio@diegidio.name> - 2018-04-17 03:22 -0700
                          Re: Trying to create array of object literals John G Harris <niam@jghnorth.org.uk.invalid> - 2018-04-17 18:28 +0100
      Re: Trying to create array of object literals bit-naughty@hotmail.com - 2018-04-13 04:08 -0700

Page 2 of 5 — ← Prev page 1 [2] 3 4 5  Next page →


#34881

From"c.l.js" <trollhunter@curiosity.kills.no>
Date2018-04-20 17:04 -0300
Message-ID<pbdh4g$1rjm$1@gioia.aioe.org>
In reply to#34825
Julio Di Egidio babbled:
> JS is a *functional* language: the modularity is modularity of *lexical*
> constructs and contexts...  (Someone else might be able to say it better.)
> 

Yes, JavaScript is a "functional" language. Here is an example:

class Moron {
   constructor(name) {
     this.name = name;
   }
   speak() {
     alert(`${this.name} says:
       "JS is a functional language."`);
   }
}

var Julio = new Moron('Julio');
Julio.speak();

Try using npm to install a brain in your head. LOL

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


#34882

FromJulio Di Egidio <julio@diegidio.name>
Date2018-04-20 13:15 -0700
Message-ID<cc462f9d-4253-424c-bba6-3af2f4a92fc7@googlegroups.com>
In reply to#34881
On Friday, 20 April 2018 22:04:40 UTC+2, c.l.js  wrote:
> Julio Di Egidio babbled:
> > JS is a *functional* language: the modularity is modularity of *lexical*
> > constructs and contexts...  (Someone else might be able to say it better.)
> 
> Yes, JavaScript is a "functional" language. Here is an example:
> 
> class Moron {
>    constructor(name) {
>      this.name = name;
>    }
>    speak() {
>      alert(`${this.name} says:
>        "JS is a functional language."`);
>    }
> }
> 
> var Julio = new Moron('Julio');
> Julio.speak();
> 
> Try using npm to install a brain in your head. LOL

You try getting your head out of your ass: the JS standard is poorly written,
and they are indeed making it worse, but only the truly incompetent trips on
some poor labelling.  That said, you piece of shit learn some education, too.

*Plonk*

Julio

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


#34883 — Is JS a functional programming language? (was: Trying to create array of object literals)

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2018-04-21 02:35 +0200
SubjectIs JS a functional programming language? (was: Trying to create array of object literals)
Message-ID<1703120.hZdRbIOfhN@PointedEars.de>
In reply to#34881
c.l.js wrote:
^^^^^^
It ill-behoves you, having so little knowledge about what you are talking 
about, to claim to speak for the entire newsgroup, and the address part of 
the “From” header of your posting is a violation of Internet standards
(RFC 5536).

You do not want anyone to report you for network abuse, do you?

> Julio Di Egidio babbled:
>> JS is a *functional* language: the modularity is modularity of *lexical*
>> constructs and contexts...  (Someone else might be able to say it
>> better.)

Modularity is not the key property of a functional programming language.
 
> Yes, JavaScript is a "functional" language. Here is an example:
> 
> class Moron {
>    constructor(name) {
>      this.name = name;
>    }
>    speak() {
>      alert(`${this.name} says:
>        "JS is a functional language."`);
>    }
> }

Note that the “speak” method of the “Moron” class is implemented as an 
*object*, a *Function* *instance*.

Note also that this does not work in several earlier implementations of 
ECMAScript, where you have to write

  function Moron (name)
  {
    this.name = name;
  }

  Moron.prototype.speak = function () {
    window.alert(this.name
      + ' says: "JS is not a functional programming language."');
  };

  (new Moron('The troll posting as "c.l.js"')).speak();

or something to that effect, instead.
 
> var Julio = new Moron('Julio');
> Julio.speak();

    [It is the standing recommendation that only class, constructor, and
     constant identifiers should start with a capital letter (after leading
     “_”s are trimmed.  “Julio” is an *instance* and a *variable*; the
     identifier should start lowercase.]

Your unnecessary insult aside:

Functional programming is a programming *paradigm*.  A functional 
programming language is a programming language where functions are first-
class objects: they can appear on the right-hand side of an assignment 
expression and/or they can be passed as arguments to other functions.  
*Functional programming is _not_, in general, a contradiction to object-
oriented programming.*

Proof that JS is/are (a) functional programming language(s) has been given 
implicitly above.  Another example:

  var f = Julio.speak;
  (function (func) { func.call({name: "Thomas ‘PointedEars’ Lahn"}); }(f));

To be more precise, implementations of ECMAScript, such as the languages 
that have “JavaScript” in their name, are procedural-imperative, functional 
and object-oriented programming languages that support both the prototype-
based and (to some extent) class-based inheritance programming paradigm.

*That* they support *all* of *those* programming paradigms, in *addition* to 
others, is an important reason for their versatility and wide distribution.

<https://en.wikipedia.org/wiki/Programming_paradigm>

See also the FAQ (referred below).

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

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


#34884 — Re: Is JS a functional programming language? (was: Trying to create array of object literals)

FromJulio Di Egidio <julio@diegidio.name>
Date2018-04-21 01:36 -0700
SubjectRe: Is JS a functional programming language? (was: Trying to create array of object literals)
Message-ID<7a88c7d4-6343-4152-b0a0-0aea9859bfe5@googlegroups.com>
In reply to#34883
On Saturday, 21 April 2018 05:28:00 UTC+2, Thomas 'PointedEars' Lahn  wrote:

> > Julio Di Egidio babbled:
> >> JS is a *functional* language: the modularity is modularity of *lexical*
> >> constructs and contexts...  (Someone else might be able to say it
> >> better.)
> 
> Modularity is not the key property of a functional programming language.

I didn't say it's the key property but I'd certainly say functional is the
*most* modular: while OO is the *least* modular.  Then of course I do know I
am saying the opposite that one can read pretty much everywhere: it's simply
all badly wrong and the result of the OO uber alles speculation that is not
even over yet, and the fact that 90%+ of people do not know what they are
talking about in this arena and just echo each other...

> Functional programming is a programming *paradigm*.  A functional 
> programming language is a programming language where functions are first-
> class objects:

Yes, but there is *more*: a functional language is a language of *lexical*
constructs and *contexts*: it's about *closures*, not just functions!

That said, having some actual disagreement in this newsgroup is indeed a great
step ahead...

Cheers,

Julio

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


#34885 — Re: Is JS a functional programming language? (was: Trying to create array of object literals)

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2018-04-21 11:46 -0700
SubjectRe: Is JS a functional programming language? (was: Trying to create array of object literals)
Message-ID<5bcea078-8dc0-4f8e-a730-2f93d925c781@googlegroups.com>
In reply to#34884
Julio Di Egidio wrote:

> I didn't say it's the key property but I'd certainly say functional is the
> *most* modular: while OO is the *least* modular.  Then of course I do know I
> am saying the opposite that one can read pretty much everywhere: it's simply
> all badly wrong and the result of the OO uber alles speculation that is not
> even over yet, and the fact that 90%+ of people do not know what they are
> talking about in this arena and just echo each other...

You're going to have to back up your claim here, preferably with an example. Show me the code.

I'll even set the stage for you. Below are two partial implementations of a Singly List List in TypeScript. The first one in Functional style, and the second in Object Oriented style. Which is more "modular" by your definition?

<script>

 // Data
type List<T> = { tag: 'Nil' } | { tag: 'Cons', head: T, tail: List<T> }

// Operations
function length(xs: List<any>): number {
    return xs.tag == "Nil" ? 0 : length(xs.tail) + 1
}

function isEmpty(xs: List<any>): boolean {
    return xs.tag == "Nil" ? true : false
}

function contains<T>(x: T, xs: List<T>): boolean {
    return xs.tag == "Nil" ? false :
           xs.head === x || contains(x,xs.tail)
}

function append<T>(x: T, xs: List<T>): List<T> {
    return xs.tag == "Nil" ? { tag: "Cons", head: x, tail: xs } :
           append(x,xs.tail)
}

</script>

<script>
abstract class List<T> {
    abstract length(): number
    abstract isEmpty(): boolean
    abstract contains(x: T): boolean
    abstract append(x): List<T>
}

class Nil<T> extends List<T> {
    length(): number { return 0 }
    isEmpty(): boolean { return true }
    contains(x: T): boolean { return false }
    append(x): List<T> { return new Cons(x, this) }
}

class Cons<T> extends List<T> {
    constructor(
        readonly head: T,
        readonly tail: List<T>
    ) { super() }
    length(): number { return 1 + this.tail.length() }
    isEmpty(): boolean { return false }
    contains(x: T): boolean {
        return this.head === x || this.tail.contains(x) 
    }
    append(x: T): List<T> { return this.tail.append(x) }
}
</script>

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


#34886 — Re: Is JS a functional programming language? (was: Trying to create array of object literals)

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2018-04-21 11:48 -0700
SubjectRe: Is JS a functional programming language? (was: Trying to create array of object literals)
Message-ID<da814496-8872-40bd-b31a-c7eb7c1ed878@googlegroups.com>
In reply to#34885
Michael Haufe (TNO) wrote:

> [...]
> I'll even set the stage for you. Below are two partial implementations of a Singly List List in TypeScript. The first one in Functional style, and the second in Object Oriented style. Which is more "modular" by your definition?
> [...]

s/Singly List List/Singly Linked List

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


#34895 — Re: Is JS a functional programming language? (was: Trying to create array of object literals)

FromJulio Di Egidio <julio@diegidio.name>
Date2018-04-21 23:53 -0700
SubjectRe: Is JS a functional programming language? (was: Trying to create array of object literals)
Message-ID<80de186b-13f0-45f6-a427-52e844db3edc@googlegroups.com>
In reply to#34885
On Saturday, 21 April 2018 20:46:14 UTC+2, Michael Haufe (TNO)  wrote:
> Julio Di Egidio wrote:
> 
> > I didn't say it's the key property but I'd certainly say functional is the
> > *most* modular: while OO is the *least* modular.  Then of course I do know I
> > am saying the opposite that one can read pretty much everywhere: it's simply
> > all badly wrong and the result of the OO uber alles speculation that is not
> > even over yet, and the fact that 90%+ of people do not know what they are
> > talking about in this arena and just echo each other...
> 
> You're going to have to back up your claim here, preferably with an example.
> Show me the code.

I owe you retarded cunts less than zero.  Indeed which one, that functional is
most modular or that you don't know what you are talking about?

> I'll even set the stage for you.

The stage of your cluelessness.

> Below are two partial implementations of a Singly List List in TypeScript.
> The first one in Functional style, and the second in Object Oriented style.
> Which is more "modular" by your definition?

Two implementations that are quite representative just of your utter lack of
perspective. Indeed "styles"??  *Paradigms* are no stupid styles, you clueless
moron, and paradigms are way above your dishonest and stupid head, learn to walk
before you can run.  I mean "pointers"... just go fuck yourself.

*Plonk*

Julio

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


#34901 — Re: Is JS a functional programming language? (was: Trying to create array of object literals)

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2018-04-22 10:33 -0700
SubjectRe: Is JS a functional programming language? (was: Trying to create array of object literals)
Message-ID<63f44f57-f90f-43b3-b51a-8a9c30cea80c@googlegroups.com>
In reply to#34895
Julio Di Egidio wrote:
> Michael Haufe (TNO)  wrote:
> > You're going to have to back up your claim here, preferably with an example.
> > Show me the code.
> 
> I owe you retarded cunts less than zero.  Indeed which one, that functional is
> most modular or that you don't know what you are talking about?

Then why waste your time here in the group? Is this your version of Primal Therapy? [1]. I provably know what I'm talking talking about and very likely know more about this topic than you do. This is what, at least the third time you've thrown claims claims around without any backup? Even MentiFake at least tries to backup his nonsense. 

> > I'll even set the stage for you.
> 
> The stage of your cluelessness.

If that was too hard, I could give you an even simpler example. Put up or shut up.

> > Below are two partial implementations of a Singly List List in TypeScript.
> > The first one in Functional style, and the second in Object Oriented style.
> > Which is more "modular" by your definition?

> Two implementations that are quite representative just of your utter lack of
> perspective. Indeed "styles"??  *Paradigms* are no stupid styles, you clueless
> moron, and paradigms are way above your dishonest and stupid head, learn to walk
> before you can run.  I mean "pointers"... just go fuck yourself.

You can't even stay consistent with your own definitions [2]. Besides even basic English is on my side with this usage:

"A manner of doing or presenting things"
<https://en.wiktionary.org/wiki/style#Noun>

"A pattern, a way of doing something"
<https://en.wiktionary.org/wiki/paradigm#Noun>

[1] <https://en.wikipedia.org/wiki/Primal_therapy>
[2] <https://groups.google.com/d/msg/comp.lang.javascript/paDy9O_kOdc/ZOyMMS_0DQAJ>

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


#34902 — Re: Is JS a functional programming language? (was: Trying to create array of object literals)

FromJulio Di Egidio <julio@diegidio.name>
Date2018-04-23 00:27 -0700
SubjectRe: Is JS a functional programming language? (was: Trying to create array of object literals)
Message-ID<6aeacc78-ba24-4c5f-ab94-2d6fe1ad5d3f@googlegroups.com>
In reply to#34901
On Sunday, 22 April 2018 19:34:10 UTC+2, Michael Haufe (TNO)  wrote:
> Julio Di Egidio wrote:
> > Michael Haufe (TNO)  wrote:
> > > You're going to have to back up your claim here, preferably with an example.
> > > Show me the code.
> > 
> > I owe you retarded cunts less than zero.  Indeed which one, that functional is
> > most modular or that you don't know what you are talking about?
> 
> Then why waste your time here in the group? Is this your version of Primal Therapy? [1]. I provably know what I'm talking talking about and very likely know more about this topic than you do. This is what, at least the third time you've thrown claims claims around without any backup? Even MentiFake at least tries to backup his nonsense. 
> 
> > > I'll even set the stage for you.
> > 
> > The stage of your cluelessness.
> 
> If that was too hard, I could give you an even simpler example. Put up or shut up.

You are the one raising objections...

> > > Below are two partial implementations of a Singly List List in TypeScript.
> > > The first one in Functional style, and the second in Object Oriented style.
> > > Which is more "modular" by your definition?
> 
> > Two implementations that are quite representative just of your utter lack of
> > perspective. Indeed "styles"??  *Paradigms* are no stupid styles, you clueless
> > moron, and paradigms are way above your dishonest and stupid head, learn to walk
> > before you can run.  I mean "pointers"... just go fuck yourself.
> 
> You can't even stay consistent with your own definitions [2].

What are you complaining about now?  Can you even read?

> Besides even basic English is on my side with this usage:

Basic English is irrelevant, besides you should really get past just the first
line when reading any dictionary.  That said, it's plain ridiculous that you
cannot appreciate the difference (at least that there is a difference) between
a *coding style* and a *language paradigm*.  In fact OO is not even just a
language paradigm, it's a full technical paradigm going from OOA to OOD to
OOP.  But the same goes for functional or, say , the logical paradigm: these
are essentially different since the outset, the very way one defines solutions.

Get a good software engineering book: Pressman's is a classic.

Julio

> "A manner of doing or presenting things"
> <https://en.wiktionary.org/wiki/style#Noun>
> 
> "A pattern, a way of doing something"
> <https://en.wiktionary.org/wiki/paradigm#Noun>
> 
> [1] <https://en.wikipedia.org/wiki/Primal_therapy>
> [2] <https://groups.google.com/d/msg/comp.lang.javascript/paDy9O_kOdc/ZOyMMS_0DQAJ>

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


#34905 — Re: Is JS a functional programming language? (was: Trying to create array of object literals)

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2018-04-23 11:50 -0700
SubjectRe: Is JS a functional programming language? (was: Trying to create array of object literals)
Message-ID<90aa23ab-ea8a-4fa9-8f5f-77e6a99211f8@googlegroups.com>
In reply to#34902
Julio Di Egidio wrote:
> Michael Haufe (TNO)  wrote:
> > Julio Di Egidio wrote:
> > > Michael Haufe (TNO)  wrote:

> > If that was too hard, I could give you an even simpler example. Put up or shut up.
> 
> You are the one raising objections...

Objecting to claims without justification. Objecting to your FUD

> Basic English is irrelevant [...]

That much seems obvious. You're just digging a deeper hole for yourself.

> That said, it's plain ridiculous that you
> cannot appreciate the difference (at least that there is a difference) between
> a *coding style* and a *language paradigm*. 

Are you ever going to provide something concrete, or just keep throwing shit against a wall to see which sticks?

> In fact OO is not even just a
> language paradigm, it's a full technical paradigm going from OOA to OOD to
> OOP.  But the same goes for functional or, say , the logical paradigm: these
> are essentially different since the outset, the very way one defines solutions.

We've been through this little dance already, and I've given you formal definitions and usage in the past. Your response then was even more shallow then, but at least there is some progress this time around:

<https://groups.google.com/d/msg/comp.lang.javascript/7yR6urAZypU/CF7Ucfj-BAAJ>

> Get a good software engineering book: Pressman's is a classic.

"Homo unius libri". I'm assuming you mean this one?

<https://archive.org/details/SoftwareEngineering7thEDByRogerS.Pressman>

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


#34906 — Re: Is JS a functional programming language? (was: Trying to create array of object literals)

FromJulio Di Egidio <julio@diegidio.name>
Date2018-04-23 12:00 -0700
SubjectRe: Is JS a functional programming language? (was: Trying to create array of object literals)
Message-ID<0ab002cd-34c4-4ace-86cc-dc4b583337ef@googlegroups.com>
In reply to#34905
On Monday, 23 April 2018 20:50:33 UTC+2, Michael Haufe (TNO)  wrote:
> Julio Di Egidio wrote:
<snip>
> > Basic English is irrelevant [...]
> 
> That much seems obvious. You're just digging a deeper hole for yourself.

Except that you were the one quoting from the basic dictionary: snip, deny,
and insult, i.e. yet another retarded cunt who's definitely lost the right
to waste my time.  (But I'll keep debunking your bullshit, stay confident.)

*Plonk*

Julio

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


#34907 — Re: Is JS a functional programming language? (was: Trying to create array of object literals)

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2018-04-23 15:07 -0700
SubjectRe: Is JS a functional programming language? (was: Trying to create array of object literals)
Message-ID<6ac594f1-3d9b-4580-a14c-4bdac36558d2@googlegroups.com>
In reply to#34906
Julio Di Egidio wrote:
> Michael Haufe (TNO)  wrote:
> > Julio Di Egidio wrote:
> <snip>
> > > Basic English is irrelevant [...]
> > 
> > That much seems obvious. You're just digging a deeper hole for yourself.
> 
> Except that you were the one quoting from the basic dictionary: snip, deny,
> and insult, i.e. yet another retarded cunt who's definitely lost the right
> to waste my time.  (But I'll keep debunking your bullshit, stay confident.)

You can't "keep debunking" if you never start. Every time I counter your rantings or push you to justify them, you retreat into insults and more generalizations. 

Are you able to even back up or expand on your current claim:

"I'd certainly say functional is the *most* modular: while OO is the *least* modular."

Why? I don't believe you and I'd be surprised if anyone else does either. 

There is a big difference between something being true, what you think is true, and what you can demonstrate to be true. 

AFAICT, you've never demonstrated so therefore it doesn't matter if it might actually be true. I would think that any effort in producing one would save you far more time in the long run.

If I'm wrong and you've actually demonstrated your proof, present it or link to it. I've asked for your prior evidence/work before and you were just as evasive then.

Since you're keen on "debunking". Here is that simplified example. Why is the functional approach more modular?

<script type="TypeScript">
/** Number Expressions */

// Functional

// data
type Exp =
    { tag: 'Lit', value: number } |
    { tag: 'Add', left: Exp, right: Exp }

// operations
function evaluate(exp: Exp): number {
    switch (exp.tag) {
        case 'Lit':
            return exp.value;
        case 'Add':
            return evaluate(exp.left) + evaluate(exp.right)
    }
}

function print(exp: Exp): string {
    switch (exp.tag) {
        case 'Lit':
            return `Lit(${exp.value})`;
        case 'Add':
            return `Add(${print(exp.left)},${print(exp.right)})`
    }
}

// 1 + 3
let exp: Exp = {
    tag: 'Add',
    left: { tag: 'Lit', value: 1 },
    right: { tag: 'Lit', value: 3 }
}

evaluate(exp) //4
print(exp) // Add(Lit(1),Lit(3))

// Object Oriented
abstract class Exp {
    abstract print(): string
    abstract evaluate(): number
}

class Lit extends Exp {
    // data
    constructor(readonly value: number) { super() }

    //operations
    evaluate(): number {
        return this.value
    }
    print(): string {
        return `Lit(${this.value})`
    }
}

class Add implements Exp {
    // data
    constructor(readonly left: Exp, readonly right: Exp) { }

    // operations
    evaluate(): number {
        return this.left.evaluate() + this.right.evaluate()
    }
    print(): string {
        return `Add(${this.left.print()},${this.right.print()})`
    }
}

// 1 + 3
let exp: Exp = new Add(
    new Lit(1),
    new Lit(3)
)

exp.evaluate() // 4
exp.print() // Add(Lit(1),Lit(3))
</script>

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


#34908 — Re: Is JS a functional programming language?

From"Christoph M. Becker" <cmbecker69@arcor.de>
Date2018-04-24 00:47 +0200
SubjectRe: Is JS a functional programming language?
Message-ID<pblnp6$ua8$1@solani.org>
In reply to#34907
On 24.04.2018 at 00:07, Michael Haufe (TNO) wrote:

> Julio Di Egidio wrote:
>
>> Except that you were the one quoting from the basic dictionary: snip, deny,
>> and insult, i.e. yet another retarded cunt who's definitely lost the right
>> to waste my time.  (But I'll keep debunking your bullshit, stay confident.)
> 
> You can't "keep debunking" if you never start.

Indeed.  It seems to me that Julio confuses claiming something, and if
anybody *argues* against that claim, following up with insults, with
debunking.

Anyhow, to boost this discussion, John Hughes' "Why Functional
Programming Matters"[1] might be useful, as well as the more JS related
"Professor Frisby's Most Adequate Guide to Functional Programming"[2],
and Scott Sauyet's "Why Ramda?"[3].

Disclaimer: I do not claim that ECMAScript implementations are
functional programming languages, but rather that functional programming
can be done with those, and that it might be a preferable alternative to
OOP, depending on the task at hand.

[1] <https://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf>
[2] <https://drboolean.gitbooks.io/mostly-adequate-guide-old/content/>
[3] <http://fr.umio.us/why-ramda/>

-- 
Christoph M. Becker

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


#34909 — Re: Is JS a functional programming language?

FromJulio Di Egidio <julio@diegidio.name>
Date2018-04-23 16:12 -0700
SubjectRe: Is JS a functional programming language?
Message-ID<e12f033e-3ae7-4c74-a57a-9501be165903@googlegroups.com>
In reply to#34908
On Tuesday, 24 April 2018 00:47:10 UTC+2, Christoph M. Becker  wrote:
> On 24.04.2018 at 00:07, Michael Haufe (TNO) wrote:
> > Julio Di Egidio wrote:
> >
> >> Except that you were the one quoting from the basic dictionary: snip, deny,
> >> and insult, i.e. yet another retarded cunt who's definitely lost the right
> >> to waste my time.  (But I'll keep debunking your bullshit, stay confident.)
> > 
> > You can't "keep debunking" if you never start.
> 
> Indeed.  It seems to me that Julio confuses claiming something, and if
> anybody *argues* against that claim, following up with insults, with
> debunking.
> 
> Anyhow, to boost this discussion

Gratuitous accusations and a bunch of links, yet another idiot.

(You see, I always explain, some just don't get it.)

*Plonk*

Julio

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


#34910 — Re: Is JS a functional programming language?

From"Christoph M. Becker" <cmbecker69@arcor.de>
Date2018-04-24 01:30 +0200
SubjectRe: Is JS a functional programming language?
Message-ID<pblqao$vk0$1@solani.org>
In reply to#34909
On 24.04.2018 at 01:12, Julio Di Egidio wrote:

> *Plonk*

Thanks! :)

-- 
Christoph M. Becker

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


#34911 — Re: Is JS a functional programming language?

FromJulio Di Egidio <julio@diegidio.name>
Date2018-04-23 16:45 -0700
SubjectRe: Is JS a functional programming language?
Message-ID<9f6654fa-d02b-4e8b-91ac-b51897733b09@googlegroups.com>
In reply to#34908
On Tuesday, 24 April 2018 00:47:10 UTC+2, Christoph M. Becker  wrote:

> Disclaimer: I do not claim that ECMAScript implementations are
> functional programming languages,

That's not even very meaningful: the JavaScript *language*, ECMAScript if you
like, is a functional language.  Look at the spec, not the labels, what it is.

> but rather that functional programming
> can be done with those, and that it might be a preferable alternative to
> OOP, depending on the task at hand.

Rather OO can be done in JS...

Julio

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


#34912 — Re: Is JS a functional programming language?

FromJohn G Harris <niam@jghnorth.org.uk.invalid>
Date2018-04-24 09:54 +0100
SubjectRe: Is JS a functional programming language?
Message-ID<26stddd3j1v1ve3mbu2k4ds3pdnbm8ep5p@4ax.com>
In reply to#34908
On Tue, 24 Apr 2018 00:47:06 +0200, "Christoph M. Becker"
<cmbecker69@arcor.de> wrote:

  <snip>
>Disclaimer: I do not claim that ECMAScript implementations are
>functional programming languages, but rather that functional programming
>can be done with those, and that it might be a preferable alternative to
>OOP, depending on the task at hand.
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Hear, here, and so say all (er ... most) of us.

  John

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


#34913 — Re: Is JS a functional programming language?

FromTim Streater <timstreater@greenbee.net>
Date2018-04-24 10:17 +0000
SubjectRe: Is JS a functional programming language?
Message-ID<240420181017122645%timstreater@greenbee.net>
In reply to#34912
In article <26stddd3j1v1ve3mbu2k4ds3pdnbm8ep5p@4ax.com>, John G Harris
<niam@jghnorth.org.uk.invalid> wrote:

>On Tue, 24 Apr 2018 00:47:06 +0200, "Christoph M. Becker"
><cmbecker69@arcor.de> wrote:
>
>  <snip>
>>Disclaimer: I do not claim that ECMAScript implementations are
>>functional programming languages, but rather that functional programming
>>can be done with those, and that it might be a preferable alternative to
>>OOP, depending on the task at hand.
>      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>Hear, here, and so say all (er ... most) of us.

Right, and are ye all done with this pointless thread now? Initiated,
as it was, by Pointy (or more likely Pointless) Head. Who yet again
shows how good he is at counting angels on pinheads.

-- 
The reason you think government is the solution is because you think freedom is
the problem. But the truth is that government ensures that the most evil,
ruthless people end up in control, because the state is a single point of
failure, and a high-value target of corruption.

Alan Lovejoy

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


#34914 — Re: Is JS a functional programming language?

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2018-04-24 12:02 -0700
SubjectRe: Is JS a functional programming language?
Message-ID<b17040d5-8081-4704-835a-a967feffbbe5@googlegroups.com>
In reply to#34908
Christoph M. Becker wrote:

[...]

> Anyhow, to boost this discussion, John Hughes' "Why Functional
> Programming Matters"[1] might be useful, as well as the more JS related
> "Professor Frisby's Most Adequate Guide to Functional Programming"[2],
> and Scott Sauyet's "Why Ramda?"[3].

#1 Is a good lead into the book: "Introduction to Functional Programming" :

<https://www.amazon.com/Introduction-Functional-Programming-International-Computing/dp/0134841972/ref=sr_1_3?ie=UTF8&qid=1524595376&sr=8-3&keywords=Introduction+to+Functional+Programming+Languages>

The book is also written in Miranda.

#2 I haven't seen this one yet and will take a look.

#3 You might recall that we've discussed Ramda before here in the group when it was being developed:

<https://groups.google.com/d/msg/jsmentors/wH6X8SDPnbw/dF8ON8LkT2wJ>


> Disclaimer: I do not claim that ECMAScript implementations are
> functional programming languages, but rather that functional programming
> can be done with those, and that it might be a preferable alternative to
> OOP, depending on the task at hand.

For OOP, I'd suggest "A Little Java, A Few Patterns":

<https://www.amazon.com/Little-Java-Few-Patterns-Press-ebook/dp/B004GCK2MO/ref=sr_1_1?ie=UTF8&qid=1516482984&sr=8-1&keywords=a+little+java%2C+a+few+patterns>

Followed by the Self Papers. I'm not to going to link to them here since it feels excessive, but I will if requested. 

The main point I was setting up with Julio was that Object-Oriented and Functional programming are duals[1] of each other and when you attempt to extend either of my examples it becomes clear the failures of both paradigms. In other words I was setting up an example of the Expression Problem [2]

[1] <https://en.wikipedia.org/wiki/Duality_(mathematics)>
[2] <https://en.wikipedia.org/wiki/Expression_problem>

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


#34915 — Re: Is JS a functional programming language?

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2018-04-25 05:04 +0200
SubjectRe: Is JS a functional programming language?
Message-ID<2432812.mvXUDI8C0e@PointedEars.de>
In reply to#34914
Michael Haufe (TNO) wrote:

> The main point I was setting up with Julio was that Object-Oriented and
> Functional programming are duals[1] of each other […]
> 
> [1] <https://en.wikipedia.org/wiki/Duality_(mathematics)>

But *that* is _not_ true.  Because you can employ the object-oriented 
programming paradigm *without* employing the functional paradigm, and vice-
versa.  And there are, among implementations of those two paradigms, pure 
object-oriented programming languages (e.g., Visual Basic) as well as there 
are pure functional programming languages (e.g., Haskell).  I happen to have 
used both, so I can confirm

<https://en.wikipedia.org/wiki/Comparison_of_programming_languages#General_comparison>

in that regard.

AISB, the key property of a functional programming language is that 
“functions are first-class objects”.  Superficialls that looks like a 
contradiction; but it _not_ because “first-class object” must be understood 
like “first-class citizen”: we are talking about objects/targets *of 
operations* there.[1]

So the most fundamental operation that a functional programming language 
must allow is passing a (reference to a) function as an argument to another 
function.  (ECMAScript implementations, like the various JavaScripts, allow 
that, as functions are specified and implemented as real *OOP* objects¹ and 
you can always pass references to objects as arguments of functions.)

Also, it is not always helpful or correct to migrate mathematic terminology 
to other fields; in this case it certainly is not.

_________
¹ Functions have *properties*, a *constructor* (Function), a
  *prototype chain*, aso.

[1] <https://en.wikipedia.org/wiki/First-class_object>
-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

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


Page 2 of 5 — ← Prev page 1 [2] 3 4 5  Next page →

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


csiph-web