« first day (277 days earlier)      last day (2956 days later) » 

2:59 AM
@Suever Yes, I've thought that in a few recent challenges too. It's a pity
@flawr I don't think so. Matlab's way is to provide functions that fold. For example, sum is the fold version of +, max with one array input is the fold version of max with two scalar inputs etc
 
 
12 hours later…
3:12 PM
0
Q: Matlab r2015a guide - cannot convert double to a handle

Samael The LightbringerIn the past , I used Matlab 2013 and this code runs correctly and no errors , but now I use matlab r2015a and when I run the code, I get the following error: Cannot convert double value -10 to a handle. I checked the Matworks website but the explanation is not very clear. Do you have any suggest...

wtf
 
 
3 hours later…
5:53 PM
+15 accept, -10 user was removed :(
 
6:06 PM
And the windmills got shorter!
7
A: Turn a string into a windmill

SueverMATL, 35 33 21 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. jtn2/kYaG1$Xd`wtD3X!T The following (when run in MATLAB) will ani...

 
@AndrasDeak Let's give you some rep by upvoting some random posts to give you some compfort.
@LuisMendo Too bad there is no such thing, thanks anyway!
 
6:30 PM
@LuisMendo Any idea why Try it Online MATL doesn't support clc?
 
@flawr heeey, I wasn't whining for that:(
but thank you:)
 
Thank you for what? =D
BTW: You've only asked one single question on SO!
 
@flawr ??? for 3 random upvotes? It had to be someone:P
So thank you, someone:D
@flawr I have...
that's why I think that 95% of questions should be answered before posting by RTFM/google and constructing an MCVE
 
7:07 PM
@Suever It's not explicitly forbidden in the online mode (as is urlread for example). I guess the way the output is dispalyed in the TIO's output pane just doesn't allow clearing. Once some characters have been sent to that pane, they are already there
 
@LuisMendo Ah got it. So the screen is essentially just a log of the output rather than a socket-like connection to the server
 
7:25 PM
@Suever That's what I think, yes. I haven't asked Dennis, though. On the other hand, it does allow dynamic output. If you insert a pause between calls to D (disp), the web page honours that pause
...Now what I think about it, `char(0)` being not displayed at all (instead of being displayed as a space) may bbe a TIO thing, not an Octave thing. In my Octave 4.0.0 on Windows it is displayed as a space

^^ @Andras, can you try this in your Octave on Linux?

disp([char(0) 'a']), disp([char(32) 'a']), disp('a')

Does the first one have a space before `a`?
 
Oh so maybe it's a browser thing actually
because octave online also doesn't show it as a space
 
@Suever If Andras can confirm on Linux, I can force zero chars to be converted into spaces by MATL's disp function
 
On OS X Octave doesn't show the space
 
@Suever Oh :-( There goes my theory
 
and it's not just the terminal I'm using to run it as I use the same terminal to run MATLAB in headless mode
 
7:28 PM
@Suever What does Matlab do on OS X?
 
Spaces
both in the IDE and at the terminal
 
Ok Then, since Matlab is my reference for MATL, I can force it to produce a space even on Octave
That way the behaviour is predictable, and the same as in Matlab
 
Yea MATLAB is consistent across both Linux and OS X
maybe due to Java
well but nevermind
because the terminal...
haha who knows
 
Now the question is: which characters to convert into space? Only 0? 1 too?
for x = 1:32, disp([char(x) 'a']); end
^^ gives a lot of variety
For example, one of those must be tab. That's not the same as space
On my machine, all seem to give space except the newline, linefeed, and tab
Can you confirm on OS X?
Oh, also char(7) differs
that must be the delete char
 
```
0: a
1:a
2:a
3:a
4:a
5:a
6:a
7:a
8a
9: a
10:
a
11:
a
12:
a
a3:
14:a
15:a
16:a
17:a
18:a
19:a
20:a
21:a
22:a
23:a
24:a
25:a
26:a
27:
28:a
29:a
30:a
31:a
32: a
```
that 9 is actually a tab
 
7:32 PM
So most produce no space, right?
On my machine most give one space
 
Correct
only 0 and 32 have a space
 
If I could find an authoritative source that 0 should be space, maybe I'd change only 0
Wikipedia says:
0 (null, NUL, \0, ^@), originally intended to be an ignored character, but now used by many programming languages to mark the end of a string.
I think I'll leave as it is for now
 
yea I honestly think that's fine
the windmill was a pretty rare case
and honestly the Octave solution remained decently short thanks to you
 
Perhaps you should change the wording in your answer. char 0 being displayed as space or otherwise doesn't seem to be an Octave thing, but rather a platform (OS, TIO, browser?) thing
 
sure thing. Thanks
 
7:40 PM
How did you reduce 12 bytes more? :-O
 
@LuisMendo By removing fourteen and adding two bytes XD
 
Now your answer is less than half mine LOL
 
@LuisMendo Decided to not stick it in a 3D array. That wasted space at the beginning to create it and within the loop to convert it to a cell array
just created two elements on the stack and flip flop between them
rotating the active one each time
 
@LuisMendo no space before a
octave:1>  disp([char(0) 'a']), disp([char(32) 'a']), disp('a')
a
 a
a
 
7:53 PM
I have the feeling that non-space is probably the "correct" behavior
 
so it's octave
 
But I don't mind hijacking MATLAB's strange behavior for my benefit :)
 
char(0) should definitely not be a space
 
how about char(i)?
 
7:54 PM
Complex values cannot be converted to chars
 
octave:2> char(1i)
error: octave_base_value::convert_to_str_internal (): wrong type argument 'complex scalar'
3.8.1 ^
 
That should really be an easter egg
 
it should print "i":D
 
It should print "These aren't the droids you're looking for."
 
@Suever ``` isn't supported in SO markdown:(
it's a github thing
ctrl-k/four space indent is the way to go for multiline code
and it doesn't work with replies
 
8:06 PM
@AndrasDeak Or 'you'
 
heh:D
mathematicians:P
 
So a finite number of logicians walks into a bar.
The bartender asks, you all want a beer?
The first one says: "I don't know."
The second one says: "I don't know."
The third one says: "I don't know."
and so on
Then the last one says: "Yes."
 
:D
horrible
and temporal logic makes my head hurt
 
I think I heard that joke a number of times but never really got it until recently, when I relly thought about it^^
 
:)
are you familiar now with the chldren with dirty faces/cuckolded husbands problem?
 
