Day 2 was a little more challenging, but still easily solved in J - around 7 lines total for both answers. I stuck to solving individual parts of the answers instead of trying to make the code as short as possible. I will post my solutions later if anyone else does, but wanted to give some time not to spoil.
fun. Maybe I can apply this logic to save on some wrapping paper this year.... On Tue, Dec 1, 2015 at 11:22 PM, Joe Bogner <joebog...@gmail.com> wrote: > Hi gc, > > I realized we all posted solutions without giving you feedback as requested > > Some feedback: > > 1. My style is to eliminate parentheses as I find it harder to see the > substance of the function > > (# - [: +:@(+/) '('&i.) '((()' > > is equivalent but with fewer parentheses > > I sometimes prefer trains over bond - again, just style > > (# - [: +:@(+/) '(' i. ]) '((()' > > 2. The usage of i. is not intuitive as you are seeking 1 if the character > is ). I would be more explicit about that > > (# - [: +:@(+/) ')' = ]) '((()' > > 3. In my version, I would remove the cap > > (# - ')' +:@(+/)@:= ]) '((()' > > 4. I considered eliminating the ] but that resulted in more parentheses > and I thought it was less clear > > (# - +: @ (+/) @: (=&')') ) '((()' > > but we can move the bond to the right and parentheses aren't needed around > it > > (# - +: @ (+/) @: =&')' ) '((()' > > compared with > > #-(+:@(+/@('('&i.))) > > I think this would be my final restyling of the concept of your version > > - sent from my mobile and tested with jandroid so not tested thoroughly > On Dec 1, 2015 5:07 PM, "Geoff Canyon" <gcan...@gmail.com> wrote: > >> Spoiler (my solution, looking for feedback) >> . >> . >> . >> . >> . >> . >> . >> . >> >> F =: #-(+:@(+/@('('&i.))) >> >> >> If S is the string from the site, then >> >> >> F S >> >> returns the ending floor (the first part of the challenge). >> >> >> Any suggestions on improving the syntax are welcome, I only dabble in J. >> >> >> thx >> >> >> gc >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm