top | item 9277572

Tulip – An untyped functional language

77 points| jneen | 11 years ago |jneen.net

58 comments

order

_pmf_|11 years ago

This might seem strange, but if there's one thing from Common Lisp that should receive wider adoption in other languages, it's hyphenated names. They are so much more readable than anything else (well, C with underscores comes close).

thomasfoster96|11 years ago

I've been playing around with creating a toy language which treats '-' as a name for a function. It means there always needs to be white space around a - (the syntax of the language isn't like LISP), but that increases readability at the cost of two extra key presses.

jewel|11 years ago

This would be an easy text-transformation that you could do in vim. Upon opening the file, translate all dashes without spaces "foo-bar" to add spaces "foo - bar". Then convert all underscores to dashes. "foo_bar" to "foo-bar". On save, invert the process.

You'd have to actually run the language's parser in order to do the transformation to avoid changing strings, and even then it'd only work if the parser output kept track of the original line and character so that you could know where to make the change.

This sort of text-transformation is something I've long wished my text editor did. At a previous job the standard was three-spaces of indent, regardless of the language.

rdtsc|11 years ago

Easier to type too. No need to press the shift key.

draegtun|11 years ago

Perl6, Clojure, Racket, Rebol, Red, Factor & Forth are some other languages that allow hyphenated names.

And I agree with you that hyphens are more readable. They're also good for adding extra semantic meaning - https://news.ycombinator.com/item?id=3978992

otabdeveloper|11 years ago

If that sort of thing interests you, also check out my language 'tab' (https://bitbucket.org/tkatchev/tab).

Tab is a statically-typed, functional, type-inferred language that occupies a niche between bash and python.

It's also not Turing-complete but can compute almost everything you could ever think of.

(I wish more languages aimed for Turing-incompleteness -- unsurprisingly, it turns out Turing-incomplete languages have big benefits for performance and resource management.)

g8gggu89|11 years ago

How is yours not Turing-complete and what benefits are there?

lectrick|11 years ago

> I strongly dislike macros that can hide in code. I get really frustrated when I open a source file and see (foo ...) and can’t tell whether it’s a function or a macro until I read documentation.

Well... that's just, like, your opinion, man.

Seriously though. In Elixir, for example, much of the language itself is implemented via its own macros, which demonstrates a certain nice extensibility. If Elixir followed this same pattern, it would get really annoying really quickly, as even simple if statements would require a leading slash.

Also, I preferred "unf" ;)

jneen|11 years ago

Yep, it's my opinion, and that's why I put it into the design. Lots of language design comes from opinions. I hope it's borne out. FWIW it's the same approach Rust has taken, where macros have to end with a ! to make them visually distinct.

59nadir|11 years ago

This is also true for Racket. The language is basically all macros built on top of each other. While this superficial distinction between macros and other constructs serves a purpose, I think that purpose is largely misguided and invented.

What is the need for knowing if it's a macro or not when you could just know how it works (what'll it spit out / do?)?

While I do believe in limiting stuff for the sake of simplicity, this notation will actually burden the developer into not using the macro system fully, simply because someone wants there to be a non-forced distinction between macros and other constructs in the code.

chubot|11 years ago

This looks cool -- is there any source code? What language is it written in?

"Tulip is still in active development, and I could use a whole lot of help, both filling in the design gaps here and actually churning out the implementation"

duaneb|11 years ago

Note that it definitely has types, they just aren't required explicitly. It seems to use dynamic type matching.

namanbharadwaj|11 years ago

It's unityped! It has one type with infinitely many variants/tags (.<string>). Match failure occurs at runtime as in any other safe typed language such as Haskell or ML.

jneen|11 years ago

Yep! It focuses more on dynamic type-checks than on static typing though, so I put it in the category of "untyped functional" - more like clojure and erlang than haskell or ml.

wyager|11 years ago

"I’ve renamed the language from Unf to Tulip, because some folks pointed out that the old name created an unnecessarily sexualized environment"

Are fifth graders critiquing programming languages now? Seriously, who makes that association and then feels the need to comment on it?

jneen|11 years ago

It was a decision I made, partly because I realized they were right, and partly because I think tulips are pretty.

     ) (
    (  _)
      |/

evincarofautumn|11 years ago

“Unf” is quite widely used as a spelling of a moan, to express sexual desire or gratification. While it can be used to express non-sexual enjoyment, the sexual connotation it evokes is just unnecessary when it comes to a programming language, regardless of the original intent.