8:18 PM
No, I don't think so?
 
wait, it's written in a bit odd way
> Children with Dirty Faces
I'm too lazy to extract the actual url, sorry
 
google.hu haha
 
this one has a solution in it, so read carefully
@flawr yeah, I use google.com, but my IP automatically redirects me:/
pain in the ass
 
Well it doesn't really hurt, does it?^^
 
not really, just leads to comments like that :P
 
8:29 PM
google.ch isn't any better
Well it is better, but not that much
XD
Well most people do not even think of associating ch with switzerland
 
I'm surprised by that. Although we (used to) have a lot of CHF-based debts in the country:P
 
Oh right, thats where one might know it from.
Hungary is still using Forint, right?
 
yeah, big time
we're getting further and further from the euro
 
why is that?
 
our current government also does everything in its power to support physical currencies, rather than electronical ones
it's nuts
@flawr our government also does everything in its power to drive us further away from the EU and nice and close to Russia and the Middle East:P
good times
 
8:38 PM
@AndrasDeak Ah! I wondered what the trick was to indent a block like that in chat. In typical posts I just have a user script that allows me to use tab
 
I only heard that there was some sort of political shift in the last few years.
 
@Suever for multiline posts you'll also have a "fixed font" button appear:)
that's a mouse-based solution
 
what's a mouse?
 
@flawr since 2010
@Suever +1 :D
 
A mouse is something a cat would eat if it doesn't find any touchscreens.
You know, back in the day, when rainbows were black and white.
 
8:47 PM
@flawr "some sort of shift" as in "populist right-wing assholes demolishing the checks-and-balances and basic foundations of democracy, stealing and selling out every possible bit of the country to friends and acquaintances, including Putin" :/
 
Is it that bad?
 
we've been renamed from the Republic of Hungary to just Hungary, and we no longer have a constitution, we have a "Fundamental Law" or something
which includes gems like the pension age limit of judges (wtf?)
and a vast majority of the "jury of constitutions" or whatever is called, comes from the ruling party
but we've had some strong shit in the first 4 years when the party had absolute majority: "New law is against the constitution? No problem, change the constitution!"
(which was no longer called a constitution, of course)
 
