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

Pipe

 [1/7] from: al:bri:xtra at: 13-Nov-2000 20:31


In Rebol, it should be possible to write a 'Pipe function, that can be used like this: Publish: [ Flow-Text Smart-eText HTML ] Pipe %Test.html Publish %Test.txt Which would read %Test.txt, and "pump" the text through the "filters" in the 'Publish block and write the file %Test.html. Any needed parameters that the filters need, for example: ... Rebol-Server-Page (now) Spell-Check %NZ-English.dic ... Could be appended after the word naming the filter. Pipe could process the block, executing the words in the block according to the filter objects it has access to, and parsing the parameters between words to the initialisation functions of the filter objects. Then it could put the file to the first filter and return the result of the filter pipe. Each filter word!, like Spell-Check, could refer to an object!, like 'Spell-Check!, that contains the filter functions. The object! would be in a file of the same name, like %Spell-Check.r, and would be stored in %Pipe/ subdirectory of the directory where %Pipe.r is stored. Necessary files for the filter "plug-ins", could be stored in deeper sub-directories matching the name of their user, so %NZ-English.dic would be in %Pipe/Spell-Check/. Filter objects could be statically loaded all at once as 'Pipe loads, or could be dynamically loaded as calls to Pipe require, then unloaded (garbage collected). Equivalents to Unix commands, perhaps like tee, grep and sed, could then be implemented, along with other unique and interesting filters. So, my question is, has anyone made anything like this yet? Or should I go ahead and make it? Andrew Martin Rebol plumber... ICQ: 26227169 http://members.nbci.com/AndrewMartin/

 [2/7] from: rchristiansen:pop:isdfa:sei-it at: 9-Jan-2001 11:14


I thought it might be useful to use a unix-like piping mechanism in REBOL, as follows:
>> |: func [target][do target] >> d: 1 | e: d * 3 | f: e * e
== 9
>>
Have I got it right? Do you see any potential problems? I don't get to use a unix command-line as much as I would like. -Ryan

 [3/7] from: rchristiansen:pop:isdfa:sei-it at: 9-Jan-2001 11:24


No, I've got it wrong. If the pipe worked as it should, then
>> web-page: read http://www.rebol.com | load/markup
would create 'web-page as a string! with the contents of rebol.com and then 'load/markup would parse 'web-page Oh, well. -Ryan

 [4/7] from: al:bri:xtra at: 10-Jan-2001 6:57


Ryan wrote:
> >> d: 1 | e: d * 3 | f: e * e > == 9
This works better for me:
>> d: 1 e: d * 3 f: e * e
== 9
> >> web-page: read http://www.rebol.com | load/markup
Try: web-page: load/markup read http://www.rebol.com Or another example: write %file.html HTML eText unwrap read %file.txt with appropriate definitions, like: eText: func [Text [string!]] [Text] I don't think that a pipe function is needed in Rebol, as it seems to be more confusing than helpful. YMMV. Andrew Martin ICQ: 26227169 http://members.nbci.com/AndrewMartin/

 [5/7] from: giovanni:cardona at: 9-Jan-2001 17:11


> I don't think that a pipe function is needed in Rebol, as it seems to be > more confusing than helpful. YMMV. > Andrew Martin
I agree! and simplicity is the trademark of REBOL. Lets leave the slashes and pipes to Perl alone ;) /\/||||//|||\\\/\/\/|\///// (Perl code looks like a karate fight to me!)

 [6/7] from: al:bri:xtra at: 10-Jan-2001 16:39


> > I don't think that a pipe function is needed in Rebol, as it seems to be > > more confusing than helpful. YMMV. > > Andrew Martin > > I agree! and simplicity is the trademark of REBOL. > Lets leave the slashes and pipes to Perl alone ;) > /\/||||//|||\\\/\/\/|\///// (Perl code looks like a karate fight to me!)
Kiaa! -/^\\|-_^X----Z! Andrew Martin Kung Fu Rebol... :-D ICQ: 26227169 http://members.nbci.com/AndrewMartin/

 [7/7] from: g:santilli:tiscalinet:it at: 9-Jan-2001 19:03


Hello Ryan! On 09-Gen-01, you wrote: RC> No, I've got it wrong. RC> If the pipe worked as it should, then RC>>> web-page: read http://www.rebol.com | load/markup RC> would create 'web-page as a string! with the contents of RC> rebol.com and then 'load/markup would parse 'web-page What's the problem with: load/markup read http://www.rebol.com ? REBOL is much more powerful than bash, so you won't need to pipe things around. :-) Regards, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/