Example Code
This Nu code defines a simple complex numbers class.
(class Complex is NSObject (ivar (double) real (double) imaginary) (- initWithReal:(double) x imaginary:(double) y is (super init) (set @real x) (set @imaginary y) self))The example is a basic definition of a complex number: it defines the instance variables, and a method to initialize the object. It shows the similarity between the Nu code and the equivalent Objective-C code; it also shows the similarity with Ruby.
(unless @prefix (set @prefix "#{((((NSProcessInfo processInfo) arguments) 0) dirName)}..")) (unless @icon_files (set @icon_files (array "#{@prefix}/share/nu/resources/nu.icns")))This snippet, from the nuke tool bundled with Nu, also shows the influence of Objective-C, Lisp, and Ruby in the design of the language.
Read more about this topic: Nu (programming Language)
Famous quotes containing the word code:
“Acknowledge your will and speak to us all, This alone is what I will to be! Hang your own penal code up above you: we want to be its enforcers!”
—Friedrich Nietzsche (18441900)
“... the self respect of individuals ought to make them demand of their leaders conformity with an agreed-upon code of ethics and moral conduct.”
—Mary Barnett Gilson (1877?)