import time
#zwykla petla for
t0 = time.time()
for i in range(1000000):
a = 1
print("petla for: ", time.time()-t0, "ms")
/home/home/RapydScript/lib/parse.js:1368
throw "Failed Import: '" + key + "' module doesn't exist in any of the import directories: " + import_dirs.join(", ");
^
Failed Import: 'time' module doesn't exist in any of the import directories: ., /home/home/RapydScript/src/lib
from stdlib import time
(function(){"use strict";var ՐՏ_Temp;function ՐՏ_Iterable(iterable){if(Array.isArray(iterable)||iterable instanceof String||typeof iterable==="string"){return iterable}return Object.keys(iterable)}function ՐՏ_bind(fn,thisArg){var ret;if(fn.orig){fn=fn.orig}if(thisArg===false){return fn}ret=function(){return fn.apply(thisArg,arguments)};ret.orig=fn;return ret}function range(start,stop,step){var length,idx,range;if(arguments.length<=1){stop=start||0;start=0}step=arguments[2]||1;length=Math.max(Math.ceil((stop-start)/step),0);idx=0;range=new Array(length);while(idx<length){range[idx++]=start;start+=step}return range}function len(obj){var length;if(typeof obj.indexOf==="function"){return obj.length}length=0;for(var i in obj){length++}return length}function eq(a,b){var i;"\n Equality comparison that works with all data types, returns true if structure and\n contents of first object equal to those of second object\n\n Arguments:\n a: first object\n b: second object\n ";if(a===b){return true}if(Array.isArray(a)&&Array.isArray(b)||a instanceof Object&&b instanceof Object){if(a.constructor!==b.constructor||a.length!==b.length){return false}if(Array.isArray(a)){for(i=0;i<len(a);i++){if(!eq(a[i],b[i])){return false}}}else{if(Object.keys(a).length!==Object.keys(b).length){return false}var ՐՏ_Iter0=ՐՏ_Iterable(a);for(var ՐՏ_Index0=0;ՐՏ_Index0<ՐՏ_Iter0.length;ՐՏ_Index0++){i=ՐՏ_Iter0[ՐՏ_Index0];if(!eq(a[i],b[i])){return false}}}return true}return false}function ՐՏ_in(val,arr){if(typeof arr.indexOf==="function"){return arr.indexOf(val)!==-1}return arr.hasOwnProperty(val)}function dir(item){var arr;arr=[];for(var i in item){arr.push(i)}return arr}function ՐՏ_extends(child,parent){child.prototype=Object.create(parent.prototype);child.prototype.constructor=child}function ValueError(){ValueError.prototype.__init__.apply(this,arguments)}ՐՏ_extends(ValueError,Error);ValueError.prototype.__init__=function __init__(message){var self=this;self.name="ValueError";self.message=message};function ՐՏ_print(){if(typeof console==="object"){console.log.apply(console,arguments)}}var ՐՏ_modules = {};ՐՏ_modules["stdlib"] = {};(function(){var __name__="stdlib";var str;str=JSON.stringify;String.prototype.find=String.prototype.indexOf;String.prototype.strip=String.prototype.trim;String.prototype.lstrip=String.prototype.trimLeft;String.prototype.rstrip=String.prototype.trimRight;String.prototype.join=function(iterable){return iterable.join(this)};String.prototype.zfill=function(size){var s;s=this;while(s.length<size){s="0"+s}return s};function list(iterable){if(typeof iterable==="undefined")iterable=[];var result,i;result=[];var ՐՏ_Iter1=ՐՏ_Iterable(iterable);for(var ՐՏ_Index1=0;ՐՏ_Index1<ՐՏ_Iter1.length;ՐՏ_Index1++){i=ՐՏ_Iter1[ՐՏ_Index1];result.append(i)}return result}Array.prototype.append=Array.prototype.push;Array.prototype.find=Array.prototype.indexOf;Array.prototype.index=function(index){var val;val=this.find(index);if(val===-1){throw new ValueError(str(index)+" is not in list")}return val};Array.prototype.insert=function(index,item){this.splice(index,0,item)};Array.prototype.pop=function(index){if(typeof index==="undefined")index=this.length-1;return this.splice(index,1)[0]};Array.prototype.extend=function(array2){this.push.apply(this,array2)};Array.prototype.remove=function(item){var index;index=this.find(item);this.splice(index,1)};Array.prototype.copy=function(){return this.slice(0)};function dict(iterable){var result,key;result={};var ՐՏ_Iter2=ՐՏ_Iterable(iterable);for(var ՐՏ_Index2=0;ՐՏ_Index2<ՐՏ_Iter2.length;ՐՏ_Index2++){key=ՐՏ_Iter2[ՐՏ_Index2];result[key]=iterable[key]}return result}if(typeof Object.getOwnPropertyNames!=="function"){dict.keys=function(hash){var keys;keys=[];
for (var x in hash) {
if (hash.hasOwnProperty(x)) {
keys.push(x);
}
}
;return keys}}else{dict.keys=function(hash){return Object.getOwnPropertyNames(hash)}}dict.values=function(hash){var vals,key;vals=[];var ՐՏ_Iter3=ՐՏ_Iterable(dict.keys(hash));for(var ՐՏ_Index3=0;ՐՏ_Index3<ՐՏ_Iter3.length;ՐՏ_Index3++){key=ՐՏ_Iter3[ՐՏ_Index3];vals.append(hash[key])}return vals};dict.items=function(hash){var items,key;items=[];var ՐՏ_Iter4=ՐՏ_Iterable(dict.keys(hash));for(var ՐՏ_Index4=0;ՐՏ_Index4<ՐՏ_Iter4.length;ՐՏ_Index4++){key=ՐՏ_Iter4[ՐՏ_Index4];items.append([key,hash[key]])}return items};dict.copy=dict;dict.clear=function(hash){var key;var ՐՏ_Iter5=ՐՏ_Iterable(dict.keys(hash));for(var ՐՏ_Index5=0;ՐՏ_Index5<ՐՏ_Iter5.length;ՐՏ_Index5++){key=ՐՏ_Iter5[ՐՏ_Index5];delete hash[key]}};ՐՏ_modules["stdlib"]["str"] = str;ՐՏ_modules["stdlib"]["list"] = list;ՐՏ_modules["stdlib"]["dict"] = dict})();(function(){var __name__ = "__main__";var t0,a,i;var time=ՐՏ_modules["stdlib"].time;t0=time.time();for(i=0;i<1e6;i++){a=1}ՐՏ_print("petla for: ",time.time()-t0,"ms")})();})();
what Can I do to run this?
rapydscript index.py
(function(){"use strict";var ՐՏ_Temp;function ՐՏ_Iterable(iterable){if(Array.isArray(iterable)||iterable instanceof String||typeof iterable==="string"){return iterable}return Object.keys(iterable)}function ՐՏ_bind(fn,thisArg){var ret;if(fn.orig){fn=fn.orig}if(thisArg===false){return fn}ret=function(){return fn.apply(thisArg,arguments)};ret.orig=fn;return ret}function range(start,stop,step){var length,idx,range;if(arguments.length<=1){stop=start||0;start=0}step=arguments[2]||1;length=Math.max(Math.ceil((stop-start)/step),0);idx=0;range=new Array(length);while(idx<length){range[idx++]=start;start+=step}return range}function len(obj){var length;if(typeof obj.indexOf==="function"){return obj.length}length=0;for(var i in obj){length++}return length}function eq(a,b){var i;"\n Equality comparison that works with all data types, returns true if structure and\n contents of first object equal to those of second object\n\n Arguments:\n a: first object\n b: second object\n ";if(a===b){return true}if(Array.isArray(a)&&Array.isArray(b)||a instanceof Object&&b instanceof Object){if(a.constructor!==b.constructor||a.length!==b.length){return false}if(Array.isArray(a)){for(i=0;i<len(a);i++){if(!eq(a[i],b[i])){return false}}}else{if(Object.keys(a).length!==Object.keys(b).length){return false}var ՐՏ_Iter0=ՐՏ_Iterable(a);for(var ՐՏ_Index0=0;ՐՏ_Index0<ՐՏ_Iter0.length;ՐՏ_Index0++){i=ՐՏ_Iter0[ՐՏ_Index0];if(!eq(a[i],b[i])){return false}}}return true}return false}function ՐՏ_in(val,arr){if(typeof arr.indexOf==="function"){return arr.indexOf(val)!==-1}return arr.hasOwnProperty(val)}function dir(item){var arr;arr=[];for(var i in item){arr.push(i)}return arr}function ՐՏ_extends(child,parent){child.prototype=Object.create(parent.prototype);child.prototype.constructor=child}function ՐՏ_print(){if(typeof console==="object"){console.log.apply(console,arguments)}}(function(){var __name__ = "__main__";var t0,a,i;t0=Date.now();for(i=0;i<1e6;i++){a=1}ՐՏ_print("petla for: ",Date.now()-t0,"ms")})();})();
t0 = Date.now()
for i in range(1000000):
a = 1
print("loop for: ", Date.now()-t0, "ms")
I don't want to spam forum so I write here.
I don't know what I am doing wrong but RS is not working for me.
I have code directly from your github:
def greet():
alert("Hello World!")then i use:
rapydscript index.py > index.js
This is output:
(function(){"use strict";var ՐՏ_Temp;function ՐՏ_Iterable(iterable){if(Array.isArray(iterable)||iterable instanceof String||typeof iterable==="string"){return iterable}return Object.keys(iterable)}function ՐՏ_bind(fn,thisArg){var ret;if(fn.orig){fn=fn.orig}if(thisArg===false){return fn}ret=function(){return fn.apply(thisArg,arguments)};ret.orig=fn;return ret}function range(start,stop,step){var length,idx,range;if(arguments.length<=1){stop=start||0;start=0}step=arguments[2]||1;length=Math.max(Math.ceil((stop-start)/step),0);idx=0;range=new Array(length);while(idx<length){range[idx++]=start;start+=step}return range}function len(obj){var length;if(typeof obj.indexOf==="function"){return obj.length}length=0;for(var i in obj){length++}return length}function eq(a,b){var i;"\n Equality comparison that works with all data types, returns true if structure and\n contents of first object equal to those of second object\n\n Arguments:\n a: first object\n b: second object\n ";if(a===b){return true}if(Array.isArray(a)&&Array.isArray(b)||a instanceof Object&&b instanceof Object){if(a.constructor!==b.constructor||a.length!==b.length){return false}if(Array.isArray(a)){for(i=0;i<len(a);i++){if(!eq(a[i],b[i])){return false}}}else{if(Object.keys(a).length!==Object.keys(b).length){return false}var ՐՏ_Iter0=ՐՏ_Iterable(a);for(var ՐՏ_Index0=0;ՐՏ_Index0<ՐՏ_Iter0.length;ՐՏ_Index0++){i=ՐՏ_Iter0[ՐՏ_Index0];if(!eq(a[i],b[i])){return false}}}return true}return false}function ՐՏ_in(val,arr){if(typeof arr.indexOf==="function"){return arr.indexOf(val)!==-1}return arr.hasOwnProperty(val)}function dir(item){var arr;arr=[];for(var i in item){arr.push(i)}return arr}function ՐՏ_extends(child,parent){child.prototype=Object.create(parent.prototype);child.prototype.constructor=child}(function(){var __name__ = "__main__";function greet(){alert("Hello World!")}})();})();
I create a html file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript" src="index.js">
</script>
</head>
<body>
<script type="text/javascript">
</script>
</body>
</html>
And I have this error in browser:in index.js 1:3232
SyntaxError: missing ] after element list
Please help beacuse I must use your project and don't even know ho to print stupid hello world :(