I've Realized That My Tutorials Haven't Been Tutorial-y Enough

I've realized that my tutorials haven't been tutorial-y enough

I've realized that recently, my tutorial posts have been too much code and not enough explanation. That was a mistake on my part, so I am going to go back now and give better explanations.

Also, I have started to make a table of contents page.

I figured that if someone wanted to read the tutorial after a significant part of it were finished, that they might have trouble, because it would kind of be in reverse order.

So TABLE OF CONTENTS AHOY!

Yeah.

So uh, any suggested changes to the format of the TOC page?

Why cant I mark this as a post that can be answered? I can let people photo reply, but once it goes in drafts I can't let people answer this question? Or is it too long?

What is with this interface?

More Posts from Learn-tilde-ath and Others

12 years ago

reading the contents of user input, and calculator improvement

This post will cover how to actually determine WHAT the user has typed, instead of just how long it is. It will also include how to interpret what the user enters as a binary number, so that its easier to type.

An Essential part of making it interpret binary numbers is making it double numbers repeatedly.

This actually has a few ways that can be done, so this is one of the first situations where coding style for this problem might differ from person to person. Because of this, I will say more than one way to do it.

The first way to do this it to copy the number twice, and then start from zero and add both of the copies. This is relatively inefficient, and would take

a copy thing, consisting of two bifurcates (which would take a little time)

where the size of the initial number is N, 2N normal bifurcates, 2N reverse bifurcates, and 4N lines relating to the actual loop

assuming each command takes the same amount of time (which is an oversimplification) this would take 9N+C line times. (C is a constant) This might be acceptable, but there is a more efficient and nicer looking way.

The second way is nicer looking, but still not the most effecient. However, when multiplying by a larger number(such as 3, or 4, or even large numbers), this method is part of what would be used.

The second method is essentially copying the number (using a reverse bifurcate and a normal bifurcate), and then adding the number to zero, except instead of each loop increasing the new number by one, it increases it by two. This is shorter, and it looks nicer. It also only takes half as many normal bifurcates. As a result, the number of steps it would take (again assuming each step is the same length) is 8N+C, instead of 9N+C 

this one I will write out, but it is still not the best way:

//N is the number initially BIFURCATE [NULL,NULL]2NULL; BIFURCATE [N,N]G; BIFURCATE G[NCOPY,JUNK]; BIFURCATE 2NULL[RESULT,JUNK]; ~ATH(NCOPY){ BIFURCATE NCOPY[JUNK,NCOPY]; BIFURCATE [BLAH,RESULT]RESULT; BIFURCATE [BLAH,RESULT]RESULT; } 

ok, so yeah. that takes N, and puts twice N into RESULT, but it is still inefficient.

A more efficient version is to copy the initial number, and add the number to itself. This way you only have to do half the number of reverse BIFURCATE statements. This is much more efficient, taking instead the steps:

a copy thing, consisting of two bifurcates (which would take a little time)

where the size of the initial number is N, N normal bifurcates, N reverse bifurcates, and 2N lines relating to the actual loop

This has 7N+C steps, which is a significant improvement. I think it is the fastest way to double a number in drocta ~ATH.

It is as follows (N is the number)

BIFURCATE [N,N]G; BIFURCATE G[NCOPY,RESULT]; ~ATH(NCOPY){ BIFURCATE NCOPY[JUNK,NCOPY]; BIFURCATE [BLAH,RESULT]RESULT; } 

This is shortest and fastest solution I have found. If you find a shorter or faster method, please tell me.

Ok. Now we can double numbers. That is good. That is an important step. But we still haven't gotten user input to be read in any reasonable way.

Hang on, I'm GETTING TO THAT. GEEZ. (I'm kidding, no one has been complaining about my taking so long, other than myself)

Ok, so here goes:

To interpret the binary number input and convert it to a "number", we can follow the following algorithm:

start with zero.(this is before the loop)

If there are any characters left, double the number that is being created.

remove the first character from the remaining characters. If it is "1" or whatever symbol (or alternatively if it is not "0"), add one to the number that is being created. Otherwise, continue onto step 4 without doing anything first.

go back to the start of the loop (step 2)

Ok. thats the algorithm we are going to use. But I STILL haven't explained how to recognize what the next character is. Seriously what is up with that?

What you do is you bifurcate the rest of the input into [the next character,the rest of the input].

