Hello -

I have studied the related language K in the past:

http://en.wikipedia.org/wiki/K_(programming_language)

<http://en.wikipedia.org/wiki/K_(programming_language)>and just the other
day I was very excited to discover J, which seems to have a better license
and better GUI than K - so I am thinking of switching from K to J. I hope
this is the right place to ask a "newbie" question - about whether J has
"dependencies" and "triggers" like K.


One feature from K which I really liked was dependencies and triggers, which
are described as follows in an older K manual (KRefLite.PDF) available
on-line:

http://patch-tag.com/r/olegfink/icfpc/snapshot/current/content/pretty/kreflite.pdf

<http://patch-tag.com/r/olegfink/icfpc/snapshot/current/content/pretty/kreflite.pdf>
*A dependency is a global variable with an associated expression describing
its relationship with other global variables. The expression is
automatically evaluated whenever the variable is referenced and any of the
global variables in the expression have changed value since the last time
the variable was referenced.* (p. 35)

*A trigger is an expression associated with a global variable that is
executed immediately whenever the value of the variable is set or modified.
The purpose of a trigger is to have side effects, such as setting the value
of another global variable.* (p. 45)


A short example using triggers and dependencies to implement database
"drill-down" for OLAP (on-line analytical processing) can be found at the
"No-Stinkin' Loops" website here:

http://nsl.com/papers/drilldown.htm

In the above example, a quoted string following a variable's attribute:

..d

denotes a *dependency* which will be automatically evaluated any time the
variable having this attribute is referenced (if any variables mentioned in
the dependency have been changed)

and a quoted string following a variable's attribute:

..t

denotes a *trigger *which will be automatically evaluated any time the
variable having this attribute is updated.

As a learning exercise, I would like to port the drill-down example above
from K to J.


So I am curious whether J has mechanisms similar to K's dependencies and
triggers.

Alternatively, (if J lacks such mechanisms) I would be very appreciative for
any ideas on how to go about simulating K's dependencies and triggers in J.

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

Reply via email to