| Krystof | "the challenge"? |
| filcab42 | I have a teacher that has years (decades ;)) of experience lisp. and, in a forum thread, he gave us a challenge |
| fax | you could just make it a normal macro (interpolate "blah blah") |
| filcab42 | to write a function (interpolate "...") |
| Krystof | it might then be his point that you can't write such a function (and since this is homework or something like it, it's probably better that you have another go yourself) |
| filcab42 | no it's not homework lol |
| fax | Krystof: it is possible |
| filcab42 | At my university we have a forum where for students. some teachers visit it and we have some threads about lisp |
| lisppaste | fax pasted "get-symbol-value macro" at http://paste.lisp.org/display/41150 |
| filcab42 | we have some meetings about lisp, also. A lisp group |
| fax | filcab42: wish we had that :/ all I have is 'Make a picture of a traffic light in java' |
| filcab42 | and someone created a thread about lisp macros. this challenge appeared in the middle of that thread ;) LOL |
| fax | its totally possible |
| Krystof | oh yeah? |
| fax | probaly use read-from-string |
| filcab42 | Java... ugh |
| Krystof | fax: maybe you need to try filcab42's exercise, too |
| fax | probably :| |
| filcab42 | lol |
| Krystof | write a function interpolate which takes a string and returns the string with variables from the lexical environment interpolated test case: (let ((a 42)) (interpolate "$a")) => "42" |
| filcab42 | I have a solution that works... with the exception of those "let" cases ;) |
| Krystof | good luck |
| filcab42 | thanks ;) |
| Krystof | filcab42: you are getting closer to enlightenment second test case, just in case it's not yet clear: (let ((fun #'interpolate) (a 42)) (funcall fun "$a")) => "42" |
| lisppaste | fax annotated #41150 with "spec1 done" at http://paste.lisp.org/display/41150#1 |
| fax | Krystof: you cant funcall a macro er yes thats what I meant to say |
| Krystof | indeed. Which is why the specification that interpolate is a _function_ is important |
| fax | er no one said it has to be a function :/ |
| Krystof | yes they did <filcab42> to write a function (interpolate "...") |
| fax | well I agree you certainly cant write a function to do it |