Nice example.

   A=:'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
   f=: 13 :'  ({.y);}.y'
   f A
┌─┬─────────────────────────┐
│A│BCDEFGHIJKLMNOPQRSTUVWXYZ│
└─┴─────────────────────────┘
   7 f A
┌───────┬───────────────────┐
│ABCDEFG│HIJKLMNOPQRSTUVWXYZ│
└───────┴───────────────────┘
   
   f
{. ; }.

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Raul Miller
Sent: Thursday, March 27, 2014 11:46 PM
To: Programming forum
Subject: [Jprogramming] lost art

I am continually struck by how difficult it is to find relevant information.

Once upon a time, I had hopes that search engines would help resolve such
issues, but more and more I'm seeing their limitations (and the limitations
of the groups of people running them). And, similarly, for educational
institutions. And, similarly, for books. Each of these have limitations -
working together they can achieve a lot, but ultimately it's up to the
individual to have the drive and interest to piece things together.

Anyways, here's an example: split

   split 1 2 3
┌─┬───┐
│1│2 3│
└─┴───┘

In other words: given a list, return the pair (first; rest). Or, more
precisely:

{. ,&< }.

This is kind of a fun concept (though, frankly, it's often better to work
with flat data - trying to introduce habitual abstractions often gets in
the way of getting to where you want to go).

Still, I remember times when I wanted something like split and I could not
think of how to find it. So I had to reinvent it, or something similar. I'm
not sure why this bothers me, but it does.

Also, this is a nice example of monadic and dyadic definitions having a
nice simularity:

   4 split 'abcdefghi'
┌────┬─────┐
│abcd│efghi│
└────┴─────┘

It's just a minor thing, but it's still food for thought.

Thanks,

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

Reply via email to