Calcish2024-03-28T07:35:28+01:00Coding Robotshttps://calcish.com/blog/atom.xmlLittle detailshttps://calcish.com/2024-03-28-little-details2024-03-28T06:43:29+01:002024-03-28T06:43:29+01:00
<p>Here’s some of our favorite little details in <a href="/">Calcish</a>:</p>
<a name="more"></a>
<h3>Fancy JavaScript <code>Date</code> representation</h3>
<p>It has “syntax highlighting” and a tiny analog clock:</p>
<p><img src="https://calcish.com/img/2024/little-details/date.webp" alt="Date in Calcish" style="max-width: 458px; border: 1px solid #eee; border-radius: 10px"></p>
<h3>Number view selector</h3>
<p>Choose decimal, hexadecimal or binary.</p>
<video autoplay loop muted playsinline style="max-width: 546px; border-radius: 10px">
<source src="https://calcish.com/img/2024/little-details/dec-hex-bin.webm" type="video/webm">
</video>
<h3>File Quick Look</h3>
<p>File representation that displays the standard JavaScript/web <code>File</code> object as an icon with Quick Look, Export and Convert to Asset buttons 😍</p>
<video autoplay loop muted playsinline style="max-width: 720px; max-height: 100%; border-radius: 10px">
<source src="https://calcish.com/img/2024/little-details/file.webm" type="video/webm">
</video>
<h3>Cmd+P to create a codebook</h3>
<p>Quick codebook selector panel, which you can bring up by pressing Cmd+P, also enables creating new codebooks: simply type a name that doesn’t exist and press Return.</p>
<video autoplay loop muted playsinline style="max-width: 677px; border: 1px solid #eee; border-radius: 10px">
<source src="https://calcish.com/img/2024/little-details/cmd-p-create.webm" type="video/webm">
</video>
<h3>Last one for now</h3>
<p>Presented without comment. 🔊</p>
<video controls playsinline style="max-width: 560px; border: 1px solid #eee; border-radius: 10px">
<source src="https://calcish.com/img/2024/little-details/qbsound.webm" type="video/webm">
</video>
Calcish 1.0 is here!https://calcish.com/2024-03-25-release2024-03-25T00:00:00Z2024-03-25T00:00:00Z
<p><a href="https://apps.apple.com/us/app/calcish-run-javascript-ai/id6477182323"><img src="https://calcish.com/img/icons/Calcish_512@2x.png" alt="Calcish icon" width="256" style="float: right"></a></p>
<p>Finally, after two years of work, Calcish is here! I am happy. You might also be happy if it turns out that this is exactly the app you were looking for.</p>
<p><strong>What’s Calcish?</strong> First of all, it’s an app for macOS to do all sorts of calculations and code tinkering.</p>
<a name="more"></a>
<p>What do people do when they need to calculate something? They open a calculator, Spotlight, or Google. As a programmer, though, I want more than numbers — I want data structures. I want functions. What if I need to process some lines of text? Or call APIs? I’d open Vim, use some Unix utilities, run Python, or Node REPL. In most cases, though, I noticed that I’d rather open a browser console and do it there, just because I write a lot of JavaScript nowadays and am kinda used to it. But browser consoles are not very convenient. They are limited by double floating-point precision. And they forget everything after a restart. So I thought — why don’t I just write myself a simple app that I can bring up with a global hotkey, that will embed a JavaScript REPL and save what I typed? Well, it turns out, this app became not so simple. And it took quite a lot of time to write.</p>
<p><img src="https://calcish.com/img/2024/console-repl.png" alt="Browser console, Node REPL, Calcish"></p>
<p>I chose to base it on top of the QuickJS engine because it’s easy to embed, modify, and extend, and because it has some features that V8, JavaScriptCore, and others don’t have, such as Math mode with big numbers by default and operator overloading.</p>
<p>After creating the initial version that worked like a browser console, I thought it would be nice to be able to edit the expressions I had entered previously, like in Jupyter or Mathematica.</p>
<p><img src="https://calcish.com/img/2024/code.png" alt="Code in Calcish" width="672"></p>
<p>Then, since we’re already venturing into computing notebook territory, let’s also add some text editing capabilities. I’d like to write and format text instead of putting it into code comments.</p>
<p><img src="https://calcish.com/img/2024/notebook.png" alt="Notebook in Calcish" width="672"></p>
<p>Then the whole AI thing started and it seemed like a perfect fit for this user interface. But I couldn’t just call the APIs; I also wanted private local models. Thankfully, they were becoming better and better (I started this project with GPT-J, and now we’re up to Mistral and Llama 2), and Apple Silicon Macs run them quite fast (my main machine is an M1 MacBook Air with a mere 8 GB of RAM, and local LLMs work fine on it!).</p>
<p><img src="https://calcish.com/img/2024/ai-models.png" alt="AI models settings in Calcish" width="672"></p>
<p>Then, a lot of work went into providing useful functions: for web connectivity, HTML and RSS parsing, design work (colors, markdown), text encoding, randomness generation, and more.</p>
<p>Finally, there are over a thousand files of documentation, describing every standard ECMAScript function, class, and constant, as well as functions that are specific to Calcish, and a search engine for it based on SQLite’s trigram indexing. (This deserves a separate post.)</p>
<p><img src="https://calcish.com/img/2024/docs.png" alt="Documentation in Calcish" width="672"></p>
<p>So, here we are. Calcish 1.0 is here. It’s a computing notebook with AI capabilities. It’s a tool for programmers, data scientists, and anyone who needs to do calculations, call APIs (with secure secret key storage), and figure out algorithms easily. It’s a perfect tool for me, and I hope it will be a helpful tool for you too.</p>
<p>You can get it for free on the <a href="https://apps.apple.com/us/app/calcish-run-javascript-ai/id6477182323">Mac App Store</a>. (We also offer a Pro version with additional features and unlimited codebooks — we’d appreciate it if you could upgrade to help us make it sustainable.)</p>
<p><em>- Dmitry</em></p>
print() in JavaScripthttps://calcish.com/2022-09-09-print2022-09-09T00:00:00Z2022-09-09T00:00:00Z
<p>Many programming languages have the <code>print()</code> function or operator to output text into the screen.</p>
<p>In JavaScript the story is different.</p>
<a name="more"></a>
<p>Since it was created to manipulate HTML documents in
the browser, the output-to-screen function was <code>document.write()</code> (<em>was</em> because it’s no longer
recommended to be used — instead, you should manipulate the Document Object Model).</p>
<p>There are also the <code>alert()</code> function (a method on the <code>window</code> object), which will display a dialog, and
<code>console.log()</code>, which will write the output into the developer console.</p>
<p>The <code>print()</code> function is also there, but instead of writing to the screen, it sends the document to the printer! Or, rather, it causes the printing dialog to pop up. This can be confusing for novice users, and makes the “Hello world” program look different from most other languages.</p>
<p>Since Calcish doesn’t use DOM, we took the <code>print()</code> function back — in Calcish
it will write the arguments into the screen (specifically, to the output part of the evaluation result).
To send Calcish documents to a printer, just use the menu.</p>
<p><img src="https://calcish.com/img/2022/print.png" alt="print function in Calcish" width="411"></p>
<p>The only downside is that after hours of tinkering in Calcish, I sometimes write <code>print()</code>
in the browser’s JavaScript instead of <code>console.log()</code>, getting the nasty print dialog.
Of course, we’ll also support <code>console.log()</code>, so if you chose not to use <code>print()</code>, you’re
free to do so.</p>
Welcome to Calcish Blog!https://calcish.com/2022-07-06-welcome2022-07-06T00:00:00Z2022-07-06T00:00:00Z
<p>Welcome to Calcish Blog! Or should we say: <code>print("Hello world!")</code>?</p>
<p>Calcish is a new calculator and REPL for programmers that we’re working on.
It will be released later this year. Meanwhile, we’ll share progress and insights here in
this blog.</p>
<p>Please subscribe to our newsletter to be notified when the app is released,
or follow this blog via the <a href="https://calcish.com/blog/atom.xml">RSS/Atom feed</a>.</p>