Open Kesanov opened 7 years ago
OK, this is really cool! Just give me some time to test it (tomorrow?)
Of course, I am glad you like it. I did not really try to run this (compiler does not understand :
->
==
right now anyway), so it is meant as a preview, how could documentation possibly look like.
Do you think I should write forall a -> forall b -> (a -> b) -> a -> b
instead of (a -> b) -> b
?
Oh and is it possible to use equality on functions in moon? Otherwise one 1 == val 1 end
does not make sense.
Otherwise I will have to implement equal
and use that instead...
An alternative approach - so far my favourite:
val = ...
end = ...
decription =
"returns 1 if any element satisfies condition"
complexity =
"O(N) where N is length of list"
this =
cond : a -> Int =>
list : (a -> b) -> b =>
list
x => xs => i =>
(if (cond x)
1
(xs (add i 1)))
i => 0
0
examples =
[ this (eql 3) (val 2 end) == 0
, this (eql 3) (val 3 end) == 1
]
this
BTW is it a problem, that tooling (like moon-tool, repl and language server) will be able to extract terms from let
s which are not normally visible?
This is not really finished. I just want to show, how does the documentation currently look like.
There might be some mistakes in the type signatures (I am not sure about
match
in particular).I do not mind changing the format of documentation if it makes sense.