News for hackers. Stuff that matters.
Re:Hy – A Lisp-flavored Python by breck on Wednesday August 02, 2017 @07:42PM (#14915688)
Very interesting link, thanks for sharing. I'm always eager to see developments in the Racket world.

> The problem is that it requires all of your functions to have a fixed arity I think, or at least a lower bound on the arity, or you use newlines as part of the syntax.

This was my initial thought as well.

However, in my latest batch of ETNs (the name I give to these types of lisps), I've found that a simple convention of putting any variadic argument last seems to work well.

An example may help. Here would be a language blueprint that defines 2 node types:

  =+2
   description Adds two numbers
   pattern resultIdentifier number number
  =+
   description A variadic adder of unknown arity
   pattern resultIdentifier number+
Here's a sample program in the language we partially defined above:

  =+2 sum 2 5
  print sum
  # prints 7

  =+ sum 1 2 4
  print sum
  # prints 7

There are no comments on this comment yet.