Coder Social home page Coder Social logo

vyxal / vyxal Goto Github PK

View Code? Open in Web Editor NEW
267.0 5.0 30.0 64.73 MB

A code-golfing language experience that has aspects of traditional programming languages - terse, elegant, readable.

Home Page: https://vyxal.github.io/

License: MIT License

Python 2.98% HTML 0.82% CSS 0.63% JavaScript 5.68% Scala 89.89%
golfing-language readability conciseness vyxal golfing programming-language code-golf stack-based stack-based-language esolang

vyxal's Introduction

Vyxal 3 - Better than Ever

If you are looking for version 2 of Vyxal, you can find it here

Vyxal is an stack-based esoteric array language that is dedicated to dominating competition in code golf challenges. This means that it strips away all need for boilerplate, long function names and impractical source layouts. However, it also has a more traditional and familiar way of expressing itself if needed. Vyxal 3 is the third major iteration of the language that drives home this key design goal. Here's how.

What's the Same as Version 2?

Vyxal 3 is still a stack based programming language that uses a Single Byte Code Set (SBCS) for scoring well in code golf. It also retains some of the key features of version 2, such as contexts, modifiers and many, many type overloads.

It also maintains the more prac-lang-centric features such as variables and comments that version 2 has.

That's about it.

Because here's what's new in version 3

Literate Mode

Ever wanted to write vyxal without needing an on screen keyboard or editor shortcuts? Well now you can! Literate mode is designed to allow you to write vyxal 3 programs in complete ascii while maintaining a SBCS score. It does this by simply converting the literate code into sbcs code. Wanna see it in action?

## A collatz conjecture program
stdin := n ## read the input into n
(. scan-fix: {if even? then halve else triple increment end}) := collatz
$n $collatz call

Try it Online!

turns into:

?#=n⸠ᵡλ#{e|½|Tꜝ}}#=collatz#$n#$collatzĖ

(Try it Online!)


## The classic fizzbuzz
100 map{
  n [3, 5] divides?
  "FizzBuzz" halve
  dot-product maximum
} join-on-newlines

(Try it Online!)

turns into:

100Mλn#[3|5#]Ḋ"FizzBuzz"½ḋG}ṅ

(Try it Online!)


## How about something that generates all the fibonacci numbers?
## Like actually all of them

relation add from [1, 1] end

## is it really that simple?!

(yes!)

turns into:

Ṇ+|#[1|1#]}

(Try it Online!)

Isn't it snazzy? You can finally do well at golf without needing to smash your head on a weird looking keyboard!

More modifiers

Notice that scan-fix: in the collatz example? That's a modifier! "But version 2 already has modifiers, you said so yourself!" you say. Well version 2 had a very limited selection of modifiers, as they were more experimental at the time. Now, there's like 20 modifiers, all waiting to be used. Plus, they've gotten a little upgrade, in the form of

Arity grouping

Ever wanted to use jelly but realised it's way too hard? (who even sells hard jelly anyway? I thought the whole point was that it was soft and jiggly.) Well forget about using Ohm, because Vyxal 3 just got its own element grouping based on arity system. Plus it's much easier to understand!

Say you have a nilad followed by a monad (basically a constant followed by something that takes a single thing). Usually this sequence would be treated as two elements. However, it's obvious that the monad is going to operate directly on the nilad, as it's the same as writing monad(nilad). So instead of treating it as 2 things, it treats it as a single thing. This is useful for modifiers because you might have a situation where you can squeeze an extra element into what a modifier modifies where you wouldn't have been able to do so previously.

Variable Buffs

But that's all esolang specific stuff. If you've never used a golfing language before, you're probably wondering what all of that element stuff means. Well I've got prac-lang material for you that I think you'll love.

To define a variable:

value #=name (sbcs)
value := name (literate)

And to retrieve its value:

#$name (sbcs)
$name (literate)

