LoBrow: a browser to examine the contents of any J locale

Another dumb program written by a dummy for dummies.

But I'm finding it very useful to study the content of locales 'z', 'j' and 'jijs' and rip-off any code samples I like.

The script: lobrow.ijs loads into its own locale: 'lobrow'. It runs itself on loading. But you can rerun it with: run_lobrow_''

LoBrow script

This is the version supporting the treatment below: lobrow_OLD2.ijs

This is a newer (beta) version, with a lot more functionality: lobrow.ijs

How to use it

Copy the code (below) into a new .ijs window and do Menu: Run > Window.

You'll see the main form appear:

Click the name of a locale (in this case: z).

You'll see the lower listbox fill up with the names of objects in the chosen locale.

You can shorten the list by clicking the checkboxes: Nouns Adverbs Conjuncts Verbs.

Click the name of an object (in this case the verb fcopynews).

Its definition appears in the big panel.

You can edit the object conventionally by clicking button 'Edit'.
The displayed text appears in a new .ijs window.
Make changes and do
Menu: Run > Window as you would normally.

Click the box +Locale.

The object name in the big panel gets suffixed by its locale.

When you edit this definition in a new .ijs window, it will be put straight back into its proper locale.

You can view the definition of a noun, too.

Here we see the noun LOBROW in the locale: 'lobrow'. It happens to be the form definition, as created by the J Form Editor.

In this format it's often good for writing back with minor changes, since it is in a format which will re-execute to rebuild the original object. (It's not always in such an illegible form).

But sometimes you want to read the text as though you had simply entered LOBROW in the J session.

Click checkbox: As Text.

You'll see the big panel change into something more readable. (This only works with nouns.)

Other things you can do:

* LoBrow takes snapshots of each panel display. You can browse earlier displays by clicking the buttons <- and ->. Get back to the latest display by clicking button -->||.

* Copy/paste the big panel by button Copy. This lets you paste a definition into a script you've already got open.

Discussion

../LoBrow/Comments

  • I want to make a better verb: linearized. The idea is to produce a LF-delimited string which displays in 'panel' as if you'd typed the name of the noun into the session. It works with 2-D char arrays, but doesn't work well for boxed vars. IanClark

  • If I did provide a button to write back an updated definition, then it could record which Tnnnn snapshot-noun this was done for,

    allowing that list of Tnnnn's to be printed-out at the end-of-session as a script of changes. IanClark

  • See also the class browser from Addons/gui/util
    Addons/gui/util/cobrowse.png
    -- OlegKobchenko 2010-01-20 07:07:44

  • If I'd known about Oleg's Cobrowse, I wouldn't have made the effort to write LoBrow. I now view my effort as largely of academic interest. But it's maybe instructive for someone at my stage of learning J. Also I can adapt it with confidence. IanClark 2010-01-20 11:58:00

  • Updated version uploaded, with new buttons:
    • Save -saves updated definition

    • Script -outputs current locale in a new script window

    • Open^, Edit^ -work on name beneath the cursor

    • Info -writes Info box back as a noun: currentObj_INFO, to help document currentObj.

    -- IanClark 2010-02-01 15:45:23

Contributed by IanClark

IanClark/LoBrow (last edited 2012-02-28 02:14:50 by IanClark)