Someone beat me to it! This is a programming language for 文言, literary Chinese. (Lit Chinese is really only a fork of classical which is somewhat backwards compatible with Classical Chinese, but whatever.) I am going to nag the author Anthony Fu to make this more Lispian and add staff and Suzhou numbers.

Understand... This is not a just novelty, this is EASY TO READ for us wacky literati types! And more bit frugal. This is wonderful!


Dear @lisp
Someone made a nice programming language using literary Chinese. I was hoping to someday make a Scheme which does this. Please tell me:
甲. Can this easily be made more Lispian easily and how would I do so?
乙. I wanted such a language to use the old staff numbers (stick calculation in squares, came before abacus, now in Unicode) and “Suzhou” numerals in an organic way. Any thoughts how to do that?
丙. It looks weird to read left to right and is ugly. How to make text TtB,RtL?

@lisp the dev are calling the literary Chinese language for 文言程序言, I reckon. It looks too JS like? I should rather it use 【】《》•。、 or such marks, the latter of which are backwards compatible to literary and classical text.


So nifty doodle!

Show thread

Why it is important to have a Chinese based programming language:

Many years ago, I realized that the spare grammar and formalism in Literary Chinese would be well adaptable to programming. Moreover, in some ways poetic forms have algorithmic dimensions. There is a wealth of possibility for novel concepts to be developed using traditional Chinese maths, too. makes programming more accessible for people who read ZH-Lit. And there are heaps!

Show thread

The grammar in could be tightened up a bit. (Define) could be set with 也 instead of 曰 to make it more terse and less abstract in tone. But it’s remarkably readable. Have to read up on how he is using 云 and such, though.

Show thread

All Chinese text should use full byte spaces and monospace. Especially in code. Why? Traditional poetry, text, song, etc. generates resonances across lines. When properly arranged, these resonances or rhymes or contrasts are highlighted and made glorious.

If you don’t believe me, walk around any Chinatown and look at the couplets posted around doors for New Years 春聯 next week.

Balance, harmony, meaning beyond the prosaic. This can and should be part of code to make it more legible.

Show thread
@Shufei I think using Racket would be the best bet. Racket's intentionally set up to design new programming languages.

TtB, RtL is perhaps trickier. Maybe it would be easier to have the editor translate the visual display?


@emacsomancer Sigh, yes, I recall I think you and I went down the rabbit hole for TtB regarding terminals and it is definitely a hairy problem. I don’t see why an editor can’t just print that way. I’ll have to get my brain together and dive into that with some discipline, make some lil notepad editor print that way by default and just ignore the issues with LtR language sets.

Honestly I’m jolly tired of reading LtR and then going to paper for proper TtB. It is jarring and messes up poetry.

@Shufei I think Emacs could be a good starting point, as you would already have a bunch of editor stuff available and something approximating a Lisp Machine for building on top of.

RtL text is already supported in general (how it interfaces with a programming language is more complicated, perhaps; we talked before about difficulties of indenting code making reference to something other than the left edge).

TtB should somehow be possible. Org-mode has tables, which includes multicolumn, and I would guess that a TtB system could be adapted using whatever mechanisms Org-mode is taking advantage of for tables.

Making this all interface with a literary Chinese based programming language would be another step, but since the underlying representation isn't really LtR per se (assuming something like an abstract syntax tree), in theory the human interface could be more flexible.

All of these pieces are going to be non-trivial to implement though, I think.

@emacsomancer Rather! Haha. Frankly... I always feel like a lil kids diving into this stuff, eager but overwhelmed. It’s a big cookie to swallow, but I shall keep nibbling at it and annoying my sempais like you who can point the way.

There is always the fake TtB route. There are some apps for iOS which either squeeze lines down to one space and use XML &c to arrange them RTL or simply reformat txt by algorithm. Both are kind of cheating, but simpler to implement.

@emacsomancer EMACS kind of skeery to me! But I suppose it is time. I shall try to learn some of it. And indents, lordy... Yes, that was a sheep shear. I think that could be faked with reinterpreting initial line full byte spaces, though. That is traditional anyway.

Tagging this thread for later recall:

@Shufei Since Emacs is designed to be an extensible editor, it makes sense as likely base. And since the way one extends and reconfigures Emacs is via Lisp, doubly so.

There's an initial steep learning curve for Emacs to get into a position for it actually to be useful, but once you're over that one can actually acquire more skill in it in a pretty incremental fashion (e.g. in small bites/bytes).

