Closed smiegrin closed 6 years ago
Yes! Good idea, and I'm thinking about two ways to implement it. I will use the tgamma
function from math.h
, and we have a choice of exposing either gamma
, !
, or both. If we only expose gamma
, we can construct !
with the following definition: ! "dup gamma *"
. And I think if we go that route, we should create the file /usr/local/share/clac/words
with definitions like pi
, avg
, and !
. Then the user of course can create a custom words
file in $HOME/.config/clac/words
and add their own commands, even overriding the previous definitions.
On second thought, maybe implementing !
as a built in is the way to go. Optionally we can also expose gamma
. I will play with the different ideas and probably push the code tomorrow.
@smiegrin I added the factorial function as a built in. Can you check if it works for you?
It's available in version 0.3.2.
Hello hello! This is a stupendous tool that's being made here, I like it a lot!
I would like to know if a factorial function would be acceptable for this tool. For most functions, I suspect defining words would be sufficient, but in the case of factorials, there's a bit more than just a one-run set of operations. If factorial is defined, I suspect that most other probability problems I would use this tool with could use words that utilize that factorial function.
I imagine the use case being something like the following:
or
Again, thank you for this wonderful tool!