[#]JavaScript is a weird language; it has #bigint, but it doesn't have a function that returns a number of bits in the bigint. Neither it has #log2 function for the bigints. If you need a workaround for the problem, see the article https://medium.com/@sergeyshandar/improving-the-log2-algorithm-for-bigint-in-javascript-7e5692e7bf0b?sk=9ac18367f61b524704cc8d82707aed3d
=> More informations about this toot | View the thread
Modern ECMAScript WTF: Do you expect that export const myObj = 42
is equal to export default = { myObj: 42 }
? Wrong! default
is a "special" namespace... #javascript #ecmascript #esm #module
=> More informations about this toot | View the thread
From today, FunctionalScript source code are ES modules. Published on NPM and JSR. https://github.com/functionalscript/functionalscript #functionalscript #npm #jsr #javascript #ecmascript #esm #module
=> More informations about this toot | View the thread
Does anyone know how to make a fast log2 function for bigint in JavaScript?
I know that JS VM can do it in almost O(1) because it has information about the size of bigint. My current best algorithm is O(log(n)). The algorithm performs faster than x.toString(2).length and consumes less memory. Do you have any ideas for improvement?
https://github.com/functionalscript/functionalscript/blob/a9a1cd2c1b0f4c025faf2223eb6ff96f48e8374b/types/bigint/module.f.cjs#L65
[#]JavaScript #bigint #log2 #Algorithm
=> More informations about this toot | View the thread
Just an idea for the future ECMAScript proposal: UTF8 literal. The literal should have the prefix u
. For example, u"Hello!". The literal automatically converted into
bigint. For example,
u"Hello"will be converted into 0x1_6F_6C_6C_65_48n. LSB first, the most significant byte is 1 as a terminal symbol. The
===` will work, but ordering (<,>) is not lexicographic. The good thing about this literal is that there is no need to change a JavaScript VM, only its parser. #JavasScript #utf8 #ecmascript
=> More informations about this toot | View the thread
NaNVM re-architecture plan https://medium.com/@sergeyshandar/nanvm-re-architecture-8097f766ec1c?sk=d14ec1daf73ac5442f12ce20b2bc037a #functionalscript #vm #JavasScript #rust
=> More informations about this toot | View the thread
I may skip adding Uint8Array
and other typed arrays to FunctionalScript because bigint
is a good enough representation of a sequence of bits. #javascript #ecmascript #bigint #typedarray
=> More informations about this toot | View the thread
Now the functionalscript/html module recognizes void elements at run-time: https://github.com/functionalscript/functionalscript/pull/280/files#diff-455482d2c63fb17913906d003fabb67dc33b9e7784882fe887ce0162e8f0248e
[#]javascript #html #FunctionalProgramming
=> More informations about this toot | View the thread
I also create art. It helps me think. For example, I draw hash maps: https://raw.githubusercontent.com/sergey-shandar/public/refs/heads/main/notes/hash-map-256.md #hashmap #art
=> More informations about this toot | View the thread
=> This profile with reblog | Go to functionalscript@techhub.social account This content has been proxied by September (3851b).Proxy Information
text/gemini