[cells-devel] Re: Cells: How to later set a formula for a cell ?
Goenninger, Frank wrote:
Hi Kenny,
currently heavily playing wit Celtk...
I have up to now only set a cell's formula by using directly (c? ...) with default-initargs. Now I am stopped cold by the fact that I have to be able to set the formula by some setf form. How to do that in a conforming way ?
Download KR from the Garnet system, they have a million backdoors like that. :) What's the big picture on this? Maybe there is a way to do it without an alley-oop. If you sell me on the need, and you can at least start the slot as c-input, I imagine there is some way to do this. If you do not sell me on the need, I will still give you some pointers* on how to mess up the beauty of Cells yourself.:) But I think you will still need to start with a c-input, or you will lose the dependencies (Cells does not record dependencies on slots not mediated by Cells.) ken (going out for groceries soon) * Look at c-install, md-awaken, c-awaken-cell, and their neighbors.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Am 03.04.2006 um 22:10 schrieb Ken Tilton:
Goenninger, Frank wrote:
Hi Kenny,
currently heavily playing wit Celtk...
I have up to now only set a cell's formula by using directly (c? ...) with default-initargs. Now I am stopped cold by the fact that I have to be able to set the formula by some setf form. How to do that in a conforming way ?
Download KR from the Garnet system, they have a million backdoors like that. :)
Don't get me tempted... You risk loosing a real Cells adict ;-)
What's the big picture on this? Maybe there is a way to do it without an alley-oop.
I certainly hope there is! The big picture - and I begin wondering if phrased my original question as misleading - is that I have laaarge code fragments being complex rules for a cell formula. I want to stick that in a separate function in order to code in a more readable way ?! When trying to achieve this I figured that c? does not much but I simply found that I need the context of the cell slot to stick some rule to it. Second use case: Imagine I have a knowledge base (using inference) that produces cell formulae based on facts and rules I have put into the knowledge base. So, I have to be able to act on lists of structure ( cell-id formula- form ) and stick those new formula-forms into the given cells with id cell-id.
If you sell me on the need, and you can at least start the slot as c-input, I imagine there is some way to do this.
Is the above enough ?
If you do not sell me on the need, I will still give you some pointers* on how to mess up the beauty of Cells yourself.:) But I think you will still need to start with a c-input, or you will lose the dependencies (Cells does not record dependencies on slots not mediated by Cells.)
ken (going out for groceries soon)
* Look at c-install, md-awaken, c-awaken-cell, and their neighbors.
Looking, even staring at them ?! Cheers Frank -----BEGIN PGP SIGNATURE----- Version: PGP Desktop 9.0.5 (Build 5050) iQIVAwUBRDGHZmAKVUddnkqnAQo7/w/9HuR0L0u/k6eycdzvosaQ+FGIIky8GTFn Hm9rg/dHctEPV6b4/7JWvIolyQd+g2AzRwjEYZyN5ZC3kq9sASTQWYsFL3aoCEZS pvlcqEeikSu6Rh5GRz3mxl0HpgcJuCqYcYLA5H5vUxaOVNR2XSCpezxjQPA0WxWa /WZbKlmoCLCXhc/DP5ZNVju9zkWD0MH3HyUrFpknninKNJuURN+fWQ+CHwJu1lTd uJRstVlH9gcNpLvEFx8tFSIrVN0i3d9CO0+UKb+J4+HexUoM7HyMbZn/ZPY/2X0D ABbiuNu+hmYVgCwh/lL0KWIwO5ocdFRQM8EfiDCe5Shsq6NkQYaj1Qy03hR1hx5h Xy87/BmeElTgBN5iRQKIxAJG+8Y+h0fci2Csg9IKYpwlpGFTU6iyGH3fWq6wTMrv xTYFtYQNa+d2A0B6rCvwdUJIYVw3JeVkNd8ldCNGRye5z23XhuvyhxlqbJ3iLnva RTFvrg3X4oUZlEIB4ZXNzsT9jzVu9dRRE7UdPcCvxjHGaIJrQ+SoauYg4CPtDa8Z 0zJCjhbsx6c5tNlhzUaaDub3qE5Xg65TZ1nKQJOk9qGklBmg9jt+skDUfFm5Ask6 TZQi8LgnFQQlCTU5I1heISohp83OmkBUYXR4hDPpjT1dc/O2UuJFEs0Eq1JYnqJo pzUwdGIAp54= =AKYa -----END PGP SIGNATURE-----
Frank Goenninger wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Am 03.04.2006 um 22:10 schrieb Ken Tilton:
Goenninger, Frank wrote:
Hi Kenny,
currently heavily playing wit Celtk...
I have up to now only set a cell's formula by using directly (c? ...) with default-initargs. Now I am stopped cold by the fact that I have to be able to set the formula by some setf form. How to do that in a conforming way ?
Download KR from the Garnet system, they have a million backdoors like that. :)
Don't get me tempted... You risk loosing a real Cells adict ;-)
What's the big picture on this? Maybe there is a way to do it without an alley-oop.
I certainly hope there is!
The big picture - and I begin wondering if phrased my original question as misleading - is that I have laaarge code fragments being complex rules for a cell formula. I want to stick that in a separate function in order to code in a more readable way ?!
First of all, a trick I use all the time because I never like to look at too much code at once: (make-instance 'thing :myslot (big-long-thing-myslot-rule-1)) ;; observe that there is no c? here (defun big-long-thing-myslot-rule-1 () (c? <big long rule>)) ;; here is the c? Second of all, do not forget that Cells work by dynamic not lexical reference, so:
When trying to achieve this I figured that c? does not much but I simply found that I need the context of the cell slot to stick some rule to it.
I doubt it. :) Are you talking about the (^myslot) forms not working? That just captures the lexical variable self. I use ^macros all the time, because I pretend I am doing Smalltalk and always call the chief instance to a function "self". So I get to use ^macros all over the place, in a rule or not. If you are talking about .cache, and do not want to pass it down the call tree, we will have to start exposing Cell internals. oh, I forgot to say: just do what you always do when a function gets too big. Split it up. Again, any /dynamic/ reference will establish a dependency, ie, the reference does not need to appear in the code of the rule (that would be lexical). So divide big-long-rule up into a driver and a bunch of helper functions as you would do normally and it will all Just Work.
Second use case:
Imagine I have a knowledge base (using inference) that produces cell formulae based on facts and rules I have put into the knowledge base. So, I have to be able to act on lists of structure ( cell-id formula- form ) and stick those new formula-forms into the given cells with id cell-id.
I have thought about such a thing. I have not actually had to do it (so maybe reality would change my approach) but I would simply keep the two beasts apart, Cells and KB: (make-instance 'thing :rule-driven-slot (c? kb-apply (kb-compute-formula <fact-1> <fact-s> <circumstance-3>)) Observe that as the parameters to kb-compute-formula change you will get a new rule as well as new computation. The downside is that, as the slots accessed only during kb-apply change, you will unnecessarily recompute the rule to be kb-applied. So: ...:rule-to-kb-apply (c? (kb-compute-formula f1 f2 c3)) :rule-driven-slot (c? (kb-apply (^rule-to-kb-apply)) ie, Let Cells do its primitive little dataflow thing and let the fancy KR/KB system do its clever machine thinking and do not bother them with each other's burden. ken
participants (2)
-
Frank Goenninger
-
Ken Tilton