[EMAIL PROTECTED] wrote:

> you need to use load...  For example (the code I tried to test this theory):
>   >> a: load ask "Func -> "
>   Func -> print 42 print "foo" return 69
>   == [print 42 print "foo" return 69]
>   >> b: func [] a
>   >> b
>   42
>   foo
>   == 69
>
> hope this helps...
>
>    Cal Dixon ([EMAIL PROTECTED])

Thanks, Cal. At least now my inputed function seems to work.  But....
I still can't get it to work in the "func" part.

I would like to input a math function like (y=) 2x + 1

Here is some of my code...



prin y: load ask ["What is your function? >>  y = "]

yfunc: func [x] [y]



I enter   [2 * x + 1]


Later code....

for x xmin xmax step [

   print [x " " yfunc x]

]

Then  I get as output

0   2 * x + 1
5   2 * x + 1
10 ...

yfunc is not evaluating.

I can set x manually and     print y     and get the proper return.
If I set x to 0    I get 1.
But if I    print yfunc 2    I get  1 again.  The arithmetic function in y
works, but does not seem to take the argument x of yfunc and use it.

I'm stuck.


>
>
> -><-
>
> >From: [EMAIL PROTECTED]
> >Reply-To: [EMAIL PROTECTED]
> >To: [EMAIL PROTECTED]
> >Subject: [REBOL] Getting a function body block from standard input
> >Date: Wed, 22 Mar 2000 23:34:02 -0500
> >
> >I would like to get a block from "ask" and pass it as a function body
> >block to "func".
> >
> >I've tried something like
> >
> >       print y: make block! ask ["Enter your function "]
> >
> >       yfunction: func [x] [y]
> >
> >but this and other variations doesn't seem to work.
> >I'm new to REBOL. Could someone point me in the right direction?
> >
> >TIA, AP [:{)
> >
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com

Reply via email to