Code Monkey home page Code Monkey logo

matl's People

Contributors

digital-carver avatar lmendo avatar suever 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  avatar  avatar  avatar  avatar

matl's Issues

continue (`X.`) continues indiscriminately

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)

Potential golfing oppurtunity

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

Examples for porting MATLAB code to MATL

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 :)

Support descending arrays with the colon operator

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.

Code examples

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.

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.