sorawee
2022-6-7 07:12:02

Yes, Python. Very functional


sorawee
2022-6-7 07:14:33

I wonder if they read my tweet and somehow thought that I was serious /s https://twitter.com/sorawee_p/status/1163725751822123008


jcoo092
2022-6-7 07:30:14

> Yes, Python. Very functional Yeah, it’s not like Python’s creator has something of a reputation for being insanely anti-FP or anything…

Also, I don’t know much about PHP, but it’s news to me that it’s considered a functional language.


ben.knoble
2022-6-7 11:16:16

That read like a writing assignment for a PL class “Research a programming paradigm/style and write about languages that support it.”


laurent.orseau
2022-6-7 11:49:20

@ben.knoble what score would you give? :smile:


massung
2022-6-7 13:19:21

So, ignoring Python, PHP, and Javascript (!?!!!), the rest of that list is literally just an exercise in someone typing “functional programming languages” into google and typing the top results.

What a waste of typing skills.


massung
2022-6-7 13:36:20

Also, I’m getting a little tired of many programming languages (including many Lisps) being included in FP language lists.

Lists like these are literally just a list of “languages with first-class functions” and might as well include C++, D, Rust, Zig, … (note: I personally consider Rust more “FP” than most Lisps).

Opinion: at this point, I don’t think a language can really be thought of as a “Functional Programming Language” unless it allows for the type-safe separation of pure vs. impure data transfer and the identification of pure vs. impure functions.

By “identification of pure vs. impure functions” I mean that since I can (using Scheme as an example) create a global variable and do set! from within any function in a way that no one knows it’s happening makes it non-FP given my more strict definition. If there was a way of the compiler catching/defining that the function was impure, that’d be ok.

By “type-safe separation of pure vs. impure data transfer” I don’t necessarily mean strongly typed, but that there is some monadic type theory exposed. If function A is async and function B calls A, that implicitly makes B async. Likewise if A can throw/error, then implicitly so can B. If C wants to call B but doesn’t allow use of async or errored results, this should fail (hopefully at compile-time, but at runtime w/ a type error is also fine).


laurent.orseau
2022-6-7 13:43:07

My take to reduce these lists: If it doesn’t have TCO, it can’t do proper FP. @massung These lists should ideally distinguish between “you can do pure FP in this language” and the stricter “You can prevent doing non-FP in this language”.


massung
2022-6-7 13:49:48

> you can do pure FP in this language That would include pretty much any language at this point, though. Only old languages that don’t have first-class functions would fail that test at this point.

> You can prevent doing non-FP… I see your idea here. I like the direction. I’d probably reword it to something about safety. I don’t necessarily want to limit the whole program, but simply to be aware of what I’m doing for safety reasons.

For example, if Racket’s core functions (e.g. map, filter, …) were marked as “pure” and that meant they could only accept pure functions as arguments, that’d be a big step towards FP IMO.

For all I know typed-racket can do this now and I just don’t know it.


laurent.orseau
2022-6-7 13:51:22

>> you can do pure FP in this language > That would include pretty much any language at this point, though. Only old languages that don’t have first-class functions would fail that test at this point. Not if you require the language to implement TCO :slightly_smiling_face:


massung
2022-6-7 13:51:59

TCO can be a pain for debuggers, though.


laurent.orseau
2022-6-7 13:52:27

You can still have an option to turn it off for debugging of course


sorawee
2022-6-7 17:04:18

Tail call is for looping. In languages with explicit loop constructs, you don’t see frames due to looping either.


laurent.orseau
2022-6-7 17:10:35

Sure, but my point is that an FP language should be able to loop with only functions, hence TCO


sorawee
2022-6-7 17:11:12

(In case it’s not clear, I was responding to the point that TCO makes it difficult to debug)


massung
2022-6-7 17:11:54

Not having the callstack can be tricky.


laurent.orseau
2022-6-7 17:12:42

Oh :)


seanbunderwood
2022-6-7 23:27:08

OK, so, aside from all the talk about many of these not being functional languages > It is very popular among data science and machine learning teams … because of its easy-to-read and understandable syntax. Data scientist reporting in. I can assure you that that is most certainly not why we use Python.


seanbunderwood
2022-6-7 23:27:42

(And the syntax just keeps getting worse with every release. :weary: )


sorawee
2022-6-7 23:28:36

Are you qualified as a data scientist though? I’ve heard real data scientists don’t hang out in a programming language chat forum (except maybe R).


seanbunderwood
2022-6-7 23:30:00

I resent that accusation.

R is not a programming language.


sorawee
2022-6-7 23:30:36

It got syntax. It got semantics. It’s…. something.


seanbunderwood
2022-6-7 23:30:46

ok. ok. I would pick Python for its easy-to-read and understandable syntax if my only other option were R.


seanbunderwood
2022-6-7 23:31:05

Though, the last major thing I did was in R, so…. :thinking_face:


jcoo092
2022-6-7 23:31:31

As a graduate of the University that claims to have invented R (one of the original co-creators was working there at the time), I must protest this unfair maligning of R :stuck_out_tongue: (while stating that I have never touched it, and the only other grad from there I know of who actually used R said she didn’t like it)


seanbunderwood
2022-6-7 23:32:47

I actually don’t mind R’s syntax that much. But I think the semantics might be the best evidence we have for extraterrestrial influence on human activities.


seanbunderwood
2022-6-7 23:33:22

OTOH…. it’s also much easer to sling numbers around in R than it is in Python.


sorawee
2022-6-7 23:34:10

6 years ago we took a grad level programming language class, and the project we decided to do is to formalize R…. We didn’t finish the project. Instead, we got a compilation of WTF facts.


seanbunderwood
2022-6-7 23:35:18

Anyway. Give me a lisp that can talk to C libraries without any marshaling (And that isn’t Hy. Sorry, Hy.), and I will be very eager to help make it successful.


jcoo092
2022-6-7 23:36:36

Can Guile Scheme do that? Or Common Lisp? (I’m guessing the answer is “no”, since you surely have already looked at both of them)


massung
2022-6-7 23:40:28

R or Matlab?


massung
2022-6-7 23:40:48

(I loathe R so much it’s sick)


seanbunderwood
2022-6-7 23:40:49

I haven’t actually looked into guile. I believe SBCL uses a generational garbage collector.


ben.knoble
2022-6-8 01:53:39

I dont know R really but I might still take it over matlab because most exemplary matlab code is not at all concerned with being a runnable program and instead is very notebook mentality