@AndrasDeak Oh my god..
That is even worse than your previous message had made me imagine it =(
 
and we've made a contract with Russia for a loan of 2000 billion forints (1 EUR~310 HUF) to upgrade our nuclear power plant
the only people who find this plan profitable are those involved
and everything related to the contract, including case studies and whatnot, have been classified for 50 years
 
@AndrasDeak Unfortunately it seems this is quite often the case in politics.
 
8:54 PM
maybe just 30? doesn't matter
all those involved will shit in diapers by the time it's no longer classified
 
Is there some reasonable source where I could read about those events?
 
hmm...I'll try to look around
 
We really did not hear much about it here....
 
yeah, I figured:)
they have been reelected in 2014, so it's in huge part my people's fault
(gullable idiots)
I guess most sources are in Hungarian:/
there's even a wikipedia page about the nuclear plant
 
So the WP entries are not too biased?
 
8:58 PM
well WP tries to be factual:P I don't know, haven't thoroughly read it yet
I was hoping for some English WP entries
OK, according to the talk page, the entry I found is biased against the government
which is hard to avoid, so it's good:D
 
I just read some in the german WP
 
9:12 PM
@flawr this seems quite thorough regarding the state of democracy and civil rights
and as I've glanced through it, it seems fair
 
Oh thank you
The media here are mostly writing about our own political nonsense, or the one in america.
 
I guess that's only natural
especially in the most xenophobic country in Europe:P
 
Haha, true
true & sad
Today I read the headline of an article about a d iscussion in the parlament regarding our "marine corps"
They want to buy new boats.
I thought why don't they buy an aircraft carrier???
 
:D
or shovels to dig an actual sea for you
 
To defend our lakes.
The only problem is that it couldn't even turn around in our lakes^^
 
9:20 PM
oh
heh:D
moraine lakes ftw
wait, that's a single lake
so the stuff that gathers in mountain valleys:P
 
@Suever I think HG2 still outputs handles as doubles if the output specified is already a numeric array, I seem to remember it happening with one of my more recent functions but I don't have MATLAB at the moment to test
either way, that code is a total clusterfuck
 
@AndrasDeak Thanks! Can you try in Matlab too?
 
@excaza Maybe it does in recent versions? I know that it was an issue when it first came out at least as I had a bunch of code I had to port that used NaN to initialize a handle array. Caused lots of issues. Switched to gobjects instead.
 
@flawr That's a very good one!!
 
>> disp([char(0) 'a']), disp([char(32) 'a']), disp('a')
 a
 a
a
 
9:24 PM
@excaza One of my favourite english words
 
:D
@flawr "total"? ;)
 
"clusterfuck"
 
Well at least MATLAB is internally consistent
despite being technically wrong
 
@flawr Probably because it reminds you of those German aggregated words
 
Idk. But it just sounds so nice when you say it. It melts right on your tongue like a piece of chocolate=)
 
9:26 PM
@excaza This doesn't work in 2015b [1.2 2.4 figure]
It tries to convert 1.2 to a handle rather than the other way around
strangely...
there's almost like an order of operations for datatypes
except it's horribly broken
i.e. [uint8(1), 2.4]
 
@flawr I share the same feeling for "batshit crazy"
 
yields no warning or anything and downcasts the higher precision value
 
Haha, that is a good one too^^
 
@flawr Are you a synesthete maybe?
 
@LuisMendo I never knew that was the name for a person with that
The more you know!
 
9:30 PM
@LuisMendo Yeah, I percieve all links here orange.
 
lol:D
 
@flawr Bwahaha
@AndrasDeak Oh, I just saw this. Thanks! That's also Linux, right? So, it appears that Matlab produces char(0) as space on any platform, and Octave produces space on Windows, nothing on Linux/OS X
 
@LuisMendo linux, r2012b
and yes, it seems so:P
just to make your job easy
 
:-D
I'm tempted to force MATL on Octave to display char(0) as space
But I don't know...
 
would that be of use?
 
9:42 PM
 
How do I fliplr in MATL?
Apparently P gets the job done.
is it saying either do k or infinite?
or be able to handle both?
 
@AndrasDeak Only in very specific cases. Like creating a "diagonal string" with diag('abc'). Currently Try it online shows that as a vertical string (it ignores zero chars)
@Suever That's flip, yes
 
@Suever I'd think either
@LuisMendo ah I see
I had no idea that diag and stuff respect the charness of its input
 
@AndrasDeak It was Suever's idea :-) For the windmill PPCG challenge
 
of course, who else?:P
 
9:56 PM
7
A: Turn a string into a windmill

