Faster Prolog in Perl with Yaswi

In my previous post, I introduced AI::Prolog, a Prolog engine written in Perl. AI::Prolog is easy to use; however, the speed may be not satisfying. Language::Prolog::Yaswi refers to Yet Another interface to SWI-Prolog; the performance of Language::Prolog::Yaswi is better than that of AI::Prolog. Before using Yaswi, You need a SWI-Prolog compl...
「點我閱讀更多」

Perl x Prolog in AI::Prolog

Perl programming can be done in imperative, objective and functional styles. However, Perl lacks direct support in logic programming. Prolog is a logic programming language, popular in the fields of natural language processing and artificial intelligence. AI::Prolog is where Perl and Prolog cross. AI::Prolog is a Prolog compiler written pure...
「點我閱讀更多」

Show Class Name in Perl

In Perl, you do not need to declare the type of a variable in advance. Sometimes, it is confusing because you do not know the type of the variable and you do not know what method to use. By using ref with a object, you can know the class (or type) of the object. Say we want to extract some data from some xml files. XML::LibXML is Perl bindin...
「點我閱讀更多」

Sort by Hash Values in Perl

Since hash is a one-way relation, you cannot directly sort by hash values and get hash keys in Perl. However, by customized sort subroutine, you can also sort by hash values. This post shows the trick. You still need hash keys for later use, so we sort hash keys here. The catch is in the by_value subroutine. Here we pass $a and $b to the su...
「點我閱讀更多」

rJava Failed to Load on Desktop RStudio

According to the official page, rJava is a Low-level interface to Java VM very much like .C/.Call and friends. A strange error occurs while I try to load rJava insido RStudio. Reason: image not found According to the thread, starting RStudio and setting LD_LIBRARY_PATH variable from terminal can solve the problem. $ LD_LIBRARY_PATH=/Library/...
「點我閱讀更多」