Philipp Winkler wrote:
> I do have a question: In your definition of sto you give the word a
> property of "val" equal to "t", why?
>
> As far as I can see you never check for that property anywhere else in
> vnav or store. The best I can figure is that used to be in the
> definition of "val?".
Ding ding ding!!! Very astute!
Yeah, the dilemma was, when using 'ls' to show the "objects" in the
vocabulary, how do I distinguish between normal words which perform a
computation and those which return a literal value?
My first approach was to set the "val" word property to 't' on words which
were created via 'sto'. This works for a while but then you to a 'store',
restart Factor, reload the vocabulary, and those specially marked "vals" are
no longer specially marked. :-) The problem is that the naive approach to
fileout *doesn't* preserve things like word properties. It's an interesting
philosophical question there. Should they be preserved? I rarely use word
properties, sort of on principle, so I'm not too concerned with the problem
at this point.
So I moved to another approach to detect "vals".
Look at the definition of the word
Is it a quotation of length one?
Is the single element not a word?
If so, then it's a "val".
> I have got to say that this coolest thing since sliced bread. Well, at
> least it matches my ideal programming process pretty well.
Cool! I'll just mention here that the model I was going after was the
environment on 'HP48'. You start in a HOME directory. You make other
directories for separate projects. If you use 'STO' your object is persisted
across power cycles. Etc. It was driving me nuts that such a nice system was
still only available on a handheld calculator...
It really is just a prototype. Lot's of little semantic issues to figure out.
For example, maybe 'sto' should be slightly more heavy weight and perform an
implicit 'store'. It's not fun to have to explicitly do a 'store' every once
in a while; I've already lost some values that way. :-)
By the way, something that may not be obvious, after loading 'vnav', type 'up'
to get started. That'll switch you to the 'home' vocabulary. 'cd' is cheesy
right now; it only works for switching to relative sub-directories.
Finally, it would be interesting to explore a ui for this system. In our
standard listener, the data stack is always on display. I prefer that the
data stack be shown in the history after each input submission. Instead of
the persistently displayed data stack, perhaps the information shown by 'ls'
could be given it's own display. For small vocabularies this would be
convenient. Also, 'ls' obviously overlaps the functionality of a full
vocabulary browser. But that's OK; it's an experiment.
Ed
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk