Re: [FRIAM] Classes, Complexity, and Functional Programming – Kent C. Dodds – Medium

2017-08-15 Thread Dale Schumacher
A while ago, I wrote up a few examples of functional and reactive
(actor-based) techniques using JavaScript. Perhaps they will add something
to this discussion.

http://www.dalnefre.com/wp/2017/01/same-fringe-revisited/


On Sat, Aug 12, 2017 at 11:20 AM, Owen Densmore  wrote:

> Great info, thanks.
>
> A few constraints:
> - I've finally gotten back to Write & Run JavaScript, no transpiling.
> - My workflow also is simplified: only npm scripts possibly using a node
> script.
> - I run a local hot-loading node http server so Write & Run is automatic.
> All managed by a npm script.
>
> Why? The JS world went nuts for several years with transpiling, babel (for
> es6/future JS features), task managers, linters etc. It was arguably
> necessary for the times. I used CoffeeScript for a while mainly for safety
> and pythonic syntax. But my peers said "Oh, great, *another* thing to
> learn"! And they didn't. :)
>
> Things are now hugely better, with editors that are very IDE-ish and
> eslint built in, and the language is finally getting functional features
> like map, reduce, and so on. The for loop? It's dead Jim. Yay.
>
> So there is a return to sanity and a healing from JS "fatigue". Simple JS,
> no task managers, and simple commands for minifying, linting, conversion to
> node modules, and so on. Write & Run w/ chores as scripts.
>
> Within that world, currently, is a very strong movement toward FP. Hence
> the article starting this conversation. And my hope for incrementally
> converting to FP.
>
>-- Owen
>
> PS: My work is not very webby. Mainly a NetLogo lookalike for JS. No
> install, just start up a page. I render using webgl which oddly enough has
> a fairly nice language for the GPU, and Three.js eases much of the
> verbosity of the CPU side.
>
>
> 
> FRIAM Applied Complexity Group listserv
> Meets Fridays 9a-11:30 at cafe at St. John's College
> to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
> FRIAM-COMIC http://friam-comic.blogspot.com/ by Dr. Strangelove
>

FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
FRIAM-COMIC http://friam-comic.blogspot.com/ by Dr. Strangelove

Re: [FRIAM] Classes, Complexity, and Functional Programming – Kent C. Dodds – Medium

2017-08-12 Thread Owen Densmore
Great info, thanks.

A few constraints:
- I've finally gotten back to Write & Run JavaScript, no transpiling.
- My workflow also is simplified: only npm scripts possibly using a node
script.
- I run a local hot-loading node http server so Write & Run is automatic.
All managed by a npm script.

Why? The JS world went nuts for several years with transpiling, babel (for
es6/future JS features), task managers, linters etc. It was arguably
necessary for the times. I used CoffeeScript for a while mainly for safety
and pythonic syntax. But my peers said "Oh, great, *another* thing to
learn"! And they didn't. :)

Things are now hugely better, with editors that are very IDE-ish and eslint
built in, and the language is finally getting functional features like map,
reduce, and so on. The for loop? It's dead Jim. Yay.

So there is a return to sanity and a healing from JS "fatigue". Simple JS,
no task managers, and simple commands for minifying, linting, conversion to
node modules, and so on. Write & Run w/ chores as scripts.

Within that world, currently, is a very strong movement toward FP. Hence
the article starting this conversation. And my hope for incrementally
converting to FP.

   -- Owen

PS: My work is not very webby. Mainly a NetLogo lookalike for JS. No
install, just start up a page. I render using webgl which oddly enough has
a fairly nice language for the GPU, and Three.js eases much of the
verbosity of the CPU side.

FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
FRIAM-COMIC http://friam-comic.blogspot.com/ by Dr. Strangelove

Re: [FRIAM] Classes, Complexity, and Functional Programming – Kent C. Dodds – Medium

2017-08-11 Thread Marcus Daniels
Owen writes:


"OK, so in the JavaScript world, how does one inch forward toward functional? I 
don't want to be so functional as some of the extremes. Curring all the way to 
one arg functions?"