SueverMATL, 35 33 21 bytes jtn2/kYaG1$Xd`wtD3X!T This first version should work for MATLAB running on all operating systems and Octave on just Windows. It will not work in the Try it Online! version of MATL. The difference lies in the way that the null character char(0) is displayed. In MATLAB (and...

 
Hmmm I wonder if there's a way to write [1 1; 1 -1] easily in MATL
otherwise I could turn my last answer into a simple matrix multiplication
and maybe beat pyth
 
@Suever I understand that as: you can choose
@Suever Let me think...
TT TFv
If the stack doesn't contain anything else
But that's long
Oh. And wrong
You'd need to add Eq
 
I suspect ` hankel([2,1])-eye(2)` doesn't help either
 
@Suever How about
`tdwsvtDT
with input a 2x1 array
 
Hmmm I think the problem with that is that you still have to flip before the diff
Because matlab does a(2)-a(1) not a(1)-a(2)
Unless I'm missing something
@AndrasDeak Actually that may...
 
10:06 PM
@Suever True. I had inadvertently flipped the inputs
 
Yea I got caught by that at first
wastes a byte!
you could do diag([0,-2])+1
crossing fingers that [0 -2] is in that table...
O2_h1$XdQ
Lol nowhere close
 
@Suever I don't think so :-( And diag is 4 bytes
This is also 10 bytes
`+lM-yyDDT
 
Yea diag hurts with one input
Is it possible to call a function so it doesn't consume inputs
?
or is the solution to just use the M clipboard
 
@Suever No, all of them consume. You need to duplicate first, or use M as you say
How about this
using input parameter K
It gets rid of the D
Your code can probably be adapted too @suever
 
Before I go: It is an oldie, but still hillarious
 
10:18 PM
@LuisMendo Very nice! looks like you've got yourself an answer!
 
@Suever Nah, too similar to yours. Go ahead!
 
Do you think the formatting matters?
And not printing the first element
I guess the directions don't specify on formatting except that the two values are separated
 
well crap, there goes jelly
 
Formatting is flexible
@Suever As usual :-/
 
10:21 PM
I can't even understand the characters that it uses
we should have MATL support unicode. Ha!
 
@Suever Jelly is s̻̥̲̤̻̭ͅc̕ar̦̟y̮
@Suever I'm thinking of maybe one day adding a form of compression
There are about 380 possible "atoms"
convert them from base 380 to base 256
with some encoding from each base-256 "digit" to one byte
But that's a bit ugly in a way
I dunno
 
and cheating?:P
 
Yea some of those get way too compressed
 
@AndrasDeak PPCG is all about cheating :-D
 
The skill is more in understanding the crap than really coming up with a clever algorithm
 
10:26 PM
aaaaaw:(
@Suever except for Jelly:P
and Dennis
I sometimes try to understand his "verbose version with comments"
never succeeded in getting beyond the first line:D
 
@Suever You should really post this version. At least it beats Pyth
 
@LuisMendo Do you think the order of the inputs matters on this?
 
He says "The output order does not matter, so long as it is consistent."
But I'm not sure if he wants two columns
Yes, probably two cols are needed
 
oh I meant input
looks like he wants [a b] k
 
@Suever No, that's always flexible
 
10:29 PM
This solution is k [a b]
Oh ok. Still learning the rules :)
 
There's some meta post about that
Input is quite flexible by default
 
Also it looks like k is inclusive of the root
 
True. That's one more q
 
Still not bad
 
But output is a single col
Not sure that's allowed
 
10:31 PM
I can ask in the comments
 
The specs could be clearer
 
"non-numeric" separator
I'd call a newline a non-numeric sep
I wish we had recursion :(
Is it impossible to implement anonymous functions in MATL?
welp, no newlines
 
@Suever I'm afraid so. No anonymous functions (except some predefined for accumarray), no recursion
Personally I try to avoid recursion as much as possible :-)
Too hard to debug for my taste
 
Oh I completely agree :)
 
But yes, sometimes it's the best approach
 
10:36 PM
some of these challenges could benefit from it. Guess it's time to learn another esoteric language
just kidding. I still have lots of work on this MATL one
so I guess I'll leave my solution as-is since newlines aren't allowed. I think once you add in the h it gets it back to 10 bytes
 
@Suever CJam has something called memoizing (I never got what that is). I think it has to do with recursion. And it has code blocks, which are anonymous functions
Cjam is easy :-)
 
yea I wish MATL had a way to say "do that again!"
Especially for two-char commands
 
Yes, I've often thought of that myself
Maybe I'll add that in the future
Problem is, it's a big change for the parser / compiler
Same thing with eval'ing MATL code
 
10:51 PM
yea makes sense
and honestly most times I've thought I've needed it there's a better way to store the data in the first place
 

« first day (277 days earlier)      last day (2956 days later) »