Nope, functions must have an argument.  The normal idiom when calling a niladic function is to use '' (empty string) as the argument, since it's easy to type and doesn't require surrounding spaces.

Henry Rich

On 11/26/2017 12:42 PM, Andrew Dabrowski wrote:
Is it possible to define a nullary function in J?  In other languages they're sometimes convenient, for example a function that returns a random element.  It's a bit awkward to have to use a dummy argument, like

randdie =: 1 + ? @: 6:

which must be called like

randdie 0

and when used in a tacit definition must be called like

randdie ].



----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


---
This email has been checked for viruses by AVG.
http://www.avg.com

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to