[Jprogramming] Translating BASIC into J
Bo Jacoby
bojacoby at yahoo.dk
Fri Nov 30 07:32:32 UTC 2012
Correct Linda. That is a bug in the translation from BASIC to J.
- Bo
>________________________________
> Fra: Linda Alvord <lindaalvord at verizon.net>
>Til: programming at jsoftware.com
>Sendt: 1:54 fredag den 30. november 2012
>Emne: Re: [Jprogramming] Translating BASIC into J
>
>J701 with Vista agree on the results for 0 and 00
>
> pray 0
>CREDO CONFITEOR ET EXPECTO AMEN
> pray 00
>CREDO CONFITEOR ET EXPECTO AMEN
>
>Linda
>
>-----Original Message-----
>From: programming-bounces at forums.jsoftware.com
>[mailto:programming-bounces at forums.jsoftware.com] On Behalf Of Bo Jacoby
>Sent: Thursday, November 29, 2012 12:28 PM
>To: programming at jsoftware.com
>Subject: Re: [Jprogramming] Translating BASIC into J
>
>Ian,
>
>Note that pray '0' and pray '00' is not the same thing.
>
>0: CREDO CONFITEOR ET EXPECTO AMEN
>00: CREDO IN DEUM ET IN JESUM ET IN SPIRITUM ET ECCLESIAM CONFITEOR BAPTISMA
>ET EXPECTO RESURRECTIONEM ET VITAM AMEN
>
>The linenumbers in the database may be padded to the right with zeroes, but
>not the question number.
>
>
>(Some authors spell EXSPECTO rather than EXPECTO, because it means 'look
>out' and has nothing to do with the heart).
>
>I invented Ordinal Fraction, the word, the concept, and the arithmetic, and
>everybody hates it but myself. It is far too simple. My article was deleted
>from wikipedia where original research is prohibited.
>
>Consider the digits (d=.i.>:9) and the proper digits (p=.>:i.9) . The
>ordinal fraction 0 is the infinite cartesian power of the proper digits. It
>is the total set of infinite sequences of proper digits. The subsets of 0
>where a finite number of prescribed digit positions have prescribed values
>are the ordinal fractions. The prescribed digit positions are noted with the
>prescribed proper digit, and the other digit positions are marked with digit
>0. So an ordinal fraction looks like a decimal number except that it is
>padded with zeroes to the right rather than to the left.
>1=10=1000 &c.
>
>A concept is modelled by an ordinal fraction in such a way that the logical
>relations between concepts are modelled by arithmetical relations between
>ordinal fractions.
>
>'Every man is mortal, Alexander is a man, so Alexander is mortal' is
>modelled like this
>1 mortal
>11 man
>111 Alexander
>
>That's all for today.
>- Bo
>
>
>
>
>>________________________________
>> Fra: Ian Clark <earthspotty at gmail.com>
>>Til: programming at jsoftware.com
>>Sendt: 16:29 torsdag den 29. november 2012
>>Emne: Re: [Jprogramming] Translating BASIC into J
>>
>>Bo,
>>
>>I am so sorry for slagging off your program!
>>
>>Had I known it was yours, I wouldn't have written what I did. I assumed
>>this was an educational curio you came across (as I often used to do in
>>hobby magazines) and hadn't quite known how it worked -- because you
>>had claimed you didn't know how to turn it into J.
>>
>>I don't either. But I cheated, and sidestepped the
>problem.
>>
>>I doubt if I'd have been able to write it better, for its purpose.
>>Which I'd say is to exhibit in lectures and not to support some
>>commercial (or religious :-) enterprise. I've written reams of BASIC in
>>my time, on all sorts of now-defunct machines, especially for IT
>>courseware. I've taught Software Engineering at postgrad level -- so I
>>think I'd be permitted to say that classic BASIC is not a language for
>>dogmatically sound programming!
>>
>>Nevertheless my little "slur" served to make the point that to re-cast
>>the algorithm to lend itself to J better, you actually find yourself
>>untangling the PRINTs from the string-processing, i.e. separating
>>processing from I/O (and preparation for I/O). I've migrated a lot of
>>heritage code too, from mainframe to MSDOS to Windows to web -- and the
>>more closely the programmer has stuck to the principle of separating
>>processing from I/O the easier it is to migrate.
>It can't
>>just be an accident. So I was grinding an axe there.
>>
>>I was doubtful about permitting (pray) to accept its y-arg as an
>>integer as well as a string of digits. I only permitted it for the
>>convenience of experimenters. Thus (pray '010') is decidedly not the
>>same as (pray '10') but (pray 010) confounds the two.
>>
>>Thanks for explaining where the record numbering system came from.
>>Since it didn't matter for the purpose of translating the code, I
>>didn't make the effort to understand how it worked. But it's really a
>>topic of investigation in its own right. It reminds me of
>>Wittgenstein's paragraph-numbering system in Tractatus. I'd be grateful
>>for a reference to "ordinal fractions" -- Wikipedia doesn't seem to
>>recognise the term in an arithmetical rather than a linguistic sense. I
>>guessed that it was a way of representing a tree as a single integer.
>>Such a domain would have interesting mathematical
>properties,
>>and a J library to handle it would have its uses, given the lack of an
>>agreed "natural" way of handling trees in J, as opposed to Python say.
>>(I'm forgetting of course the nested box structure delivered by 5!:1).
>>
>>IanClark
>>
>>On Thu, Nov 29, 2012 at 10:52 AM, Bo Jacoby <bojacoby at yahoo.dk> wrote:
>>> Ian, you did an amazing job! Thank you very much!
>>>
>>> You write about my BASIC program: "Like many amateur programs, it
>>> thoroughly mixes up input, processing and output. Even in the 1960s
>>> when BASIC was invented (Kemeny & Kurtz,
>>> 1964) this was recognised to be a bad thing". Yes, everybody knew how
>>> to criticize, but few BASIC programs were actually easy to read and
>>> understand. My excuse, apart from being such an amateur, is that I
>>> kept it down to 8 lines. It could have been worse. The input
>>> statements were INPUT;C$
>which reads a textstring from the terminal, and LINE INPUT#1,A$ which
>reads a line from the file into a textstring. The output statements were
>PRINT":"; which outputs a colon without carriage return, and PRINT
>which outputs the carriage return - in those days the typewriter terminal
>had a physical carriage to return - and PRINT" ";A$; which outputs
>first a blank sign, then the word, and no carriage return. The statements
>A%=ASC(A$)-48: A$=MID$(A$,2) translates the first digit in the line number
>into an integer, and chops if off the string.
>>>
>>> The database structure is flexible in that it fuses the array structure
>and the tree structure together into a single structure. Compare pray 0 with
>pray 00 and pray 000 to see the tree structure, while pray 13500 shows a 2*2
>array.
>>>
>>>
>>> In extended versions of the program
>in FORTRAN and in Pascal I included an editor to insert, modify and delete
>records. (If a record was there already it was modified, otherwise it was
>inserted. Empty records were deleted.) Modifying a line number restructured
>the database. For example changing 0 to 2 ment that all line numbers in the
>database were prefixed by digit 2.
>>>
>>>
>>> The line numbers are ordinal fractions: "1" is the first half and "2" is
>the second half, "first" and "second" are ordinals and "half" is a fraction.
>That's why! "0" means both halfs.
>>>
>>>
>>> Ordinal fractions are like arrays except:
>>>
>>> * an array has only a finite number of dimension, while an
>ordinalfraction has an infinite number of dimensions.
>>> * arrays have different shapes, while all ordinalfractions have
>the same shape.
>>> * an array may have subarrays and
>elements, while an ordinalfraction has sub - ordinalfractions, but no
>elements.
>>> * arrayelements have values and subarrays do not have values,
>while ordinalfractions have values.
>>> I am fascinated by the power of ordinal fraction arithmetic, but it is
>far more heretical than artificial catholicism. Beware of the inquisition!
>>>
>>> - Bo
>>>
>>>
>>>
>>>>________________________________
>>>> Fra: Ian Clark <earthspotty at gmail.com>
>>>>Til: programming at jsoftware.com
>>>>Sendt: 3:58 torsdag den 29. november 2012
>>>>Emne: Re: [Jprogramming] Translating BASIC into J
>>>>
>>>>Here's my take on the topic:
>>>>http://www.jsoftware.com/jwiki/IanClark/credo
>>>>
>>>>There's a script at the bottom of the wiki page you can download.
>>>>
>>>>I haven't attempted to replicate BASIC's itty-bitty I/O, all mixed-up
>>>>in the processing. As well write a mini interpreter in J and get it
>>>>to run the BASIC code!
>>>>
>>>>Instead I've intuited the algorithm and done it as a J-er would.
>>>>Might.
>>>>Would.
>>>>(At least, as this J-er would).
>>>>
>>>>IanClark
>>>>
>>>>On Tue, Nov 27, 2012 at 6:31 AM, Bo Jacoby <bojacoby at yahoo.dk> wrote:
>>>>> Dear J'ers.
>>>>>
>>>>> At the Norddata conference in Göteborg in the summer 1989 I gave a
>>>>> lecture (in Danish) on Ultraflexible Database Structure and
>>>>> Artificial
>Catholicism.
>>>>>
>>>>>
>>>>> It contained this 8-liner in BASIC.
>>>>> ...snipped...
>>>>---------------------------------------------------------------------
>>>>- For information about J forums see
>>>>http://www.jsoftware.com/forums.htm
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> - For information about J forums see
>>> http://www.jsoftware.com/forums.htm
>>----------------------------------------------------------------------
>>For information about J forums see http://www.jsoftware.com/forums.htm
>>
>>
>----------------------------------------------------------------------
>For information about J forums see http://www.jsoftware.com/forums.htm
>
>----------------------------------------------------------------------
>For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>
More information about the Programming
mailing list