> --
> You received this message because you are subscribed to the Google
> Groups "Qilang" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/qilang/-/strpKkv3ixkJ.
> To post to this group, send email to qil...@googlegroups.com.
> To unsubscribe from this group, send email to
> qilang+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/qilang?hl=en.
> The specification of Shen says that Shen's mission is to be an
> "ultra-portable version of Qi". This is contrasted by the requirement that
> "tail recursion optimisation is a must" for Kl implementations.
>
> I think it is easier to introduce a primitve such as "recur" in Kl (as is
> done in Clojure) to explicitly indicate tail recursion. Implementing
> "recur" in any "traditional" language like JavaScript, Ruby, Python etc. is
> a breeze, since iteration can be used. Without "recur" each and every
> implementor for JavaScript, Ruby, Python etc. has to implement some code
> that does an tail call analysis and optimization. This risks buggy and
> unnecessary complex implementations. Why is TCA and TCO not done by Shen?
> Shen has Prolog and all the tools required on board. Shen could generate Kl
> code with all tail calls being identified by "recur".
It's not hard to write kl->kl translator that adds `recur` in
appropriate places. It you're not afraid of horrible code you can look
how translator.shen of shen-js deals with tail recursive calls. For new
shen-js I've made kl->kl translator implementing partial application
support.
> Along the same line of argumentation: Why must Kl support partial
> application? Shen could offer a standardized solution via Kl!
> If TCO and partial application would be removed from Kl (but not Shen), the
> only implementation "challenge" is the dual namespace model and possibly
> error handling. Other than that, implementing Kl in any target language
> would be simple, easy and fun.
>
> What do you think?
I think that with current Shen specification one can choose the best
suitable for host language methods of partial application and TCO.
Standardized solution might be inefficient on some platforms.
Einsteins riddle you mention on the Wiki can be solved
not only by 300 kLIPS, ordinary Prolog systems do it in 3
mLIPS and above. Already for a couple of decades.
https://plus.google.com/u/0/b/103259555581227445618/103259555581227445618/posts/Wien54QZFpW
I didn't try YAP Prolog, which is one of the fastest Prologs
around, but I guess it will do it with around 30 mLIPS.
Mark Tarver schrieb:
Not necessarely, Jekejeke and SWI don't use machine code, both
use an intermediate form. And you get ~3 mLIPS.
YAP uses machine code heavily and even some JIT specialization.
As a result it is usually ~10 times faster.