My current Emacs config continues my original Emacs config from the 2000s. So it has bits I've copied-and-pasted in, and then tweaked, and things I've written 'from scratch'. Occasionally I'll look back at old bits and see that they're somewhat stupidly written, and sometimes rewrite them. But even stupidly written bits worked fine for years. The point being that it's not too much work to get to the point to be able to write functioning things, even if they're not perfect. Lisp is great for being to get things working quickly.

@emacsomancer I appreciate the longevity culture to Emacs, having forward compatibility and optimization on the level you all use it. I once heard a chap talk about how he watches videos in emacs and such, haha. But, yes, goodness the first few steps are forbidding. But you’re right. Time to do Emacs, haha. Anything I can stick with in my slow way and cut down on distraction is a good idea.

@Shufei Yes, I really appreciate the longevity & 'tradition' of Emacs. In software terms, it's practically existed since nearly the beginning of time.

I'm always happy to attempt to answer Emacs-related questions. One nice thing about Emacs is the document is not bad (and it's self-documenting). `C-h t` brings up a decent in-Emacs tutorial, for instance.

@emacsomancer Well, I tried to be a Vim fan, but mostly it makes me want to cry, and tell me if I’m wrong but it isn’t as extensible and malleable which is what I’m after. So I shall do the tutorial and hope can remember the commands eventually.

@Shufei Vim wants you to buy into the Vim-way. It's not designed primarily as an extensible editor, but rather as an efficient editor. There is Vimscript which allows for some customisation, but it's nothing like Emacs Lisp, and is perhaps more of an afterthought.

Of course, Emacs being Emacs, there's a package that emulates Vim-style editing. It's called evil-mode.

For remembering keybindings, when you're starting out it could be helpful to have a printed quickreference card: https://www.gnu.org/software/emacs/refcards/pdf/refcard.pdf that lists commonly used things.

Of course, again Emacs being Emacs, you can assign new keybindings if you desire.

(In general Emacs itself can be helpful in helping you to remember keybindings and commands in various ways.)

@emacsomancer Generally I prefer to learn standards for interoperability. The whole oldschool keybindings thing can get a bit obtuse, though. And I have trouble associating them sometimes, in a visual way. Many coders poopoo GUI, but it is cognitively friendly for some of us. So if Emacs let’s me make lil wingding /dingbat icons for things, more’s the better?

@Shufei By default GUI Emacs (and you should generally use the GUI version and not the terminal one, the GUI one has more features) starts up with drop-down menus and a GUI toolbar (and you could add additional things to it).

