This page is under development.

Click here to download a ZIP archive containing the latest version of the Nanoquery interpreter and standard library, or click here to view the latest version of the Nanoquery specification.

Please note: the currently available Nanoquery specification document is essentially in its infancy, and does not offer much help with learning the language as this time. Please visit Rosetta Code for Nanoquery programming examples.

If you want to develop code in Nanoquery using a text editor, a syntax highlighting definition for vim is available.

def cusip_checksum(cusip)
    alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    num   = "0123456789"
    sum   = 0

    for i in range(1, 8)
	c = cusip[i - 1]
	v = 0
	if c in num
	    v = int(c)
	else if c in alpha
	    p = alpha[c] + 1
	    v = p + 9
	else if c in "*@#"
	    v = "*@#"[c] + 36
	end
	if (i % 2) = 0
	    v *= 2
	end

	sum += int(v / 10) + (v % 10)
    end

    return (10 - (sum % 10)) % 10
end

if main
    codes = {"037833100", "17275R102", "38259P508",\
	 "594918104", "68389X106", "68389X105"}

    for code in codes
	if int(code[len(code) - 1]) = cusip_checksum(code)
	    println code + " is valid"
	else
	    println code + " is invalid"
	end
    end
end

Copyright © Waterfront Software 2020

(last updated Jan 29, 2020)