I'm not sure what properties of JavaScript you care about.  If it is just the 
operational part of being able to run in a web browser, there are languages 
like Fay (a subset of Haskell) that compile to JavaScript.


FP is something you can do in incremental ways in many languages.  Even though 
I use a mostly-FP style in R (or Common Lisp or Python or Julia or Fortran 
2008), in my mind it is isn't _really_ FP unless there is strong typing and an 
mandatory requirement of purity.   Currying, IMO, is something that is easier 
to use with languages that have strong typing and type inference because the 
transformations between function signatures is natural to inspect in those 
environments.  (It is quite common in Haskell to get complex, even surprising 
types by automatic type inference.)   Currying is nice, in contrast to 
closures, because it is deliberate and localized; one can capture a lot in 
lexical scope and a lambda may not be easy to convert into a non-anonymous 
function -- you may not be clear on what you are capturing in the closure and 
why.   Also currying has a nice intuition of progressively reducing the degrees 
of freedom of a function as that information becomes available.


The philosophy of languages like Haskell, F#, Mercury, etc. is to make working 
code more likely just by virtue of getting it past the compiler.   Instead of 
dynamic typing, the compiler uses logical inference to figure out what types 
make sense when they are not provided.  This gives the similar brevity as 
dynamic typing but with many more internal consistency checks.


I write a lot of R, and for simple things dynamic typing is fine.  But, as soon 
as I start using it for more complex things in a production context, any minor 
mistake can cost a lot of wasted CPU time.   For me, there's a point at which I 
want the cognitive support that static typing affords.   And of course static 
typing gives code generation more information to work with, which usually leads 
to faster code.


Haskell (GHCI) still has a REPL interpreter-like interface, so it is not fair 
to say that experimentation is not possible as it is in JavaScript.


Marcus


From: Friam <friam-boun...@redfish.com> on behalf of Owen Densmore 
<o...@backspaces.net>
Sent: Friday, August 11, 2017 9:42:15 PM
To: The Friday Morning Applied Complexity Coffee Group
Cc: Wedtech
Subject: Re: [FRIAM] Classes, Complexity, and Functional Programming – Kent C. 
Dodds – Medium

On Fri, Aug 11, 2017 at 10:30 AM, Marcus Daniels 
<mar...@snoutfarm.com<mailto:mar...@snoutfarm.com>> wrote:
"I know, I know, functional programming is as fun as hitting your head with a 
brick."

It is fun!

​That's great to hear, too much is NOT fun in programming!​

If I have a project that isn't FP, I make it into an FP project because it is 
the right thing to do.

​OK, so in the JavaScript world, how does one inch forward toward functional? I 
don't want to be so functional as some of the extremes. Curring all the way to 
one arg functions?

The article says performance may be an issue.

The chief appeal for me is the Self-like objects only, no classes. But the lack 
of centrality may just as hard to navigate as the over-tight, stateful class 
approach.

   -- Owen​


On Fri, Aug 11, 2017 at 10:30 AM, Marcus Daniels 
<mar...@snoutfarm.com<mailto:mar...@snoutfarm.com>> wrote:

"I know, I know, functional programming is as fun as hitting your head with a 
brick."


It is fun!


"It is a bit scary letting go of "central control" Classes provide, very human. 
I mean, who's *boss*?"


The caller is the boss.  With FP you know that arguments are all read-only.

This gives you unambiguous dataflow and you know when parallelism can be done 
because the arguments just tell you.


let c = f(a)


..can run at once with..


let d = g(a)


..but not with..


let e = h(a,c)


Also "=" here isn't assignment, it is equality.


If I have a project that isn't FP, I make it into an FP project because it is 
the right thing to do.


Marcus




From: Friam <friam-boun...@redfish.com<mailto:friam-boun...@redfish.com>> on 
behalf of Owen Densmore <o...@backspaces.net<mailto:o...@backspaces.net>>
Sent: Friday, August 11, 2017 10:19:05 AM
To: Wedtech; Complexity Coffee Group
Subject: [FRIAM] Classes, Complexity, and Functional Programming – Kent C. 
Dodds – Medium

​I know, I know, functional programming is as fun as hitting your head with a 
brick.