Now you have the next character. Then what you do is you reverse bifurcate it with some other object, and then you check whether that object is already dead or not.

But how do you make it so the combination is already dead? How do you get the object for the character before the user has even inputed it?

Answer: You don't. Not in the current version of drocta ~ATH anyway. You will have to tell the user to enter all the characters they will be using ahead of time. Yes this is horrible and stupid. No its not exactly like that in the comic. Its ~ATH what do you expect? :P

that might change in future versions, but I will try to stay backwards compatible with that.

but anyway, back to comparing it:

so you say something along the lines of:

import comparingobject CMP1; othercodehere makeNEQ1besomethingalive BIFURCATE [CMP1,CHAR]EQ1; BIFURCATE [NULL,NULL]2NULL; ~ATH(EQ1){ print yep, they are equal; BIFURCATE 2NULL[EQ1,NEQ1]; } ~ATH(NEQ1){ print nope, they are not equal; BIFURCATE 2NULL[NEQ1,JUNK]; }  

in the othercodehere you get the character a head of time, and say BIFURCATE[CMP1,THECHARTHATMATCHESWITHCMP1]D; D.DIE();

That makes it so that it will go through the one section of code if the character is the right one, but something else if it is something else.

Which is what we want.

So to put it all together, and make the thing that interprets the input as a binary number(hold on tight(ok, what, why did I say that), this will be a long one(why am I talking like this?)):

import blah BLAH; print please enter whatever character you will be using for binary zero.; INPUT ZEROCHAR; BIFURCATE ZEROCHAR[ZEROCHAR,JUNK]; import chrcmp CMP0; BIFURCATE [CMP0,ZEROCHAR]D; D.DIE(); print please enter whatever character you will be using for binary one.; INPUT ONECHAR; BIFURCATE ONECHAR[ONECHAR,JUNK]; import chrcmp CMP1; BIFURCATE [CMP1,ONECHAR]D; D.DIE(); BIFURCATE [NULL,NULL]2NULL; BIFURCATE 2NULL[OUTNUM,JUNK]; print please input the binary number you want.(it will be converted to unary); INPUT BINNUM; ~ATH(BINNUM){ BIFURCATE [OUTNUM,OUTNUM]G; BIFURCATE G[NCOPY,OUTNUM]; ~ATH(NCOPY){ BIFURCATE NCOPY[JUNK,NCOPY]; BIFURCATE [BLAH,OUTNUM]OUTNUM; }  BIFURCATE BINNUM[CHAR,BINNUM]; BIFURCATE [CMP0,CHAR]NEQ0; ~ATH(NEQ0){ BIFURCATE [BLAH,OUTNUM]OUTNUM; BIFURCATE 2NULL[NEQ0,JUNK]; } } print ok, going to print it out in unary, with each digit on one line. If the number you entered was large you might want to close the program instead of hitting enter.; INPUT JUNK; BIFURCATE [OUTNUM,OUTNUM]GOUTNUM; BIFURCATE GOUTNUM[OUTNUMCOPY,JUNK]; ~ATH(OUTNUMCOPY){ BIFURCATE OUTNUMCOPY[JUNK,OUTNUMCOPY]; print 1; } print Am I a terrible person for writing this?; 

Oh gosh. I wish I could indent in tumblr. that is terrible to read. tumblr is a terrible source code editor.

One time someone called me a masochaist for writing this type of stuff.

And then we just have to put that together with the adding thing, and then maybe add a better way of outputting the number. maybe in binary.

HAHAHAHAH

ok, yeah, I'm going to put it together in the next post, not this one, because I have to homework now.(using the noun homework as a verb was intentional)

yeah. putting it together in the next post.

As always, if something was confusing, please ask for clarification.


Tags
12 years ago

How often should I post stuff?

I am still here, and I am wondering what my update schedule for this tutorial should be.

Its been a week or two since I last posted part of the tutorial, so I feel like I probably should have posted during that time, but I haven't.

I will probably post one today.

Do you have any suggestions for what type of update schedule I should keep on this tutorial?

12 years ago

Syntax explanation post completed, and Hello, World.

I have completed the syntax explanation post, and I think it is fairly clear now.

If you find any part of the post to be unclear, and that it requires further explanation,  please say so so that I can improve it.

Now that that post is in an acceptable form, We can get on to writing our first few ~ATH programs.

print Hello, World.; THIS.DIE(); 

That wasn't so hard, was it?

