About Tuplet

Tuplet is a love-child born from the union of Scheme, Python, and Ruby. It has a smattering of genetic heretage from other languages too. Every piece of functionality tries to adhere to our Guiding Principles.

Behind the scenes, Tuplet is a source-to-source compiler (transpiler) that compiles it to Janet (a thouroughly modern lisp), and then on to C. You can find its GitHub repo here.

It looks like this:

   # auto-generated docs from the contract
   #= Parameters
   #= who - string
   #= Returns
   #= string
   def say-hello: [who]
     contract: [ [who string?:~] ] => string?:~

     if <equal: "who" "Dachary">
       println: "Hello Love"
       println: "Hello %s" who
     return true

   say-hello: "Dachary"
   # => Hello Love

   var: a_list [1 2 3 4]

   # lambdas
   var: plus_ten lambda: [x]
                    return +: x 10

   map: a_list plus_ten
   # => [11 12 13 14]

It also has a secret weapon that comes from being a transpiled language. Any feature that isn't supported by Tuplet, but can be expressed in Janet, can be directly expressed in Janet. For example, I haven't written a function to upper-case strings yet, but Janet has one, so I can use it directly in my code.

   def to-upper: [a_string]
       contract: [ [a_string string?:~]] => string?:~
       return: (string/asci-upper a_string)

This isn't limited to simple function calls like that though. Literally any valid Janet is valid Tuplet.

Alas, there's no syntax highlighting yet, because I haven't gotten that far. To know what I have gotten around to implementing, check out the dev diary on the home page.