But this article does a nice job of showing how functional programming is very 
Self-like:
  ​​
https://me
​​
dium.com/@kentcdodds/classes-complexity-and-functional-programming-a8dd86903

Re: [FRIAM] Classes, Complexity, and Functional Programming – Kent C. Dodds – Medium

2017-08-11 Thread Owen Densmore
On Fri, Aug 11, 2017 at 10:30 AM, Marcus Daniels 
wrote:

> "I know, I know, functional programming is as fun as hitting your head
>> with a brick."
>
> It is fun!
>
​That's great to hear, too much is NOT fun in programming!​

> If I have a project that isn't FP, I make it into an FP project because it
> is the right thing to do.
>

​OK, so in the JavaScript world, how does one inch forward toward
functional? I don't want to be so functional as some of the extremes.
Curring all the way to one arg functions?

The article says performance may be an issue.

The chief appeal for me is the Self-like objects only, no classes. But the
lack of centrality may just as hard to navigate as the over-tight, stateful
class approach.

   -- Owen​


On Fri, Aug 11, 2017 at 10:30 AM, Marcus Daniels 
wrote:

> "I know, I know, functional programming is as fun as hitting your head
> with a brick."
>
>
> It is fun!
>
>
> "It is a bit scary letting go of "central control" Classes provide, very
> human. I mean, who's *boss*?"
>
>
> The caller is the boss.  With FP you know that arguments are all
> read-only.
>
> This gives you unambiguous dataflow and you know when parallelism can be
> done because the arguments just tell you.
>
>
> let c = f(a)
>
>
> ..can run at once with..
>
>
> let d = g(a)
>
>
> ..but not with..
>
>
> let e = h(a,c)
>
>
> Also "=" here isn't assignment, it is equality.
>
>
> If I have a project that isn't FP, I make it into an FP project because it
> is the right thing to do.
>
>
> Marcus
>
>
> --
> *From:* Friam  on behalf of Owen Densmore <
> o...@backspaces.net>
> *Sent:* Friday, August 11, 2017 10:19:05 AM
> *To:* Wedtech; Complexity Coffee Group
> *Subject:* [FRIAM] Classes, Complexity, and Functional Programming – Kent
> C. Dodds – Medium
>
> ​I know, I know, functional programming is as fun as hitting your head
> with a brick.
>
> But this article does a nice job of showing how functional programming is
> very Self-like:
>   ​​
> https://me
> ​​
> dium.com/@kentcdodds/classes-complexity-and-functional-
> programming-a8dd86903747
>
> ​It's objects and functions all the way down, and for me the best is no
> `this`.
>
> It is a bit scary letting go of "central control" Classes provide, very
> human. I mean, who's *boss*?
>
> Do any of us *use* functional programming?
>
>-- Owen​
>
>
> 
> FRIAM Applied Complexity Group listserv
> Meets Fridays 9a-11:30 at cafe at St. John's College
> to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
> FRIAM-COMIC http://friam-comic.blogspot.com/ by Dr. Strangelove
>

FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
FRIAM-COMIC http://friam-comic.blogspot.com/ by Dr. Strangelove

Re: [FRIAM] Classes, Complexity, and Functional Programming – Kent C. Dodds – Medium

2017-08-11 Thread Marcus Daniels
"I conceptually like the ideas behind it, but it takes immutability to more of 
an extreme than I feel is necessary (e.g. unless you use its software 
transactional memory constructs, there is no way to re-bind a local variable)."


In Haskell, if this is needed, one uses the State Monad.


https://wiki.haskell.org/State_Monad


From: Friam <friam-boun...@redfish.com> on behalf of Gary Schiltz 
<g...@naturesvisualarts.com>
Sent: Friday, August 11, 2017 2:04:44 PM
To: The Friday Morning Applied Complexity Coffee Group
Subject: Re: [FRIAM] Classes, Complexity, and Functional Programming – Kent C. 
Dodds – Medium

