On Wed, Nov 28, 2012 at 5:47 AM, Raul Miller <[email protected]> wrote:

> I am having difficulty with this because I do not understand that
> dialect of basic well enough.
>
> For example, what does
>    OPEN "CREDO" FOR INPUT AS 1
> do?
>
> Is it specifically always opening a file named "credo"?
>

Yes.

http://en.wikibooks.org/wiki/Visual_Basic/Files
http://msdn.microsoft.com/en-us/library/aa266177%28v=vs.60%29.aspx


> Does the input statement on line 1 read from this file?
>

No. It reads from the console.


>
> Which part of the string does mid$ read? (are you stripping off the
> first 2 characters or the first three characters with mid$(a$,2)?
>

It strips off the first one character.

http://msdn.microsoft.com/en-us/library/05e63829%28v=vs.80%29.aspx

What is also noticeable is, ASC function on strings returns the ascii value
for the first character of the whole string.


> Thanks,
>
> --
> Raul
>
> On Tue, Nov 27, 2012 at 1:31 AM, Bo Jacoby <[email protected]> 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.
> >
> > 1 INPUT;C$: IF C$="" THEN END
> > 2 OPEN "CREDO" FOR INPUT AS 1: PRINT":";
> > 3 IF EOF(1) THEN CLOSE: PRINT: GOTO 1
> > 4 LINE INPUT#1,A$: B$=C$
> > 5 IF A$=""THEN A%=-1 ELSE A%=ASC(A$)-48: A$=MID$(A$,2)
> > 6 IF B$=""THEN B%=-1 ELSE B%=ASC(B$)-48: B$=MID$(B$,2)
> > 7 IF A%<0 THEN PRINT" ";A$;: GOTO 3
> > 8 IF A%=0 OR B%=0 OR A%=B% THEN 5 ELSE 3
> >
> > I have not yet been able to translate this program into J, mainly (I
> think) because I have no experience in reading textfiles from J. I request
> your assistance! The line numbers in the file must be separated from the
> rest of the lines. The line numbers may be padded to the right with zeroes.
> >
> >
> > The program is a database browser. The question put to the program is a
> number, and the answer from the program consists of the lines in the
> database having numbers compatible to that of the question. Like this:
> >
> > 1: CREDO AMEN
> > 2: CONFITEOR AMEN
> > 3: EXPECTO AMEN
> > 0: CREDO CONFITEOR ET EXPECTO AMEN
> >
> > The digit zero is wild card character. A zero in the question indicate
> that the answer has many words, and zero in a word in the database indicate
> that this word answers many questions. So "AMEN" is included in all
> answers. Like this:
> >
> > 11: CREDO IN DEUM AMEN
> > 12: CREDO IN JESUM AMEN
> > 13: CREDO IN SPIRITUM AMEN
> > 14: CREDO ECCLESIAM AMEN
> > 15: CREDO AMEN
> > 10: CREDO IN DEUM ET IN JESUM ET IN SPIRITUM ET ECCLESIAM AMEN
> > 21: CONFITEOR BAPTISMA AMEN
> > 22: CONFITEOR AMEN
> > 31: EXPECTO RESURRECTIONEM AMEN
> > 32: EXPECTO VITAM AMEN
> > 33: EXPECTO AMEN
> > 30: EXPECTO RESURRECTIONEM ET VITAM AMEN
> > 01: CREDO IN DEUM CONFITEOR BAPTISMA ET EXPECTO RESURRECTIONEM AMEN
> > 13500: CREDO IN SPIRITUM QUI CUM PATRE ET FILIO SIMUL ADORATUR ET
> GLORIFICATUR AMEN
> >
> > 13510: CREDO IN SPIRITUM QUI CUM PATRE ET FILIO SIMUL ADORATUR AMEN
> > 13520: CREDO IN SPIRITUM QUI CUM PATRE ET FILIO SIMUL GLORIFICATUR AMEN
> > 13501: CREDO IN SPIRITUM QUI CUM PATRE ADORATUR ET GLORIFICATUR AMEN
> > 13502: CREDO IN SPIRITUM QUI CUM FILIO ADORATUR ET GLORIFICATUR AMEN
> > 13511: CREDO IN SPIRITUM QUI CUM PATRE ADORATUR AMEN
> > 13512: CREDO IN SPIRITUM QUI CUM FILIO ADORATUR AMEN
> > 13521: CREDO IN SPIRITUM QUI CUM PATRE GLORIFICATUR AMEN
> > 13522: CREDO IN SPIRITUM QUI CUM FILIO GLORIFICATUR AMEN
> >
> > The database is this.
> > 1 CREDO
> > 11 IN
> > 111 UNUM
> > 11 DEUM
> > 112 PATREM
> > 1121 OMNIPOTENTEM
> > 113 FACTOREM
> > 1131 CÆLI
> > 1139 ET
> > 1132 TERRÆ
> > 11331 VISIBILIUM
> > 1133 OMNIUM
> > 11339 ET
> > 11332 INVISIBILIUM
> > 19 ET
> > 12 IN
> > 1211 UNUM
> > 1211 DOMINUM
> > 12 JESUM
> > 1211 CHRISTUM
> > 1212 FILIUM
> > 1212 DEI
> > 12121 UNIGENITUM
> > 1219 ET
> > 1213 EX
> > 1213 PATRE
> > 1213 NATUM
> > 12131 ANTE
> > 121311 OMNIA
> > 12131 SÆCULA
> > 1221 DEUM
> > 12211 DE
> > 12211 DEO
> > 1222 LUMEN
> > 12221 DE
> > 12221 LUMINE
> > 1223 DEUM
> > 12231 VERUM
> > 12232 DE
> > 12232 DEO
> > 122321 VERO
> > 1231 GENITUM
> > 12311 NON
> > 12311 FACTUM
> > 1232 CONSUBSTANTIALEM
> > 1232 PATRI
> > 12321 PER
> > 12321 QUEM
> > 12321 OMNIA
> > 12321 FACTA
> > 12321 SUNT
> > 124 QUI
> > 124101 PROPTER
> > 124101 NOS
> > 12410101 HOMINES
> > 124109 ET
> > 124102 PROPTER
> > 12410201 NOSTRAM
> > 124102 SALUTEM
> > 12411 DESCENDIT
> > 1241101 DE
> > 1241101 CÆLIS
> > 12419 ET
> > 12412 INCARNATUS
> > 12412 EST
> > 1241201 DE
> > 1241201 SPIRITU
> > 124120101 SANCTO
> > 1241202 EX
> > 1241202 MARIA
> > 124120201 VIRGINE
> > 12419 ET
> > 1241301 HOMO
> > 12413 FACTUS
> >
> > 12413 EST
> > 124211 CRUCIFIXUS
> > 1242101 ETIAM
> > 1242101 PRO
> > 1242101 NOBIS
> > 1242102 SUB
> > 1242102 PONTIO
> > 1242102 PILATO
> > 124212 PASSUS
> > 124219 ET
> > 124213 SEPULTUS
> > 12421 EST
> > 12429 ET
> > 12422 RESURREXIT
> > 124221 TERTIA
> > 124221 DIE
> > 124222 SECUMDUM
> > 124222 SCRIPTURAS
> > 12429 ET
> > 12423 ASCENDIT
> > 124231 IN
> > 124231 CÆLUM
> > 12424 SEDET
> > 124241 AD
> > 124241 DEXTERAM
> > 124241 PATRIS
> > 12429 ET
> > 124251 ITERUM
> > 12425 VENTURUS
> >
> > 12425 EST
> > 124252 CUM
> > 124252 GLORIA
> > 124253 JUDICARE
> > 1242531 VIVOS
> > 1242539 ET
> > 1242532 MORTUOS
> > 125 CUJUS
> > 125 REGNI
> > 125 NON
> > 125 ERIT
> > 125 FINIS
> > 19 ET
> > 13 IN
> > 13 SPIRITUM
> > 131 SANCTUM
> > 132 DOMINUM
> > 139 ET
> > 133 VIVIFICANTEM
> > 134 QUI
> > 134 EX
> > 1341 PATRE
> > 1342 FILIO
> > 1349 QUE
> > 134 PROCEDIT
> > 135 QUI
> > 135 CUM
> > 13501 PATRE
> > 13509 ET
> > 13502 FILIO
> > 13509 SIMUL
> > 1351 ADORATUR
> > 1359 ET
> > 1352 GLORIFICATUR
> > 136 QUI
> > 136 LOCUTUS EST
> > 1361 PER
> > 1361 PROPHETAS
> > 19 ET
> > 141 UNAM
> > 142 SANCTAM
> > 143 CATHOLICAM
> > 149 ET
> > 144 APOSTOLICAM
> > 14 ECCLESIAM
> > 2 CONFITEOR
> > 211 UNUM
> > 21 BAPTISMA
> > 212 IN
> > 212 REMISSIONEM
> > 2121 PECCATORUM
> > 9 ET
> > 3 EXPECTO
> > 31 RESURRECTIONEM
> > 311 MORTUORUM
> > 39 ET
> > 32 VITAM
> > 3211 VENTURI
> > 321 SÆCULI
> > AMEN
> > ----------------------------------------------------------------------
> > 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

Reply via email to