By asking about where the code came from, I was trying how to help Raul in
the best way possible.  Code is available in Phrases, the dictionary and
other code in demos and labs.

Sometimes it is chosen to do exactly what you want. At other times it seems
to do exactly what you want, but you don't quite know exactly why so it is
inserted in a situation and may or may not be appropriate.

My style is obviously simplistic and focused toward learning the language. 
Raul is well able to write very terse and effective code.  However, just as
he doesn't read my code easily, I don't read his easily.

All I can do is explain what I want as an outcome and some basic rules
along the way.  I will point out where those are not followed.  

If you or others have advice for him or anyone else, we all benefit as best
we can from the concerns of advanced progremmers. I have been tenderly
taught a lot of things in the course of this challenge.  My writing is
getting better but some ideas I just am not ready to absorb.  However, they
will come around again like a merry-go-round and maybe next time I'll get
the brass ring.

A good example of this is Ric's code.

fdrs=: 13 :'/:~({. , #)/.~y'

In big chunks, I understand what it does.  I could incorporate it into
another situation.  At another level, I can't quite grasp how it does what
it does.

Driving to the supermarket this afternoon, an image came to me.

   ]ft=:5 2$i.10
0 1
2 3
4 5
6 7
8 9

  ,ft 
0 1 2 3 4 5 6 7 8 9

The  list  has  the oblique lines  -0 (1 2) (3 4) (5 6) (7 8) 9
I don't quite know where it will take me but it is a path to explore.

We all think in diverse ways, but learning to follow the rules in one sport
rarely hampers our ability to follow the rules in another. 

I don't mean to cramp any of your styles permanently.  Hopefully, you will
just learn more options that will increase your flexibility.

Most of all, thinking is fun and tools of thought are important.

Linda

----Original Message-----
From: programming-boun...@jsoftware.com [mailto:programming-
boun...@jsoftware.com] On Behalf Of Dan Bron
Sent: Friday, December 09, 2011 1:19 PM
To: 'Programming forum'
Subject: Re: [Jprogramming] Oblique Road to Success!

I can't speak for Raul, obviously, but:

        -  J is a (programming) language
        -  It is used to express (and sometimes execute) ideas, using a
vocabulary

So, asking "where did you get this?" of the sentence "(,+/&i./ 2{.1 1,~$y)
u key ,/y" is not very different than asking it of the sentence "where did
you get this?".  

You want to express a concept, you have a bag of well-understood words you
can use towards that end, and so you arrange them in a way you hope
communicates the idea to your interlocuter (which is sometimes a person
named "Linda Alvord", and other times a machine named "the J interpreter").

Anyway, even if Raul "got this somewhere", someone had to invent it in the
first place (say it for the first time).  So the comments above still apply.

That said, it does make use of several concepts which, while composite
(instead of primitive), are well-established enough to be considered part
of the shared vocabulary, rather than (re-)invented each time they are
used*.  One such concept is "(=x) u@#"1 _ y", which, beyond "well
established", is actually canonized in the DoJ [1].  

Another such concept is "the oblique lines of a table (2D array) are formed
by the collection of atoms whose index-sums are equal".  This is such a
compelling definition that, in [2], REB made the case that it should be
formalized and extended to higher-order arrays (though that hasn't been
done).

-Dan

[1]  DoJ entry for /. (Key), "x u/.y ↔ (=x) u@# y": 
     http://www.jsoftware.com/help/dictionary/d421.htm

[2]  R.E. Boss,  "Proposal for a different oblique", December 2006:
     http://www.jsoftware.com/pipermail/programming/2006-
December/004410.html

*  Roger doesn't like the term "idiom" as it applies to well-established J
phrases, as (in English) it carries connotations of conventions beyond the
face of the text.  I don't share that opinion, but out of consideration for
his perspective, I have avoided the term ;)


-----Original Message-----
From: programming-boun...@jsoftware.com [mailto:programming-
boun...@jsoftware.com] On Behalf Of Linda Alvord
Sent: Friday, December 09, 2011 12:18 PM
To: 'Programming forum'
Subject: Re: [Jprogramming] Oblique Road to Success!

Where did you get this.  Is there some way that you capture code like this
or do you just write it yourself?

oblique=:1 :0
   (,+/&i./ 2{.1 1,~$y) u key ,/y
)

Thanks in advance.

Linda

-----Original Message-----
From: programming-boun...@jsoftware.com [mailto:programming-
boun...@jsoftware.com] On Behalf Of Raul Miller
Sent: Friday, December 09, 2011 11:09 AM
To: Programming forum
Subject: Re: [Jprogramming] Oblique Road to Success!

On Fri, Dec 9, 2011 at 10:46 AM, Linda Alvord <lindaalv...@verizon.net>
wrote:
>     b=:5 3 5
> Either definition has only one argument so isn't the function oblique
rather
> than key? So Ric has taken the "Oblique oad To Success!".  One wonders if
it
> is faster than the other one.

My previous post about equivalents to /. was confused.

/.~ uses key
/. without ~ and using only one argument is oblique

key=:1 :0
:
  (=x) u@#"1 _ y
)

oblique=:1 :0
   (,+/&i./ 2{.1 1,~$y) u key ,/y
)

FYI,

-- 
Raul
----------------------------------------------------------------------
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

Reply via email to