Arc Forumnew | comments | leaders | submitlogin
Tagging
1 point by almkglor 6164 days ago | 4 comments
I just thought that a method for tagging - for documentation and other purposes - might be useful. For example:

  (def queue ()
    " Creates a queue. "
    (t related enq deq qlen qlist enq-limit)
    (list nil nil 0))
In the above case, (t related ...) serves a documentation purpose, specifically to document that (queue) is related to (enq ...) etc.

Or for another case:

  (def median (ns)
    " Computes the median of an unsorted list. "
    (t type ns ('num))
    ((sort > ns) (truncate (/ (len ns) 2))))
The above would then effectively be similar to a (declaim ...) that ns is a list of 'num, useful for, say, optimizations.

In any case, the only minimum requirement would be that (t ...) would validly return a "useless" value without any side-effects and cannot be redefined.

Thoughts?



1 point by sjs 6162 days ago | link

> In any case, the only minimum requirement would be that (t ...) would validly return a "useless" value without any side-effects and cannot be redefined.

Well, you have the last part of your wish. t is the symbol representing true in Arc and cannot be redefined. ;-)

-----

1 point by almkglor 6161 days ago | link

Actually, what I meant is that (t ...) could not be redefined.

-----

1 point by sjs 6161 days ago | link

I know, hence the ;-). All I was saying is that you have to choose a symbol different from t, as you will not be able to define a meaning for (t ...), let alone redefine it.

-----

1 point by bayareaguy 6163 days ago | link

Reminds me of elisp, which looks for a top-level call to (interactive) in order to know if the function can be invoked "interactively" (i.e. via M-x or command-execute).

-----