- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Interpretting input from compiler.
Thu, 2012-01-26, 18:48
I was wondering if there was any way to interpret the input from the
user and use it as a part of the program
Suppose i have a program that calculates sum of a function with a
start and end number
and takes the following arguments
sumSeries(f:Double=>Double,start:Double,end:Double)
now is there any way the user can enter the value of f and some how i
interpret it and pass it to the function.
eg if i entered x=>x*x on the console it will be a string can it be
interpreted and passed to the function sumSeries so i can calculate
the sum of squares?
Sorry i meant interpreting input from User.
On Jan 26, 10:48 am, anant wrote:
> I was wondering if there was any way to interpret the input from the
> user and use it as a part of the program
> Suppose i have a program that calculates sum of a function with a
> start and end number
> and takes the following arguments
> sumSeries(f:Double=>Double,start:Double,end:Double)
>
> now is there any way the user can enter the value of f and some how i
> interpret it and pass it to the function.
> eg if i entered x=>x*x on the console it will be a string can it be
> interpreted and passed to the function sumSeries so i can calculate
> the sum of squares?