« first day (67 days earlier)      last day (2920 days later) » 

6:31 AM
@DrGreenEggsandIronMan So you are learning MATLAB as well as MATL! :-)
Awesome, 2 birds with one stone! :D
Although, I'm unlikely to end up learning MATLAB. Paying for a language doesn't sound very appealing to me.
 
4 hours later…
10:10 AM
@DrGreenEggsandIronMan Then let's say you are learning Octave rather than MATLAB :-D
 
3 hours later…
1:12 PM
Yea the octave compatibility of MATL I know is a pain for @LuisMendo to maintain, but it makes it 1000% more adoptable.
 
4 hours later…
5:12 PM
@Suever This is probably a crazy idea. Have you considered making the input interactive in the online compiler? If there are no lines of input left in the input text box, wait for user input, with something like a "send" button. (I'm not even sure if this is possible, and it's not really important if it's not possible or feasible)
definitely possible
So it'd be more like the interactive input of MATLAB command prompt?
Yes, that would be the idea
I'm not sure how to make this compatible with allowing several lines of input in advance
Maybe just consume lines until none left
and then ask for interactive input
maybe deleting used up lines along the process
So what would be an example of a use case for that?
Say a challenge where you write a program in which the user has to guess a random number
Oh I see. hmmmm
5:15 PM
so the user keeps guessing until he finds it
maybe we could have a toggle for interactive input
(not a vey interesting example!)
then you wouldn't have to compensate for the two
Oh, very good idea!
it'd be either or
5:16 PM
Yes!
In interactive input, a button would be needed to "send" it. Is that possible?
Yea so the site uses websockets current so it's very easy to have real-time back and forth communciation
I mean, can the server accept that input and feed it to Octave?
Oh, great
Well, think about it. I'm not sure how much useful this is, vs. how much complicated
yea I can definitely think about it
are there any specific challenges for which this woudl be useful?
that way I can have a better idea of how it would work
Also, people are not used to posting challenges with interactive input. So this feature, although nice, might turn out to be not often used
Let me think of a better example
You know what I should do....I should write up a snippet that we can use to insert the MATL interpreter into the answer
haha that would be awesome
5:19 PM
Hm, what do you mean?
So similar to the javascript answers, there could be a "run snippet" button which would allow you to visualize the MATL output directly in the answer
so the snippet would talk to the server
Oh, I see!
Haha
Octave compiled to JS?
Oh no not even that. So all communication between the web interface and the server is via javascript anyhow
and snippets run javascript.
So you'd just have a snippet which interacted with the server the same way the website you goto interacts with the server
5:35 PM
Ooh. So the proposal was more serious than I had thought :-)
A possible drawback is that the answerer needs to know to insert that snipppet in the answer
Well, like JS anyway, and people do that
6:10 PM
@Suever So a better example could be the Battleship game. The user will give inputs like "A2", "B5" etc, and the program answers "hit", "miss" or "sunk". The input needs to be interactive because subsequent inputs depend on previous results
 