"that's all good and well, but that's the same capabilities of version 2, how is that a buff?"

Because a) augmented variable assignment:

function #>name (SBCS)
function :> name (literate)

(works with any element or function, not just the regular +=, -=, *= etc you're probably used to seeing)

And b) variable unpacking

#:[x|y|z] (SBCS)
:=[x|y|z] (literate)

Variable unpacking can support any number of depths (e.g. [a|b|[[[[c|d]]]|e]|f]). Think of it like tuple unpacking in python but a little more powerful.

Whole New Built-in Set

The entire list of elements has been re-worked to remove some unnecessary overloads in version 2, and add some sorely missing elements that would make golfing a lot easier and shorter.

For a more specific overview of Vyxal 3, check out the tour

How do I run Vyxal 3?

There's a few methods:

  1. Head over to the online interpreter (this is the easiest).

  2. Download one of the release jar files, and run using

java -jar vyxal-jar <arguments>
  1. Download one of the executables for your platform and run as you would usually run an executable.

  2. Download the repository source and run with ./mill jvm.run. See Building.md for more details.

Contributing

For instructions on how to set up a development environment and an overview of how the interpreter works, see the contributing folder.

Links

Enjoy the cookies.

vyxal's People

Contributors

a-stone-arachnid avatar amiller42 avatar cgccuser avatar chunkybanana avatar deepsource-autofix[bot] avatar deepsourcebot avatar edison1119 avatar fmbalbuena avatar gingershaped avatar github-actions[bot] avatar hyper-neutrino avatar lyxal avatar mathcat4 avatar nayakrujul avatar not-thonnu avatar pacmanboss256 avatar placereporter99 avatar pre-commit-ci[bot] avatar pxeger avatar razetime avatar rubenverg avatar scala-steward avatar seggan avatar shaiksamad avatar sporeball avatar steffan153 avatar thesecondcoming123 avatar vyxal-bot-old avatar ysthakur avatar zoomlogo 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  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

vyxal's Issues

Feature request: group_by function

A group by function would be nice. For example, applying group_by(['foo', 'barb', 'baz', 'food', 'blah', 'o'], key=len) would return [['foo', 'baz'], ['barb', 'food', 'blah'], ['o']] or [[3, ['foo', 'baz']], [4, ['barb', 'food', 'blah']], [1, ['o']]].

You can't have backticks in the compressed form of a string

For example:

