Code Monkey home page Code Monkey logo

japt's Introduction

Japt

Japt is is a shortened version of JavaScript. Online interpreter

Basic programs

Hello, World!

"Hello, World!

In Japt, the last expression is automatically outputted. Also, when you have a string literal at the end of the program, you can leave out the ending quotation mark and it will be automatically inserted.

Even shorter:

`HÁM, W�ld!

(Note that the should be code point U+008E.)

Japt uses the shoco library for string compression. Wrapping your text in backticks ` instead of quotation marks " tells the interpreter to automatically decompress the string. And like quotes, if you have a backtick at the end of a program, you can leave it off.

Greeting

"Greetings, {U}!

Let's move on to input: the first few inputs (up to six) are stored in the variables U, V, W, X, Y, and Z. In case that's not enough, the entire input is stored as an array in N.

Also shown here: curly braces inside the string tell the interpreter to evaluate the innards as Japt code. For example, "abc{U}xyz" transpiles to "abc"+(U)+"xyz".

Again, with compression:

`GÎ>Ä�, {U}!

(Note that this time, the should be code point U+000F.)

cat

N

Since all input is stored in N, and output is implicit, all we have to do is call N to output all of the input.

Quine

1

Taking advantage of Japt's automatic output, any single number is trivially a quine. But what fun is that? Let's try a better one:

"+Q ³s7J"+Q ³s7J
"+Q ³s7J"            // Take this string,
         +Q          // add a quotation mark,
            ³        // repeat it 3 times,
             s7J     // and slice off the first 7 chars and last 1 char. (J = -1)

New Syntax

The syntax of Japt is much the same as JavaScript; in fact, after transpilation, it is evaluated as normal JS. Here's the specialties:

Parentheses and spaces

When transpiling, each right parenthesis ) is doubled )), then each space is replaced with ). This helps to save space when nesting function calls. Also, if you have extra parentheses next to semicolons or at the beginning or end of the program, you can leave them out. The interpreter will catch on and add them when transpiling.

Variables

All uppercase letters are pre-defined to different values. A-L are numbers, M is the Math object, P-S are text-related, and U-Z are the first six inputs. Besides keeping variable-related things simple, this also allows us to shorten syntax even more with...

Variable functions

A variable or literal of any sort can be followed by a lowercase letter. This will automatically transpile to a function call. For example, "abc"q becomes "abc".q(, which functions as "abc".split(. 23s2 transpiles to 23 .s(2), or 23 .toString(2); "asdf"s1,3 transpiles to "asdf".s(1,3), or "asdf".slice(1,3).

Since most of these functions return values, you can chain them: "abcdefghij"s2,6 n36 transpiles to "abcdefghij".s(2,6).n(36), or "abcdefghij".slice(2,6).toNumber(36).

You can also leave out commas between arguments, as long as they're not two literal numbers. UtV2 transpiles to U.t(V,2).

Single char and char-code shortcuts

If you need a string made of a single char, you can type an apostrophe, then the char, like 'a. This transpiles to "a", which can be used exactly the same as all other strings. Similarly, #a transpiles to the character code of a, or 97. If you need a large number (>= 100), this is probably the cheapest way to attain it.

String interpolation

Thanks to the power of the regex, you can use ES6's string interpolation in Japt! Anything inside curly braces in a string is evaluated as actual code. For example, "abc{U}xyz": transpiles to "abc"+(U)+"xyz". If you need to use actual curly braces in the string, just precede the left brace with a backslash, like so: "abc\{U}xyz"

Need to return one of two different strings, using a?b:c syntax? No problem! You can omit the two middle quotation marks. E.g. U==1?"abc":"xyz" can be shortened to U==1?"abc:xyz". But what's that? One of the strings already contains a colon? Well, there's a remedy for that, too! Just precede the colon with a backslash. U==1?"abc\:123:xyz" transpiles to U==1?"abc:123":"xyz".

Oh, and one more thing: if you have a string literal at the end of a program, you can leave out the final quotation mark, and the interpreter will automatically insert it for you.

String compression

Japt uses the shoco library for string compression. You can access this in a few ways:

  • Using Oc"text to compress", you can compress the text to save bytes.
  • Using Od"text to decompress", you can decompress the pre-compressed text.
  • Wrapping your text in backticks ` instead of quotation marks " tells the interpreter to automatically decompress the string.

Unicode shortcuts

Japt code can be compressed, similarly to its strings. The most commonly used runs of characters are mapped to Unicode points, starting at ¡. A full list of these can be found at the online interpreter.

Anonymous functions

With ES6, we got the new fat arrow operator =>, which quickly and concisely defines a function. In Japt, the equivalent is {, with any number of uppercase letters preceding it as arguments. For example, XY{X+Y} defines a function that takes in two arguments, and returns the result of adding them (or concatenating them, if one is a string).

There's also two shortcut operators:

  • @, which stands in for XYZ{. UrXY{X+Y} can be reduced to Ur@X+Y}.
  • _, which stands in for Z{Z. UmX{Xc} can be reduced to Um_c}.

Also, when performing a single-char operation as a function, you can usually just reduce the function to one or two chars:

  • When doing something like UrXY{X+Y}, you can simply use the operator: Ur+
  • When the arguments are reversed, like with UrXY{Y-X}, just prefix the operator with an exclamation point: Ur!-
  • When using a single prototype function, e.g. UmX{Xc}, just use the letter: Umc
  • When you need to preform the operator or function with a fixed value or variable, e.g. UmX{Xp2}, use the value after the operator: Ump2
  • When you need to switch the two values, e.g. UmX{2pX}, prefix the function with an exclamation point: Um!p2

Pure JS

Have a task that Japt just can't handle yet on its own? Well, the good news is, you can call pure JavaScript code inside a Japt program! Anything between dollar signs $...$ will be preserved through the compilation process. For example, Japt doesn't actually have for loops yet, so you could use something similar to $for(Z=0;Z<A;Z++)$ instead.

japt's People

Contributors

andrewsav avatar drakari avatar etheryte avatar jmariner avatar petershaggynoble avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

japt's Issues

Japt Corpus

Similar to this issue, I decided to run Lynn's method on Japt answers.

Query used. Code is the same as the Vyxal corpus. Results:

2-graphs:
 109  f
  98  m
  92 U 
  92 V 
  82 &#
  76 c 
  73 #1
  69 }a
  67 X 
  66 â 
  64  +
  60  x
  52 pU
  52 x 
  51 o 
  50  r
  50 1 
  49 " 
  48  ®
  48  c
  47 +U
  46 n 
  45  g
  43 r"
  43 k 
  42  l
  42 2 
  41  ¬
  41 XÃ
  40 +"

3-graphs:
  73 &#1
  24 #14
  21 #13
  19  f_
  19 r"%
  17 #15
  16  â 
  16 å+ 
  14 "iQ
  14 iQ 
  14 }a@
  13  á 
  13 â Ê
  13 òV 
  13 Q ²
  13 }jU
  12 ò¦ 
  12  f@
  12 ...
  12  fÈ
  12 ?X:
  11 Ãc 
  11  w 
  11  c 
  11 U}a
  11 gV 
  11  +U
  11  fj
  11 }iU
  11 mx 

4-graphs:
  24 &#14
  21 &#13
  17 &#15
  14 "iQ 
  11 iQ ²
  10 &#12
   8  fj 
   7  mx 
   6 #158
   6 158;
   6 W&#1
   6 `HÁM
   6 ©ÒßU
   6  &#1
   6 #131
   6 131;
   6 `&#1
   6 #128
   6 128;
   5 à f_
   5  f_x
   5 #142
   5 142;
   5  ¬v1
   5  f@¶
   5 f@¶X
   5 ò¦ m
   5 ?U:ß
   5 _x ¥
   5 #&#1

Auto-shorten code

I suggest, that there should be somewhere a button, which would automatically convert long sentences to Unicode shortcuts. It would help golfing faster and also prevent missing some opportunities to shorten the byte count.

Array.z() ignores input other than 1,2,3

Array.z(), the rotation function, ignores input values other than 1, 2, or 3. For example, the program

Nz0 qR

when run with an input of

[0 1 2]
[3 4 5]
[6 7 8]

returns:

6,3,0
7,4,1
8,5,2

The obvious expected result would be

0,1,2
3,4,5
6,7,8

This will be fixed in a few minutes.

Add ð method for strings

A request for an S.ð(f?) method, which, like the same method for arrays, would return an array of indices of the characters that return truthy when passed through f.

Change Return Value of 0.ì()

Currently N.ì() returns an empty array when N=0 but it might be more useful if it instead returned [0].

I know I brought this up before but I promptly forgot my use case for it! Another one I've come up with, though, is on a recent challenge where we needed to convert digits to words (e.g., 0 -> zero) and I was trying to use A.g(N.ì()) to do so.

Create a custom encoding

The ISO-8859-1 encoding has many unprintables: 0x00-0x1F, 0x7F-0x9F, and 0xAD, for a total of 66. That's more than a quarter of all possible byte values left unusable. Also, the current range of Unicode shortcuts is pretty inconvenient because very few of the shortcuts actually resemble what they represent.

So I'm going to create a custom encoding, sort of like Jelly's. The current plan for the encoding is:

   x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
0x
1x
2x     !  "  #  $  %  &  '  (  )  *  +  ,  -  .  /  (0x20 is literal space)
3x  0  1  2  3  4  5  6  7  8  9  :  ;  <  =  >  ?
4x  @  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O
5x  P  Q  R  S  T  U  V  W  X  Y  Z  [  \  ]  ^  _
6x  `  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o
7x  p  q  r  s  t  u  v  w  x  y  z  {  |  }  ~  ¶  (0x7F is also newline)
8x
9x
Ax
Bx
Cx
Dx
Ex  à  á  â  ã  ä  å  æ  ç  è  é  ê  ë  ì  í  î  ï
Fx  ð  ñ  ò  ó  ô  õ  ö  ÷  ø  ù  ú  û  ü  ý  þ  ÿ

Unassigned chars:

⁺ ⁻  (unary + and -; + and * in regex)
₊ ₋  (++ and --)
“ ”  (strings)
ʽ    (backslash: “aʽnb”)
‹ ›  (regex: ‹ ʽv⁺.›; interpolation: “‹U›spooky‹U+2›me”)
« »  (<< and >>)
≤ ≥  (<= and >=)
≈ ≠  (== and !=)
≡ ≢  (=== and !==)
⁽ ⁾  (`((` and `) `)
₍ ₎  (`(((` and `))`?)

Regex replacements:

+ * +? *? ? (a) (?:a) (?=a) (?!a) [ [^ ] { } \
⁺ ⁻ ₊  ₋  ¿ “a” “a„   ‟a”   ‟a„   « ⁽  » ≤ ≥ ʽ

Safe "wrapping" non-ASCII chars:

«»‘’“”‟„‹›⁽⁾₍₎≤≥

(plus a bunch of mathematical operators in the same vein as ≤≥, none are currently planned though)

Any detail may change at any time. Of course, suggestions are welcome.

Function Methods that run until result stops changing

Two new function methods that work similarly to F.g() and F.h() that only take an array as input, no number, and run until the result returned by F is equal to the last element in the array.

Maybe a third one, too that, instead of returning the (last element in the) array, returns the number of iterations it takes to complete.

Add f? to A.v

Currently, A.v simply returns the first element. Optionally feeding the result through f? would make it behave more like other methods and save some bytes too.

For example, with .m, you can do

[1,2,3]m+1

Currently, with .v, you have to do

[1,2,3]v +1

Adding an optional function would allow us to save one byte:

[1,2,3]v+1

The same argument could be made for a number of methods that don't currently take arguments.

Array.y() cuts off if an item is longer than the previous

The array transpose function y swaps the array's rows with it's columns. For example, the program

Ny qR

with an input of

[0 1 2]
[3 4 5]
[6 7 8]

outputs

0,3,6
1,4,7
2,5,8

However, this does not work if one of the items is longer than the one before it. As an example, the above program run with input

[0    ]
[3 4  ]
[6 7 8]

outputs

0,3,6

when the correct output would be

0,3,6
,4,7
,,8

Test it here

The current setup for this function is based on .map. I think it would be better to create a double for-loop that loops through each x and y in the 2D array, putting the item at (x:y, y:x) in the new array. If the array is full of strings, this will also require filling each item in the new array with a space, then joining them after the loop.

Update shortcut for reducing by multiplication

With the need to provide an initial value to A.r() removed a while ago, the × shortcut could probably be updated to transpile to r'*<space>, which would allow it to be used as an auto-function.

Update .á() to be non-recursive

The current implementation of .á() is recursive and grows slow very fast as N increases.
It would be great to update it with a faster implementation, namely this one based on Heap's method, which is faster than any other algorithm suggested in the Stack Overflow thread.
Additionally, it might benefit the interpreter to offload this operation (or why not all of the execution) to a web worker.

Parens balancing algorithm needs several improvements

Found while solving this PPCG challenge.

Real example: (link)

[]L³õ@pXk cXì)ø7 ?UgV++ :X
s7p7 -A,7p7

Transpiled code:

U = [], L.p(3).õ(function(X, Y, Z) { return U.p(X.k().c(X.ì()).ø(7) ? U.g((V++))) : X }); U.s(7 .p(7) - A, 7 .p(7))

Since the parens are not balanced inside ?: operator, SyntaxError is raised.

Erasing the space results in erasing two closing parens at the end of V++, so the SyntaxError persists.


There is another problem regarding ?: ternary operator: the balancing algorithm treats it as any other binary or unary operator. As a simple example, Japt code xA?(B:C transpiles into U.x(A ? (B : C)) which is clearly a syntax error. The algorithm should consider the ?...: region as an isolated context, so the parens are always balanced inside the region.

A.c() adds unnecessary elements to the returned array

Example program:

[['H]['H]]c

Expected output (with -Q):

["H","H"]

Actual output (with -Q):

["H",null,null,"H",null,null]

Using -R instead shows two functions, namely Array.prototype.contains and Array.prototype.sortBy.

Reproducible on v2.0a0. The function works as expected on v1.4.5.

Possible cause:

japt/src/japt.js

Lines 775 to 779 in 90d1401

if (this[i] instanceof Array) {
var q = this[i].c();
for (var j in q)
f.push(q[j]);
}

Possible solution: f.push(...q); or check if the index is a number.

Random Question about Random Numbers

Hello,
I really like how condensed Japt makes JavaScript. So, I was attempting to learn Japt but got confused. The code Mr1,4 from what I understand should give me a random number between 1 and 4. Instead I get numbers bigger than 4. Am I misunderstanding something? I tried to read through the source code but did not help me figure it out.

S.e() uses the 'g' flag by default

As it's currently written, "abcdef"e".."@OpZ;Xg (repeatedly replace /../ by outputting the current string and returning the first char) will output

abcdef
abcdef
abcdef
ace
ae

While the desired output is

abcdef
acdef
adef
aef
af

I believe this has something to do with the internal regexify function handling the flags itself rather than letting each function handle its own flags.

Old hyperlinks cause 404

The hyperlinks used to be generated like so:

This worked fine when the page was hosted in the ethproductions.github.io repo. However, ever since I moved it to a gh-pages branch in this repo, this style of link has been bringing up a 404 error. This alternate link does work as expected:

Notice the extra slash after "japt". I think this could be fixed by creating a custom 404 page that redirects the browser if the link is wrong.

Array.o() infinite loop

The Array.o() function runs in an infinite loop if the argument given to it is both

  • > 1
  • not an integer

For example, [1,2,3]o1.5. This seems to be due to the fact that the loop used in that function relies on the counter becoming equal to zero, and that never occurs with a non-integer value.

Add wrappers for Function.prototype.call() and Function.prototype.apply()

When a function is stored into a variable, say U, there is no simple way to call it, especially with arguments. It is because, if you type U(, the transpiler inserts a comma between U and (. But vanilla JS has a couple of handy tools for that:

Since plenty of slots are still available for Function.prototype in Japt, I suggest to add these two methods as one-char aliases.

In place of apply, there is a more general alternative: F.d(x) = F(...x). This not only spreads array elements, but also individual chars of a string. It's a useful tool to have in vanilla JS for something like Math.max(..."12345") which calculates the largest digit of a number (though I can't think of use cases in Japt right now).

Function declarations other than { are ignored during look-aheads

The transpiling of functions (usually) takes the section of code between a curly-bracket and its match on the other side (or the end of the program, if there is no match). For example:

UmX{XmZ{Za}1

transpiles to

U.m(function(X){return X.map(function(Z){return Z.a()},1)})

However, if you use a function started by @ or _ inside another function, then place something after the inner function, it gets moved to outside the function:

UmX{Xm_a}1
U.m(function(X){return X.map(function(Z){return Z.a()},1)})  // should become this
U.m(function(X){return X.map(function(Z){return Z.a()})},1)  // becomes this instead

Note that this version still works; it just doesn't work in the way you would expect it to. This bug should be fixed in a few minutes.

JavaScript to JAPT

It would be really cool to have a JS to JAPT converter as I am finding JAPT difficult to understand because, well, it is a golfing language 😛

Thanks!

Default inputs

As it stands U-Z all default to 0. Would it be possible to change those defaults to something else, with each parameter being different?

This would give room for 6 new variables/shortcuts, presuming, of course that no arguments are passed through them.

I haven't given much thought to what the new defaults could be yet but one possibility might be an empty array of length U, equivalent to [...Array(U)] in ES6. Unless I've missed a trick, which could well be the case after less than 24 hours working with it, there's currently no shortcut for that in Japt.

Proposal for Saving Bytes

Looking at the source for Japt, it appears to be the case that Japt has a lot of unused single-bytes ISO-8859-1 tokens; if this is the case, then perhaps you can devote a few of them as transpiling with a fixed arity. I'm still not entirely sure how Japt performs transpilations (I'd have to read the source a few more times to fully understand it), so I'm not sure if you can have fixed arities. If you can, this will often shave a byte in an expression.

You still seem to have these characters open:

 Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ

I propose that þ transpiles to c(space) and that ß transpiles to s(value)(space). Again, I'm not sure if the latter is possible, but if it is, then it would save you bytes in many situations.

Default Parameter for S.å(f)

More often than not, S.å(f) is used to get the prefixes of a string, which is achieved by passing + as the argument. As this is the most common use case, it might be a good idea to have f default to + if no argument is passed.

Cannot specify whether to access v1 or v2 of specific commit

A simple oversight I just noticed while writing another issue. If the commit hash happens to start with 2, it will use the v2 version; otherwise, it uses v1.

This could be fixed by using something along the lines of v2:0f25ac3 to specify to use v2 of a specific commit.

Mathematical Operations on Arrays

This may be completely infeasible but, other than +, when a basic mathematical operator is applied to an array of 2 or more elements, it results in NaN. I wonder, instead, would it be possible to apply the operation to each element in the array, foregoing the need to apply the map method to apply the operation on each individual element?

`Error: Japt.stdout must be sent to an HTMLElement`

I tried to run @ETHproductions' program for my nested programs challenge (try it online: http://ethproductions.github.io/japt/?v=master&code=YHDOQyLDAHQoJ1NUT1AhJyki&input=), and I got this error:

Error: Japt.stdout must be sent to an HTMLElement

The code was all correct. Apparently it's a bug in the interpreter.

The Stack Exchange chatroom is frozen, and I don't think ETHproductions is active on SE, so I'm posting this bug as an issue there.

Browser used is latest Firefox (Mozilla/5.0 (Windows NT 6.0; rv:45.0) Gecko/20100101 Firefox/45.0). Also, apparently, this bug makes all programs fail (see: http://ethproductions.github.io/japt?v=master&code=W1UsVipXZyAsV2cxXXFT&input=ImFiYyIgMTMgWzkgInp5eCJd).

Fixed arity functions

[tag:feature-request]
Fixed-arity functions will omit the need for lots of spaces and could help golf a lot of bytes

On à And The Empty Array/String

Recently A.à() & S.à() were updated to include the empty array and string. Definitely useful to have but there are still occasions when they're not needed but, because they're the last element in the array, the shortest way to remove them is to filter by length with .

I propose, instead, that they be added at the beginning of the array so we can slice them off with Å, thus saving a byte.

Characters without meaning should be interpreted as strings

This is more of a feature-request but my idea is: characters that would throw a syntax error, should be converted to strings:

*+UqR 
"*"+UqR

Like in this example, the * operator would never at the very start of a program so it can be considered a string.


Another example, this time with emojis

U===🦄
U==="🦄"

because I can't imagine a case where a unicorn would be in the middle of a program

Default Parameter for N.e()?

N.e() might benefit from a default being assigned to its n parameter.

I don't know what the best option is, though as N.e(1)=N*10=N*A and N.e(2)=N*100=N*L and anything above 2 would just seem arbitrary.

Filtering Permutations & Combinations

On a recent challenge I needed to get the combinations of an array and then filter them, which got me thinking that an additional, optional function parameter for à & á to apply the filter directly, without the need for f, would be handy. And, in most cases, would save 2 bytes.

I had also considered that maybe making that function parameter a map rather than a filter might be more useful. Apart from my immediate use-case, I couldn't come up with an argument for one over the other but, seeing as the n parameter of those methods is also a filter, of sorts, a filter does probably make most sense.

Add a method to get the N-th lexicographical permutation

In some cases, it's favorable to get a single permutation instead of finding all the permutations, especially for large N.

I've written a sample implementation based on this article:

// Input: Number
// Output: Array of the factoradic representation digits of the input
function factoradic(n) {
    var f = [];
    for (var i = 1; n > 0; n = Math.floor(n / i++)) {
        f.push(n % i);
    }
    return f.reverse();
}

// Input: Array, Number
// Output: N-th lexographical permutation of the input array
function nthPermutation(a, n) {
    var p = [];
    var fac = factoradic(n);
    var copy = a.slice();
    for (var i = 0; i < fac.length; i++) {
        p.push(copy.splice(fac[i], 1)[0]);
    }
    return p;
}

Add a shortcut for XYZ{X

This got me to thinking that it might be handy to have a shortcut for XYZ{X, similar to @ for XYZ{ and _ for Z{Z ( maybe?), with a corresponding shortcut for m™.

Function Arguments in N.õ()

Currently, unlike the other number range methods N.õ() can only accept f as its first or third argument but not its second (e.g. Aõ1_+1 - expected output [2,3,4,5,6,7,8,9,10,11]).

It seems that this is due to the other methods relying on N.o() but N.õ being its own, self-contained method and should be fixable by adding:

if (typeof y === "function")
    f = y, y = undefined;

Update interpreter with char-by-char algorithm

For version 2.0, the interpreter will need to be upgraded from a regex-replacement algorithm to a character-by-character digestion algorithm. There will be numerous advantages to this:

  • The current value can be tracked (Don't think this is realistically possible without switching to an algorithm that actually performs the proper action as it goes over each char.)
  • Lowercase letters can be replaced by their built-in JS counterparts in real-time (Not realistically possible for the same reason as above.)
  • No-arg functions (e.g. l on all three value types) can have the following space removed (Somewhat possible; see issue #19 for details.)
  • Custom functions A{...} will be possible
  • Plus many more...

License terms

According to GitHub, repos without a LICENSE file are copyrighted. Since this repo is such, did you intend for it to be copyrighted? The readme does not state anything about it so I was just curious. Thanks.

Key characters in strings are not ignored during look-aheads

When the transpiler comes to a key character, such as [ or {, it looks ahead until it finds the matching one. It also runs through multiple levels, so for example [A[B]C] ends after the C instead of before it. However, some of these characters are mistakenly recognized in strings, resulting in some annoyingly wrong transpilations. Here's a few examples: (code, should become, instead becomes)

"123[456"
"123[456"
"123

Test it here

The [ is somehow interpreted as the beginning of an array. Currently, an array without a ] is not transpiled at all, although this should be changed as well.

A={"123}456"
A=function(){return "123}456"}
A=function(){return "123"},456,""

Test it here

When the transpiler reaches the }, it thinks it has found the end of the function. This is actually a cool feature, because it means closing quotes are not necessary in functions, but it also means that it's near impossible to include a } in a string in a function.

'(
"("
"(")

Test it here

This is a result of the transpiler trying to match up pairs of parentheses. Similarly, ') transpiles to (")". These two bugs may actually be completely separate from the rest, but the result is similar enough that I'm including it here.

Line Breaks in Transpiled Code

The transpiled code is a great tool for helping debug a programme but, for some reason, I often struggle to find the section I want when writing multi-line programmes.

Would it be possible to have the transpiled code preserve the line breaks in a programme? I'm assuming the fact that it doesn't is a holdover from the days before Japt could handle multiple lines and that it's a simple "fix"?

Overloading Base Conversion Methods

The following additions to S.n() , A.ì(), N.s() & N.ì() would be handy to have:

  • S.n(x,x) / A.ì(x,x): convert from base x1 to base x2.
  • S.n(x,f) / A.ì(x,f): convert from base x, apply f and convert back to base x.
  • S.n(x,x,f) / A.ì(x,x,f): convert from base x1, apply f and convert to base x2.
  • N.s(x,f) / N.ì(x,f): convert to base x, apply f and convert back to integer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.