lmendo / matl Goto Github PK
View Code? Open in Web Editor NEWA programming language based on MATLAB and suitable for code golfing
License: MIT License
A programming language based on MATLAB and suitable for code golfing
License: MIT License
This could be an unrealistic way to shave bytes, but I thought I'd mention it just in case.
In this answer, I noticed an odd pattern:
&*XRXzXM
The final 3 functions were all modified by X
. Could it be useful to have something like "enable implicit modifier"? I'll use <M>_
to denote this, seeing as X_
, Y_
, and Z_
are unused. This answer could become:
&*X_RzM
...saving 1 byte. It is very situational, but maybe common enough to warrant this shorthand. I want to do a bit of a corpus analysis to see if this would do anything useful, similar to lynn's for Jelly
First of all, nice project!
In the introduction I read that one can get started in a few minutes, so I decided to try it a bit, but it is actually not that easy to get started.
When browsing the doc, I see a few examples of MATL code, and their MATLAB equivalent, but without much help on turning MATLAB code into MATL code.
Here is what I tried:
Getting the sum of numbers 2:10
2:10 % This is easy!
sum(2:10) %Hmm too bad
s(2:10) %Well this is the function, now how do I call it
...
2:10s %Yay
Input: 10 code: :s %Ok, so it is easy to use one input
inputs: 2 and 10 code: :s %Ok I guess I don't know how to use two
After this I tried to use datestr, but I basically failed to make it do anything. (First attempt was to replicate a simple datestr(1)).
So my conclusion:
I think this will help a lot for code golf, but a number of examples on how to get from MATLAB to MATL would be very helpful :)
The colon operator should be able to make ascending and descending arrays. For example, this:
4:2
should push the array
[4 3 2]
Rather than just pushing an empty array, like it does now. This is possible right now with:
2:4P
But this way is one byte longer and less intuitive.
Hello,
I'm sorry but couldn't find your email address so I'm asking this favor through an Issue.
I'm trying to learn your language but could not figure out how to create and add numbers to an array.
I've got this program:
`to?3*Q}2/]tq}x@
that prints the number of iteractions to run a collatz conjecture up to 1.
I'd like to modify it so it prints the whole set instead of its length.
Hi! Is it intended that continue (X.
) goes to the next iteration without checking the stack?
The manual says "the loop proceeds with the next iteration, if any" - the "if any" part makes it sound like it should check the stack like the loop usually does, and go the next iteration only if it's truthy. That's the behaviour I'd expect from other languages too - continue
means skip the rest of the loop, but do check the loop condition again. It seems like that's not the behaviour in MATL, from some testing:
Without continue
octave:1> matl 'F T X` X# '
/-------
STACK{1} =
0
-------/
With continue at the end of loop
octave:2> matl 'F T ` X# X.'
/-------
STACK{1} =
0
-------/
/-------
STACK{1} =
0
-------/
/-------
STACK{1} =
0
-------/
(output goes on indefinitely, loop doesn't terminate)
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.