Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Another easy one:
#10
(12-11-2023, 01:53 PM)euklides Wrote: "3 * 3" is an alphanumeric expression !

Val ("3 * 3") ---> 3
Val ("5 * 2") ---> 5
Val ("8 hundred dollars") ---> 8

In some old basic, this function existed: calculating an alphanumeric expression... 
X=Calculate("4 * 8")---> 32

But not here in qb64 Big Grin

That old Basic was probably interpreted.  Interpreters have various evaluation functions built-in for internal use.  Many interpreters are nothing but glorified evaluation functions.

With a compiled language, expressions must either be resolvable during compilation or resolved one step at a time using program code, unless you have a separate evaluation engine ala Steve's built into your program.


(Greenspun's tenth rule of programming: Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.)
(In the modern day, this can be expanded to any sufficiently large program, involving any language(s).)
Reply


Messages In This Thread
Another easy one: - by PhilOfPerth - 12-10-2023, 04:46 AM
RE: Another easy one: - by a740g - 12-10-2023, 04:53 AM
RE: Another easy one: - by SMcNeill - 12-10-2023, 05:01 AM
RE: Another easy one: - by a740g - 12-10-2023, 07:05 AM
RE: Another easy one: - by SMcNeill - 12-10-2023, 04:53 AM
RE: Another easy one: - by PhilOfPerth - 12-10-2023, 05:09 AM
RE: Another easy one: - by SMcNeill - 12-10-2023, 05:11 AM
RE: Another easy one: - by euklides - 12-11-2023, 01:53 PM
RE: Another easy one: - by SMcNeill - 12-11-2023, 04:05 PM
RE: Another easy one: - by JRace - 12-13-2023, 02:26 AM



Users browsing this thread: 2 Guest(s)