You can use whatever paradigms work best for you in Emacs. (It's a big malleable ball of Lispy clay.)

@emacsomancer And I do appreciate your help and insight. Heaps. But I try not to bother you with greenhorn issues if I can sort them out on my ownsie, natch!

@emacsomancer What was that concept again... Sheep sheering? Where you go off endlessly on a chain of research and fixits...

@Shufei Yeah, given that most existing technology assumes a LtR paradigm, some sort of faking TtB might be the easiest path.

Thinking about how TtB works: for LtR editing, usually the horizontal dimension is (artificial) limited: 60 character line conventions, line-wrapping, &c. and the vertical dimension is theoretically infinite (usually scrolling is up and down). Would TtB be the inverse? Artificially-limited vertical, with infinite horizontal scrolling?

@emacsomancer Yes, it would have to do that towards the left, or perhaps paginate. I’m thinking each line could be defined as a text box, actually a slip of bamboo 竹簡. But that introduces a problem of word wrapping across each slip. Text clients must already do something like this for line numbering, which is a certain advantage for sorting and rearranging. Perhaps that function of editors is enough to leverage by clever 90 degree turns...

@Shufei @emacsomancer
How often do you need to word wrap across a line break? My impression is that words longer than two units are excessively rare. Rather I'd prefer to line break at a valid word division if at all possible. I came across a nasty piece of (RtL) Chinese text yesterday, which had a fault I see more often than I like : a parenthesis as the first character on a line.

@publius @emacsomancer Oh, yes, I dislike that as well. I take care to eliminate all such dangling bits from my documents. It just shows a want of care which writing deserves.

There are rules for traditional indentation and break, depending on which format, natch. I prefer to nest indent for headings. A multi-character word, phrase, 成語 or word before a dangling 。、,&c should be wrapped, natch.

@publius @emacsomancer This gets tricky, as you no doubt observe, in texts where there is ambiguous grammar and antiently no punctuation. Sometimes this *was intentional*, and it may be best to not punctuate. Sometimes each... bamboo slip has historically necessary value (a line of poetry per slip, but the slips get jumbled when the book strings rot). In such cases, these are kept regardless of pretty formatting, natch.

@publius @emacsomancer For WYLang I won’t worry too much, and probably won’t wrap at all because it’s code. But I can’t imagine I shall have too long lines even if I Lispify the code a bit.

That said, as you also no doubt have seen, when pages are at a premium, such as if I were to print a programme out for paper storage, formatting matters not, so just jumble it all together. It’s still readable, and compiles. Many old books did this purely for expediency and paper saving.

@publius @emacsomancer I reckon what is almost never discussed in western scholarship that I’ve seen is how texts play in trad scribal life. Literary Chinese is meant to allow texts to be “compressed” and “uncompressed” by the hand of a scribe. It is very much a tradition, and part of the ancient written-mediated culture. A book will be compressed for storage and uncompressed for recitation, singing, reading, display, and especially gifting if possible.

@publius @emacsomancer So apropos the question, the answer is I dunno. At first I shall keep making it pretty in Java form, but probably ditch that and invert the indents as I’m wont to do. If I ever got good (haha), then I’d probably just write WY code in solid blocs per state and wrap at the bottom of the screen... 80 columns?

@Shufei @emacsomancer
It's long been clear to me that this is how traditional Chinese works ― that an enormous meta-text of metaphors & allusions understood by the whole scholarly community is used to convey the greatest amount of meaning in the smallest amount of writing. There are incidents in popular literature such as the 水滸傳 which make no sense otherwise! But it seems to me that this makes simply learning to use the language for communication a big chunk of a life's work.

@publius @emacsomancer Don’t we do that anyway? But it’s not too much to learn for tv subtitles of whatever. I doubt the statistical burden is much more than weird English spellings, say.

@publius @emacsomancer Still, you understand it better than many of the mouldier Sinologists. What I’m underscoring is that this richness was not just for scholars. That’s an understandable misconception by orientalists given with whom they palled around. But this lore is dialectic with spoken language via story, song, poetry, 成語 &c... Yes 文雅/民俗, but traditionally contexts interpenetrate even at popular lexical level. Regardless, the modality is (was, sigh) not hermetically stratified.

@publius @emacsomancer Trying to think of a good example, and... Heh, Water Margin is a good one. These novels were never high culture, natch. They were the junk paperbacks of their day. And they were based on oral stories and song. I know more about Journey to the west and it’s certainly true there; it was more compilation of folk tales rewritten as Buddhist polemic and propaganda (immortally well done, but still). The stew of references were all explicitly popular in direction.

@Shufei @emacsomancer
Western culture has this ― "road to Damascus", "crossing the Rubicon", & like that encapsulate a great deal of meaning. But our modern educated class has discarded most of it because being in touch with your roots automatically means endorsing Imperialism, Patriarchy, & other forms of Crimethink. Or something! But not, I think, to the extent of classical Chinese, where a translation into the vernacular appears to expand the text by a factor of five.

@Shufei @emacsomancer
One of the fascinating problems in preparing modern editions of Latin texts, coequal in my opinion with the reconciling of variant readings in the extent manuscripts, or indeed reconstruction where the extant readings seem to make no sense, is the addition of punctuation.

@publius @emacsomancer It is indeed a trick! And one too often leveraged by an intemperate scholar toward their preferences, sometimes little grounded.

I once saw a ZH-WY to ZH-ModVern analysis of the 大同篇 in which the author insisted that Confucius meant the opposite of what he wrote because he couldn’t understand it, haha. So he changed one character and shifted a comma. The cheek!

But it’s good to have punct. when skilled. I muddled through a chunk of Tacitus long ago, and was glad for it..

@emacsomancer @lisp @Shufei
The order of the runes should be monotonically increasing. The on-screen presentation is something that I thought Unicode addresses? If not, you might need an appropriate editor. I don't think DrRacket could easily accommodate, but ask in the Racket list for sure!

@tfb @emacsomancer There’s heaps of stuff Unicode has potential to do which no one has implemented. Building characters with the description glyphs like the original Cangjie spec, for instance.

I like your monotonic Runes ladder, if I understand it, and shall ponder it. I’d like to see similar for 天干地支, the sexigeneray cycle, which can be deployed analytically beyond use as an ontological clock (which is most usual). I reckon it would be fab for circular polarization, for instance.

If I understand you correctly, oooooh YES. (My Chinese is horrible and largely based on high school Japanese)

@tfb @emacsomancer Oh, Highschool Japanese, yea, I reckon you’d know 干支. There’s a lot of this stuff computed in old 數術 (Earthly sciences) texts, most of it over my lil noggin. But modelling cyclical ontologies is definitely what I’m after here.

Sign in to participate in the conversation
Mastodon @ SDF

"I appreciate SDF but it's a general-purpose server and the name doesn't make it obvious that it's about art." - Eugen Rochko