Interesting timing. Although I don't do much software development these days, 
I've been fiddling around with Clojure off and on for the last few years. I 
conceptually like the ideas behind it, but it takes immutability to more of an 
extreme than I feel is necessary (e.g. unless you use its software 
transactional memory constructs, there is no way to re-bind a local variable). 
Also, the programming environment with the most advanced support for it is 
emacs, and I haven't drank enough koolaid to grok it fully. So, just last night 
I decided to download Racket (a scheme dialect with a nice simple IDE). So far, 
I have been having a blast with it. Part of the reason I downloaded it is that 
I wanted to run programs from the book "The Little Schemer", which among other 
things is a crash course on replacing iterating and mutating of data structures 
with purely functional recursive solutions.

On Fri, Aug 11, 2017 at 11:19 AM, Owen Densmore 
<o...@backspaces.net<mailto:o...@backspaces.net>> wrote:
​I know, I know, functional programming is as fun as hitting your head with a 
brick.

But this article does a nice job of showing how functional programming is very 
Self-like:
  ​​
https://me
​​
dium.com/@kentcdodds/classes-complexity-and-functional-programming-a8dd86903747<http://dium.com/@kentcdodds/classes-complexity-and-functional-programming-a8dd86903747>

​It's objects and functions all the way down, and for me the best is no `this`.

It is a bit scary letting go of "central control" Classes provide, very human. 
I mean, who's *boss*?

Do any of us *use* functional programming?

   -- Owen​



FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
FRIAM-COMIC http://friam-comic.blogspot.com/ by Dr. Strangelove


FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
FRIAM-COMIC http://friam-comic.blogspot.com/ by Dr. Strangelove

Re: [FRIAM] Classes, Complexity, and Functional Programming – Kent C. Dodds – Medium

2017-08-11 Thread Gary Schiltz
Interesting timing. Although I don't do much software development these
days, I've been fiddling around with Clojure off and on for the last few
years. I conceptually like the ideas behind it, but it takes immutability
to more of an extreme than I feel is necessary (e.g. unless you use its
software transactional memory constructs, there is no way to re-bind a
local variable). Also, the programming environment with the most advanced
support for it is emacs, and I haven't drank enough koolaid to grok it
fully. So, just last night I decided to download Racket (a scheme dialect
with a nice simple IDE). So far, I have been having a blast with it. Part
of the reason I downloaded it is that I wanted to run programs from the
book "The Little Schemer", which among other things is a crash course on
replacing iterating and mutating of data structures with purely functional
recursive solutions.

On Fri, Aug 11, 2017 at 11:19 AM, Owen Densmore  wrote:

> ​I know, I know, functional programming is as fun as hitting your head
> with a brick.
>
> But this article does a nice job of showing how functional programming is
> very Self-like:
>   ​​
> https://me
> ​​
> dium.com/@kentcdodds/classes-complexity-and-functional-
> programming-a8dd86903747
>
> ​It's objects and functions all the way down, and for me the best is no
> `this`.
>
> It is a bit scary letting go of "central control" Classes provide, very
> human. I mean, who's *boss*?
>
> Do any of us *use* functional programming?
>
>-- Owen​
>
>
> 
> FRIAM Applied Complexity Group listserv
> Meets Fridays 9a-11:30 at cafe at St. John's College
> to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
> FRIAM-COMIC http://friam-comic.blogspot.com/ by Dr. Strangelove
>

FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
FRIAM-COMIC http://friam-comic.blogspot.com/ by Dr. Strangelove

Re: [FRIAM] Classes, Complexity, and Functional Programming – Kent C. Dodds – Medium

