From: Timothy Rue
Subject: Some Q & A about IQ Date: Sat, 5 Dec 98 19:12:00 As is typical of learning about using computers, actually doing (using) is very important. Reading helps but understanding comes from the verification loop of doing. --- Q: What Do I need to run IQ? Arexx and the rexxtricks.library? (it's available on Aminet) Rexxtricks is needed for a pattern matching function but has alot of other useful functions too. --- Q: what is IQ supposed to do Look at IQ as basicly another type of search engine, like AmigaDos search, grep, etc. but there are differences. Still it is a search engine. IQ, in it's current public version is not for building dictionaries, but to search them. Dictionaries are easy to make or convert from other electronic documentation. If just getting started, to help you understand it by doing, I do have some dictionaries available on my web page. The rexxtricks.iq file is one (converted from the rexxtricks Amiga Guide file) and you can compair it to it's Amiga guide version to see the differences (You'll have the rexxtricks Amiga Guide from rexxtricks archive). --- Q: how does IQ work? Just like using a printed human language dictionary (but better). For example lets say you want to look up the word "matchpattern" in the rexxtricks.iq file. The basic commandline elements IQ TO FROM WORD PART | | | - definition part(s) you want (any amigados pattern(s)) | | - the word pattern to look for (may be any amigados pattern) | - the .iq file you want to read/search. - the arexx port you want to send the output to. (none for none) Enter on the command line shell: (Using proper paths for IQ and the .iq file to search) - rx IQ none rexxtricks.iq matchpattern#? #? - IQ will search the rexxtricks.iq file and output the definition of the "matchpattern" function to the shell window. All AmigaDos Pattern matching elements are valid for both the word and any number of definition parts (as many as you want.) You can shorten "matchpattern#?" to "mat#?" and still get the same output. The last arguement of "#?" is used to output the whole definition of "matchpattern". You can select a part or parts of the definition to output. For example: - rx IQ none rexxtricks.iq matchpattern#? example#? - To output only the example part of the definition. --- Q: How do I know what parts there are, or for that matter what words are in the .iq file? To see what different definition parts "matchpattern" has: - rx IQ -k none rexxtricks.iq matchpattern#? #? - "-k" stands for "keys" and it will show you the different words and parts. To see a list of all words enter: - rx IQ -k none rexxtricks.iq #? - To see a list of all words and parts enter: - rx IQ -k none rexxtricks.iq #? #? - IQ will only list the parts the first time if find them (not for each word), so if you want to see what parts a specific word has use the example specific word format above. (rx IQ -k none rexxtricks.iq theword#? #?) *** In the above command lines "none" is used because you are not sending the output to an arexx port. The AmigaDos wild cards at the end of "matchpattern" is because the complete word is "matchpattern()" But Arexx or matchpattern (which really uses AmigaDOS pattern matching abilities) sees the "()" as pattern matching elements and therefor misses them in words. --- Q: In trying the above I noticed the first output line mentions filekeys and the second line is "filekey : :: :::", what is this? IQ looks to see if the first line of the .iq file starts with the word "filekey", and if so IQ knows the following ": :: :::" defines what IQ recognizes as a word, part, and file (for .iq files that point to other .iq file to also look/search thru) identifiers. In creating or converting a file to be understood by IQ, all you need to do is start each word with the first character set (here it is ":"), start each part with the second character set (here it is "::") and for any file you want IQ to also search in, start the files name with the third set of characters (here it is ":::"). And these character sets must be at the beginning of the line directly followed by the word, part or filename. These character sets can be any character sets except blank spaces and must not include blank spaces. If the .iq file doesn't contain the first line (here it is "filekey : :: :::") then IQ will use either the default sets "word: subs: file:" or the "filekey" of the last file it was in during it's current execution. --- Q: how can IQ be used with, say REBOL, to help me learn and code in Rebol. It takes a little bit of setup. First you need to add, create or convert rebol documentation (and any rebol source code) to IQ understandable files. Following the above questions answer: Since Rebol uses the semicolon ";" in code for comments, you can start the three keys with the semicolon followed by whatever additional character(s) to make each of the three keys unique. Of course these are just a prefix for you to use in identifying words, parts and files within the documentation or code. (I.E. the word key might be ";w;", part might be ";p;" and file ";f;") Unless you change IQ defaults (* see below), You'll also want to start the first line of documentation with the word "filekey" followed by the three keys. This way IQ will know to use these keys. (I.E. "filekey ;w; ;p; ;f;" (** see below for a way to change "filekey" also) Once you have the documentation done, then you can search it with IQ, as you would in using traditional help methods. ----- But IQ is like any other dos command, so you can also redirect IQs output to a file. This is useful if you are creating/generating code. The great thing about IQ is that you can take a file of code you are working on and use IQ to insert code into it, from another file or even from documentation. The simplest way to do this is to use the default IQ key that identifies a file to also search "file:". But your rebol code may find this a problem. (Setting things up for coding) (*) So you'll want to change IQs defaults. Simply look thru the source code of IQ and change the lines to what you want the defaults to be. The lines will read something like: (There is only one set of lines like this) key. = 'filekey' key.1 = 'word:' key.2 = 'sub:' key.3 = 'file:' I.E. you might change these to read: key. = 'filekey' key.1 = ';w;' key.2 = ';p;' key.3 = ';f;' Don't change any other lines. So long as you use these new default keys in your .iq files, you'll not need to include the first line defining the keys. But it is recommened that you do use this first line anyway (these keys are definable in order to allow IQ to be versatile - as here we are able to redefine them to work with rebol. But this won't work with Arexx code.) ** If you want or need you can change "key. = 'filekey'" to whatever you want "key." to equal (for rebol it might be "key. = ';filekey') But if you do this you will have to begin ALL of your .iq files that contain a first line defining the keys, with the new word for "filekey" or make a second copy of IQ (modified for rebol only file). (End set up - Now the easy doing) Simply place the key for a file where you want to insert code into your code. Make the filename the key points to, the file the code you want, is in. I.E. on it's own line in your rebol code ";f;rexxtricks.iq" will cause IQ to output your code with whatever word and part of the rexxtricks.iq file that you search for. For example, entering: - rx IQ -s none yourcodefilename match#? ex#? - Will output your code with the example code for matchpattern inserted. And you can redirect this to a file, using AmigaDos redirection. - rx IQ -s none yourcodefilename match#? ex#? >yournewfilename. - BTW, the "-s" in the above line is to turn off any warning messages IQ may also output (which you don't want in code). --- Q: Is IQ safe to use? The only way you can run into danger, is if you are sending the output of IQ to an arexx port or redirecting it to something that executes it. And that is only if the output contains damaging directions or commands. The risk is no more or less than anything else you do at the command line level. However, You are completely safe in just using "none" as I have above. This simply sends IQ output to the shell window, echoed (not executed), allowing you to see what the output is before to send it to a port or redirected. --- Q: Can I find out what Arexx ports are available? You can use the -p option to list current Arexx ports. - rx IQ -p - --- Comment: All this command line typing. I can just use a text editors cut and paste and the whatever help system to do these things. This is true, almost. For one, you are missing the ability to send IQs output to an Arexx port or redirection. Second, IQ may be used for more than just help and coding. For example, you can convert/create and add to, as you want, an IQ "dictionary" of commands sequences you send to ImageFX. Certainly if you are editing code, you'll be using an editor. Also there are ways to shorten what you need to type on the command line. The AmigaDos "alias" command for example can allow you to shorten "rx IQ none rexxtricks.iq" to "IQn" so that you only need to type in "IQn word#? part#?" Going further, a point and click GUI is being created for IQ, using gui4cli (a user configurable/programable GUI system which is also freeware). This will greatly help in making IQ easy to use and more. What you need to understand about IQ is that it is versatile enough to do thru it, what you would use several other tools for. It is thru the right combination of functionality that this is possible. IQ is only the beginning of a larger project (not huge though) that will give the user more and more of the "right stuff" combination of functionality. Eventually it will allow you to do such advanced things as to creating and using an auto-coding environment (not yet in existance), and much more. Especially for the non programmer end user. IQ is a part of an open project called the Virtual Interaction Configuration. --- *3 S.E.A.S - Virtual Interaction Configuration (VIC) - VISION OF VISIONS!* *~ ~ ~ Advancing How we Perceive and Use the Tool of Computers!* Timothy Rue What's *DONE* in all we do? *AI PK OI IP OP SF IQ ID KE* Email @ mailto:firstname.lastname@example.org >INPUT->(Processing)->OUTPUT>v Web @ http://www.mindspring.com/~timrue/ ^<--------<----9----<--------< Search email/name @ http://www.dejanews.com for other puzzle parts/posts.