Wow! I didn't know REBOL supported associated lists like that. That's very
cool. :-)

Regarding Lisp keywords, no. Here's some Lisp code to consider:

>> :im-a-keyword
== :im-a-keyword

>> (eval :im-a-keyword)
== :im-a-keyword

This is because keywords are symbols bound to themselves. In REBOL I can
simulate them like so:

>> foo: 'foo
== foo

>> do foo
== foo

It's possible that I only miss this in REBOL because there are still gaps in
knowledge I have as to when REBOL evaluates and when it doesn't. I'm getting
the hang of it more, but still having trouble. Consider the following sample
code to print a tile on an Othello board:

;; assume "tile" is none, white, or black
switch/default tile [
  'white [ prin "X "]
  'black [ prin "O "]
] [ prin ". " ]

Simple enough. Only it isn't obvious that this is wrong. 'white and 'black
aren't ever evaluated, so there is no need for the quote. But, written
without the quote it looks like I might be comparing against the RGB tuple.
Keywords eliminate this ambiguity, because evaluated or not, they are always
the same.

I hope that makes sense.

Jeff M.


On 3/15/06, Tim Johnson <[EMAIL PROTECTED]> wrote:
>
>
> * Jeff Massung <[EMAIL PROTECTED]> [060315 09:05]:
> >
> > One important concept that REBOL can simulate, but doesn't have
> > intrinsically, that I miss from Lisp is that of keywords. Keywords (in
> Lisp)
> > are symbols that are bound to themselves. This is used for many things,
> but
> > most commonly for enumerated values.
> >
> ;; Do you mean like this:
> >> test: [a 1 b "two" c 3.3]
> == [a 1 b "two" c 3.3]
> >> select test a
> ** Script Error: a has no value
> ** Near: select test a
> >> test test 'a ;; word must be quoted
> == a
> >> test/a ;; if 'placeholder' is word, can be path
> == 1
> >> test/b
> == "two"
> >> test/c
> == 3.3
>
>


--
[EMAIL PROTECTED]

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to