r/functionalprogramming • u/SrPeixinho • Sep 17 '26
FP Bend 2: a functional language that compiles to fast CPU and GPU code, with proofs
https://bend-lang.com/
111
Upvotes
r/functionalprogramming • u/SrPeixinho • Sep 17 '26
12
u/andrewcooke Sep 17 '26
i'm really struggling to understand this, but are there no first class functions?
if map cannot be defined, what can be defined?
sorry, really lost.
3
u/mocompute Sep 17 '26
Why/how is compile time so fast?
8
u/Inconstant_Moo Sep 19 '26
Your example is kind of worrying:
It seems like the AI is allowed to do anything necessary to preserve the invariant. But this is what's wrong with AIs anyway, that if you tell them to find a permanent cure for your headaches they'll figure out that decapitation is the best solution. It seems like in most cases I would rather just know that the law has been broken than have the AI do whatever it can think of to maintain it.
13
u/mocompute Sep 17 '26
By the way, the website looks great. I usually skip AI coded content but you've got my attention.
4
u/Afrotom Sep 18 '26
Maybe I'm dumb and not understanding but how are laws different to unit tests?
3
u/NojipizRemastered Sep 17 '26
I need to try this, looks awesome!
3
u/_nathata Sep 18 '26
I remember when I first saw a post from you years ago on Facebook regarding HVM. Glad to see you are still making progress.
2
u/Distinct_Historian37 Sep 18 '26
This sounds great
2
u/generic-d-engineer Sep 18 '26
Nice work guys
2
u/vallyscode Sep 18 '26
Where’s the comparison against the rust the blazing fast?
2
u/No_Complex_18 Sep 18 '26
How do you prove a law to hold for a program?
2
u/2hands10fingers Sep 18 '26
Glad to see Bend growing! It was difficult to work with back then but fascinating to try out when it was compiled with Rust.
2
u/CardiologistTiny6226 Sep 21 '26
Lately, I've been experimenting with Lean in this same vein. I'm terrible at writing proofs myself, but perhaps the bigger obstacle to formal verification in "regular" sw engineering is the tediousness. But if agents bring this cost down, it seems more attractive- if a unit test and formal proof both just cost me a prompt, why not opt go for the latter? I'm also hoping it let's me trade informal documentation for formal specification that can't go stale. I find most agents leave enormous amounts of chatty md/comments that go stale and mislead the next session.
How do you compare your language to Lean in this context?
2
u/thegreatest_evr Oct 04 '26
I have been thinking about something similar for a while since AI has gotten so good at splitting out code. The natural next step would be to make sure correctness of the code by proof than just passing test case. Great work guys.
i’ll surely try this, this is what future systems will have or something similar to this to build any software, especially when it’s critical.
4
u/Optimal-Builder-2816 Sep 18 '26
I like this, I think things like this will continue to be the direction things are headed.
I appreciate the desire to reuse python syntax but I suspect this is actually going to be a rake that LLMs step on fairly consistently as it naively expects all syntax productions to work correctly.
Just use s-expressions instead, if it’s not intended for humans.
1
u/Truly_freedom Oct 02 '26
I really like how easy it is now to use functional language with coding agents.
I shared a step-by-step walkthrough how to use Bend2 here: step-by-step Bend 2 walkthrough
1
u/hhefesto Sep 21 '26
You can play with bend2 on my potato website refl.hhefesto.dev or run it locally with ‘nix run github:hhefesto/refl’