hello, fig (based on lambdashire hotpot post)

today i found a particularly charming new entry about “hello world.” i will quote parts of it here and direct you to the original: -> https://lambdashirehotpot.wordpress.com/2017/05/05/hello-world/

“The ubiquitous introduction to a language, the purpose of the hello, world program is to get the user up and running in an environment, prove that their system is working and provide a taste of its syntax and philosophy.”

alright! so lets do fig. fig tries to be the easiest practical language to learn, topping even basic. (basic has an incredible history, is pretty much the first computer language designed to be learned by everyone– logo is the second– and it has few things about it that are worth improving for an educational language. but there are some, and fig does try.)

how to do hello world in fig?

hello

thats great. but we want it to say hello world:

hello “world”

ok, now weve set the variable hello to the string “world” but we want the string to be “hello world”:

now “hello world”

the “now” almost could be anything:

x “hello world”

p “hello world”

helloworld “hello world”

englebert_humperdinck “hello world”

the goal of hello world is to put it on the screen. we therefore add the print command:

now “hello world” print

now for a “lambdashire hotpot”-style analysis of this example: (loved the “‘armless” bit, lh.)

“It’s terse, requires no unnecessary boilerplate and gets straight to the point, which tends to be true of the language in general.”

i think fig works nicely here, though it does require that most lines begin with a variable. on the other hand, fig doesnt require parentheses to print.

“But let’s take a look at some of the implicit assumptions made here:”

“The python executable needs to be available in our environment, and if it wasn’t initially, then we needed to run a simple installer or take a trip to the system’s package manager.”

at least as much is true for fig.

“We need to understand the process of the call-response mechanism that command line interfaces use in order to enter the print command and interpret its output.”

there is an equivalent of this for fig.

“We must be competent in text entry via, perhaps, a keyboard.”

same here.

“This can run on a device somewhere that we have access to, maybe a desktop PC.”

🙂

“We are fluent enough in written English to understand that ‘print’ is a verb and ‘Hello, world!’ is an object. And that the quotation marks in the construct ‘some words’ draws on the metaphor of someone speaking.”

well, fig goes left-to-right a little more often.

“At some point we need to able to take some of this for granted,”

yeah.

“So let’s try taking a look at the concepts presented in the program itself that the user will be expected to understand or learn”

perfect:

“The pattern name(argument) is a statement indicating that the command name will be invoked with the given argument.”

fig is less explicit in this regard (a huge no-no in python. but fig isnt always like python.) the pattern is left-to-right and new variables are on the left, except for block commands.

“The symbol print is to be interpreted as an atom, in this case an identifier representing a named command, which is implicitly always available to the user.”

same here– though the first part is the variable, the second (in this case) is the string it gets set to, and then what to do with it follows after it is set.

in most languages, the function has to point to the object. but by following chronologically, the object is associated implicitly. (again frowned upon in python. but i think both designs have their own merits.)

“The symbol ‘Hello, world!’ is also to be interpreted as an atom, in this case a string of characters in which whitespace does not act as a separator.”

same here!

“Defining string literals is likewise always available to the user as part of the language.”

indeed, a string literal in fig is either a function parameter, or it overwrites (sets) the default 0 value of a new variable.

“The act of entering a newline causes the command to be evaluated and run.”

the act of entering a newline indicates a new line (and very likely a new variable also.)

“The double-quotes are not included in the output, so there is some difference between the representation of the underlying string and the format of the glyphs that form the output.”

also the same in fig, as well as many other languages.

“the action of printing to the console occurs as a ‘side effect’ – something that cannot be expressed in the language directly.”

hmm, i think ive conflated “state” with “side effect” for too long. is there any sort of i/o that doesnt qualify as a “side effect?” (not a rhetorical question.)

“That’s actually quite a cognitive load! And we’ve not even got into other ‘simple’ concepts such as numbers, variables, sequential execution, conditional execution, loops, and function definition…”

well, youve overexplained it. but i enjoyed it. fig was designed specifically around the concepts of:

* variables * input * output * basic math * loops * conditionals * functions

lets find out how that matches your excellent list:

(y) numbers
(y) variables
(y) sequential execution (well it does go left-to-right)
(y) conditional execution
(y) loops, and
(y) function definition…

“It’s very easy to forget how hard the first few steps can be, and Python is one of the simpler entry points.”

i agree. i coded in basic for a quarter century, and spent years looking for the best “21st century basic” dialect. i settled on python, and also used python to write fig.

i believe im also your first follower– i hope you enjoy this platform, and write more.

cheers.

 

Lambdashire Hotpot

Welcome! This is a blog about programming. And what better way to begin a blog about programming than with a clichéd post about Hello World? The ubiquitous introduction to a language, the purpose of the hello, world program is to get the user up and running in an environment, prove that their system is working and provide a taste of its syntax and philosophy. So let’s see what we can learn about some contemporary languages from how they present us with this allegedly straightforward task. Today, it’s the turn of everyone’s ‘armless snaky friend, Python.

Python

Hello world in Python is simple, right?

It’s terse, requires no unnecessary boilerplate and gets straight to the point, which tends to be true of the language in general. Excellent. We are encouraged to run it in an interactive mode to begin with, so let’s do so.

Like I said, simple! But let’s take a look…

View original post 532 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s