Lacking Natural Simplicity

Random musings on books, code, and tabletop games.

SRFI-159 Supersedes Alix Shinn's fmt package

This is a note to help me remember to use SRFI-159 instead of fmt when I can.

The scheme SRFI-159 is similar to the Chicken Scheme fmt egg and is written by Alex Shinn and references his original fmt - Combinator Formating code on which the egg is based but it doesn’t seem to be implemented for Chicken Scheme. It does explain why there isn’t a version of fmt for Chibi Scheme, since Chibi Scheme includes an implementation of SRFI-159 already. There doesn't seem to be a Snow version either.

Why D&D is so successful?

I once quoted Ken Hite's description of D&D

The original D&D seems, quite obviously, to be a pastiche of Fritz Leiber and Robert E. Howard adventure stories, set in a Tolkeinian world of Moorcockian morality, using Jack Vance's magic system, redacted for multiple protagonists. No wonder things are confused.

to a friend, and they were a little offended, considering it a criticism of D&D. I guess it is a criticism, but I think it is a valid description of D&D. However, I advance the theory that this “confused” nature of D&D is what makes it successful, because it provides so many different (and sometimes conflicting) elements that you can come up with about anything in D&D, and it will be fun. Each gaming group selects those things from D&D that they find interesting, customizing their play to their taste. This is something that is sometimes much harder in more focused games.

What do you think?

Having Emacs time-stamps at the end of files

Do you ever use Emacs time stamp functionality (type C-h f time-stamp in Emacs to learn about that) to insert the current date time stamp into your file when you save it? I use this frequently in documents I write, for my blog or standalone. For the longest time I thought you had to have the time stamp at the beginning of the file. But I wanted it at the end of blog posts because it’s really an afterthought to most readers. (Sometimes I go back and edit posts some time after first posting them — perhaps they were incomplete, or they had errors that needed correcting, etc.) It turns out that you can do that — if you set the variable time-stamp-line-limit to a negative number it will look backwards from the end of the file for the timestamp. I often set the time stamp variables in a Local Variables: comment at the end of the file.

Here's the reST fragment I insert into my blog posts that uses time-stamp:

.. role:: app
.. role:: file
.. role:: command
.. role:: key

.. *Last edited: 2020-08-05 17:03:37 EDT*

..
   Local Variables:
   time-stamp-format: "%04y-%02m-%02d %02H:%02M:%02S %Z"
   time-stamp-start: "Last edited:[ \t]+\\\\?"
   time-stamp-end: "\\*\\\\?\n"
   time-stamp-line-limit: -20
   End:

How I author e-mails to pandoc-discuss and issues on the pandoc repo

To submit an issue to the pandoc GitHub repository or an e-mail to the pandoc-discuss Google group when it is complicated I write a reStructuredText (reST) file that shows the problem and a reST file that explains the problem that prompted the issue/e-mail and include the pandoc and os version information and includes the problem reST file and sometimes the resulting output files. I process these files with pandoc, of course. If it is going to the mailing list I format it to HTML with a fancy style and cut and paste it from Chrome into gmail. If it is going to be an issue report on GitHub I format it into .gfm (Github Flavored Markdown: GFM) file because that’s what you write GitHub issues in and also format it into HTML to check that the .gfm is formed properly. Typically when I’m writing the issue reST file I don’t use language names on code blocks for the syntax highlighting because that doesn’t seem to come out right in GFM.

For example, here is a post, “RST to RST Conversion Loses Interpreted Text Roles”, to pandoc-discuss.

Here is the problem reST source:

RST to RST Conversion Looses Interpreted Text Roles
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.. role:: app

:app:`GNU Emacs` is an app.  So is :app:`Eclipse`.

Here is the e-mail reST source:

RST to RST Conversion Loses Interpreted Text Roles
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

.. role:: file(literal)
.. role:: app

It turns out that when you use :app:`pandoc` to convert from ``rst``
to ``rst`` the process loses interpreted text roles.

My :app:`pandoc` version is:

.. include:: pandoc.version
   :code:

My OS information is:

.. include:: os.version
   :code:

I generated the outputs to check with the following commands:

.. code::

   pandoc -r rst -w rst -o r2rclitr-out.rst r2rclitr-in.rst
   pandoc -r rst -w native --output=r2rclitr-in.native r2rclitr-in.rst

So, for the ReStructuredText input (file :file:`r2rclitr-in.rst`):

.. include:: r2rclitr-in.rst
   :code:

the resulting ``rst`` output (:file:`r2rclitr-out.rst`) is generated:

.. include:: r2rclitr-out.rst
   :code:

And the ``native`` output (:file:`r2rclitr-in.native`) generated:

.. include:: r2rclitr-in.native
   :code:

has ``Span`` elements with classes, so it should be possible to turn
those back into interpreted text roles in ``rst`` output.  I suppose
you'd have to write out at the beginning of the RST output file a list
of

.. code::

   .. role:: rolename

lines for every class ``rolename`` in a span.  Would this be possible?

Here is the GNUmakefile for it:

all: r2rclitr-email.html

