Re: Matheval ... the next step (for me)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Matt Lewis wrote:
> 
> Mike777 wrote:
> > 
> > What I'd like to do is this:
> > 
> > block(
> > x := 1,
> > y := 2,
> > (mySequence := "I know this works " & {STR,{ADD,x,y},{}} & " times")
> > )
> > 
> > Is what I want to do possible?
> 
> That should work, but due to a bug in the parsing routine for STR, it
> doesn't.  In texteval.e, change CStr to this:
> }}}
<eucode>
> function CStr( sequence expr, integer tok )
>     if tok = length( expr ) or (not CheckCollapsed({expr[tok+1]}))  then
>         return {{INVALID, "Missing argument for STR()", {}}}
>     end if
> 
>     expr[tok][ARG1] = expr[tok+1]
>     return expr[1..tok] & expr[tok+2..length(expr)] 
> end function
> </eucode>
{{{


Wow!  Are you sure this isn't IRC?

Well, the good news is that it now runs.  The bad news is that any line with the
STR function on it disappears.  I have tested the equivalent of:

BLOCK(
(mySeq := "Test"),
x := 1,
y := 2,
(mySeq := mySeq & {STR,{ADD,x,y},{}} ),
(mySeq := mySeq & mySeq)
)

I get "TestTest".  Nothing between the two tests.

Any suggestions at this point?

Thanks again.

Mike

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu