(archive 'newLISPer)

October 2, 2007

Hello nu (Lisp)

Filed under: newLISP — newlisper @ 11:48

In other nu-s: say hello to the nu programming language. Nu™ is an open-source programming language descended from Lisp. Read all about it here. It’s based around Objective C, which means that, in practical terms at least, it’s MacOS X only at the moment. Tim, nu’s creator, says:

In a lot of ways it’s like Ruby, but in one important way, it’s Lisp. You might say that it’s “Ruby with Parentheses”, but it’s called Nu, and it’s not just for the desktop.

And here’s a sample of nu code:

    (class ConverterController is NSObject
      (ivar (id) window (id) form)
      (imethod (id) init is
       (super init)
       (set @window 
          ((NSWindow alloc)
               initWithContentRect:'(125 513 383 175)
               styleMask:(+ NSTitledWindowMask
       (@window setTitle:"Currency Converter")
       (let (form ((NSForm alloc) initWithFrame:'(15 70 348 85)))
        ('("Exchange Rate per $1" 
           "Dollars to Convert" 
           "Amount in Other Currency") each:
          (do (text) (form addEntry:text)))
        (form set: (interlineSpacing:9 
        ((@window contentView) addSubview:form)
        (set @form form))
       ((@window contentView) addSubview:((NSBox alloc) initWithFrame:'(15 59 353 2)))
       (let (button ((NSButton alloc) initWithFrame:'(247 15 90 30)))
            (button set: 
            ((@window contentView) addSubview:button))
       (@window orderFront:nil)
      (imethod (void) convert: (id) sender is
         ((@form cellAtIndex:2) 
            ((* ((@form cellAtIndex:0) floatValue)
                ((@form cellAtIndex:1) floatValue))

As you can see, you’ll be better off if you already know your way around Objective C (notice all those NS objects?). Unfortunately I’m already using up most of my brain cells working with newLISP, and I didn’t see any tutorials floating around to make learning Nu any easier than it looks. But it’s great to see people coming up with new languages.

Comment from cormullion

Sorry about the formatting. It’s hard to retain the original’s formatting given the limited width of the text area…


Leave a Comment »

No comments yet.

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Blog at WordPress.com.

%d bloggers like this: