Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Model hacking

From: joel:neely:fedex at: 22-Jun-2001 12:35

Hi, Ladislav, Perhaps this is a more concise response... Ladislav Mecir wrote:
> > > > 3) ELEMENTARY vs. COMPOSITE -- Values of some types have > > "sub-"components that REBOL > > explicitly lets us talk about (e.g., time! values with their > > /hour, /minute, and /second fields). Other types (e.g. char! > > and logic!) do not. > > A rather subjective notion. Don't you think, that type is an > attribute of any Rebol value? > >> first 12:34:56
== 12
>> first [1 2 3 4]
== 1
>> first 12.34.56.78
== 12 versus
>> first true
** Script Error: first expected series argument of type: series pair event money date object port time tuple any-function library struct event ** Where: halt-view ** Near: first true
>> first #"X"
** Script Error: first expected series argument of type: series pair event money date object port time tuple any-function library struct event ** Where: halt-view ** Near: first #"X" Inspired by the style of your "Evaluation" essay, this leads me to define
>> elementary?: func [x] [error? try [first x]] >> composite?: func [x] [not elementary? x]
as in
>> map :elementary? reduce [
[ 12:34:56 [1 2 3 4] 12.34.56.78 true #"X" ] == [false false false true true] and
>> map :composite? reduce [
[ 12:34:56 [1 2 3 4] 12.34.56.78 true #"X" ] == [true true true false false] -jn- It's turtles all the way down! joel'dot'neely'at'fedex'dot'com