I am rethinking my concern with  @  and  [:  and am leaning toward using
explicit definitions as a way of teaching  J  to beginners as a natural
mathematical language.

Some of the programmers responding to the forum think in idioms and use  @
happily.

   f
 <:@-@[ C.&.|. ]
   i
-@#@[ |. C.
   k
<@i.@-@>:@[ C. ]
   
0thers favor the tacit approach with lots of  [:

   g
] C.&.|.~ [: <: [: - [
   h
[: |. ([: <: [: - [) C. [: |. ]
   j
C. |.~ [: - [: # [
   

Both styles are appropriate and I should not suggest one way or the other.
Many of you have suggested this.


We are looking for a simple way to introduce  J  to beginners. In my opinion
we would introduce J  as a mathematical language for solving problem.


I am suggest starting with expressions that produce desired results.
Developing from right to left may come naturally.

    (<:-3 6)C.&.|.'abc*ef*g'
**abcefg        
   
The next step is making explicit functions indicating if the intended use is
monadic or dyadic. There is no use of  @  or  [: allowed at this point.
 
    g=: 13 :'(<:-x)C.&.|.y'
    h=: 13 :'|.(<:-x)C.|.y'
   j=: 13 :'(-#x)|.x C.y'

Now exploring the tacit definitions would be appropriate in some
environments and can be explored an studied in terms of forks and hooks.
At this special code and common idioms can be explored and timing of
expressions can be compared. In the end all roads lead to Rome.

   3 6 f 'abc*ef*g'
**abcefg
   3 6 g 'abc*ef*g'
**abcefg
   3 6 h 'abc*ef*g't 
**abcefg
   3 6 i 'abc*ef*g'
**abcefg
   3 6 j 'abc*ef*g'
**abcefg
   

-----Original Message-----
From: programming-boun...@jsoftware.com
[mailto:programming-boun...@jsoftware.com] On Behalf Of Linda Alvord
Sent: Wednesday, February 01, 2012 6:01 PM
To: 'Programming forum'
Subject: Re: [Jprogramming] Understanding C. , A.

Sorry I missed the version by Arie.  Nice!

   3 6 (i=:-@#@[ |. C.) 'abc*ef*g'
**abcefg
   i
-@#@[ |. C.
   
   j=: 13 :'(-#x)|.x C.y'
   j
C. |.~ [: - [: # [
   
   3 6 j 'abc*ef*g'
**abcefg

Please let me know if you have concerns or modifications as I plan to use
different rules beginning with challenge 6.

Henceforth I'll have no opinion concerning the merits of  @  and  [:  I hope
to learn to favor them both gracefully.

Linda

-----Original Message-----
From: programming-boun...@jsoftware.com
[mailto:programming-boun...@jsoftware.com] On Behalf Of Linda Alvord
Sent: Wednesday, February 01, 2012 5:20 PM
To: 'Programming forum'
Subject: Re: [Jprogramming] Understanding C. , A.

I'm happiest with the explicit version. It shows the arguments needed for
the application. 
   
   3 6 (f=:<:@-@[ C.&.|. ]) 'abc*ef*g'
**abcefg
   3 6 f a=:'abc*ef*g'
**abcefg
  
   g=: 13 :'(<:-x)C.&.|.y'!
   3 6 g a
**abcefg
   
   f
<:@-@[ C.&.|. ]
   g
] C.&.|.~ [: <: [: - [
g=: 13 :'(<:-x)C.&.|.y'

J provides the  ~  which shows up in the tacit version above. 

Then there is  h  with no  ~  and no  &.

   h=: 13 :'|.(<:-x)C.|.y'
   h
[: |. ([: <: [: - [) C. [: |. ]
   3 6 h a
**abcefg

Linda


-----Original Message-----
From: programming-boun...@jsoftware.com
[mailto:programming-boun...@jsoftware.com] On Behalf Of Roger Hui
Sent: Wednesday, February 01, 2012 11:26 AM
To: Programming forum
Subject: Re: [Jprogramming] Understanding C. , A.

Personally, I dislike expressions with multiple uses of ~ as they make my
head spin.

    3 6 (C.&.|.~ <:@-)~ 'abc*ef*g'
**abcefg
   3 6 (<:@-@[ C.&.|. ]) 'abc*ef*g'
**abcefg

I much prefer the second over the first.



On Wed, Feb 1, 2012 at 8:05 AM, Aai <agroeneveld...@gmail.com> wrote:

> Ah, I see that's a bit like yours David.
>
> Modifying it for 1< #x
>
>    3 6 (C. |.~ -@#@[) 'abc*ef*g'
> **abcefg
>
>
> (from Essays)
>
>    3 6 (C.&.|.~ <:@-)~ 'abc*ef*g'
> **abcefg
>k
>
>
>
> On 01-02-12 16:47, Aai wrote:
> > Sorry for the noise. You should forget the previous ones I sent: they
> > are wrong.
> >
> > It looks like this one is ok:
> >
> > mtf=:_1&|.@C.
> >
> >    ]samples=: '*abcef' |."0 1 ~-i.6
> > *abcef
> > f*abce
> > ef*abc
> > cef*ab
> > bcef*a
> > abcef*
> >
> >
> >    ]res=: '*' ([,-.~) "1 samples
> > *abcef
> > *fabce
> > *efabc
> > *cefab
> > *bcefa
> > *abcef
> >
> >    res -: mtf&>/"1 (;~I.@:('*'&=))"1 samples
> > 1
> >
> >
> >
> >
>
> --
> Met vriendelijke groet,
> @@i = Arie Groeneveld
>
> ----------------------------------------------------------------------
> 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

Reply via email to