Ad
  • Default User Avatar

    That sounds crazy. It took me less than 10 minutes to find a solution, even if it probably wasn't what you had in mind.
    Thanks for the Kata anyway, it was refreshing!

  • Default User Avatar

    Also add Hash into the list of frozen classes. Set class is using Hash class under the hood.

  • Custom User Avatar

    \x0B does not match with the name length either.

    I've changed the example to \x0C\x00Maximilianus, which should be valid, correct and a useful example.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Agree: not sure if they are somehow converted automatically or if it was intentional, but I go other strange characters too to distract me.

  • Custom User Avatar

    Mine's pretty straightforward as well. Reduce takes operators as symbols, which is incredibly useful in this case.

  • Default User Avatar

    I agree with the duchess. Showing the character as \\b is misleading because the character isn't supposed to be interpreted as an ASCII backspace, but as an integer.

  • Custom User Avatar

    The most interesting solution. Mine is also not using eval, but quite simple and easy to read. @JoshBrodieNZ your solution is universal, man, you could use it for half of katas with minor changes ;)

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    The garbled text unpacks to read:

    module Kernel
      import org.jruby.RubyKernel
      def require(n)
        org.jruby.RubyKernel.require(Class,n,nil)
      end
    end
    require 'matrix'
    

    Which I then eval to run and require the built-in Matrix functionality.

    I obfuscated this because on the previous jRuby based system, this could be modified to escape the sandbox environment by leveraging the jRuby hooks to reimplement blacklisted functionality like 'require' and 'system'.

  • Custom User Avatar

    Sorry but I got to ask, What are you doing there?

  • Custom User Avatar

    I also hate eval and haven't ever used curry, but I will now!

  • Custom User Avatar

    I try not to do this too often but sometimes I just can't help it!

  • Custom User Avatar

    Ah! Need to be sneakier! :)

    ps. I just submitted a less obvious albeit somewhat longer solution.

  • Custom User Avatar

    This was pretty interesting, thanks for the challenge!

    That being said, I couldn't personally rank it at 1 kyu. It was quite difficult, but I come from Javascript and have only dealt with Ruby in a few very simple katas. If I hadn't to Google every bit of syntax, I wonder how much easier it'd be.. :P

    I find it odd, given Ruby's reputation of insane magic tricks, that a JS background could help so much.

    Am I'm just misguided, and they are actually very similar languages?

  • Loading more items...