Oh yes, you're right.  Thanks for the catch.

-Dan

-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of R.E. Boss
Sent: Monday, September 09, 2013 5:28 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Joining up a rank-1 array of integers

Wasn't it 
(, '/' -. {:) '/some/path'
?


R.E. Boss

(Add your info to http://www.jsoftware.com/jwiki/Community/Demographics )


-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Dan Bron
Sent: maandag 9 september 2013 5:48
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Joining up a rank-1 array of integers

That's one of my favorite J idioms!

A similarly elegant phrase arising from the use of -. is (, '/' -.~ {:)
'/some/path' . This ensures all paths end in a slash, without duplicating
slashes in paths that are already in canonical form. To appreciate its
elegance, write an analogous function on another language of your choice,
then compare it to the J: did you notice that the J only has a single
reference (direct or indirect) to the constant '/'? How many were used in
the othe language? (Now, try transliterating the two algorithms to English.
Fun game.)

Brian McGuiness showed this pattern to me in 2010 and it blew me away (and
I'd been studying J for decade at the time; it's an endless thrill) [1].

-Dan

[1] J as a declarative language:
    http://www.jsoftware.com/pipermail/programming/2010-January/017673.html





N
consider that there is only a single reference to the constant '/' (direct
or indirect), and then try and  how you would express function in another
language w

Please excuse typos; composed on a handheld device.

On Sep 8, 2013, at 11:16 PM, Joey K Tuttle <j...@qued.com> wrote:

> Another (related, and also using -. (twice!)) expression that I use a 
> lot for getting just the digits from a string -
> 
>   digits=: -.&(a.-.'0123456789')
> 
>   digits ": 23 45 6
> 23456
> 
> 
> On 2013/09/08 19:54 , Alex Giannakopoulos wrote:
>> That 'less' verb is very useful, I'd never had occasion to use it until
now!
>> It could have been a bit more hyped up in the documentation, though, 
>> I'd never even seen it used before! (blush)
>> 
>> 
>> 
>> On 9 September 2013 03:46, Alex
Giannakopoulos<aeg...@blueyonder.co.uk>wrote:
>> 
>>> >Ah, OK, now I got it!
>>> >
>>> >(": 23 45 6) -. ' '
>>> >
>>> >23456
>>> >
> ----------------------------------------------------------------------
> 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