nrnrnr / noweb

The noweb tool for literate programming
BSD 2-Clause "Simplified" License
253 stars 27 forks source link

How to handle hyphens in identifiers, as is the typical case of Lisp code? #9

Closed hovege closed 4 years ago

hovege commented 4 years ago

Lisp code often uses hyphens in identifiers. I don't know how to resolve the following situation.

The code below defines two identifiers, "same-variable?" and "variable?", but it seems the "variable?" part of "same-variable?" is always identified as "variable?" and so "same-variable?" is not taken as an identifier in its own right. The situation is better illustrated with hyperref, so I use it in this example.

\documentclass{article}
\usepackage{noweb}
\noweboptions{longchunks,longxref,smallcode}
\usepackage[hyperref]{xcolor}
\definecolor{darkblue}{rgb}{0,0,0.4}
\usepackage[colorlinks=true,linkcolor=darkblue,citecolor=]{hyperref}
\title{Title}
\begin{document}
\maketitle
It seems I cannot define [[variable?]] along with [[same-variable?]].
How can I handle this?
<<*>>=
(define (same-variable? v1 v2)
  (symbol=? v1 v2))
(define (variable? v1)
  #t)
@ %def same-variable? variable?                                                                                         
\end{document}

Here's the PDF file. e.pdf

We can see in the LaTeX file what happens.

(define (same-\nwlinkedidentc{variable?}{NW0-1p0Y9w-1}\nwlinkedidentc{ v1 v2)}{NW0-1p0Y9w-1}
  (symbol=? v1 v2))

What is the wise thing to do here? Thank you.

This seems to be the same behavior in noweb3 and noweb2.

hovege commented 4 years ago

I'm also looking for a place to discuss noweb usage. It seems there's no noweb user in Stack Overflow lately. The USENET is barely alive... Any directions?

nrnrnr commented 4 years ago

You'll need to replace the finduses element of Noweb's pipeline with something that is more friendly to Lisp. Or you can simply recompile it with a different definition of ALPHANUMERIC.

It would be reasonable to consider adding an environment variable for these kinds of dynamic configuration, but I have never been willing to go there.

As for discussion, the Google group comp.programming.literate would be the natural place, but I cannot seem to get moderation turned off. Usenet is indeed barely alive.

nrnrnr commented 4 years ago

@noweb-user I saw your message to comp.programming.literate. I can't get it through moderation. If you can post it with an Approved: header, you should.

hovege commented 4 years ago

Changing ALPHANUM in finduses.c did do the trick. Thank you.

When comp.programming.literate was active in 2016, it seems you were the moderator. The idea to drop that moderation is so you don't have to do the job? If you can't turn the moderation off, you probably can't reassign the job to another person either?

I miss the USENET.

nrnrnr commented 4 years ago

It's a software issue. I don't mind moderating, but I can't get reliable access to a server that enables me to do the job. I've petitioned both the responsible group and an administrator with power to do things, but to no avail.