tomtheisen / stax Goto Github PK
View Code? Open in Web Editor NEWStax Golfing Language
License: Other
Stax Golfing Language
License: Other
Instead of rot13, I think it would be more useful to have a general caesar cipher with str num
as arguments.
^ there doesn't seem to be any comments in the code..
z|m
should get the minimum value of an array. I'm not sure what the correct result is for an empty array, but certainly not crashing the debugger with "Stax runtime error: Cannot read property 'every' of undefined". Maybe infinity?
It'll therefore treat any zero as 32. Not very nice.
If I press Esc to abort a program while the Quick Reference bar is open, it closes the Quick Reference bar. While there is another way to close the Quick Reference bar (F1), I haven't found another way to abort the program without clicking the button. It overrides the only and documented way to abort the program by an undocumented second way to close the Quick Reference bar, which is quite annoying.
& arr int any conflicts with & arr int block
& arr arr any conflicts with & arr arr block
When & arr int any gets a negative integer bigger than array's size the program's behavior is unspecified. arr int int any form excludes negative indices so the problem does not occur.
https://staxlang.xyz/#c=VaP%0A%22abcdef%22Va%7Cbd%0AVaP&i=&a=1
VaP
"abcdef"Va|bd
VaP
produces
abcdefghijklmnopqrstuvwxyz
ghijklmnopqrstuvwxyz
The correct behavior is to repeat the complete alphabet twice.
The program "foo"cU*d
copies the string "foo"
, reverses it by multiplication, then discards the copy. What's left should just be foo, but it's oof.
While the document says "flatten the array once", current implementation sums elements if the first element of the array is a number, illustrated by this.
Illustrated here. Only the first and the second inputs works correctly. According to Mathematica and others, all of them should return 0
.
Calling the :P
and :p
(and maybe others, I don't know) directly outputs the prime instead of putting it on the top of the main stack.
I've made a generator which repeatedly run-length encodes an array for this here: https://staxlang.xyz/#c=%7B%7B3%3Cm%7CA_%251%3D%21*%7Dgf%3AG&i=[1,2,2,1,1,2,1,2,2,1,2,2,1,1,2,1,1]%0A&m=2
How do I prevent shorthand mode and make it push intermediate results to stack? I'm not sure how to do it from the tutorial.
In this program, stax asserts that [[7],[0]]
and [7,0]
are equal. Is this intentional, or a bug?
From this online run it can be seen that D
is changing the main stack, the input stack, and the X and Y variables. This behavior is undocumented and either this is a bug or the documentation is incomplete.
It would be useful to have date and time returning variables/ function for those types of challenges.
For reference, I wanted to solve this.
Such a feature exist in many other stack-based golfing languages.
The Stax interpreter doesn't seem to work at all in Safari: Permalinks don't load any code, the buttons basically do nothing and it is overall unresponsive.
On staxlang.xyz
Code: {}"a":[
Expected: Stax runtime error: macro not found for types in :[
Actual: Stax runtime error: macro not found for types in [
I spent an hour tracking this down because I couldn't figure out what instruction was faulting.
Here's where the bug is happening. It happens every single time the program is run with an input of 1. The debugger shows that the inputs are 1 and 0 on the stack.
The tab is also frozen and cannot be reloaded.
The program zP2Rc]@
produces no output when run.
But when stepping, it produces an error output.
Ideally, a no-op infinite loop should be achieved by a single letter W
. However, this does not work in the current version of Stax and gives a error about trying to pop an empty stack.
Here is a repro.
When a string literal containing Unicode characters has to be used, the whole Stax program cannot be packed no matter how long it is. There are many solutions to this. Adding Base64 encode/decode is just one of them.
10
pushes 0
instead.
For the content in LICENSE.md, it allows others to do anything they want. There is an existing license for that.
It instead finds one of the elements with the longest run. So for input [1,2,3,3,3,1,2,1,2,1]
it returns 3
instead of 1
because although 1
appears four times, 3
has the longest run of length 3. Not sure whether it's a bug with the program or an issue with the documentation.
Not long ago I wanted to do a matrix transpose. I searched the document but could not find an instruction to do that. I can't believe that it is not implemented in Stax, so I checked the source code and found the instruction I need. It's M
. I think I am going to live with it if this is the only instruction missing in the document.
Just now I tried to do factorization of a composite number, and again find that there are no such instructions in the document. I looked into the source and found the instruction |f
. I don't know how many more are missing and I suggest making a thorough semi-automatic check over the source code to ensure that all available instructions have been properly documented.
In addition, some spurious quotation marks in the "Constant" section of the document should be removed. I have seen a recent commit removing the quotes for VI
and Vi
, but the quotes for Ve
should be removed as well, for example.
A final issue on the document is, the document does not say whether it is possible to have a fraction literal, or how to embed one in the code. I know that I can write it in the input as a/b
but even this (albeit somehow obvious) is not documented as well.
That said, I think the documentation of Stax is already much better than that of many golfing languages I have seen. I just want to make it even better.
There is an extra issue which may just as well be submitted as a separate issue. The Javascript version of Stax hangs if I run |f
on 2147483647
. It is a prime, but it is not too large and can be handled properly by a normal Javascript code that does not use the bigInteger
type to factorize a composite number.
Stax really needs a random number generating function.
One should probably be deprecated.
This program produces different results depending whether you're running or stepping.
v'_{Vl|&5/i@{97<m:bVa@}R
Use _
for the input.
A feature request for a builtin that calculates e^x.
On this machine 18RS%
errors with too much recursion. This should be reasonably possible to calculate.
It would be useful to have date and time returning variables/ function for those types of challenges.
For reference, I wanted to solve this.
Code snippet
Comment line
iP
with input "abc" should produce output "abc" but produces output abc.
in the form {...gf
currently Stax asks for a filter block. Instead, it can assume that {}
is the filter to save bytes on the generator.
I think this may not be the only command that is faulty. To reproduce, clink here.
Right now if I type a double quote in the input area and append an arbitrary letter to it, and use arbitrary single letter command as the code, the online interpreter would hang. Explicitly suppressing implicit eval provides a workaround to the issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.