Monday 21 October 2013

Rosetta Code

I went over to the Rosetta Code website to look at the examples of Julia in action. Amongst them I found one marked as not completed so I took the challenge. This code picks the middle three digits from numbers returning an error message if it's not possible. It illustrates the use of the @sprintf macro for formatting text. You don't waste a lot of keystrokes when you write Julia:

2 comments:

  1. why do you need the 'let' scope block here, I don't see the need...

    ReplyDelete
  2. I don't see it as necessary - it was in earlier code and I liked the form. There were two earlier examples of code which had been flagged as not meeting Rosetta's spec. I left them there but I see that they've been removed along with the non-compliance banner. To me it seems a nice way of introducing s,l and mid without a significant penalty. If there is a downside I'm keen to be educated though.

    ReplyDelete