«S⊍ǐ/µȦġk*∪±c*ɖøW₌≤₀e+₇ /)ðaðc~²⊍λġOṙŻZ⁽ɽẇ¼∴ðḂ>⁰IŻ↳Y%⁼ǐ∩\ǔḞo⁋$∪@ø₇↑^V×Qc□„&<$↲AFðM‟[Ẏ`∵∪SĊ⟩%IHṠλ!q⟩»ꜝ∩=ẏ¼≥ȧ(ε∑²Z₁Ẇġ@Ḃ9d@3ġf₇Ṗꜝµ∞†≥¨ǐ $*∆⇩nTǎ√7Ḃ«

does not equal

`abbdbbbabbbdbbacbdbbbtbbbtbbbdbcbbdbbbdbdbbbdbbcdbbdbbbdbbbdbbdcbbbbdbbbbbdbbbbcbtbbbtbbbtbbbtbcbbdbbbdbdbbbdbbcabbdbbbebbbdbbacbbdbbbdbdbbbdbbcbtbbbtbbbtbbbtbcbbbbdbbbbbdbbbbcdbbdbbbdbbbdbbdcbbdbbbdbdbbbdbbcbdbbbtbbbtbbbdbcabbdbbbabbbdbba`

`Ŀ` broken as `repeat_until_false`

When using the Ŀ command as repeat_until_false, instead of returning an object of type <class '__main__.Generator'>, it returns an object of type <class 'generator'>, which is not something that commands are overloaded for, so they fail.

For example: Try it Online!

∑ doesn't vectorise correctly

When trying to vectorise the command, it acts the same way as when it is not vectorised.

Example: Try it Online!

From example:

⟨ ⟨1|2|3|4|5⟩ | ⟨10|20|30|40|50⟩ ⟩v∑

Expected output: ⟨15|150⟩
Actual output: ⟨11|22|33|44|55⟩

kP and k□ are the same

The constants kP and k□ both output the full list of printable ASCII. I'm guessing k□ is supposed to output the full ASCII list, since there are already built-ins for punctuation, whitespace, printable, uppercase, and lowercase.

Example: Try it Online!

Submission generation broken

The buttons at the top in the online interpreter are broken. They still copy what is inside the output box, but they no longer generate links or markdown or anything first. This was likely broken by one of the recent changes to main.html.

`Þ↑` don't work

I'm too tired right now to thoroughly look into what the command is trying to do, but stuff is breaking. Also, feature request: Þ↑ should be reversible.

Try it Online!

`|` mistreated in two-char strings

The | character is behaving strangely in two-character strings. It works fine in the global scope, but this errors:

1[‛| ]

Try it Online!

This also happens with other structures. What I think's happening is that the parser is singling out these even when in two-char strings. Single characters work fine though.

Header and Footer are prepended/appended directly to the program

When adding content to the header or footer, they have no newlines in between them and the program.

Expected:

Header Stuff
Program Stuff
More Program Stuff
Footer Stuff

Actual:

Header StuffProgram Stuff
More Program StuffFooter Stuff

Normally, this would not be a problem, since whitespace doesn't matter too much, but there is one important instance in which it does:

# Header Stuff
Program Stuff

Example: Try it Online!

`q` doesn't play nice with backslashes or backticks

The q command does uneval. By definition, this means that eval (or more specifically, Vyxal_exec) should cancel it out, so `string`qĖ should output the same as `string`.

For example: Try it Online!

However, q doesn't work properly when \ or ` is involved.

For example: Try it Online!

This could be fixed by having q escape every \ and ` in the input string.

Incorrect functionality in ꘍

Based on the documentation in elements.md, it looks like the command, when given string, number or number, string, should insert trailing or leading spaces, respectively. Instead, it has essentially the same functionality as the e command.

Example: Try it Online!

Unable to stop interpreter mid-execution

It looks like this snippet from main.html is supposed to allow you to kill the execution at any point, but it doesn't work.

function do_run() {
    if (!run.innerHTML.includes("fa-spin")) {
        ...code to start execution...           
    } else {
        $.post("/kill", { session: session }, res => 0);
    }

$("#run_button").on("click", e => {do_run();});

x has the wrong functionality

The x command moves the context level down, but according to elements.md:

* call current function # recursion. Prints entire stack if not in a function/lambda

Header and Footer don't stay open

If there is code in the header and/or footer of the program, it won't stay open when you run the program, nor do those boxes open automatically when you go to that page. As a result, you also have to click in the boxes to type before they will update and show their contents.

Example: Try it Online!

Infinite List Class

I'm on mobile right now, and can't make a proper commit.

class InfList():
    def __init__(self, rules=[]):
        self.rules = rules
   
    def __getitem__(self, index):
        result = index
        for rule in self.rules:
            result = rule(result)
        return result
        
    def add(self, rule):
        self.rules.append(rule)
       
x = InfList()
print(x[3])
x.add(lambda n : 2 * n - 1)
print(x[3])

`Q` doesn't do implicit output

When terminating a program with the Q command, there is no implicit output. This may be intended behavior, but I wanted to mention it anyway. What is probably a bug, however, is that it still doesn't do implicit output, even if you use the o flag to force implicit output.

Example: Try it Online!

∆T does not work

The ∆T command, or transpose, does not return the expected output.

Example: Try it Online!

The above example is taken directly from the documentation for this command.

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.