18
\$\begingroup\$

Some examples.

Desmos.com is a graphing calculator. Would it count as a programming language? Here is my case, with respect to this:

  1. Representation of a natural number: 42.
  2. Tuples: \left[1,2,3,4,5\right].
  3. Transformational Model: f_{Transform}\left(x\right)=3x-2.34
  4. Adding two natural numbers: f_{Add}\left(x_1,x_2\right)=x_1+x_2
  5. Prime checking:
    1. d_{iv}\left(x,n\right)=1\left\{\frac{x}{n}=\operatorname{floor}\left(\frac{x}{n}\right),0\right\}
    2. p_{rime}\left(x\right)=1-\operatorname{sign}\left(\sum _{n=2}^{x-1}d_{iv}\left(x,n\right)\right)

Not exactly the most golf-friendly language, but is it a language? How would characters be counted? (source versus appearance?)


Further questions: What is an acceptable input? (I think sliders/variables.) What is an acceptable output? (There does not seem to be a way to output arbitrary strings; you can hard-code the string by typing a quote (") to insert a text equation. OR you could upload images of necessary texts.)

\$\endgroup\$
11
  • \$\begingroup\$ Since it meets the consensus that you linked, I think it does count as a language. I would assume we would count it like TI-BASIC where each operation has it's own assigned byte, but I don't know how they implemented it, if there are more than 256 operators some would need 2 byte or more op codes, then things start to get confusing. \$\endgroup\$ Sep 28, 2015 at 19:33
  • 1
    \$\begingroup\$ I find it very unlikely that operators are a single byte. Someone who is experienced at JS could read the source and find out. \$\endgroup\$
    – feersum
    Sep 28, 2015 at 19:41
  • \$\begingroup\$ What should we consider truthy/falsey values on Desmos? The only conditionals are comparisons. \$\endgroup\$
    – lirtosiast
    Sep 29, 2015 at 4:41
  • \$\begingroup\$ @ThomasKwa Well, there are expressions like \left{condition,elseVal\right}. The condition is an expression (e.g., x = y, x > y, x <= y, ...). As far as truthy-ness goes, only expressions are considered to be valid input towards the aforementioned conditional. See this for (a lot of) examples of the {...} used as a restriction without an else value. \$\endgroup\$ Sep 29, 2015 at 11:12
  • \$\begingroup\$ What about scoring by keystrokes? Does vim golf compete with regular golf keystroke to byte? \$\endgroup\$
    – lirtosiast
    Sep 29, 2015 at 15:10
  • \$\begingroup\$ @ThomasKwa I thought about that, too, though it seems like it be up to debate + is hard to replicate, esp. for long programs. Still, Desmos holds up pretty well here... \$\endgroup\$ Sep 29, 2015 at 20:30
  • 3
    \$\begingroup\$ Just a note: I would call this "Desmos", not "Desmos.com". \$\endgroup\$ Sep 29, 2015 at 21:50
  • \$\begingroup\$ Does anyone know of a way to easily convert the copied expressions (e.g. f\left(x\right)=2\left\{x>1,3\right\}) into desmos (looks like f(x)=2{x>1,2})? How do I turn the escaped form into a desmos program? \$\endgroup\$
    – Cyoce
    Jan 11, 2016 at 22:26
  • \$\begingroup\$ You copy-paste it @Cyoce \$\endgroup\$ Jan 11, 2016 at 22:27
  • \$\begingroup\$ @CᴏɴᴏʀO'Bʀɪᴇɴ I thought I had tried that, I guess I did it wrong.... It works... (facepalm) \$\endgroup\$
    – Cyoce
    Jan 11, 2016 at 22:29
  • \$\begingroup\$ @Cyoce All is good ^_^ \$\endgroup\$ Jan 11, 2016 at 22:30

1 Answer 1

22
\$\begingroup\$

Yes, Desmos.com counts as a programming language

Scoring is the "normal" bytecount without special rules

The examples above of Desmos.com's programming language demonstrate that it is a fully-functional programming language capable of solving a wide range of problems (probably all primitive recursive functions). We should accept it as a programming language the same way we allow TI-BASIC and Mathematica.

Although the language may have limited input/output functionality, I believe we should treat this as a "feature" of the language (accepting the language as limited in this regard). A lack of string operations has no impact on whether or not it counts as a language.

Scoring should be calculated normally, without a special encoding. For example, your "adding two numbers" program should count as 35 bytes.

TI-BASIC's special encoding is based off of several reasons:

  • Each command is a single token which takes up either 1 or 2 bytes in memory. binomcdf( is a single token taking up 2 bytes. You can directly measure the bytecount of any program from within the calculator.
  • Programming is performed token-wise. You select binomcdf( from a menu instead of typing each letter. You are unable to edit it in way (such as typing other letters in the middle of it). Even if you type the individual lowercase letters b i n o m c d f ( it would not function, even though it would look the same (it would also have more bytes).
  • When run, the TI-BASIC interpreter receives binomcdf( as two bytes because that's how it's stored.

On the other hand, in the case of Desmos.com:

  • Although you can enter functions via menu, you can also type them out by hand and backspace in the middle of them. This demonstrates how the editor treats the program as a series of individual characters.
  • I strongly doubt the existence of any special tokenization or character encoding that exists when storing the program.

I believe that the string you get from copying the program out of Desmos (like the OP's examples) is the most reproducible/verifiable option for measuring program size.


I have become aware, however, of some auto-formatting done by the Desmos editor. For example, pasting in y=sinx is the same as pasting in y=\sin x. This may open up other, more editor-specific ways to measure size. Somewhat interestingly, copying the function will always result in y=\sin x but typing out y=\sin x doesn't work (typing y=sinx does work).

\$\endgroup\$
1
  • \$\begingroup\$ Lovely! Thanks you for your input. \$\endgroup\$ Sep 28, 2015 at 23:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .