# How to count programs in Folders?

Folders is an esoteric programming language without any files at all. Instead, the program is represented by the directory structure instead, so our normal rules for counting the file size of the program won't work here (or all Folders programs would be zero bytes, which is clearly impractical).

So how should Folders programs be counted? Two options I can think of:

• Define an ASCII representation of a Folders program and count that.
• Count how many bytes the folders take up in the file system (if that is easy to determine, and then the question is which file system should be used).

As far as I understand, the folder names are the commands, while the hierarchy provides the structure, like opening and closing braces in C-style languages {}. So I suggest counting...

• ...the total length of all folder names plus:
• ...one (or two or more) byte/s for each folder.

This seems to be pretty much consistent with earlier discussions:

Counting bytes for multi-file programs

Loopholes that are forbidden by default

• In an ASCII representation, would a single-byte delimiter be enough to encode any arbitrary tree? – Martin Ender Nov 9 '15 at 19:46
• For a binary tree I think this would work as e.g. heaps are usually stored in lists, but I am not yet sure about more general trees. – flawr Nov 9 '15 at 19:49
• @MartinBüttner cc:flawr After experimenting a bit, I think for general trees the answer is no. For any proposed system, try this tree: a->[b->[c->[d,e]],f]. I don't think there's any way to avoid two end-of-children tokens in a row. – DLosc Nov 9 '15 at 20:21
• So would it be reasonable to generalize this to "if the filename matters, it always counts as the length of the filename plus two bytes for directories / one byte for other files"? – Doorknob Nov 9 '15 at 20:56
• @Doorknob Yes I think that is a reasonable suggestion! – flawr Nov 9 '15 at 21:11
• @Doorknob Apparently Folders ignores all the files in the directories, so for this particular discussion it would be "folder names plus two bytes for each folder after the first". I guess that's technically more bytes than a string representation would need (at the lowest level, folders could be separated by a single byte). Maybe we should also amend the other consensus to make additional required folders count two bytes in general. – Martin Ender Nov 10 '15 at 17:39
• @DLosc Maybe we can't use one symbol only mean beginning of folder, but maybe two, each costing half byte? – l4m2 Oct 30 '18 at 2:08

# A JSON/XML/YAML format of the hierachy

If I recall correctly, We can change the folders and files to json or xml. That might be better (and easier) to score.

• yaml – dkudriavtsev Feb 10 '17 at 4:09
• Oh, right. yaml. – Matthew Roh Feb 11 '17 at 4:22