I saw the discussion at LtU (http://lambda-the-ultimate.org/node/ 2166), but I am replying here since I do not have any PLT to share on the issue. But, just from an end user perspective, here are some ideas for renaming "quote":
"const" - This will let users see either "constant" or "constantly" however they prefer.
"constf" - For me, this is more connotative of what it does, i.e. "constant function".
"fconv" - OK, the seemingly more accurate "function that returns a constant value".
Anyway, I do agree that "thunk" just doesn't conjure up a good picture of what the function does (at least to a non-langauge designer).
> I saw the discussion at LtU (http://lambda-the-ultimate.org/node/ > 2166), but I am replying here since I do not have any PLT to share on > the issue. But, just from an end user perspective, here are some > ideas for renaming "quote":
> "const" - This will let users see either "constant" or "constantly" > however they prefer.
> "constf" - For me, this is more connotative of what it does, i.e. > "constant function".
> "fconv" - OK, the seemingly more accurate "function that returns a > constant value".
> Anyway, I do agree that "thunk" just doesn't conjure up a good picture > of what the function does (at least to a non-langauge designer).
I kind of like "qv". When I encountered just "quote", it made me think of what "quote" meant in other langauges and I tried to reconcile its meaning from other languages with how it is used in Cat. "qv" on the other hand seems to have no equivalent in other languages (at least the few I know of) and so no "baggage" gets attached.
However, maybe "quote" in other function composition languages has the same meaning as the one in Cat, so using "quote" may be the best way to go.
Thanks Scott Prouty
On Apr 3, 12:26 pm, "Christopher Diggins" <cdigg...@gmail.com> wrote:
> Thanks for your ideas Scott. What do you think of leaving it the name > quote? I was also playing with "qv" which stands for "quote value".
> On 4/2/07, Scott Prouty <scott.pro...@solimarsystems.com> wrote:
> > I saw the discussion at LtU (http://lambda-the-ultimate.org/node/ > > 2166), but I am replying here since I do not have any PLT to share on > > the issue. But, just from an end user perspective, here are some > > ideas for renaming "quote":
> > "const" - This will let users see either "constant" or "constantly" > > however they prefer.
> > "constf" - For me, this is more connotative of what it does, i.e. > > "constant function".
> > "fconv" - OK, the seemingly more accurate "function that returns a > > constant value".
> > Anyway, I do agree that "thunk" just doesn't conjure up a good picture > > of what the function does (at least to a non-langauge designer).
On 4/4/07, Scott Prouty <scott.pro...@solimarsystems.com> wrote:
> I kind of like "qv". When I encountered just "quote", it made me > think of what "quote" meant in other langauges and I tried to reconcile its > meaning
Out of curiosity, what are the different interpretations you can think of for the following statements given your previous experience of quote:
5 quote [f] quote
To be honest I never learned a "quote" operator in any other language prior to adding it to Cat and asking the question. I come from a primarily imperative background. I like Manfred von Thun's (the Joy language designer) nomenclarature of "quotations" to refer to anonymous functions. Joy doesn't differentiate between lists and functions, wheras Cat does, so I had to come up with a new operator. This lead me to create "quote", which seemed apropos given the path I followed.
> from other languages with how it is used in Cat. "qv" on the other > hand > seems to have no equivalent in other languages (at least the few I > know of) > and so no "baggage" gets attached.
I feel the same way.
> However, maybe "quote" in other function composition languages has the > same meaning as the one in Cat, so using "quote" may be the best > way to go.
I may make the "qv" the official term, and leave "quote" in the library for posterity. Heck I will probably even add "constantly" to the library just for the lispers. :-) Maybe programmers will come to prefer one over another. The only concern I have with "qv" is how cryptic it may seem (but I do like its brevity), however I am hoping that it won't come up frequently. People would be more likely to use "curry" than doing actual quoting, interestingly enough, given a curry one can define "qv" as "[id] curry", but I do it the other way around "curry = [qv] dip compose". Quoting just seems to me to be more primitive than currying.
The hardest part of designing a language might simply be finding names for things!
:-)
> Thanks > Scott Prouty
Thank you very much for your feedback, Christopher
On Apr 4, 3:42 pm, "Christopher Diggins" <cdigg...@gmail.com> wrote:
> On 4/4/07, Scott Prouty <scott.pro...@solimarsystems.com> wrote:
> > I kind of like "qv". When I encountered just "quote", it made me > > think of what "quote" meant in other langauges and I tried to reconcile its > > meaning
> Out of curiosity, what are the different interpretations you can think > of for the following statements given your previous experience of > quote:
> 5 quote > [f] quote
Actually, since I have no experience of an operator named "quote", my mind grabbed for the next closest thing which was that quotes (i.e. the ") are used to delimit strings. That thought kept getting in the way of what "quote" really is in Cat.
The "qv" seems to not evoke any connotations, so it is easier for me to just concentrate on what it is...
> To be honest I never learned a "quote" operator in any other language > prior to adding it to Cat and asking the question. I come from a > primarily imperative background. I like Manfred von Thun's (the Joy > language designer) nomenclarature of "quotations" to refer to > anonymous functions. Joy doesn't differentiate between lists and > functions, wheras Cat does, so I had to come up with a new operator. > This lead me to create "quote", which seemed apropos given the path I > followed.
Well, looking at the Cat documentation, you do say that [ and ] are quotation constructs. Hence, "quote" would follow from that description. But for me, in PostScript, this would be called constructing an "executable array" (or more commonly called a "procedure").
> I may make the "qv" the official term, and leave "quote" in the > library for posterity. Heck I will probably even add "constantly" to > the library just for the lispers. :-) Maybe programmers will come to > prefer one over another. The only concern I have with "qv" is how > cryptic it may seem (but I do like its brevity), however I am hoping > that it won't come up frequently. People would be more likely to use > "curry" than doing actual quoting, interestingly enough, given a curry > one can define "qv" as "[id] curry", but I do it the other way around > "curry = [qv] dip compose". Quoting just seems to me to be more > primitive than currying.
I agree. However, I do have a question about this. It seems that everything on the stack in Cat is a function, correct? So a 5 on the stack is really a function that returns the integer 5. So what use would "quote" really be? Or is there really a distinction between what kind of objects are on the stack?
> The hardest part of designing a language might simply be finding names > for things!
It is your language, so you can be as creative as you want. Sometimes it might be good to signal that some functionality is really different, so a quirky name like "qv" or "fconv" might be just the ticket...
> I agree. However, I do have a question about this. It seems that > everything on the stack in Cat is a function, correct? So a 5 on > the stack is really a function that returns the integer 5. So what > use would "quote" really be? Or is there really a distinction between > what kind of objects are on the stack?
This is not quite correct, everything you write is a function, or more precisely a function call:
5 = call the function that pushes the value 5 on the stack f = call the function f, and let it do it's thing [5] = call the function that pushes the 5 function on the stack or in other words quote the 5 function. [f g] = call the function that pushes the [f g] function onto the stack (quote f g).
When you push a function onto the stack, you are actually pushing a function value on the stack.
So everything on the stack is a value.
Does this make sense?
> > The hardest part of designing a language might simply be finding names > > for things!
> It is your language, so you can be as creative as you want. Sometimes > it might be good to signal that some functionality is really > different, so > a quirky name like "qv" or "fconv" might be just the ticket...
> > I agree. However, I do have a question about this. It seems that > > everything on the stack in Cat is a function, correct? So a 5 on > > the stack is really a function that returns the integer 5. So what > > use would "quote" really be? Or is there really a distinction between > > what kind of objects are on the stack?
> This is not quite correct, everything you write is a function, or more > precisely a function call:
> 5 = call the function that pushes the value 5 on the stack > f = call the function f, and let it do it's thing > [5] = call the function that pushes the 5 function on the stack or in > other words quote the 5 function. > [f g] = call the function that pushes the [f g] function onto the > stack (quote f g).
> When you push a function onto the stack, you are actually pushing a > function value on the stack.
> So everything on the stack is a value.
> Does this make sense?
I think so, thanks, Christopher.
I just looked at the write-up on the interpreter, and I think what you refer to as a value is really the CatStack object. It seems that the CatStack object can be one of three items: Literals, Function Names, or Quotations. This makes things a little clearer.
It also seems that the [ starts what I would call "defered execution" mode until ] is encountered. So if function f is [ 5 ], [ f ] is [ [ 5 ] ] and not just [ 5 ], i.e. after the [ the function name f is not executed but rather the function name is left on the stack and the ] quotes the function. Is the function name dereferenced in this case, or is it left intact and only derefernced upon execution?
I also noticed a mention of an "executing stack". Is this distinct from the "normal" stack? As you may know, in PostScript there is more that one stack, i.e. operand stack, execution stack, dictionary stack, etc.
BTW, the graphics stuff you just added looks fun. Is there any possibility of adding some simple file I/O so that arbitrary binary files can be read and written to? A little project I have in mind is to create a file compressor like WinZIP (not with GUI interface, just simple command line).
> I just looked at the write-up on the interpreter, and I think what > you refer to as a value is really the CatStack object. It seems > that the CatStack object can be one of three items: Literals, > Function Names, or Quotations. This makes things a little > clearer.
> It also seems that the [ starts what I would call "defered execution" > mode until ] is encountered. So if function f is [ 5 ], [ f ] is > [ [ 5 ] ] and > not just [ 5 ], i.e. after the [ the function name f is not executed > but > rather the function name is left on the stack and the ] quotes the > function.
Yes.
> Is the function name dereferenced in this case, or is it left intact > and > only derefernced upon execution?
This varies from release to release. 8-( The plan is to dereference immediately.
> I also noticed a mention of an "executing stack". Is this distinct > from > the "normal" stack? As you may know, in PostScript there is more > that one stack, i.e. operand stack, execution stack, dictionary stack, > etc.
In Cat there is only one explicit stack. During parallel execution of certain primitives other stacks may be created. In order for dip to work, there is another stack used.
> BTW, the graphics stuff you just added looks fun. Is there any > possibility > of adding some simple file I/O so that arbitrary binary files can be > read and > written to? A little project I have in mind is to create a file > compressor > like WinZIP (not with GUI interface, just simple command line).
I hope to add this feature next week. I will be out of town for a few days, and unable to work on it, but I'll bump the feature to the top of the request list.
> > BTW, the graphics stuff you just added looks fun. Is there any > > possibility > > of adding some simple file I/O so that arbitrary binary files can be > > read and > > written to? A little project I have in mind is to create a file > > compressor > > like WinZIP (not with GUI interface, just simple command line).
> I hope to add this feature next week. I will be out of town for a few > days, and unable to work on it, but I'll bump the feature to the top > of the request list.
> Cheers, > Christopher
Thanks! I also just realized that the graphics stuff you added would help with PostScript emulation.