I wonder - how do other J-users trying to solve Project Euler problems
cope with the
(to me) fairly new display format, which is apparently MathJax?
Using Windows 10, copy&paste to get the problem statement into my J
edit screen used to be adequate
to get it where I need it as a set of NB. comment lines. I'd nearly
always have to tweak the quoted
text, but it was manageable.
It's now losing too much information, and it's tedious typing
everything in. I wasted time solving
the relatively easy problem 727 because I'd mis-typed 1 <: ra < rb < rc
<: 100 with <: everywhere.
Here's a snippet from today's problem, 729, using the old method:
"Consider the sequence of real numbers [LF]
defined by the starting value [LF]
and the recurrence [LF]
[LF]
for any ."
[I've typed in "[LF]" in this message quote to confirm the gratuitous
line-feeds which appear instead of
marked-up text elements, such as an, a0...]
It's possible to capture the explicit markup code from the display,
using a widget tagged with
"Show HTML problem content"
Here's the same paragraph using that view, ie copy&pasted from
problem 729, https://projecteuler.net/minimal=729
"<p>Consider the sequence of real numbers $a_n$ defined by the starting
value $a_0$ and the recurrence
$\displaystyle a_{n+1}=a_n-\frac 1 {a_n}$ for any $n \ge 0$.</p>
<p>"
I'd like it to appear in the J script in plain-ish commented text, eg:
NB. Consider the sequence of real numbers an defined by the starting
value a0 and the recurrence
NB. a[n+1] =an - 1/an for any n >: 0.
SO - I can soldier on and work up a function or two to translate the
data from clipread (in JQt) ,
but I've never seriously got into html, and suspect I'd be reinventing
the wheel from first principles when
someone probably knows this stuff backwards and might even have some
suitable code.
BTW, Google has thrown up "pandoc", and J has addons/format/publish.
Both are file-based and don't work
on clipboard data as far as I can see so far.
Thanks for any help,
Mike
PS - I've just checked behaviour on the iPad with J701 - copy&paste on
that kit has been pretty bad for some time;
it doesn't lose the text, but uses a line feed with every character in
an escape sequence. eg
"a_{n+1}= a_n " becomes
"
a
n
+
1
=
a
n
[etc]
"
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm