3 ms·
That's a great example right there. Notice, the end result is just data, as terse and minimal as possible. But to act on (aka "interpret) that data, he wrote f
by charlieflowers 11y ago
That's a great example right there.
Notice, the end result is just data, as terse and minimal as possible. But to act on (aka "interpret) that data, he wrote functions called "term", "part-of-speech" and "definition."
So now, that data is code. Code is data and data is code.
- mdpopescu 11y agoAgreed - that example is amazing. However, the devil's advocate in me can't help but ask: what if I want more than one transformation? What if I want to generate both HTML and, say, JSON for returning that information from a web service? Hmm... it might work if I use some sort of global parameter: I first "execute the data" (damn!) with the output type set to HTML and then do it again with an output type of JSON.
- charlieflowers 11y agoThere's an answer there too. In Lisp, it is possible to have local functions. In other words, you're defining a function, and inside it you have a couple of functions that are local to the containing function. That's one way for "term" and the other items to have different definitions. There are probably other even better ways to do it.