r2rclitr-email.html: pandoc.version os.version pandoc.style \
        r2rclitr-in.rst r2rclitr-out.rst  r2rclitr-in.native

pandoc.version: $(shell type -p pandoc)
        pandoc --version | head -2 >$@
os.version:
        osinfo >$@

# ReST input
%-out.rst: %-in.rst
        pandoc -r rst -w rst -o $@ $<
%.html : %.rst
        pandoc -r rst -w html --include-in-header=pandoc.style --output=$@ $<
%.native : %.rst
        pandoc -r rst -w native --output=$@ $<

.PHONY: clean

clean:
        -rm *.pdf *.html *.ms *.ctx *.ltx *.native os.version *-out.rst

When I'm doing an issue the result is a GFM file that I can cut and paste into the editor used for issues on GitHub, which expects GFM. I write it in reST because that can include files and processing from reST to GFM does the inclusion, so I don't have to do it by hand.

Here's an example issue, "Reference Not Found Error #6592" on the pandoc repository.

The problem reST file rnf.rst is

​   **Option:** Arachnaurs' webs are made with a neurotoxin_ that can
​   quickly paralyze their prey!  When wrapped in a web, make a Vigor
​   roll or quickly lose consciousness.

   .. _neurotoxin: https://www.sciencenews.org/article/spiders-poisonous-webs-neuro-toxins-genes

(The contents of the actual file are all indented 3 spaces, but I had to prefix all the lines in the code block in this source with the Unicode ZERO WIDTH SPACE so the indentation would show.)

The issue reST file rnf-issue.rst is

Reference Not Found Error
@@@@@@@@@@@@@@@@@@@@@@@@@

When I process the following reST file (notice it the whole file is
indented 3 spaces)

.. include:: rnf.rst
   :code:

into ``ms`` or PDF via ``ms`` output with the command

.. code::

   pandoc -s -r rst -w ms -o rnf.ms.pdf rnf.rst


I get the errors

.. code::

   [WARNING] Reference not found for 'neurotoxin' at chunk line 1 column 57
   <standard input>:70: macro error: pdfhref has no destination

and the resulting output PDF file and ``.ms`` file indeed do not
have the link.

Here's the ``.ms`` file that was generated:

.. include:: rnf.ms
   :code:

I'm using the following version of Pandoc:

.. include:: pandoc.version
   :code:

My OS information is:

.. include:: os.version
   :code:

The generated GFM is

Reference Not Found Error
=========================

When I process the following reST file (notice it the whole file is
indented 3 spaces)

       **Option:** Arachnaurs' webs are made with a neurotoxin_ that can
       quickly paralyze their prey!  When wrapped in a web, make a Vigor
       roll or quickly lose consciousness.

       .. _neurotoxin: https://www.sciencenews.org/article/spiders-poisonous-webs-neuro-toxins-genes

into `ms` or PDF via `ms` output with the command

    pandoc -s -r rst -w ms -o rnf.ms.pdf rnf.rst

I get the errors

    [WARNING] Reference not found for 'neurotoxin' at chunk line 1 column 57
    <standard input>:70: macro error: pdfhref has no destination

and the resulting output PDF file and `.ms` file indeed do not have the
link.

Here's the `.ms` file that was generated:

    .QS
    .LP
    \f[B]Option:\f[R] Arachnaurs\[aq] webs are made with a \c
    .pdfhref W -D "" -A "\c" \
     -- "neurotoxin"
    \& that can quickly paralyze their prey! When wrapped in a web, make a
    Vigor roll or quickly lose consciousness.
    .QE

I'm using the following version of Pandoc:

    pandoc 2.10.1
    Compiled with pandoc-types 1.21, texmath 0.12.0.2, skylighting 0.8.5

My OS information is:

    Mac OS X, Version 10.15.6, Build 19G73

Here is the GNUmakefile for it:

all: rnf-issue.gfm rnf-issue.html rnf-issue.gfm.html rnf.ms.pdf rnf.ms

rnf-issue.html rnf-issue.gfm rnf-issue.gfm.html: rnf.rst \
        pandoc.version os.version

.PRECIOUS: rnf-issue.gfm


pandoc.version: $(shell type -p pandoc)
        pandoc --version | head -2 >$@
os.version:
        osinfo >$@

%.ms : %.rst
        pandoc -r rst -w ms -o $@ $<

%.ms.pdf : %.rst
        pandoc -s -r rst -w ms -o $@ $<

%.html : %.rst
        pandoc -s -r rst -w html -H fancy.style --output=$@ $<

%-pandoc.html : %.rst
        pandoc -r rst -w html --output=$@ $<

%-docutils.html: %.rst
        rst2html.py $< | sed '1,/^<div class="document">/d' | sed -e '1,2d' -e '\%</div>%,$$d' >$@

%.gfm : %.rst
        pandoc -r rst -w gfm -o $@ $<

%.gfm.html : %.gfm
        pandoc -s -r gfm -w html -H fancy.style -o $@ $<

.PHONY: clean

clean:
        -rm *.html *.native os.version pandoc.version docutils.version *.gfm

.depend: rnf-issue.rst
        rst-depends rnf-issue.rst >$@

include .depend

