What do you mean by "better"?

That said, there are several "native" ways of representing code in J:

1) as a sequence of characters (J can be thought of as a virtual
machine with ascii mapped as machine instructions)
2) as a file (typically represented as a file name)
3) as a gerund (you can use `:6 to evaluate gerunds which produce a
verb, or an adverb, or a conjunction, or a noun)
4) as a locale (class or object)

And there's variations on these themes. For example you could use ".
to interpret a sequence of characters (implies you want a noun
result). Or, you could use a 0!: foreign (implies you are defining
things, not getting a result), or you could use : (implies you are
producing a verb, adverb or conjunction).

That said... remember, also, that scheme has a fundamentally different
design philosophy than J. Scheme is an outgrowth of a language (LISP)
which originally corresponded to machine instructions on a specific
machine. J, in contrast, was originally a language (APL, and before
that "Iverson notation") designed to represent machine architecture.
You can emulate the one in the other, but you're going to be working
through cognitive disconnects, and very different concepts of
"efficiency" means.

Thanks,

-- 
Raul

On Thu, Jan 16, 2020 at 2:55 PM Raoul Schorer <raoul.scho...@gmail.com> wrote:
>
> Hi,
>
> I am translating scheme code that makes heavy use of delayed evaluation
> (thunks). In scheme, there is a predicate 'procedure?' that returns a
> boolean. I translated that into a check for a boxed string, which is the
> representation I use for delayed procedures, which I then 'force' using ".@>
>
>
>    1. Is there a better way than building a program string to get delayed
>    eval? I tried using (3: '(delayed_verb)"_'), but the interpreter seems to
>    greedily eval the whole thing with that pattern. The only working solution
>    I found was to convert everything to string.
>    2. Is there a general test similar to 'procedure?' in J?
>
>
> Thanks!
> Raoul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to