[Jprogramming] gerund creation failure
Raul Miller
rauldmiller at gmail.com
Sat May 19 22:10:13 HKT 2007
On 5/19/07, Raul Miller <rauldmiller at gmail.com> wrote:
> I lied.
>
> This will not work. to make this work I have to get rid of
> a set of parenthesis:
>
> rec_case=:(fib]-1:) +(fib]-2:)
>
> The problem is that with (+ fib]-2:) I have only two verbs at
> the top level, so (fib]-1:) is used as a dyad rather than as
> a monad.
Well... ok, maybe I lied about me lying... if the definition of
fib simply ignores its left argument (which it probably would),
then the above "issue" is not really an issue in this case.
(But could cause problems in other cases.)
Also...
On 5/19/07, Raul Miller <rauldmiller at gmail.com> wrote:
> On 5/19/07, Terrence Brannon <metaperl.j at gmail.com> wrote:
> > On 5/19/07, Raul Miller <rauldmiller at gmail.com> wrote:
> > > Why? Well, the parenthesized expression
> > > (] - 2)
> > > evaluates as:
> > > _2
> >
> > How did you figure out what it evaluates as?
>
> I type the expression into the J console.
I can also figure out how this expression evaluates, by hand, using
the rules at http://www.jsoftware.com/help/dictionary/dicte.htm
queue: rule: stack:
mark ( ] - 2 ) shift
mark ( ] - 2 shift )
mark ( ] - shift 2 )
mark ( ] shift - 2 )
mark ( 1 Monad ] - 2 )
mark ( shift ] _2 )
mark 1 Monad ( ] _2 )
mark 8 Paren ( _2 )
mark shift _2
DONE mark _2
Note: while I don't know where this is specified, the result of
evaluation is successful if the final stack matches
mark CAVN
and is a syntax error if it's anything else.
FYI,
--
Raul
More information about the Programming
mailing list