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

[REBOL] Re: REBOL dynamic graph code problems and REBOL mindset

From: moliad::gmail::com at: 22-Feb-2008 15:35

Carl beat me to it hehe I put 'HAS specifically to show of that rebol has a few shorthand notations for function creation... this also means you can define your own quite easily... if you have usage patterns which come up. A variable which gets initialised all the time, for example... you could reduce your code to initialise it localy all the time. about the random/seed... its a left over of stuff I was testing while implementing your little example. Its also a nice point to make that you can use many types in many functions (you DO have to check if a particular functions supports a type, obviously) perhaps, something I forgot to tell you, which I had intented, is a good way to learn REBOL, especially when you are trying to understand code, or the dictionnary reference from the web. Use PROBE (as opposed to 'print) , 'HELP and especially 'SOURCE as much as you can. with these three functions you can unlock most of REBOL mysteries. be carefull though, some functions written by advanced rebolers (many by Carl S. himself) are quite cryptic with oft used functions, or very cool (obscure ;-) tricks. So when you encounter a function which is so dense, you can't make it out after 5 minutes... tell yourself... *LEARNING OPPORTUNITY* hehe... don't be discouraged. I rememeber trying to understand some of the series functions which are mezzanines. another good source of (advanced) enlightenment is any code written by mr. Ladislav Mecir, but be ready to be humbled, and feel like a 2x4 has more IQ. Some of his functions are so dense, many of us advanced users even have a hard time reading it. so it can be a good experience, just to open your mindset, without expecting to really understand. I put a few entry-level tricks in my example, one being the inline assignment of a var within the any/all group. if you reconsider that little snippet in other languages, you will realise that those 3 lines can amount to ten lines in other language. in fact, it could have been expressed in one line. another good thing to remember is that the vast majority of functions return a value, even those which are considered declarative or are statements in other languages.... examples are: if, either, any, all, try. so instead of doing: either choice = "red" [color: 255.0.0][color: 0.0.0] you can warp this in many ways (and indeed some go to great lengths too do so, just for fun hehe) ex: color: either choice = "red" [255.0.0][0.0.0] HTH! -MAx On Fri, Feb 22, 2008 at 4:39 AM, Carl Read <> wrote: