BlockstreamResearch / simfony

Rust-like high-level language that compiles down to Simplicity bytecode. Work in progress.
19 stars 6 forks source link

Add for-while loops #75

Closed uncomputable closed 1 month ago

uncomputable commented 1 month ago

Implement for-while loops based on the existing Haskell code. (Function signatures are adapted for right-associativity for a better fit with the rest of Simfony.) Implement for-while iteratively such that the exact same Simplicity expressions are returned as for the recursive implementation. Updatre the number types to support this implementation.

uncomputable commented 1 month ago

Updated one "Safety" comment.

apoelstra commented 1 month ago

79d4c16e5e0a8b65e6002d3532d7e9ddf2b69c8a looks good other than the unsafe thing.

I also wish that the user didn't have to explicitly indicate the counter type in the for-loop. It seems like we should be able to infer it from the type of the function passed?

uncomputable commented 1 month ago

Rebased, removed unsafe and removed the generic bit width parameter from for_while.

uncomputable commented 1 month ago

Updated a commit description