Mar 24, 2022

Update: Learning Mathematica Slowly

I am on an extremely slow journey to pick up Mathematica again, one is that the current Mathematica is massive, the second is on me, in short “small brain”, that it is difficult to switch among several different programming languages. I mainly do coding with Python and JavaScript. I’ve tried to learn Julia and Mathematica at the same time since January, and got confused very quickly. So, in the next several months, I will focus on Mathematica first.


Currently reading: Wolfram Language Tutorial: Fast Introduction for Programmers

This book mainly explores Wolfram language on the level of grammar and syntax, it may fall short on emphasizing the importance of functional programming. Even though it plays a much minor role in Python, the basic idea of functioning programming lives well inside the Python ecosystem, for example, pure function (lambda) and map() are used frequently. If this book can absorb more materials from Functional Programming—Wolfram Language Documentation, it definitely helps a Python programmer understand the paradigm of Wolfram Language better.


The book comes with the notes for Java and Python programmers. The notes on Python are too simple and almost lose their purpose. The following are two examples:

  1. List comprehension: 

In Iterators | Wolfram Language Fast Introduction for Programmers, it says "Using Table in this way is analogous to using the [... for ... in ...] list comprehension construct in Python, though it has somewhat richer semantics.”. What’s the richer semantics? The list comprehension in Python is versatile, it has a basic format: newList = [ expression(element) for element in iterable], and combined with conditions(if/else), lambda function and nesting, it can do lots of things in a concise syntax. Here is not arguing the feature in which language is more powerful, it is mostly a missed opportunity for a better explanation on Wolfram language.

  

  1. f-string formatting:

In Strings | Wolfram Language Fast Introduction for Programmers, it says “TemplateApply in the Wolfram Language works similarly to Python's % or format function, except inline computations using <* ... *> are not supported in Python.” This claim is not accurate, Python’s f-string (introduced in Python 3.6) does the exact same thing. The screenshot shows some examples.



No comments: