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

[REBOL] TECHNICAL ESSAY/CHALLENGE(s) - "Expression Based"? Re:

From: kgozlin:gis:pl at: 4-Oct-2000 17:33

> (*WARNING* *HYPOTHETICAL SYNTAX FOLLOWS*) > > use [diffs] [ > diffs: make tally [] > foreach num bunchanums [ > diffs/(either even? num [up] [down])/by num > ] > print ["net sum:" diffs/now?] > ] >
i like this hypothetical stuff, so you got it almost as you wish : REBOL [] imbc: func [ items [block!] /local imbc-blok][ items: copy/deep items forall items [ if path? first items [ imbc-blok: next make block! first items forall imbc-blok [ if tag? first imbc-blok [ change imbc-blok do bind make block! first imbc-blok 'print ] ] change/only items make path! head imbc-blok ] ] head items ] bunchanums: [3 1 35 8 4 5 52 42 19 13 32 43 81 2 6 34 46] tally: make object! [ tot: 0 zero: does [tot: 0] up: func [/by n [number!]] [tot: tot + either by [n] [1]] down: func [/by n [number!]] [tot: tot - either by [n] [1]] now?: does [tot] ] use [diffs ][ diffs: make tally [] foreach num bunchanums [ num2: num ; due to binding/context problem do probe imbc [diffs/<either even? num2 ['up] ['down ]>/by num2] ; <-- SEE? ] print ["net sum:" diffs/now?] ] halt [diffs/down/by num2] [diffs/down/by num2] [diffs/down/by num2] [diffs/up/by num2] [diffs/up/by num2] [diffs/down/by num2] [diffs/up/by num2] [diffs/up/by num2] [diffs/down/by num2] [diffs/down/by num2] [diffs/up/by num2] [diffs/down/by num2] [diffs/down/by num2] [diffs/up/by num2] [diffs/up/by num2] [diffs/up/by num2] [diffs/up/by num2] net sum: 26
>>
and somthing strange:
>> imbc [ a/<"REBOL">]
[a/"REBOL"] == [a/"REBOL"]
>> [a/"REBOL"]
** Syntax Error: Invalid path -- a/. ** Where: (line 1) [a/"REBOL"]
>>
karol