I
invincible
hi friends , how can I declare / create function during runtime similiar to
lambda in lisp.
thanks
Mohan
lambda in lisp.
thanks
Mohan
invincible said:hi friends , how can I declare / create function during runtime similiar to
lambda in lisp.
DeltaOne said:Well there is no facility in C language for this. Well if you want to
create something like this you can try ony way that is giving a feel
that actually you are creating a function at run time but in actual you
dont...You take input and parse the input yourself and the if a
statement like this is there::
printf("hello world")
then make it str="hello World";
and puts(str);
invincible said:hi friends , how can I declare / create function during runtime similiar to
lambda in lisp.
Probably by implementing a Lisp interpreter in C.
hi friends , how can I declare / create function during runtime similiar to
lambda in lisp.
Chris said:<OT>
... or your process writes the C text to a file, spawns other
processes to compile and link the C, then dynamically load the resulting
shared object into the running process, if your operating system
supports it.
</OT>
Mark McIntyre said:You cannot. Not in ISO C, anyway; and not in any dialect of C that I'm
aware of without resorting to the most hairy of hacks.
www.enlightenment.org has a nice implementation of Small, a C-likeChris said:
On Thu, 19 May 2005 06:29:33 GMT, in comp.lang.c ,
You could write an interpreter, and your C programme could write the
fn out to file / into memory, invoke the interpreter on it, and
process the results.
Then you're creating _another_ programming environment within the larger program,
the language of which may be deceptively similar to the one your main program is written in.
AFAIAA all lambda functions in all Lisp-alikes create new functions as a
part of the main program itself.
Mark McIntyre said:Sure, but that's a whole different thing.
He said he wanted to create a function during runtime, the above meets
the requirement. YMMV.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.