Suggestion: add a doc page called "CL for coders from other languages: how it is different"

Dear CL folks,

My personal experience trying to learn CL, which I’m guessing many others have felt too, has been feeling “Wow, this seems very different to the languages that I’m used to. But I’m not exactly sure how”. I’ve done most of my coding in Matlab (yes, I’m old) and more recently in Python, but probably people coming from C, Java, etc. may have felt this way too.

For example, today I learned from this forum that CL script doesn’t actually store or update variable values. I was starting to think that was probably the case, but I wasn’t sure.

Given how different CL is from standard procedural programming languages, I think it might be useful to have a page in the online documentation somewhere, laying that out explicitly. I haven’t done functional programming, but I get the impression it’s maybe structured more along those lines?

It might be worth adding a documentation page titled something like
“CL for people who have coded other languages: how it’s different from what you’re probably used to”.

Something like that would help me (and probably many others) a lot. I’m not sure if my guess above is correct that it’s more like functional programming, but if it is, a brief doc note saying “CL is a functional programming language, not a procedural one” probably wouldn’t be enough, because the target audience (e.g. people like me) wouldn’t know what that actually means or what it implies.

For me, the most confusing things have been:

  1. Trying to figure out how all this stuff about sources and sinks relates to the programming that I’m used to (e.g. functions with arguments and outputs, variable assignments, etc.)
  2. The fact that CL doesn’t execute a series of commands in order. (Or at least, I don’t think it does, but I’m still not sure about that!)
  3. The fact that CL doesn’t store variable values, and hence that it can’t update those stored values. (I learned this today, from this forum, after having been puzzled by it for months).
  4. Probably a bunch of other important stuff too, that I don’t even realise yet that I’m naively assuming will be like normal coding, but that I haven’t tripped up on yet.

My apologies if this post sounds whiny! I love Desmos, and I think CL is a fantastic addition to it. It’s just that when I started trying to learn CL I naively thought to myself “Hey, I know how to code, so this should just be a matter of learning a few new commands and some different syntax”, and boy was I wrong about that.

I also appreciate that writing new documentation is a ton of work. If anyone at Desmos does decide to try to write a new doc page, then I would be more than happy to help in any way I can, e.g. by giving feedback from the perspective of whether it makes sense to a clueless newbie like me! :smiley:

Raj

The most telling difference for me in the CL is the lack of any type of iteration, which I think would be particularly useful for tables where currently each cell needs to have it’s own line of code. Holding Alt+click is a very useful trick to edit the same character within multiple lines of code. You can sometimes achieve those iterations within a graph using actions or lists, which I think maybe relates to your #3.

There is one important situation where code is read in order is the when-when…-otherwise conditionals. Another way of “updating” a variable.

I have only some self-taught coding experience usually with some educational purpose. A little V-Basic to code dynamic worksheets in ExamView. This seems closest from my experience, but again I only know it in this context. Some JavaScript initially spurned to make my own for Khan Academy (which never really happened). A little Python.

1 Like

Thanks, very interesting. Every coding language gets users from all kinds of different backgrounds, and so different things will feel familiar or weird to different people.

My guess is that other people, like me, will also get the feeling with Desmos CL: “Wait, what, why aren’t things working as sequential procedures like I’m used to?”. However, I actually have no idea! For all I know, that may just be my own personal weirdness! :smile: