« first day (276 days earlier)      last day (2946 days later) » 

12:02 AM
Ok cool that's what I figured!
0
A: Trump needs your help to stop the Starman!

SueverMATL (Non-Competing), 57 bytes 5lh4*t_vi2^5*+X^Xj1\~a2:*sQ'Pippi Lucas Ness Travis'YbwX) Try it Online! Explanation Again, similar logic to my other answers here and here. 5 % Number literal l % Create a scalar 1 h % Horizontal concatenation to produce [5 1] 4* % Mul...

no clipboards!
 
12:17 AM
@Suever Nice! You can change X) to ). A cell with a string is displayed as a string
 
12:33 AM
whyyyy the upvote?? v
0
Q: matlab voronoi representation for data including less than three points

NPRI would like to know how to represent a two points data using voronoi in matlab. I know that voronoi needs at least three points to be able to draw but in my case I have two points and sometimes one point as I am dealing with a tree that should be represented using voronoi where a parent node can...

 
@AndrasDeak because it has words?
 
12:53 AM
@Suever And now that I think about it, this is shorter (for the array): 20Kht_v
 
@beaker good point:P
 
@AndrasDeak Isn't Voronoi for tesselations? How can you have a tesselation with two data points?
 
@TroyHaskin yes
well, you can separate the 2d space with a single line between the two points...
but it's also not really clear what OP is trying to do, how voronoi comes into play
 
1:12 AM
I think I might have found a bug in Octave's voronoi implementation
 
@beaker how so?
 
@AndrasDeak It references an uninitialized variable if you pass in a scalar first argument
which is supposed to be an axis graphics handle
  if (isscalar (varargin{1}) && ishandle (varargin{1}))
    hax = varargin{1};
    if (! isaxes (harg))
      error ("imagesc: HAX argument must be an axes object");
    endif
harg isn't mentioned anywhere else in the file... apparently that was supposed to be hax
it's been fixed in the latest version
 
heh:D
good night
 
good night @AndrasDeak
 
1:39 AM
@LuisMendo Thanks for the pointers. Also just realized that I don't have to increment for 1-based indexing. I just circshifted by strings so that the zero index just wraps around to the end. One more byte saved!
 
 
1 hour later…
3:02 AM
posted on April 01, 2016 by Cleve Moler

Recent theoretical, observational and computational results establish the possibility that gravitational waves produced by the dark energy created at the dawn of the universe affect the clock rate of silicon digital processors operating at very low temperatures.... read more >>

 
 
7 hours later…
10:08 AM
@Suever Tied with CJam! :-) You need to replace X) by ) in the explanation
 
10:36 AM
Clipboards were too well suited for this one... using two
0
A: Turn a string into a windmill

Luis MendoMATL, 47 bytes ' 'jntX"tGtnXyg(wGtnQ2/Y(XJDXKD`J3X!XJDK3X!XKDT Try in online! (but kill it immediately, infinite loop) With 1-second pause: 59 bytes ' 'jntX"tGtnXyg(wGtnQ2/Y(XJD1Y.XKD1Y.`J3X!XJD1Y.K3X!XKD1Y.T Try it online! (again, infinite loop)

 
11:30 AM
47 bytes
Does anyone know if you can reshape stuff that does not exactly fit the output matrix, with some kind of automatic padding or so?
 
 
2 hours later…
1:59 PM
@flawr Do you have an example?
@LuisMendo Made one last tweak to handle the "Trump" challenge to get the 15 point bonus and beat CJam. Saved two more bytes
2
A: Trump needs your help to stop the Starman!

SueverMATL (Non-Competing), 57 55 54 (67-15) = 52 bytes 20Kht_vi2^5*+X^Xj1\~a2:*sG2016=-'Lucas Ness Travis Trump Pippi'Ybw) Try it Online! Explanation Again, similar logic to my other answers here and here. 20 % Number literal K % Retrieve the number 4 from the K clipboard (the default...

 
2:26 PM
@LuisMendo Is there something funny going on here? matl.tryitonline.net/#code=J2FiY2RlJzEkWGQ&input=. In MATLAB, this would result in a square matrix with abcde along the diagonal
It looks like it's actually an Octave difference. In octave diag('abcde') gives a 5 x 1 column vector whereas in MATLAB this gives a 5x5 char array with abcde along the diagonal
However, if use a numeric array in Octave than it has no issues diag(1:5)
i.e. In MATLAB:
matl('-r', '''abcde'',1$Xd')
a
 b
  c
   d
    e
 
3:31 PM
@Suever The difference is that Matlab displays char 0 as a space, whereas Octave doesn't always do that. Check 'abcde'1$XdQ and you'll see it's actually producing a Matrix, but the online compiler displays char 0 as nothing
Strangely, my Octave (on Windows) does display 0 as space
>> matl "'abcde'1$Xd"
a
 b
  c
   d
    e
^^ Octave 4.0.0 on Windows 7
I've encountered this in the past, but I wasn't sure if I should force char 0 to be treated as space. Is there a standard here? How should char 0 be displayed?
Was that for the windmill challenge? You've given me an idea :-)
 
Oh ok, I hadn't actually converted the result to an int to check it's actual value but char(0) is consistent.
I'm not actually sure what the standard is, I was just thinking of how to shorten your windmill
because constructing a logical eye and then filling in values seems like a waste
I was considering submitting a MATLAB solution that just relies upon diag(input)
 
@Suever Matlab seems to display 0 as space, yes
I tried 1$XdO32XE' ' but I don't save any bytes :-(
 
yea so MATL is just subject to the underlying system on this one
 
The replacement from 0 to space takes too many
 
yea
question though, why do you have to do 1$Xd? why does 0Xd not work
i.e. the 0th diagonal
 
3:39 PM
@Suever I could force char 0 to be displayed as space in MATL's `disp' functions. But I'm not sure if that's correct from an ASCII point of view
@Suever Oh. I changed Xd for the next release
>> matl -h Xd
Xd  diagonal matrices and diagonals of a matrix
    1--4 (2);  1--2 (1)
    If 1 input and 1 output: diag. Otherwise: spdiags
 
Oh ok so in passing it two inputs it's going to use spdiags got it.
 
In the current relase yes, I think it's not needed
Hm wait
Current release already works that way
It's already in the online compiler version
 
So the thing I was thinking about the windmill is that you could do a mod inside of the loop on the rot90
because @ already refers to the current iteration
Sorry not a mod
rot90(J,@*3)
then you don't ever have to store back in the clipboard
 
@Suever Yes, I thought about that too. Saves 2 bytes
 
Not sure if that ultimately saves bytes or not
 
3:49 PM
Thanks!
Yes, I think 2
 
also I was considering cating the two versions, the diag and the non-diag
 
I was going to try that now
 
then rot90 on the pair at once
 
@Suever Hm does that work?
 
and display them after reshaping to N*2 x N
but I'm not sure that works out
was going to toodle around in matlab and try it out
 
3:50 PM
It works! rot90 can take 3D input
 
I wish displaying 3D structures were cleaner
oh yea that part definitely works
 
That's too major a change. You should post your answer!
 
how do you cast as a char?
Y$ isn't quite giving me what I expected
 
What do you mean? c?
 
haha wow. yes
because the other idea with the empty spaces would be to do an elementwise max between char(0) and int(' ')
 
3:53 PM
@Suever Good idea!
Post it!
You can use 0, not char(0)
Maybe cast to char after max
 
yea
something like 0c' 'X>c'a'h
0c is only in there for demo purposes
 
2-ary max is 4 bytes, though :-(
2$X>
 
why do you need the two-arg version?
Pretty sure that does not save any space whatsoever
ha
 
Oh is the j implied?
I thought the default input was numeric
oh i guess that doesn't matter
because you're going to cast it anyhow
 
3:59 PM
No, only i is implied. I added quotes
This should work
But Octave can't do max(32,'a')
!!
I'll correct that for next version
Octave doesn't always convert from char to number when needed
 
really?
good to know
 
These incompatibilities are so annoying
 
Subtle but frustrating
 
I've needed to patch 30 Octave functions
and counting
 
wow
Hmmm what's up with the display of a 3D matrix
 
4:06 PM
That's normal. The display function calls num2str
And num2str does that
 
ah ok
 
It collapses all dimensions beyond the first into one
disp(num2str(randi(9,2,2,2)))
 
never realized that
 
Octave does it in a different way
So I had to patch Octave's num2str for MATL
(It's one of those 30 functions) :-)
 
What's the easiest way to determine what is getting called internally?
Is it the function definition file?
fundef.txt or whatever?
 
4:08 PM
Yes, funDef.txt
Not sure if that's easy to follow, though
But you can ask me anything
 
haha yea it's a little tricky to parse visually
 
I may remember what I did :-)
There's a column, about the 12th, with the actual code
 
I was actually contemplating parsing it out with javascript and making a browseable help
and displaying the underlying code as a code snippet
but then again that's a lot of time not golfing :)
 
Not sure it the underlying code is very meaningful
The description you get with matl -h should be enough
>> matl -h D
D   convert to string and display
    0-- (1);  0
    If 1 input: disp(num2str(..., '%.15g ')). If several inputs:
    disp(num2str(eachInput,lastInput)), where eachInput loops over
    all inputs but the last. In either case, (nested) cell arrays
    are (recursively) unboxed in linear order. See also XD, YD, ZD
 
ah ok
 
4:10 PM
It already says num2str is called
 
yea I really need to start running MATL from within matlab
 
But of course it's not very well known how num2str works with 3D arrays :-)
Well, those descriptions are on the pdf too
 
Well I appreciate your help
 
The final, big table
 
yea I keep that thing open constantly
 
4:11 PM
Anytime!
This is also helpful
You know MATL has some sort function
But don't remember
>> matl -h sort
S   sort
    1--3 (1);  1--2 (1)
    sort an array (sort) / sort an array based on another. (i)
    Single-array mode works like Matlab's sort. If 2 inputs, a
    negative value of the second input corresponds to descending
    order. If first input is a cell array and the first cell
    contains a char array, the rest of the cells' contents are
    converted to char. (ii) If the first input is a cell array and
    the first cell contains a numeric array, single-array numeric
    mode is used. The first input is linearized if it's not a
You can search
 
Holy crap. that is exactly what I've been needing. I've typically just been trying to search the PDF
which is clunky
 
Yeah. I use that all the time. matl -h whatever
 
I can see how searching combined with actually using the MALTAB IDE could be useful here
My headless mode doesn't do so great with all those links and formatting
OK very cool. Thanks for the tips. This is really a lot of fun
I can't imagine how much time you've put into this
 
Too much I guess :-)
But yes, it's so funny
Thanks for helping me find yet another Octave - Matlab incompatibility
It will be corrected for next version
This one's easy
 
 
2 hours later…
6:06 PM
@LuisMendo you've implemented a help function? :D sweet!
 
6:43 PM
@Suever reshape(ones(3),[],2)
 
7:01 PM
How bad is it to rely on MATLAB's functionality for MATL?
when golfing
basically Octave and MATLAB handle the same thing differently
@flawr So you'd expect the output to be what?
5 x 2?
Asking with respect to this
0
A: Turn a string into a windmill

SueverMATL, 37 bytes This only works when running MATL from within MATLAB due to the difference in how Octave and MATLAB display the null character. MATLAB displays null char(0) as a space and Octave does not display it at all. 3,itn2/kYaG1$XdXc`TwtGnt,lth4$Y{D3X!w

 
7:23 PM
@rayryeng It's been there for long! Yes, it's handy :-)
@Suever Maybe add the online-compatible version? 3itn2/kYaG1$XdXcO32XETwtGntlth4$Y{D3X!w`
40 bytes, you'd still be winning!
 
Yea that's not a bad idea
I'm trying to figure out the shortest way to do that substitution
I was thinking something like ~' '(
but the assignment looks like it wants 3 inputs
Basically all things zero change to ' '
Like I would think this would work
Oh I'm an idiot
destination, data, index
 
8:13 PM
This golf is the only time I wish I had length :)
Then I wouldn't need Gn, I could just get the first dim of the current 3D array
 
@Suever Yeah 5x2 but e.g. padded with zeros. (one zero here)
 
So like how to do that in a golf kinda way or just in general
I don't really know of a good way apart from creating the zeros and then filling in the known values with outputs(1:numel(inputs)) = inputs;
 
 
1 hour later…
9:38 PM
Hm that is going to be the best way.
Another question: Is there anything like a fold command in matlab?
(Like in functional languages?)
 
9:53 PM
And is there a (short) way to convert a string into a number?
 
convert how?
ascii value or as str2num?
 
As kind of a hash
 
ascii is +'124', str2num is '123'-47
oh
 
'helloworld'-> 25146231
 
yeah it was a surprisingly simple question coming from you:P
 
9:56 PM
haha
 
I'm a hopeless optimist, hoping I can tell you something new in matlab/codegolf:D
 
I also hoped you could tell me=)
 
does it have to be hash-like? different for close strings, but OK if it gives same output for various inputs?
 
I'm thinking about seeding a random generator with the string, or something
 
9:59 PM
Is not allowed =/
 
Except if you implement it yourself
 
now you tell me;)
 