2 hours later…
7:50 PM
Searching through that pdf can be kind of a pain, is there a "substrings" built-in in MATL?
(Also is there a more search-friendly way to look through the doc for builtins?)
8:27 PM
@FryAmTheEggman You can test out our beta online interpreter's documentation
matl.suever.net
click the documentation in the top right and that will bring up a searchable table
Are you trying to create substrings or search for substrings?
Create them, so [1,2,3] -> [1], [2], [3], [1,2], [2,3], [1,2,3] etc
Hmm yea I don't think we have a good way to get all permutations of all lengths like that
you'd have to generate all permutations of a given length for each possible length
Darn, I think that would have improved Luis' answer for the stock market question
Thanks for your help! :)
Well that's basically what 2XN does it creates all permutations of 2
@LuisMendo Ah yes. I think we can definitely do and it wouldn't be that hard. I think figuring how to make the UI work is really the hardest part. From a technical perspective it's trivial not so bad.
You can use --- to strike out in chat
Foo
8:37 PM
haha thanks. Literally just was looking in meta to figure that out
No problem :)
Hmm, is there a nice way to broadcast XN then? Doing <test array>1:3XN doesn't seem to work out nicely
Oh so XN with various n?
Not really, no.
<testarray>3:"t@XN
Ah well, I don't think that would have been shorter anyway.
I think MATL should really consider that "substrings" operation as a built-in, though, I've used it quite a lot in Pyth, and it just was added to Jelly a day or two ago
So it's basically all permutations of all possible lengths?
Oh, yeah XN also gives the different orderings, which this solution wouldn't want...
8:50 PM
Right so sometimes in MATLAB order matters and sometimes it doesn't
it's confusing
Hehe, ordering things is just generally confusing :P
But basically its array[2-pairs from 0..length(array) where the pair is sorted] if that makes more sense?
sorted based on it's original location?
or by value?
i.e. what is the output of [2 1 3]<theoretical operator>
by the pair's values, sorry this is kind of tricky to put to words
that would give [2], [1], [3], [2,1], [1,3], [2,1,3]
Ok I see so it's essentially a "sliding window" of size 1...N
Similar to our blockproc except that it has varying lengths
Yeah, that's exactly it
You could add it without the varying length bit, but I've personally found it rather useful to get them all in several golf challenges
8:58 PM
So basically this
Yeah, that looks correct
So really YC is the closest to what we have for doing that
for a fixed length it's easy
Hmmmm not sure what the 4th input to YC is since matlab's im2col only accepts three inputs.
@FryAmTheEggman @Suever If you don't mind the result in a cell array, and in a different order: &Xf
@LuisMendo That was my same link as before I think
Did you forget to press save?
9:07 PM
Or maybe my site broke :(
Thanks! Corrected
It was me not pressing "save" :-)
@Suever But it can have 4 inputs, right? There's the 'indexed' flag
Not that it's used often
Oooohhhhh I see that now
you're right
I don't think I've ever used it :-)
Is there a way to broadcast sum over that result to Xf?
If you can do that and take the max in < 3 bytes you can shorten your answer
@FryAmTheEggman No :-( The result is a cell array. No broadcasting for cell arrays
@FryAmTheEggman In the stock market challenge?
9:11 PM
Rats :(
Yeah, diff->substrings->sum->max works to get the output, but I haven't found a language where that's < 5 bytes :P
diff as in "consecutive differences"? Hm, how does that work?
Oh I think I may have just found a way to save you a byte
Just kidding :(
:-D
Oh I see your answer now! @FryAmTheEggman
Yeah (I thought that's what it was called in MATLAB?). It works because in a sort of odd roundabout way it calculates end-beginning for each substring, which is basically the same as combinations of length 2
I should... probably explain that in my answer... >_<
@FryAmTheEggman Yes, exactly, that's what it's called. I just wasn't sure because I didn't see how that works. And I still don't. Better explain it, yes :-)
9:18 PM
Sadly I've got to go now, but I'll add a proper explanation soon™!
:P
 
1 hour later…
10:31 PM
@LuisMendo I added an example, does that clarify? codegolf.stackexchange.com/a/85474/31625
10:47 PM
Is there any where to post a question just to test out snippets?
Like basically a SE Q/A sandbox
I have MATL running via a snippet and would like to run it by you guys but there's really no good place to put it
@Suever Maybe in meta?
Well regardless you can create a new question and paste this into the draft and it should allow you to run the snippet
<!-- begin snippet: js hide: true console: true babel: false -->

<!-- language: lang-js -->

    var socket = io.connect('https://matl.suever.net');

    var code = 'lYG';
    var inputs = '[1 2 3]';

    socket.on('connection', function(data) {
      socket.emit('submit', {
        code: code,
        inputs: inputs,
        uid: socket.id
      });
    });

    socket.on('status', function(resp) {
      data = resp.data;
      $('#output').text('');
      for (var i = 0; i < data.length; ++i) {
It works! It displays the image
Input is embedded in the snippet, right?
yea if you look at the top you can see code and inputs being defined
Multiple inputs are separated by \n
It would be possible to make an input box or something
THis was really just a proof of concept
11:05 PM
@FryAmTheEggman It does! Telescopic sums, very nice
Like you could use prompt
so var inputs = prompt();
@Suever I see. You make it seem easy! :-)
Well it is easy once the server / backend work is done
the javascript is just the sugar on top
So anyhow it seems like it's totally doable if we want an inline MATL interpreter in answers. We'd just have a snippet that could be pasted into an answer.
@Suever That sounds very nice. Having a snippet is more than enough (as opposed to the toggle button in the interpreter), as it won't get used that often
well we can definitely do both
The snippet really could be used for any answer you wanted.
it just makes it a low barrier for people to test the answers
as long as you have a good way to get input
11:23 PM
@Suever That fullfile idea was good.
If the path is guaranteed to exist, something like cd(fullfile('/a/b', '../..')); disp(pwd) may work
Yea it works for like 90% of cases
yea but it isn't. So there were some like fullfile('/', '../..')
you could do cd('/');try cd(fullfile); catch; end; disp(pwd)
Good catch :-P
Yea there were all sorts of strange cases where you were left with /../.. and stuff and I just wasn't sure how to deal with those in a brief way

« first day (67 days earlier)      last day (2920 days later) »