I feel I should note that the syntax of the print command is not entirely finalized, it might change sometime later.

EXPLANATION:

The first line of the program says to output the text "Hello, World." 

The 2nd line of the program says to end the program. This is because the variable THIS initially points to a object that is only alive when the program is running. If the object is ever not alive, the program stops.

oh gosh why is this a bullet-ed list I am not good with tumblr

To run a drocta ~ATH program, you need the interpreter (available from the github), and python 2.7 (the interpreter can be easily modified to run with python 3, but it is written to work in 2.7)

Open interp_2.py with python, and when the program comes up, type in the filename of the ~ATH program, and hit enter, this will run the ~ATH program.

With this example, it should output the text

Hello, World.

Now, of course, this is a relatively simple program, but at least its something.

Depending on how you are running the interpreter, the program might close immediately after outputting the text.

That might not be what we want.

To make the program not close until we specifically tell it to, we use the following:

print Hello, World.; ~ATH(THIS){ } THIS.DIE(); 

EXPLANATION:

The first line is the same as in the first program. It outputs "Hello, World."

The second line is different, this says to start a loop, which will continue until the object pointed to by the variable THIS is dead.

The third line says to go back to the corresponding ~ATH statement.

The fourth line is never executed, because the loop above it will continue until the object pointed to by THIS dies, and if that object dies the program ends. If it were to be executed it would make the object pointed to by THIS die, and the program would end as a result.

This program should be the same, except that it will keep running until you close it manually.

Now you have hello world written in two different ways!


Tags
12 years ago

User input, and a basic calculator.

Most programs people use have some form of user input. A calculator isn't much use if it always uses the same numbers after all!

~ATH of course accepts user input and output as shown in the file Roxy sent Jane.

Also I just found out you can put more than one read more line in one post.

The input command has the syntax:

INPUT VARNAME;

What this does is when program execution meets this line, the program pauses execution, allowing the user to input text. When the user hits enter, program execution will continue and the variable VARNAME will be made to point to an object corresponding to the text the user entered.

This object is such that the left half is the object that corresponds to the first character. If there is no character after that, the right half will be the NULL object. Otherwise the right half will be the object corresponding to the input without the first character. If they hit enter without inputting any characters the object will just be the NULL object.

Now that we have that all explained, we can start to make programs that actually take user input!

As you might have guessed from the title, the thing we will be making is a very basic calculator. All it does is add two numbers, like in the last example.

But in this, it will get the numbers from the user!

One simple way to do this is to use the length of the input text as the number: The way we define what we call numbers just so happens (heh) to be such that if we interpret the object for the input string as a number, the number will be the same as the length of the input!

This isn't the greatest solution, but it is easier than other methods. We will use this method first and then move on to other methods that are harder to write, but will be nicer when using the end program.

HERE WE GO:

ok, so like I said, much of it is pretty much the same as that previous program, so we might as well just include said here:

SOME CODE TO GET A AND B HERE import bluh BLAH; BIFURCATE [BLAH,A]ATEMP; BIFURCATE [BLAH,B]BTEMP; BIFURCATE ATEMP[JUNK,ATEMP]; BIFURCATE BTEMP[JUNK,BTEMP]; BIFURCATE [BLAH,NULL]C; BIFURCATE C[JUNK,C]; ~ATH(ATEMP){ BIFURCATE ATEMP[JUNK,ATEMP]; BIFURCATE [BLAH,C]C; } ~ATH(BTEMP){ BIFURCATE BTEMP[JUNK,BTEMP]; BIFURCATE [BLAH,C]C; } BIFURCATE [BLAH,C]CTEMP; BIFURCATE CTEMP[JUNK,CTEMP]; ~ATH(CTEMP){ BIFURCATE CTEMP[JUNK,CTEMP]; print some text; } print DONE!; 

so pretty much what we need to do it put the code to get A and B where that goes(at the beginning), as well as stuff to tell the user how to print stuff.

Like I said, the objects from the input commands can be interpreted as numbers.

so this becomes:

