From J Wiki
Jump to: navigation, search

Outstanding proposals for J interpreter extensions and enhancements. (Library extensions and enhancements are on another page.)

See also System/Interpreter/Proposals/Closed

Tacit expressions with explicit J syntax

I would like to propose new tacit expressions with explicit J syntax, with [ and ] replacing left and right arguments.

For the purpose of this text I will call them tacit-v expressions.

For the purpose of this text I will call the present tacit expressions tacit-t expressions.

It should be possible to have other tacit-v expressions within a tacit-v expression.

It should not be possible to have tacit-t expressions within tacit-v expressions.

Like in explicit J, parentesis is used in tacit-v expressions to change the order of execution. To define a combination of verbs, adverbs and conjunctions as a single verb, tacit-v expressions are used instead of tacit-t expressions, instead of enclosure in parenthesis.


Below we can see examples of these both versions of tacit expressions when curly brackets are used to mark the tacit-v expressions.

The curly brackets can be replaced by any suitable notation.



This is the corresponding explicit J expression:

   (<:b++/\b-~-.b=.'\'=v){."0 v=.'\\\//\\\//'

Arguments For Tacit-v Expressions

  • Easier to read than tacit-t expressions.
  • Easier to write than tacit-t expressions.
  • Code can be moved between tacit-v and explicit J with minor modifications.

Arguments For Tacit Expressions as Such

  • To avoid mutable state.
  • Since the tacit expressions are compiled at execution time they might be more efficient.
  • Removing variable names from code snippets gives them a more general form.

Test Implementation

There is a test implementation, a programming language called JWithATwist, however, there are many more differences between this test implementation and J than this proposal covers.

The JWithATwist Reference manual might give som useful information, for example in the chapter The JWithATwist Syntax.

The JWithATwist tests might give useful information, for example the system tests.

There is a JWithATwist Windows application which can be installed.

The JWithATwist project can be cloned. JWithATwist can then be used from F#.


My proposal is not that the tacit-v expressions should be like JWithATwist, but that they should be like explicit J, with the differences mentioned above and some differences mentioned below.

Tacit-v expressions should be direct replacements for tacit-t expressions and should have many things in common with them. It should not be possible to use variables inside them. There should be a recursion functionality.

Since there should be no tacit-t expressions within tacit-v expressions there should be no hooks and forks. It is not clear if any of the & &: &. &.: @ and @: conjunctions would be useful inside of the tacit-v expressions. Tacit-v expressions as they are implemented in the test implementations rely on composition. The tacit-v expressions are compositions of compiled code. How the composition is created is nothing the user has to care about. He only has to care about the application functionality.

Nothing prevents having composition operators to be used in the tacit-v expressions. There could be a no operation compose operation which could be inserted between all verbs. There could be a hook conjunction. I think the best implementation of a fork would be in the form of a tacit conjunction definition. Let's say the chosen form of tacit-v expressions would be ().v . Tacit conjunction definitions could then have the general form ().c , where the parenthesis could contain left and right noun arguments and left and right verb arguments. There could be a default implementation allowing the fork to be written +/ %.c # . A simple implementation of this could be a modifier which changes a verb to a fork conjunction with itself as the center verb.

It would be possible to allow tacit-t expressions in tacit-v, but that is not what I propose.

If we let @ denote composition, f @ g @ h(x) means f(g(h(x))) which in tacit-v expressions is written fgh] and in tacit-t expressions is written [: f@:(g@:(h))] if f, g and h represents any combination of verbs, adverbs and conjunctions constituting a verb.

I think references to the left and right argument of a tacit-v expression should always be explicit.

Erling Hellenäs (talk) 10:00, 26 September 2017 (UTC)