Lojban for Programmers Part 1: Grammar Terms and How to Make Statements

« Part 0 | Part 1 | Part 2 »

I'm giving this post a structure of explaining the applicable programming structure, what the Lojban terms are, and then how they translate between each other. This structure may change in future posts. Also, while I'm not committing to any particular programming language, the (pseudo)code examples will mostly look familiar to users of C-family programming languages, unless I decide something else makes the point clearer.

This post parallels Wave Lesson 1, which should be read before/after/while reading this.

Programming concepts

Programming is a way of telling a computer what something is and what to do with it. This is generally done by variable assignments and functions, respectively. For example the code site = "lojban.org" is a variable assignment that tells the computer that some variable called "site" should have value "lojban.org". Then this could be used in a function call like print(site) to "print" the contents of the variable "site", likely by showing the string "lojban.org" in the console running the program.

However, functions aren't limited to just showing output. In fact, functions can be used as a way of storing data, much like variables. For example, instead of site = "lojban.org", a program might call a function like setValue("site", "lojban.org"), which might store pairs of strings as a sort of map. Then the value could be retrieved via something like getValue("site"), which would then return "lojban.org". Making assignment into a function might be used for things like storing values in a database or having the function do extra processing when storing the value.

Lojban concepts

Parts of speech

Lojban documentation and tutorials I've seen thus far seem to shy away from using English terms for Lojban parts of speech. While it is possible to adequately define Lojban parts of speech in English, Lojban does not have nouns, verbs, adjectives, and adverbs as we know them. So I'm attempting to describe Lojban parts of speech in English and give the most familiar parallels there are, but also make it clear how Lojban is different. Lojban as I have learned it thus far has, roughly speaking,three types of words.
  • sumti: About the same as nouns or noun phrases, sumti are the objects that say what you're saying things about.
  • selbri: The action words of Lojban, selbri feel like an alien type of verb. See the example selbri in Wave Lesson 1 to see how different they are from English verbs.
  • grammatical modifier-type words: There are words that will be learned in later lessons that change syntactic and semantic meanings of other Lojban words and phrases. These are for later lessons, but for now know that Lojban has tools to do things such as: change parts of speech, group related words, specify temporal and spatial tense, and express emotion about something.

Sequences of words

Combined, these types of words can form:
  • jufra: Any Lojban utterance, from a "sentence fragment" to a "sentence".
  • bridi: A complete idea, a logical proposition, something with a true-false value, a Lojban "sentence".
As this is Lojban for Programmers and not Lojban for English Speakers (even though this is written in English), I'm skipping the full English descriptions that you have read/are reading/will read in Wave Lesson 1.

Lojban concepts in programming terms

Lojban bridi are like function calls to add information to the recipient's concept storage system (today a brain, but maybe some day an AI's database...). They combine sumti and selbri to make a statement. While in programming terms a bridi might look like selbri(sumti1, sumti2, sumti3, ...), in Lojban the order is a bit different, looking like sumti1 selbri sumti2 sumti3 .... So a bridi is like a function call in programming, only there aren't any parentheses and commas, and the first parameter is listed before the function name.

Note that, as in programming functions, Lojban selbri require you to know what the different parameters are and how they relate. So learning Lojban vocabulary is kind of like learning a programming library for encoding human thought.

Aside -- this lesson's vocabulary

While the grammar terms sumti, selbri, jufra, and bridi are useful to talk about Lojban, we need more words to talk in Lojban. Since the copyright notice on the Lojban wiki says content is licensed under the Creative Commons Attribution license, I'm taking the liberty of directly copying the vocabulary definitions from Wave Lesson 1.

selbri (note that x1, x2, etc. are placeholders for the sumti, as in the Wave Lessons and other Lojban resources):
  • dunda = x1 gives x2 to x3 (without payment)
  • pelxu = x1 is yellow
  • zdani = x1 is a home of x2
  • mi = I or we -- the speaker(s) of the jufra
  • ti = this -- a thing or event close enough to be pointed at by the speaker
  • do = you -- the one(s) being spoken to
grammar word
  • .i = sentence separator -- separates jufra, and thus also bridi
    • Note: This is like a semicolon at the end of a line in a  C-family programming language. But .i is used as a separator, not a terminator. It's only used between statements, making it optional after the last one.


If you think about acting on linguistic constructs in your mind as following a program in an object-oriented C-family language, then you might define the selbri dunda in programming terms as stating that x1.give(x2, x3) happens; i.e., the object/entity x1 runs its give() function on owned object x2 to transfer it to entity x3. The bridi mi dunda ti do thus means that I/we give this to you/y'all.

While dunda has a pretty clear parallel to a hypothetical programming function, pelxu seems more like an attribute or property. Perhaps x1 pelxu could be translated into code as true == x1.isYellow or x1.colour == yellow. On the other hand, programming is flexible enough that this could be translated as x1.setColour(yellow), so the selbri-as-function comparison still holds.

Closing remarks

Thus far, Lojban grammar maps well to programming, but it takes a bit of creativity to think of some selbri as functions. Fortunately, programming is flexible enough to convert variable/attribute assignment into functions, to the point where I feel like var = value is just syntactic sugar for setVar(var, value). Does Lojban have similar syntactic sugar? Stay tuned and we'll find out eventually! In the meantime, make sure you've gone thru Wave Lesson 1.

No comments:

Post a Comment

I've finally set this to email me when comments require approval, so no more waiting 3 years.