> I feel so grown-up, using i.~ If I can only use 16 expressions to show off APL/J, i.~ would be one of them. http://www.jsoftware.com/papers/amuse-bouches.htm#3
On Sat, Dec 5, 2015 at 1:40 PM, Henry Rich <henryhr...@gmail.com> wrote: > i =. ];._2 wd 'clippaste' > nice2 =. ([: +./ 3&(=/@:(0 _1&{)\)) *. (1 < >./@(i.@# - i.~)@(2&(]\))) > > +/ nice2"1 i > > > I feel so grown-up, using i.~ > > Henry Rich > > > On 12/5/2015 3:43 PM, 'Pascal Jasmin' via Programming wrote: > >> with utilities to help minimize typing and parentheses >> >> part 1 >> >> Sel =: 1 : '] #~ u' >> >> daF =: 1 : ('a =. (''2 : '', (quote m) , '' u'') label_. 1 : (''u 1 :'' >> , quote a)') >> at =: 'u (v@:) 'daF >> atop =: 'u (v@) 'daF >> nd =: 'u (v&)' daF >> >> # ( 2 (4 2 $ 'abcdpqxy')-:"1 nd\ +./ at ]) +./ at -. atop "1 Sel ( 2 >> =/\ ]) +./ at"1 Sel 'aeiou' ( 3 <: ="0 1 +/"1 atop +/ at)"1 Sel > cutLF a >> >> for part 2, this is a bad solution that involves taking out 3 letters in >> a row but putting back in 4 letters in a row. the spec wasnt super clear >> on that rule, and this turned out to be the answer. >> >> In terms of double adverbs, I did not get rid of all @s. The one in the >> middle is kept because too many gaps between double adverbs makes it hard >> to follow the pairings (though extra whitespace that wont show in email >> works pretty good for this) >> >> >> Less =: 1 : '] -. u' >> >> # +./@( 4 (1 = #@~.)\ ])"1 Sel Less @:((3 (1 = ~.#at)\ ]) +./ atop"1 >> Sel) Less (3 (({. ~: 1&{) *. {. = {:)\ ]) +./ at"1 Sel@:((1 < >> >./"1)@:([: +/\"1 [: = 2 <\ ]) +./ atop"1 Sel) at > cutLF 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