5 ms·
They presented two new languages for functional programming, can we leverage existing popular languages that can do FP just fine for the same goal, e.g. python,
by synergy20 4y ago
They presented two new languages for functional programming, can we leverage existing popular languages that can do FP just fine for the same goal, e.g. python, javascript, or rust,etc?
- dgb23 4y agoThe requirements include be high performance processing. That would exclude the first two.
- FrustratedMonky 4y agoIs there a definition for 'high performance'. Does a .NET language like F# qualify. Or does it have to simply be compiled? I'm just not sure that Python wouldn't qualify.
- richardjam73 4y agoF# can use AOT compiling.
- dgb23 4y agoFrom the examples they gave it’s clear you wouldn’t use python.
- nestorD 4y agoYes, for example JAX is a strictly functional language, designed for high-performance computing and embedded in Python.
- synergy20 4y agoI don't think JAX is a new language though, if it is, it's still Python?
- _kulang 4y agoIt’s not even really a language as much as it is an interop layer of sorts. It’s a collection of functional operations on numpy arrays, and a capable JIT. It’s main draw is honestly autograd, and if you’re using that, you often can’t use while or for loops effectively, can’t index numpy arrays without .at[], and should avoid side effects, so strangely it’s neither it’s own language or Python any longer
- pharmakom 4y agoThose languages (except maybe Rust) cannot do FP just fine.
- packetlost 4y agoLOL Python is not functional. We got a crumb of FP with `itertools`, `functools` and `lambda`
- synergy20 4y agothe reality is, general programming language with FP capabilities is what flies in practice, pure FP language might be perfect, it's just hard to find coders for them, we will have to live with that. for HPC and ML, Python is dominant, I would expect to enhance python somehow with FP instead of anything else, then adding c/c++/rust/fortran libraries(e.g numpy) for intensive computing needs.
- noloblo 4y agowhat about GIL? https://wiki.python.org/moin/GlobalInterpreterLock https://wiki.python.org/moin/GlobalInterpreterLock why python can't thread? impact of GIL on python https://pythonspeed.com/articles/python-gil/ https://pythonspeed.com/articles/python-gil/
- synergy20 4y agoMy understanding is that even with GIL removed today, Python is still not a performant language for cpu-intensive tasks, be it single core or multiple-core. Python is better used as a glue language and leverage numpy etc to do the heavy lifting, numpy can work with multiple-core just like c/c++/rust languages can. If you really need launch multiple python processes, the multiprocessing module comes to rescue. While not ideal, I don't see a showstopper to use Python for HPC's high and parallel computation needs at all.
- karmakaze 4y agoPython isn't popular for data only because it's imperative, there's also the vast numerical processing ecosystem. Scala/Spark is an example where FP fits well.
- bigbillheck 4y agoWe almost lost map/filter/lambda in the python3 transition: https://www.artima.com/weblogs/viewpost.jsp?thread=98196 https://www.artima.com/weblogs/viewpost.jsp?thread=98196
- throwwaway8529 4y agoPython can’t even do multi line lambdas
- Iwan-Zotow 4y agosure it can
- pasquinelli 4y agoit's been a while since i used python; have lambdas improved? i recall weird restrictions using them, but i can't quite remember what. this was pre puthon 3
- Iwan-Zotow 4y agoAssignment Expression were added, so you could do x = 1 y = 2 q = list(map(lambda t: ( tx := tx, ty := ty, tx+ty )[-1], [1, 2, 3])) print(q)
- fatneckbeard 4y agoas an amateur rust admirer , looking at https://rise-lang.org/ https://rise-lang.org/ .... i think its maybe possible. because their language / tools Rise + Elevate looks like its starting out with a chain of iterators, something we see often in Rust, like zip, reduce, map. if i understand it, they then automatically analyze the iterator chain and rewrite some of it using parallel versions of the code, for example they change Map to MapPar "In Rise, low-level implementation choices such as performing a computation in parallel are encoded with low-level patterns. For example, the map pattern that applies a function to each element of an array might be performed in a data-parallel fashion as indicated by the mapPar variant of the pattern" https://arxiv.org/pdf/2002.02268.pdf https://arxiv.org/pdf/2002.02268.pdf This reminds me a bit of how the Rayon crate in Rust works, where you can take an iter() and change it to par_iter() and instantly get parallelism in your program (depending on various details). but it seems like they have taken it "to the next level" and can output a CUDA program automatically , starting from their basic iterator chain.
- synergy20 4y agoGood to know Rise, it does not look like it is under active development since last May though.