cool,

http://code.jsoftware.com/wiki/Essays/Progressive_Index-Of

oc=: i.~ (] - {) /:@/:
pi=: #@[ ({. i.&(,.oc) }.) [ i. ,

  'a' (] {~ i.@#@] -. pi~) 'cbaab'
cbab


my original version, (fails some of the order requests)


delfromend =: ;@:(] (</.~@[ }.&.>~ {./.) +/@:(=/))


 'a' delfromend&, 'cbaab'
cbba

----- Original Message -----
From: Henry Rich <[email protected]>
To: [email protected]
Sent: Monday, July 25, 2016 11:02 AM
Subject: Re: [Jprogramming] challenge: dyad -. but removing the number of 
copies of x in y

See Progressive Index in the Wiki

Henry Rich

On 7/25/2016 10:41 AM, 'Pascal Jasmin' via Programming wrote:
> write function delfromend (naming things is hard) such that
>
>   'cabd' delfromend 'cbaab'
> ba
>
> 18 (delfromend~ ; delfromend)&q: 54
> ┌┬─┐
> ││3│
> └┴─┘
>
>   'aaaa' delfromend 'cbaab'
> cbb
>
>  
>
> removes as many instances of x that exist in y.  Taking out items from the 
> end of y.  Though a bit easier is to just group items by "key" for output.
>
>
> (,<'a') delfromend ;/ 'cbaab'
> ┌─┬─┬─┬─┐
> │c│b│b│a│
> └─┴─┴─┴─┘
> ----------------------------------------------------------------------
> 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