The "classic apl" approach for such things involved using groups of flat
arrays in appropriately named variables (perhaps sharing a common prefix).

of course VSAPL also had "dynamic locals", which means that there was no
distinction between global variables and local variables in a calling
function - the most local version shadowed anything else of the same name.
What J has, instead, is a purely static system, but where locals are
distinct from "globals" and were globals are actually names within locales
(as opposed to locals). J's locales are powerful enough to implement
classes, objects, stack frames and other abstractions involving collections
(but perhaps too powerful for fine grained parallel data structures - you
should use arrays for those).

So I imagine the "classic J" approach for implementing something like json
might involve a locale (object) with a variety of variables representing
various aspects of the data (the characters, the nesting level, the
elements, and so on).

That said, for the json which I have been working with recently (aws
command line json), it's organized well enough that it can be treated as a
flat data structure with one name/value pair per line.

And that brings up another valid J approach: write a custom verb for each
access pattern and extract what's needed from the raw character string
representing the json.

It all depends on what it is you are trying to accomplish.

Thanks,

-- 
Raul


On Mon, Apr 28, 2014 at 5:16 PM, greg heil <[email protected]> wrote:

> Raul
>
> >OK so i will bite.-) i would guess as boxes were created specifically to
> expose structures that they would continue in that role. The, associated,
> data however, where would it be? Presumably carried around in the same
> noun? With a & family adverb to allow amending and extracting data; and
> rearranging structure?
>
> >This is kind of abstract question though, not really handleable. Perhaps
> json is a popular format here, and getting stuff to and from that data
> structure for use in outside languages; and of course being able to
> manipulate it in J, would be beneficial. Perhaps there is a pidgin of json
> which is appropriate for communication? It does need however to include
> some recursive structure; though that might be flattened like trees are in
> APL like representations.
>
> greg
> ~krsnadas.org
>
> --
>
> from: Raul Miller <[email protected]>
> to: Programming forum <[email protected]>
> date: 27 April 2014 22:22
> subject: Re: [Jprogramming] [Jchat] How a Genius Programmer Rewirtes a
> Ten-line code into One-line.
>
> I meant homogeneous at the top level.
>
> >That's probably not what you meant, of course. What you meant (a
> pervasive form of homogeneous) would probably be best represented by paring
> a flat array with an external representation of structure?
>
> Thanks,
>
> --
> Raul
>
> --
>
> from: greg heil <[email protected]>
> to: Programming forum <[email protected]>
> date: 27 April 2014 22:06
> subject: Re: [Jprogramming] [Jchat] How a Genius Programmer Rewirtes a
> Ten-line code into One-line.
>
> >Wow great! Now i suppose for the next few weeks i will use try the appose
> hammer on every problem i encounter (it is mostly directory structures that
> are popping nails now)
>
> >i do wonder though what you mean by homogeneous when it is perfectly
> normal to have a boxed structure such as
>
> 'asf';1 2 3;(i.2 3);2.3 4.5;1 0 1 1
>
> Yes the external view is, but internal is anything but. So operators
> can make NO assumptions which might be useful for simplification. Open
> (and yours!) help though.
>
> greg
> ~krsnadas.org
>
> --
>
> from: Raul Miller <[email protected]>
> to: Programming forum <[email protected]>
> date: 27 April 2014 20:46
> subject: Re: [Jprogramming] [Jchat] How a Genius Programmer Rewirtes a
> Ten-line code into One-line.
>
> Boxes are a homogeneous, ragged type.
>
> Also, something to think about:
>
> open=: &:>
>
> Thanks,
>
> --
>
> from: greg heil <[email protected]>
> to: Programming forum <[email protected]>
> date: 27 April 2014 20:28
>
> subject: Re: [Jchat] How a Genius Programmer Rewirtes a Ten-line code
> into One-line.
>
> >i kind of liked Rogers idea but missed the decoration afforded by
> textbook tables. This kept it to just the snippet afforded by the genius:
>
> * table open/ 1 2+ each i. each 9 4
>
> >it is a bit annoying that J treats boxes in such a cumbersome manner, so
> i did have to define open:
>
> open=:1 : '([:>[) x [:>]'
>
> table and each are in the standard lib
>
> >i kind of miss the each`s (and the lack of boxes) of K -ragged data is so
> easily dealt with (eg dictionaries, XML, json...). i do wonder if a subset
> of J could be made where all the content of boxes were made of a homogenous
> type, just ragged...
>
> greg
> ~krsnadas.org
>
> --
>
> from: Roger Hui <[email protected]>
> to: Chat Forum <[email protected]>
> date: 27 April 2014 15:29
> subject: Re: [Jchat] How a Genius Programmer Rewirtes a Ten-line code
> into One-line.
>
> Yes, */~i.10. And then +/~i.10, >./~i.10, <./~i.10, |/~i.10, +./~i.10, etc.
> ----------------------------------------------------------------------
> 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