[Jprogramming] Boxing pairs

Sam Simone ssimone at raleighcharterhs.org
Thu Oct 27 18:34:13 UTC 2016


NB. Use the infix adverb: x u\ y

NB. this applies u to every infix of x items of y

    t =. 1 2 2 4 1 5 3 4 4 2 3 3

2 <\ t

┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐

│1 2│2 2│2 4│4 1│1 5│5 3│3 4│4 4│4 2│2 3│3 3│

└───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┘

- Sam

On Thu, Oct 27, 2016 at 2:28 PM, Skip Cave <skip at caveconsulting.com> wrote:

> What is the best way to box each sequential pair in a string of integers?
>
>    t =. 1 2 2 4 1 5 3 4 4 2 3 3
>
>
>
>   ??  t
> ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
>
> │1 2│2 2│2 4│4 1│1 5│5 3│3 4│4 4│4 2│2 3│3 3│
>
> └───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┘
>
>
> Skip Cave
> Cave Consulting LLC
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

-- 


*This message originated from Raleigh Charter High School, a public charter 
school in Raleigh. All e-mail correspondence to and from this address is 
subject to the North Carolina Public Records Law as defined under N.C.G.S. 
§132.1, which may result in monitoring or disclosure to third parties, 
including law enforcement.*


More information about the Programming mailing list