Can't get started with Observables and ganja.js

I am newer to Observables and new to ganja.js and frustrated by my inability to get through the second lines of either Tom McWright’s notebook “Simpler ganja example” or one of Steven De Keninck’s examples from his Intro to ganja. I’m missing something fundamental and trivial. The two lines, which I copied and pasted into the notebook, are:
Algebra = require (‘ganja.js’) //correctly returns Algebra = ƒ(p, q, r)
Algebra(2, 0, 1, () => { // yields a red carot under “A” of Algebra and returns SyntaxError: Unexpected token.
I would dearly love to be able to use these two tools. Thank you.

Sometimes syntax errors can happen if you capture a space-like character that isn’t really a space in your copy and paste buffer. Seems to work for me:- Community Help / Tom Larkworthy / Observable

Thank you—I hoped that would work, but have also (again) retyped it (rather than copy/paste) and get the same result. Frustrating!

Pete

It will be easier to help you if we can see your code. Can you please publish your notebook as “unlisted” and share the link here?

Thank you, too! Here’s the link (I hope).

https://observablehq.com/d/e7a1b51584d19e47

Here’s the example code that is also in my first link.

https://observablehq.com/d/e120ca3cee0cf018

Ahhh, you have put two lines of code into one cell. Each line of code is supposed to be a seperate cell. Use the + button to create an additional cell (shown in pic, + is at bottom of left cell menu).

image

Yeah observable is a notebook environment made up of vertical cells. Like a spreadsheet but 1D. you will get it soon enough…

BTW I have been ‘user testing’ on folks who have never had experience of Observable and this trips up loads of people! People see an example and think that can just paste a block of code.

1 Like

Oh my goodness!! I have spent literally hours copying and typing multiple lines of code into cell number “A2” of the “spreadsheet”. I can’t thank you enough. I get it. I knew I was making a stupid error, but could not give up because this is exactly the package I dreamed of discovering. (I already ( 7:30 AM) have an algebraically complicated, physics-related test working.)

Pete Willson

4 Likes