Re:Tamgu, a functional, imperative, logical programming lang...
by clauderoux on Thursday July 25, 2019 @05:38AM
(#20523949)
Tamgu offers something very similar to that. I borrowed a lot of elements from Haskell, including data management but also declarations. In Tamgu functional elements are enclosed in <..>
In this example, I implement a join that takes a vector and transforms it into a string.
//type declaration
<joining:: vector -> string>
//The function itself
<joining(v) = x | x <- v>
println(joining(['a'..'z']));
I'm building one too in Rust and there exist a very nice concept:
https://doc.rust-lang.org/std/convert/trait.From.html
Is the first time I see a blessed way into a lang to define conversions.
For example, to parse strings into int you need to say (in pseudo-code):
and suddenly you get the way to convert to strings into ints EVERYWHERE.Is amazing.
The key here is that is for much more than just basic stuff. You can do a lot of very convoluted things here, like Auto-Convert a vector of ints into a Zip compressed stream in one go.
----
The second things required is how avoid the boilerplate when dealing with data. If I read a file and need a lot of parsing and validation and need to be relaxed about this... how about the same thing between eager and lazy?
- Have "strict" by default and need to manually do
calls- Have a "auto-convert" when need to chain a lot of steps:
this is nice because you can see where the " big dirty vicious beasts full of mistakes and traps" are in your code!