This may seem complex, but in practice I use templates to start out all the files and by building it all with make and pandoc using the include directive of reST I ensure that the contents of the message are correctly built from the various included files.

Compiling s7 scheme on macOS

To compile s7 scheme with a standalone REPL, s7's home page says to add the empty file mus-config.h to the source directory, then (in Linux):

gcc s7.c -o repl -DWITH_MAIN -I. -O2 -g -ldl -lm -Wl,-export-dynamic

It turns out that on macOS, whose ld (from clang) doesn't understand -export-dynamic, you have to do

gcc s7.c -o repl -DWITH_MAIN -I. -O2 -g -ldl -lm -Wl,-dynamic

Then you need to do

./repl libc.scm

which seems to generate libc_s7.c and compile it into libc_s.so. Then you can run the REPL:

./repl

which, from looking at s7.c, loads repl.scm. Unfortunately, I don't understand the repl commands, except for pwd and cd. Oh, and (exit) exits the repl.

Last edited: 2020-08-03 16:03:57 EDT

Paragraph Justification in groff and TeX

An interesting message thread developed on the groff mailing list about various features of Groff and Heirloom Troff, with a mention of neatroff. In particular, Steve Izma's post (P1) discussed how he found TeX's paragraph-at-a-time justification required as much tweaking as groff's simpler paragraph justification. That lead to Peter Schaffter's post (P2) linking to an earlier post (P3) where he proposed a simpler algorithm to improve Groff's line-breaking and justification than the full Knuth-Plass Line-Breaking Algorithm (KP1, D1) that TeX uses. While writing this post I ran across another paper, “Global multiple objective line breaking” by Alex Holkner (GMOLB1, GMOLB2) that explores another line breaking algorithm and references some of the other papers on the subject.

ACKS Links for Later Reference

Since I'm reading a lot about the Adventurer, Conqueror, King System (ACKS) lately, here are some links for later reference.

ACKS POD books from DriveThruRPG finally arrived

I finally got my order of Adventurer, Conqueror, King System (ACKS) books by Autarch from DriveThruRPG today. The COVID-19 pandemic has really delayed their POD printing and shipping, so I was quite some time waiting.

The books I got were:

  • Adventurer Conqueror King System

  • ACKS Player's Companion

  • Heroic Fantasy Handbook

  • Barbarian Conquerors of Kanahu

  • Axioms Compendium 1-8

  • ACKS Domains at War - Battles

  • Lairs & Encounters

  • Capital of the Borderlands (revised edition)

  • Eyrie of the Dread Eye

  • Ruined City of Cyfandir

  • Secrets of the Nethercity

  • The Sinister Stone of Sakkara

I had already received, some weeks ago, one book from that order:

  • Auran Empire Primer

I got these because I'm planing on running some ACKS adventures, possibly leading up to the ACKS version of Dwimmermount. I got a request from one of my players to try a megadungeon, and after looking at the ones I had I decided to try out Dwimmermount. I have both the Labyrinth Lord and ACKS versions (I backed the kickstarter for Dwimmermount), but have never played ACKS before. I thought it would be a good opportunity to try it. However, I didn't want to run a new system at the same time as trying to run my first megadungeon, so I thought I'd get some of the published ACKS adventures and run one of them first, to get myself and my players used to the system.

While waiting for this order to come in I've been rereading the ACKS core rulebook, as I already had a copy of that and the ACKS Player's Companion. I admit that I found reading “Chapter 4: Proficiencies” and “Chapter 5: Spells” slow going. The proficiencies are sometimes like feats and sometimes like skills and have a lot of details that need to be read carefully. The spells also have to be read carefully, to see how they differ from the versions of D&D I've run before. I expect that I'll be going much faster now that I'm through those chapters, though there may be some slogging during “Chapter 8: Monsters”.

All in all, I'm liking what I'm reading. I think that the things that ACKS adds give it a lot more depth without increasing its complexity to AD&D 1E or D&D 3.5E levels. I think the players will appreciate the increased options for their characters and I'll appreciate the additional support for things like economic background and domain play.

Since I got my order I've scanned quickly over the books I got. They all seem interesting and useful. I'm now reading The Sinister Stone of Sakkara in parallel with the core rulebook, thinking that it will be the best introduction to the game for myself as Judge (that's ACKS's term for Dungeon Master) and my players. It is a setup somewhat like “Keep on the Borderland” with a military fort with an associated village and a stronghold of evil nearby. By default It is set on the Auran Empire's Borderlands province, which has some interesting setting details, but once would easily place it anywhere in ones own campaign. One thing about it that has impressed me is the background information it supplies on workings of the fort “Türos Tem”, which, without becoming tedious, goes down to the amount of hay on hand to feed the the horses of the fort's cavalry soldiers and how long it will last and how much it cost. Some people would say “who would need that information?” because they run campaigns that concentrate on wild adventure and don't sweat the background details, but I've found in the past that having that detail can inspire ideas for more wild adventure, and it fits into ACKS's additional support for domain play and economic underpinnings.

Anyway, I'm really looking forward to playing ACKS. Now I just have to figure out a Virtual Table Top (VTT) to use.