43
Q: Tweetable hash function challenge

orlpIn this code-challenge you will write a hash function in 140 bytes1 or less of source code. The hash function must take an ASCII string as input, and return a 24-bit unsigned integer ([0, 224-1]) as output. Your hash function will be evaluated for every word in this large British English diction...

 
no, it seems allowed
> Your hash function must run on a single string, not a whole array. Also, your hash function may not do any other I/O than the input string and output integer.
> Built-in hash functions or similar functionality (e.g. encryption to scramble bytes) is disallowed.
> Your hash function must be deterministic.
> Contrary to most other contests optimizing specifically for the scoring input is allowed.
if you seed from the string, it will be deterministic
 
10:01 PM
> Built-in hash functions or similar functionality (e.g. encryption to scramble bytes) is disallowed.
 
is it similar?
OK:(
 
I think seeding+rng is quite close to a hash function
 
I wish Octave/Try it online supported clc or else my rotating windmill would look much better online
 
possible...
 
@Suever Rotating windmill???
 
10:03 PM
5
A: Turn a string into a windmill

SueverMATL, 35 bytes This only works when running MATL from within MATLAB due to the difference in how Octave and MATLAB display the null character. MATLAB displays null char(0) as a space and Octave does not display it at all. Ijtn2/kYaG1$XdXc`TwtGntlth4$Y{D3X!w The following (when run in MATLAB) ...

 
Oh that one=)
 
Yea I added the code to animate it within the MALTAB command window
Kind of hilarious that that almost doubled the length
@flawr what if you did something with magic?
like create magic(int(character))
 
Hm that would be an idea...
 
and then combine the matrices in some way
obviously they would be different sizes
 
At the moment I'm trying to play with binary stof
 
10:06 PM
night, guys
 
Night!
 
but you could multiply each by a constant indicating where it was in the string
 
I already tried that=)
 
hah ok
did that not go so well?
 
no not really...
 
10:08 PM
Yea there's a reason we rely on experts for hashing :)
 
and why hash functions usually require more than 140 bytes of code^^
 
how long can the hash itself be?
 
24 bit
so 2^24
 
hmm
 
For some reason I still get a very bad score =/
 
10:16 PM
I'm thinking of like a histogram of magic matrices the size of the ascii code for a character and normalized to 1 and then multiplied by the position of the character
and somehow make that 2^24
hhaa
yea I dunno
 
you can participate too=)
Congrats to your 8888 rep=)
A histogram of magic matrices?
 
yea so imagine your string is abc you could do M1 = 1 * magic('a')
M2 = 2 * magic('b'), etc.
then cram them all together and compute a histogram
hist(cat(1, M1(:), M2(:), ...))
Then from there I haven'ta clue
I'm just talking out of my ass
I just like magic numbers
 
10:33 PM
magic
XD
making a histogram with 10^6 bins was a bad idea
Distribution could be worse.
lets see what my score is
Ok the score is as bad as before
I give up
 
10:55 PM
Now I really give up.
Hm I was thinking of making a bitpattern from sign(sin(1/x)) where x is some number made from the string=)
 

« first day (276 days earlier)      last day (2946 days later) »