2017-08-11 Thread Marcus Daniels
It is really not a big change from classes.   If you already have objects, 
often all you have to change is that you return them.  Object-oriented 
languages implicitly have the notion of the object as a first argument, so 
you've got a container to work with.  The job of higher level code is to 
assemble and disassemble what is returned in a reasonable way.  Perhaps it 
involves folds/reductions or perhaps it is just bigger containers.  This gives 
a good (and, in FP, necessary) opportunity to think about how to manage 
dependencies.   And yes, you have to start thinking in terms of `custody' of 
objects rather than `ownership'.  One of the recent trends in web app 
development are `reactive' services.  These ideas came from the FP community.


Marcus


From: Friam  on behalf of Owen Densmore 

Sent: Friday, August 11, 2017 10:19:05 AM
To: Wedtech; Complexity Coffee Group
Subject: [FRIAM] Classes, Complexity, and Functional Programming – Kent C. 
Dodds – Medium

​I know, I know, functional programming is as fun as hitting your head with a 
brick.

But this article does a nice job of showing how functional programming is very 
Self-like:
  ​​
https://me
​​
dium.com/@kentcdodds/classes-complexity-and-functional-programming-a8dd86903747

​It's objects and functions all the way down, and for me the best is no `this`.

It is a bit scary letting go of "central control" Classes provide, very human. 
I mean, who's *boss*?

Do any of us *use* functional programming?

   -- Owen​


FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
FRIAM-COMIC http://friam-comic.blogspot.com/ by Dr. Strangelove

Re: [FRIAM] Classes, Complexity, and Functional Programming – Kent C. Dodds – Medium

2017-08-11 Thread Marcus Daniels
"I know, I know, functional programming is as fun as hitting your head with a 
brick."


It is fun!


"It is a bit scary letting go of "central control" Classes provide, very human. 
I mean, who's *boss*?"


The caller is the boss.  With FP you know that arguments are all read-only.

This gives you unambiguous dataflow and you know when parallelism can be done 
because the arguments just tell you.


let c = f(a)


..can run at once with..


let d = g(a)


..but not with..


let e = h(a,c)


Also "=" here isn't assignment, it is equality.


If I have a project that isn't FP, I make it into an FP project because it is 
the right thing to do.


Marcus




From: Friam  on behalf of Owen Densmore 

Sent: Friday, August 11, 2017 10:19:05 AM
To: Wedtech; Complexity Coffee Group
Subject: [FRIAM] Classes, Complexity, and Functional Programming – Kent C. 
Dodds – Medium

​I know, I know, functional programming is as fun as hitting your head with a 
brick.

But this article does a nice job of showing how functional programming is very 
Self-like:
  ​​
https://me
​​
dium.com/@kentcdodds/classes-complexity-and-functional-programming-a8dd86903747

​It's objects and functions all the way down, and for me the best is no `this`.

It is a bit scary letting go of "central control" Classes provide, very human. 
I mean, who's *boss*?

Do any of us *use* functional programming?

   -- Owen​


FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
FRIAM-COMIC http://friam-comic.blogspot.com/ by Dr. Strangelove

Re: [FRIAM] Classes, Complexity, and Functional Programming – Kent C. Dodds – Medium

2017-08-11 Thread Russ Abbott
Can't resist. I've been in love with functional programming for years. I
teach an introductory Haskell class. My goal is to get students to think at
a higher level that functional programming facilitates.

P.S. The link in Owen's message wasn't created properly. Here's a
correction:
https://medium.com/@kentcdodds/classes-complexity-and-functional-programming-a8dd86903747


On Fri, Aug 11, 2017 at 9:19 AM Owen Densmore  wrote:

> ​I know, I know, functional programming is as fun as hitting your head
> with a brick.
>
> But this article does a nice job of showing how functional programming is
> very Self-like:
>   ​​
> https://me
> ​​
>
> dium.com/@kentcdodds/classes-complexity-and-functional-programming-a8dd86903747
>
> ​It's objects and functions all the way down, and for me the best is no
> `this`.
>
> It is a bit scary letting go of "central control" Classes provide, very
> human. I mean, who's *boss*?
>
> Do any of us *use* functional programming?
>
>-- Owen​
>
> 
> FRIAM Applied Complexity Group listserv
> Meets Fridays 9a-11:30 at cafe at St. John's College
> to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
> FRIAM-COMIC http://friam-comic.blogspot.com/ by Dr. Strangelove

-- 
Russ Abbott
Professor, Computer Science
California State University, Los Angeles

FRIAM Applied Complexity Group listserv
Meets Fridays 9a-11:30 at cafe at St. John's College
to unsubscribe http://redfish.com/mailman/listinfo/friam_redfish.com
FRIAM-COMIC http://friam-comic.blogspot.com/ by Dr. Strangelove