• Events

    Kynetx Impact Dev. Day
    Sat. Sept. 18, 2010
    FREE Day-long Intensive Developer Training. Seats are limited so sign-up today.

    Friday Open House Lunches
    Stop by on Fridays for lunch and see what's new, ask questions, brainstorm or just get to know us. RSVP to @kynetx on Twitter.

    Kynetx Dev "Load-N-Codes"
    Once a month, come for dinner, instruction, show & tell and brainstorming at Kynetx. Watch us on Twitter for dates and times.

  • Library

  • Nov 24 2009

    Build 353: Coercion and Random Numbers

    Kynetx Logo

    We released Build 353 of the Kynetx Rules Engine (KRE) this morning. Actually, I should point out that Wade Billings released it and I watched over his shoulder. This is the first time in the history of Kynetx that someone besides me released KRE code. Yeah!! This is an exciting thing in and of itself. Wade's job is to build a continuous integration environment for Kynetx so that code changes appear in production as quickly as possible. Until then, I've pushed the pain on him to ensure he's properly motivated.

    The new release adds two new features to KRL:

    • The as operator provides a way to coerce primitive values. The most interesting ones are coercing strings and regular expressions. You can construct a string and then coerce the result to be a regular expression for use in a replace:
      my_str.replace(("/this/"+ e).as("regexp"),"do you want a")
      
    • You can use math:random to generate random numbers. The function takes an argument and generates a random number between 0 and the argument. For example, you could bind r to a random number between 0 and 9999999 with the following:
      pre {
        r = math:random(9999999)
      }
      notify("Randomness", "A new random number: " + r)
      

      Here's the result showing on my blog:

    Both of these features were the result of developers asking for something they needed. We can't promise same day turn around, but for small features like this we try to be as responsive as we can. On Monday we'll announce the new Kynetx Developer Exchange where you can ask questions, answer questions, and make feature requests. More on that later.

    No Comments

    No comments yet.

    RSS feed for comments on this post. TrackBack URI

    Leave a comment

    Back to Blog