Re: eval use ?
- From: Alan Crowe <alan@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: 28 Feb 2006 18:33:37 +0000
"newbie" <amit_h123@xxxxxxxxxxx> writes:
hello,
i am just tryin to learn lisp from robert wilensky's common lispcraft.
But i am all stuck at the eval function use ..can somebody help me out
what does exactly eval is used for specially can you give me some
examples of complex code where it is being use.. coz its like i can get
the simpler examples but not gettin it utility for complex thinkgs
where it can be used..
Thanks
You might enjoy this example
http://lambda-the-ultimate.org/node/587?from=76&comments_per_page=1
but remember the old saying:
code that writes code that writes code
make a programmers head ...... explode
and that care!
I nearly had a real life use of eval a few weeks ago. It was
for a database thingy.
(defun select (list-of-columns predicate-form table)
It seemed natural to do
(progv column-names
row-from-table
(eval predicate-form))
Then I realised that eval would repeat the syntactic
analysis of the predicate form for every damn row in the
table, really slowing things down, so what I really needed
to do was align the list-of-columns with the column-names
and massage the predicate form into a lambda expression so
that I could compile it once and for all before applying it
to all the rows of the table.
Alan Crowe
Edinburgh
Scotland
.
- References:
- eval use ?
- From: newbie
- eval use ?
- Prev by Date: Re: Sudoku Solver
- Next by Date: Re: Sudoku Solver
- Previous by thread: Re: eval use ?
- Next by thread: norvig book ?
- Index(es):