print INPUT SOMETHING WITH THE NUMBER OF CHARACTERS AS THE FIRST NUMBER YOU WANT TO ADD; INPUT A; print INPUT SOMETHING WITH THE NUMBER OF CHARACTERS AS THE SECOND NUMBER YOU WANT TO ADD; IMPORT B; import bluh BLAH; BIFURCATE [BLAH,A]ATEMP; BIFURCATE [BLAH,B]BTEMP; BIFURCATE ATEMP[JUNK,ATEMP]; BIFURCATE BTEMP[JUNK,BTEMP]; BIFURCATE [BLAH,NULL]C; BIFURCATE C[JUNK,C]; ~ATH(ATEMP){ BIFURCATE ATEMP[JUNK,ATEMP]; BIFURCATE [BLAH,C]C; } ~ATH(BTEMP){ BIFURCATE BTEMP[JUNK,BTEMP]; BIFURCATE [BLAH,C]C; } BIFURCATE [BLAH,C]CTEMP; BIFURCATE CTEMP[JUNK,CTEMP]; ~ATH(CTEMP){ BIFURCATE CTEMP[JUNK,CTEMP]; print some text; } print DONE!; 

So yeah. That should work. I still need to test this, but I am pretty dang sure that this works.(have to go do homework now) In the next post I will explain how to make it so that the user can type in the number as an actual number!


Tags
8 years ago

This blog still exists

Hi, I haven’t posted much here in quite some time.

So, is this blog abandoned? I wouldn’t say so. I intend to post more ~ATH content here at some point. I have other projects and obligations, which is why I’ve been not doing as much with it recently (”recently”: understatement of the year), but if anyone has any questions about drocta ~ATH, or would like to request that I do something in particular with it, I think I’ll probably respond within a reasonable amount of time.

Right now though I thought I would link to two blogs that I think you are likely to appreciate if you like this blog.

The first is @sbahjsic http://sbahjsic.tumblr.com/ which is for a programming language and assorted connected software meant to be, well, sbahjsic . like sweet bro and h---- jeff. (Warning though, that blog has some javascript alerts when you view it. Also it has moving parts which might be bad if you get nauseous easily or something? idk.) The blog theme there is a work of art to behold. This is likely to appeal because it is also a homestuck related programming language, and also it is great.

The second is @tilde-he which is where I post most of my non ~ATH related tumblr posts. This is somewhat likely to maybe appeal because it is by the same person as this blog (me).

Again, if you have any questions or comments about my version of ~ATH, or, really, any version that you can point out, feel free to send them, and I’ll try to respond within a reasonable amount of time.

Alright, cheers


Tags
12 years ago

planned features and feedback.

I am planning two features to add.

one us user defined functions.

the second is, uh, it would let you make an object that would have itself as one of its components or one of the component of one of its components etc.?

the third one I am not sure if I think it is dumb yet, but I was thinking maybe functions being objects that you can bifurcate together to make functions.

which would allow for macros kind of?

which of these three features are good ideas, (as in, for each, it is a good idea)?


Tags
6 years ago

Merry Christmas!


Tags
12 years ago

Ok, apparently I hadn't pushed the code that allows user input to github.

I had written the code for user input a while ago, but apparently it didn't get put on github. And then my local copy got deleted. But I rewrote it today, and I fixed a bug with reverse bifurcation. So it should work now. And I have confirmed that it did indeed get put on github, so I don't need to worry about this happening again.

3 years ago

My ~ATH keeps crashing whenever I run a non-computer exploding code, or if I press enter. Why is this?

Based on the username which recently followed this blog at the same time as I received this ask (which I won't say what it was because you asked this on anon, and haven't received permission), I'd guess that you may be running a different version of ~ATH than the one I document here :P

Unfortunately, I don't have a specification for the version you have.

If you have such a specification, or the executable for it, I'd be happy to take a look if you could send it to me, haha.

If on the off chance you are using the version I document here, then presumably you have a syntax error or something in your code?


Tags
12 years ago

I couldn't help but notice that out of some of the best things you could do, no link to the download in the sidebar? You may want to do that...

uh, yes. that would be good to do.

I put a link in the about section, but I don't actually know how to put links in the sidebar outside of that.

do you think you could explain that for me?(I am not particularly experienced with tumblr)

EDIT:Nevermind, my friend from school told me where the feature is.

Loading...
End of content
No more pages to load
  • purrhaps
    purrhaps reblogged this · 12 years ago
  • learn-tilde-ath
    learn-tilde-ath reblogged this · 12 years ago
learn-tilde-ath - Learn ~ATH
Learn ~ATH

News and tutorials on drocta ~ATH by drocta. interpreter here A brief summary of how to write code in the language (but also see the table of contents)

38 posts

Explore Tumblr Blog
Search Through Tumblr Tags