This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://stackoverflow.com/questions/449734/is-there-a-tool-for-converting-vb-to-a-scripting-language-e-g-python-or-ruby | |
http://stackoverflow.com/questions/9880805/automatically-convert-scala-code-to-java-code | |
http://stackoverflow.com/questions/3919343/how-to-convert-vb6-to-visual-c-native-code | |
http://stackoverflow.com/questions/29193069/how-do-i-start-writing-a-transpiler-is-it-even-possible | |
http://stackoverflow.com/questions/358016/convert-python-to-c-sharp | |
http://stackoverflow.com/questions/2801811/how-can-i-convert-a-shell-script-into-a-perl-script | |
http://stackoverflow.com/questions/2597255/porting-perl-to-python | |
http://stackoverflow.com/questions/2184510/easily-porting-lua-code-to-c-sharp | |
http://stackoverflow.com/questions/1114789/how-can-i-convert-perl-to-c | |
http://stackoverflow.com/questions/8051710/is-there-any-tools-to-convert-perl-script-to-c-sharp-code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%Java-to-scala translator for SWI-Prolog | |
:- use_module(library(transpiler)). | |
:- set_prolog_flag(double_quotes,chars). | |
:- initialization(main). | |
main :- | |
Input = "def add(a:String,b:String):String={return a+b;} def squared(a:Int):Int={return a*a;} def add_exclamation_point(parameter:String):String={return parameter+\"!\";} | |
", | |
translate('scala','java',X), | |
atom_chars(Y,X), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%This is a basic English-to-Prolog translator. It uses a | |
%pathfinding algorithm to find the meaning of each sentence. | |
%For example, output([a,is,greater,than,B],X) means X = (a > b). | |
%The input is an English phrase. The output is a Prolog expression. | |
output(Input,Output) :- | |
is_output(Output), | |
means(Input,Output). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Andy | |
// @namespace test | |
// @description test | |
// @grant GM_getValue | |
// @grant GM_setValue | |
// @match htt(p|ps)://*/* | |
// @exclude https://www.google.com* | |
// @noframes | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- use_module(library(chr)). | |
:- initialization(main). | |
:- chr_constraint is_true(+). | |
is_true(A) \ is_true(A) <=> true. | |
:- chr_constraint are_true(+). | |
are_true(A) \ are_true(A) <=> true. | |
:- chr_constraint is_false(+). | |
is_false(A) \ is_false(A) <=> true. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- initialization(main). | |
main :- recursive_simplify_expr(((x+y+1)^2 = (x-y)^2),Output),writeln(["Output: ", Output]). | |
%mul([add([mul([add([mul([x,x]),mul([x,y2])])]),mul([add([mul([x,y1]),mul([y1,y2])])])])])=0 | |
simplify_expr(mul([A|Rest]),mul([1|[A|Rest]])) :- | |
atom(A). | |
simplify_expr(mul([A]),A). | |
simplify_expr(A/B,A1/B1) :- | |
simplify_expr(A,A1),simplify_expr(B,B1). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- initialization(main). | |
:- set_prolog_flag('double_quotes','chars'). | |
:- use_module(library(chr)). | |
:- chr_constraint is_true/1. | |
is_true(X) \ is_true(X) <=> true. | |
is_true(X ==> Y),is_true(X1) ==> copy_term((X -> Y),(X2 -> Y1)),(X2=X1,(is_true(X1)->is_true(Y1));X2\=X1),writeln(Y). | |
is_true((X;Y)) ==> is_true(X);is_true(Y). | |
is_true((X,Y)) ==> is_true(X),is_true(Y). | |
is_true(is_true(X)) ==> is_true(X). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<input type="text" id="input_box"/> <button id = "speak">Click me</button><br/><br/>Repeat how many times:<input type="text" id="repeat"/> | |
<script type = "text/javascript"> | |
var speak = function(){for(var i = 0; i < document.getElementById("repeat").value; i++) | |
window.speechSynthesis.speak(new SpeechSynthesisUtterance(document.getElementById('input_box').value));}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%Since SWI-Prolog does not have a built-in implementation of closures, I wrote my own implementation here. | |
:- initialization(main). | |
:- set_prolog_flag('double_quotes','chars'). | |
main :- predicate_with_nested(1,C),writeln(C). | |
call_local(Definition,Params) :- | |
copy_term(Definition,(Params :- Body)), | |
call(Body). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- initialization(main). | |
:- set_prolog_flag(double_quotes, chars). | |
main :- | |
duplicate_code( | |
(G<A;A>B+1;C>D+1), | |
Output), | |
writeln(Output). | |
%find a duplicated term within a term |
OlderNewer