[REBOL] Who is that grouch? -or- Fun with functions! Re:
- Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 05, 2000 1:35 PM Subject: [REBOL] Who is that grouch? -or- Fun with functions! > I fear that anyone reading my last few posts may conclude that I'm > a real grouch. (Of course, it's not necessary to read my emails to > draw that conclusion! ;-) > > In the interest of Suitable Doses of Levity, let's have fun with > functions in REBOL! > > First, let's define an oldie from APL: > > >> iota: function [n [integer!]] [r i] [ > [r: copy [] > [i: 0 > [while [i < n] [append r i: i + 1] > [r > [] Hi Grouchy ;) iota: function [n [integer!]][r i][ r: copy [] repeat i n [append r i] ] Using the 'repeat native is quicker. (by about 1 sec per 1000 iterations on my machine). Thanks for the fun.. Allen K
[REBOL] Who is that grouch? -or- Fun with functions!
I fear that anyone reading my last few posts may conclude that I'm a real grouch. (Of course, it's not necessary to read my emails to draw that conclusion! ;-) In the interest of Suitable Doses of Levity, let's have fun with functions in REBOL! First, let's define an oldie from APL: >> iota: function [n [integer!]] [r i] [ [r: copy [] [i: 0 [while [i < n] [append r i: i + 1] [r [] >> iota 20 == [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20] >> iota 100 == [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 4... ...so that iota n returns a block containing the first n positive integers. Now let's do another oldie, this time from Lisp and Perl: >> map: function [[catch] b [block!] f [function!] /all] [r v] [ [r: copy [] [foreach c b [ [if any [found? v: do [f c] all] [append/only r v] [] [r [] ...so that map some-block some-single-arg-function returns a block containing the results of applying the function to each element of the argument block. (Results of none are suppressed unless the /all refinement is supplied with the call.) Thus we have... >> map iota 20 func [n] [n + n - 1] == [1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39] ...the first twenty odd positive integers. Now let's get creative, and define: >> nondiv: func [d] [func [n] [either n // d = 0 [none] [n]]] ...so that nondiv n returns a function that transforms anything divisible by n to none and leaves all other values alone. (Yes, I know I forgot the type specs... It's close to bedtime!) With this new toy, we can compute: >> map iota 20 nondiv 3 == [1 2 4 5 7 8 10 11 13 14 16 17 19 20] ...all integers between 1 and 20 that aren't divisible by 3. By: >> map/all iota 20 nondiv 3 == [1 2 none 4 5 none 7 8 none 10 11 none 13 14 none 16 17 none 19 20] ...we see that the /all refinement is doing its job. STOP! Have you guessed where this is heading yet? An all-around trivial-but-handy numeric function is: >> square: func [n [number!]] [n * n] ...which does Just What You Think It Does. With all of these nice toys in hand, we are now in a position to define: >> plist: function [n [integer!]] [p c d] [ [p: copy [] [c: next iota n [while [0 < length? c] [ [append p d: first c [c: map c nondiv d [] [p [] ...so that we can say things like: >> plist 50 == [2 3 5 7 11 13 17 19 23 29 31 37 41 43 47] In case you were wondering why we defined square (other than to drop another subtle hint...), it was so that we could do the obvious optimization, with an even more obvious name: >> primes: function [n [integer!]] [p c d] [ [p: copy [] [c: next iota n [while [all [0 < length? c (square d: first c) <= last c]] [ [append p d [c: map c nondiv d [] [append p c [] >> primes 50 == [2 3 5 7 11 13 17 19 23 29 31 37 41 43 47] >> primes 65 == [2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61] and >> print primes 1000 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353 359 3 67 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457 46 1 463 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571 577 587 593 599 601 607 613 617 619 631 641 643 647 653 659 661 673 677 683 691 701 709 719 727 733 739 743 751 757 761 769 773 7 87 797 809 811 821 823 827 829 839 853 857 859 863 877 881 883 88 7 907 911 919 929 937 941 947 953 967 971 977 983 991 997 Enjoy playing with maps! -jn-
[REBOL] shifting characters in rejoin Re:(2)
Thanks, guys, for the answer. I didn't think about there being a datatyping problem, but that makes perfect sense now. >A tag! is meant to represent only one tag. If you want to have more than one >tag in an HTML element, you need to make a string. So it's very easy to >correct your function. Replace the line quoted above with: > > markup-string: rejoin ["" open-tag data/name close-tag]
[REBOL] Antwort: Command question Re:(4)
- Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 04, 2000 10:13 PM Subject: [REBOL] Antwort: Command question Re:(3) > Maybe we could also agree upon some standard plug-ins system, as proposed > by Andrew Martin on rebmail list, and then Elan's or other solution would > be just one of plug-ins ... > > the idea: > REBOL/ > /Plug-ins >/Allen_K_cool_menu >/other-menu >/dbms >/inactive > Allen_K_cool_menu.cfg > other-menu.cfg > dbms.cfg > LOL! Looks like I'll have to make that menu a reality ;-) > the activation/deactivation of plug-in would be decided upon presence of > file in /plug-ins directory, and deactivation just means moving > appropriate .cfg file into /inactive subdir ... > > plug-ins are scripts, probably should function as separate modules (once > modules are introduced to rebol), should represent certain domain specific > dialects, etc... > > So far Andrew calls plug-ins components, but it should change imho as > rebol uses 'component name for /View, /Shell, /Library etc. components. > > ... all is opened yet - we don't have modules yet, we don't have final VID > yet, and so I am just curious, if using 'stylize aproach will be powerfull > enough to handle more complex gui areas (components, widgets), as menu is > for e.g. I think styles are powerful enough to do this, they are as powerful as any other object in REBOL. Cheers, Allen K ICQ 456820 PS. Hey Petr have you got ICQ, you could join Andrew and I on our daily discussions :-)
[REBOL] New Article
Hi REBOLs, A new article by Ole Friis, the first in a series on compression & REBOL http://www.rebolforces.com/compression1.html. This first one looks at Huffman encoding. Cheers, Allen K
[REBOL] Did you know? - 'Bind is stackable!
Did you know? - 'Bind is stackable! I didn't - until I tried it. Have a look at the line: if all bind bind Filter 'File 'Header Unit: function ['Name [word!] Base-Directory [file!] Sub-Directory [file!] Filter [block!]] [Script Header] [ error? try [ if system/script/parent/header/File = %user.r [ set Name make object! [ Directory: file! Files: block! ] change-dir Base-Directory Name: get Name Name/Directory: Sub-Directory Name/Files: read Name/Directory change-dir Name/Directory foreach File Name/Files [ Script: load/header File Header: first Script if all bind bind Filter 'File 'Header [ do Script ] ] Name/Directory: join Base-Directory Sub-Directory ] ] ] Unit Patches %/C/Rebol/Patch/ %Patches/ [ Header/File = File Header/Patch = Header/Name ] Unit Enhancements %/C/Rebol/Enhancement/ %Enhancements/ [ Header/File = File Header/Enhancement = Header/Name ] BTW, 'Unit is my keystone building block for Patches, Enhancements for Rebol and Components and Plug-ins for Rebol applications, like RebMail. Note that the order of 'File and 'Header didn't matter. Which leads me to wonder if an enhanced version of 'bind that allows a block would be of interest to people or Rebol crew. Andrew Martin ICQ: 26227169 http://members.nbci.com/AndrewMartin/ http://members.xoom.com/AndrewMartin/ -><-
[REBOL] New View version 0.10.38.3.1 Re:
I got help from "Bo" at RT how to install the new /View properly. I quoted his suggestion: When you click on REBOL/View and it wants to install itself, you cannot install it in the same location where you ran it from. What you should do is close down all REBOL/View windows currently running, move the new rebol.exe file to a temporary directory, delete the rebol.exe file from the directory where you want to install REBOL (this will ensure that you aren't running rebol.exe from the wrong location), and then run rebol.exe from the temporary location and install it to the correct location. End of quote. It worked for me. Geo... [EMAIL PROTECTED] wrote: > > The new version of view 0.10.38.3.1 wont install properly on my win-98 > machine, anybody else having this problem? > > --Ryan
[REBOL] shifting characters in rejoin Re:
Hi Ryan, Andrew Martin already answered you, but maybe this provides a little different perspective ... The results look strange because the < and > aren't part of the tag! data, they just delimit it. >> length? == 3 When you do markup-string: rejoin [open-tag data/name close-tag] the first item in REJOIN's block argument is a tag, so the result is a tag. But before close-tag is appended, it is formed to a string, which causes the delimiting < > to actually become characters of data. A tag! is meant to represent only one tag. If you want to have more than one tag in an HTML element, you need to make a string. So it's very easy to correct your function. Replace the line quoted above with: markup-string: rejoin ["" open-tag data/name close-tag] Eric >I have created a function which returns something strange when I use >rejoin. > >The function is called build-html.r which builds a markup statement. >Here is the console result. Notice the closing bracket for the opening >tag is strangely moved to the end of the rejoined string: > >>> do %build-html.r >Script: "Untitled" (none) >== > >>> > >Your input would be helpful. -Ryan > >Here is the script: > >REBOL [] > >author: make object! [ >name: "Ryan C. Christiansen" >email-address: [EMAIL PROTECTED] >stylesheet-info: make object! [ >tag-style: "font" > class-name: "author" >] >] > >build-html: func [ >{Build an HTML page element including the data to be displayed > and the markup language surrounding the data.} >data [object!] "the data to be marked up" >][ >open-tag: build-tag [(data/stylesheet-info/tag-style) class > (data/stylesheet-info/class-name)] > >close-tag: rejoin [{}] > >markup-string: rejoin [open-tag data/name close-tag] > >markup-string > >] > >build-html author
[REBOL] shifting characters in rejoin Re:(2)
> You've run into the interesting way that 'join works on tag!. > > >> rejoin [ "class=" "Ryan C. Christiansen" ] > == > > > Basically you have to convert the tags to strings to work as you'd expect, as 'join on a tag! will put the stuff in the block inside the tag. I forgot to mention that the end result of 'join and 'rejoin is to make the result the same datatype! as the first datatype in the block for 'rejoin or first argument of 'join. >> type? rejoin [ "class=" "Ryan C. Christiansen" ] == tag! What's the type! of this one expression? ;-) Andrew Martin ICQ: 26227169 http://members.nbci.com/AndrewMartin/ http://members.xoom.com/AndrewMartin/ -><-
[REBOL] List! series [Was: blank] Re:(2)
Hi gmassar, it's not quite as drastic as that. After removing from the list, do >> list: head list == make list! [2 3 4] Also try: >> list: make list! [1 2 3 4] >> at list 2 compare to >> block: make block! [1 2 3 4] >> at block 2 Another surprise: >> list: make list! [1 2 3 4] >> foreach element list [print element] Also try >> foreach element list [print mold element] forall and forskip work as expected. Also compare >> block: make block! [1 2 3 4] >> partial-block: skip block 2 >> list: make list! [1 2 3 4] >> partial-list: skip list 2 >> remove block >> remove list >> partial-block >> partial-list In short, you'll run into surprises if you expect list to behave like a block. Looks to me like list is not completely implemented in the experimental version I'm using (0.10.38.4.2) . [EMAIL PROTECTED] wrote: > I followed Elan's suggestion to try out list! series. Here is what I > did: > > >> list: make list! [1 2 3 4] > == make list! [1 2 3 4] > >> first list > == 1 > >> remove list > == make list! [2 3 4] > >> first list > ** Script Error: Out of range or past end. > ** Where: first list > > What!!! > > >> list > == make list! [] > > Oh, the series is completely empty! > > Can anybody explain why remove all elements in the list instead of just > the first element? Remove block! series just one element at the head. > Why different? >
[REBOL] List! series [Was: blank] Re:(2)
>> list: make list! [1 2 3 4] == make list! [1 2 3 4] >> first list == 1 >> remove list == make list! [2 3 4] >> first list ** Script Error: Out of range or past end. ** Where: first list >> first head list == 2 As Larry points out, some functions work differently for list!. I believe it's for performance reasons. Andrew Martin ICQ: 26227169 http://members.nbci.com/AndrewMartin/ http://members.xoom.com/AndrewMartin/ -><-
[REBOL] shifting characters in rejoin Re:
> I have created a function which returns something strange when I use rejoin. > > The function is called build-html.r which builds a markup statement. Here is the console result. Notice the closing bracket for the opening tag is strangely moved to the end of the rejoined string: > >> do %build-html.r > Script: "Untitled" (none) > == > You've run into the interesting way that 'join works on tag!. >> rejoin [ "class=" "Ryan C. Christiansen" ] == > Basically you have to convert the tags to strings to work as you'd expect, as 'join on a tag! will put the stuff in the block inside the tag. Something like this from my HTML! component, soon to be released on RebMail list, and my Web Dialect list: A: func [File [file! url!] Link [string!] /Top] [ rejoin ["" join [{ href="} Encode File {"} either Top [{ TARGET="_top"}] [""]] Link ] ] Which from script like this: H1 A URL/Absolute Spectrum-Studios Name Spectrum-Studios generates HTML like this: http://members.nbci.com/SpectrumStudios/Spectrum%20Studios.html">Spect rum Studios The above line is broken by the email client I'm using. Note that 'Spectrum-Studios is a object like: Spectrum-Studios: Make-Page "Spectrum Studios" %"Spectrum Studios.html" [ Title Name Spectrum-Studios Body I hope that helps! Andrew Martin ICQ: 26227169 http://members.nbci.com/AndrewMartin/ http://members.xoom.com/AndrewMartin/ -><-
[REBOL] List! series [Was: blank] Re:(2)
Hi gmassar Some of the series functions work differently for lists then other series. >From the new Core PDF doc: "Removing the element currently referenced in a list causes the reference to reset to the tail of the list" So using your example: >> list: make list! [1 2 3 4] == make list! [1 2 3 4] >> remove list == make list! [2 3 4] >> list: head list == make list! [2 3 4] >> first list == 2 The value returned from the remove function is a pointer to the list after the removed element, but the current pointer for the list is at the tail. Other functions work differently as well, I would suggest reading the manual. Cheers -Larry - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 04, 2000 4:04 PM Subject: [REBOL] Re: List! series [Was: blank] I followed Elan's suggestion to try out list! series. Here is what I did: >> list: make list! [1 2 3 4] == make list! [1 2 3 4] >> first list == 1 >> remove list == make list! [2 3 4] >> first list ** Script Error: Out of range or past end. ** Where: first list What!!! >> list == make list! [] Oh, the series is completely empty! Can anybody explain why remove all elements in the list instead of just the first element? Remove block! series just one element at the head. Why different? snip-
[REBOL] Re: List! series [Was: blank]
I followed Elan's suggestion to try out list! series. Here is what I did: >> list: make list! [1 2 3 4] == make list! [1 2 3 4] >> first list == 1 >> remove list == make list! [2 3 4] >> first list ** Script Error: Out of range or past end. ** Where: first list What!!! >> list == make list! [] Oh, the series is completely empty! Can anybody explain why remove all elements in the list instead of just the first element? Remove block! series just one element at the head. Why different? [EMAIL PROTECTED] wrote: > > Hi Sharriff, > > 1. Thanks for the link to the SocketServer site. Interesting stuff. > 2.Theoretically (I haven't actually timed it) > LIST! is faster when it comes to adding and removing elements. If you have a > lot of add/remove operations on a series than a value of type list! should be > faster. > HASH! is faster when it comes to looking up elements. If you need to speed up > searches then HASH! should be much faster. I expect that the speed of looking > up elements in hashes is offset by the time it initially takes to construct a > hash! and to add and remove elements in a hash. > Be careful when navigating in list series. Indeces do not work the same way > they do in blocks. Try out these examples: > >> list: make list! [1 2 3 4] > >> block: make block! [1 2 3 4] > >> first block > >> first list > >> remove block > >> remove list > >> first block > >> first list > > [EMAIL PROTECTED] wrote: > > > It´s stated somewhere that HASH! and LIST! types are better for data > > retieval, by what factor and why exactly? are there any special sort or > > retieve commands or functions that are not documented? I habe´nt found any > > I´m using Blocks to try to implement a user list of 40-50 users. > > > > Sharriff Aina > > med.iq information & quality in healthcare AG
[REBOL] shifting characters in rejoin
I have created a function which returns something strange when I use rejoin. The function is called build-html.r which builds a markup statement. Here is the console result. Notice the closing bracket for the opening tag is strangely moved to the end of the rejoined string: >> do %build-html.r Script: "Untitled" (none) == > >> Your input would be helpful. -Ryan Here is the script: REBOL [] author: make object! [ name: "Ryan C. Christiansen" email-address: [EMAIL PROTECTED] stylesheet-info: make object! [ tag-style: "font" class-name: "author" ] ] build-html: func [ "Build an HTML page element including the data to be displayed and the markup language surrounding the data." data [object!] "the data to be marked up" ][ open-tag: build-tag [(data/stylesheet-info/tag-style) class (data/stylesheet-info/class-name)] close-tag: rejoin [{}] markup-string: rejoin [open-tag data/name close-tag] markup-string ] build-html author
[REBOL] Re: New View version 0.10.38.3.1 Re:
Hello [EMAIL PROTECTED] On 04-Oct-00, [EMAIL PROTECTED] wrote: > Ryan: > I had problems loading before and found out that if you already have a > 'View directory, it will not load. To correct, you must delete or move > your previous view directory and then try again. > > Hope this helps, > > Joe > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, October 04, 2000 3:03 PM > To: [EMAIL PROTECTED] > Subject: [REBOL] New View version 0.10.38.3.1 > > > The new version of view 0.10.38.3.1 wont install properly on my win-98 > machine, anybody else having this problem? > > --Ryan > > What I did is rename rebol.exe in View to rebol-old.exe and then it would install Regards -- If you wish to learn the highest truths, begin with the alphabet. -- Unknown JMS Trustee http://www.jms.org HP=http://www.sonic.net/~alanwall/ First computer solar powered vic-20 AmigaQNX-notAmigaNG=no good computers for people not suits sent via Yam ver2 on AmigaForever ver3 Be a Rebel get [EMAIL PROTECTED] UIN#=9391028
[REBOL] New View version 0.10.38.3.1 Re:
Ryan: I had problems loading before and found out that if you already have a 'View directory, it will not load. To correct, you must delete or move your previous view directory and then try again. Hope this helps, Joe -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 04, 2000 3:03 PM To: [EMAIL PROTECTED] Subject: [REBOL] New View version 0.10.38.3.1 The new version of view 0.10.38.3.1 wont install properly on my win-98 machine, anybody else having this problem? --Ryan
[REBOL] New View version 0.10.38.3.1
The new version of view 0.10.38.3.1 wont install properly on my win-98 machine, anybody else having this problem? --Ryan
[REBOL] Re:
Hi Sharriff, 1. Thanks for the link to the SocketServer site. Interesting stuff. 2.Theoretically (I haven't actually timed it) LIST! is faster when it comes to adding and removing elements. If you have a lot of add/remove operations on a series than a value of type list! should be faster. HASH! is faster when it comes to looking up elements. If you need to speed up searches then HASH! should be much faster. I expect that the speed of looking up elements in hashes is offset by the time it initially takes to construct a hash! and to add and remove elements in a hash. Be careful when navigating in list series. Indeces do not work the same way they do in blocks. Try out these examples: >> list: make list! [1 2 3 4] >> block: make block! [1 2 3 4] >> first block >> first list >> remove block >> remove list >> first block >> first list [EMAIL PROTECTED] wrote: > It´s stated somewhere that HASH! and LIST! types are better for data > retieval, by what factor and why exactly? are there any special sort or > retieve commands or functions that are not documented? I habe´nt found any > I´m using Blocks to try to implement a user list of 40-50 users. > > Sharriff Aina > med.iq information & quality in healthcare AG
[REBOL] CGI Re:
It simply makes an easy-access object out of the data: decode-cgi "foo=10&bar=20" == [foo: 10 bar: 20] when you make an object out of it with: cgi: make object! decode-cgi "foo=10&bar=20" you can access the form values like this: cgi/foo == 10 cgi/bar == 20 The reason you might not make an objects is if you have multiple form items on the page with the same name so your cgi query string looks like this: "foo=10&bar=20&bar=30" Then if you make an object, you'll only get one value for 'bar. WARNING You can also DO the decoded cgi block and it will set the words to their respective valus. This is neat but remember that any word can come in through cgi so if you do this: do decode-cgi "foo=10&bar=20&read=0" will stomp all over the word 'read... not a good idea. And since you do not have control over what somebody could hack pu and send in to you cgi program it is not generally a good idea to DO the decode-cgi block. WARNING Sterling > Hi guys! > > Sorry to bother you with this newbie question: > > Why does one have to "make object!" after a "decode-cgi" ? just curious... > > > Sharriff Aina > med.iq information & quality in healthcare AG > Gutenbergstr. 42 > 41564 Kaarst > tel.: 02131-3669-0 > fax: 02131-3669-599 > www.med-iq.de > >
[REBOL] Parsing question Re:(4)
aha! All so simple when you realise you can put numbers in there!!! I missed that is the new manual. Cheers, > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, October 04, 2000 10:09 AM > To: [EMAIL PROTECTED] > Subject: [REBOL] Re: Parsing question Re:(2) > > > Hello [EMAIL PROTECTED], > > Here's a parse rule that does the trick: > > my-table-rule: [ > 4 [thru "" thru ""] > 1 [thru "" copy my-text [thru "" to ""]] > to end > ] > > "to end" isn't strictly nessesary, but will make parse return > true if the text was succesfully copied. > > > > Best regards > Thomas Jensen > > > > On 04-Oct-00, [EMAIL PROTECTED] wrote: > > > okay maybe I was being too generic. > > > > Example, parsing a web page to locate the fifth table. This basically > > involves looking for the fifth occurrence of "" and then > the second > > occurrence of "" (as there is an embedded table in one of the > > cells). > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > The content I'd like to be copied is "" > > (don't ask why I'd want this) > > > > Hope that clears up what I'm trying to do. Cheers, > > > > > > Jamie > > > Jamie Lawrence.vcf
[REBOL] Re: Parsing question Re:(2)
Hello [EMAIL PROTECTED], Here's a parse rule that does the trick: my-table-rule: [ 4 [thru "" thru ""] 1 [thru "" copy my-text [thru "" to ""]] to end ] "to end" isn't strictly nessesary, but will make parse return true if the text was succesfully copied. Best regards Thomas Jensen On 04-Oct-00, [EMAIL PROTECTED] wrote: > okay maybe I was being too generic. > > Example, parsing a web page to locate the fifth table. This basically > involves looking for the fifth occurrence of "" and then the second > occurrence of "" (as there is an embedded table in one of the > cells). > > > > > > > > > > > > > > > > The content I'd like to be copied is "" > (don't ask why I'd want this) > > Hope that clears up what I'm trying to do. Cheers, > > > Jamie
[REBOL] Problem with try [ open/direct/binary tcp://... ] Re:
Hi Elan, Thanks for setting me straight on where my observations were lacking. So, apparently INSERT and friends always use TO STRING! , but TO STRING! 's behavior itself is a little harder to understand than I'd thought. I take it that of the three types of conversion, MOLD preserves the integrity of the original value the most, TO STRING! compromises it the most, and FORM is somewhere in between. TO STRING! wipes out the distinction between the members of any block values it gets, but preserves the internal integrity of individual members of its block value arguments. This produces these results, which were unexpected for me: >> to string! [abc/def/ghi jkl/mno/pqr] == "abc/def/ghijkl/mno/pqr" >> to string! [["abc" "def" "ghi"] ["jkl" "mno" "pqr"]] == "abc def ghijkl mno pqr" I'd like to know if Carl thinks this behavior is a bug as well. You say, >5. I think it is reasonable to expect that REBOL's conversion routines >maintain CONVERSION INTEGRITY. Unfortunately that is not true. Examples: I was thinking that CONVERSION INTEGRITY was the job of MOLD, which saves the most integrity. But even that doesn't give quite the right answer sometimes: >> to block! mold ["abc" "def"] == [["abc" "def"]] although LOAD works OK for this case: >> load mold ["abc" "def"] == ["abc" "def"] I think CONVERSION INTEGRITY can be achieved in most cases, but you have to use a heterogenous set of tools on a case-by-case basis. Not an ideal situation! And it seems there's no way to maintain CONVERSION INTEGRITY with datatype! >> to datatype! to string! string! ** Script Error: Cannot use to on datatype! value. ** Where: to datatype! to string! string! >> load mold string! == string! >> type? load mold string! == word! Eric
[REBOL] TECHNICAL ESSAY/CHALLENGE(s) - "Expression Based"? Re:
> (*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//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
[REBOL] simple parse and copy question Re:
Hi, Sharriff... [EMAIL PROTECTED] wrote: > > >> help copy > USAGE: > COPY value /part range /deep > > considering: > > "parse page [thru copy text to ] " > > copy is evaluted towars the RIGHT side, copies values into WORD! text > > am I to take this as it is? can someone explain exactly why this > particular example works this way. > The answer is that help copy gives you the normal usage of copy as a word in standard REBOL. However, inside a setting such as parse something [ ... copy bletch somerulepart ...] the word copy is used as a part of the parsing dialect. (See the new docs, chapter 14, for an explanation -- esp. pp. 14-14 and 14-27.) In that dialect (using the above partial example) the variable following the word copy receives a copy of whatever matches the following somerulepart . The help (or ? variant) function only deals with top-level usage of words, which is also why you get >> ? thru No information on thru (word has no value) for another word in the parsing dialect. HTH! -jn- -- ; Joel Neely [EMAIL PROTECTED] 901-263-4460 38017/HKA/9677 REBOL [] print to-string debase decompress #{ 789C0BCE0BAB4A7176CA48CAB53448740FABF474F3720BCC B6F4F574CFC888342AC949CE74B50500E1710C0C2400}
[REBOL] Problem with try [ open/direct/binary tcp://... ] Re:(9)
[EMAIL PROTECTED] wrote: > >yeah, REBOLs build-in binary capabilities are a bit strange sometimes :-/ > >## to binary! 100 > >== #{313030} > > Doesn't that seem like a bug? If you're saying that, then sure it does! :) It would be really useful to be able to convert an integer (or even a decimal, perhaps in IEEE format?) to a (32 bit?) binary. Regards, Gabriele. -- Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
[REBOL] Parsing question Re:(2)
okay maybe I was being too generic. Example, parsing a web page to locate the fifth table. This basically involves looking for the fifth occurrence of "" and then the second occurrence of "" (as there is an embedded table in one of the cells). The content I'd like to be copied is "" (don't ask why I'd want this) Hope that clears up what I'm trying to do. Cheers, Jamie > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, October 04, 2000 7:48 AM > To: [EMAIL PROTECTED] > Subject: [REBOL] Parsing question Re: > > > Short answer - It depends (doesn't it always :) ) > > Long answer, > > If I assume there is no relationship between the 5th occurence of > "something" (A) and the 9th occurrence of "whatever" (B) > then the answer is no - you probably cannot do it in one rule. The reason > being is that you want parse to essentially go back and process > the input a > second time in order to find B. So, need to call parse once to find (A), > again to find (B) and then just do a copy/part A B. > > If however, there is a relationship, like all 9 occurrences of "whatever" > always follow A then yes you can probably do it in a single parse rule. So > what you need to do to use parse is to identify the rules that the page > structure follows - or at least a pattern that you can exploit. > > If you have a concrete example, it might help. > > Brett. > > - Original Message - > From: <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, October 05, 2000 5:52 AM > Subject: [REBOL] Parsing question > > > > is it possible to parse a page with the following pseudo-rule: > > > > copy from the 5th occurrence of "something" to the 9th occurrence of > > "whatever" > > > > I have found lots of references to thru and to but I can't quite get my > head > > around how to use them to perform this. > > > > Many Thanks, > > > > Jamie > > > > > > Jamie Lawrence.vcf
[REBOL] Antwort: simple parse and copy question Re:
>Parse rules are made up from a dialect specific to parse. That is, the >"code" you find in a parse rule is not executed like ordinary script, it is >instead interpreted by the parse function. When the parse function >encounters the word "copy" in a parse rule it applies its own specific >meaning - just like you could if you had a function that processed words in >a block. Thanks Brett, saw the same explanation in the users guide, guess I should do some more RTFM Sharriff Aina med.iq information & quality in healthcare AG
[REBOL] TECHNICAL ESSAY/CHALLENGE(s) - "Expression Based"? Re:(5)
[EMAIL PROTECTED] wrote: > To sum up thus far, it appears that handling these three cases > > 1) same object, same method, computed argument(s) > 2) same object, computed method, same argument(s) > 3) computed object, same method, same argument(s) > > involves the use of three (radically!) different techniques. I'm > very grateful for the responses thus far. I would be even happier > if we could come up with a single general approach that would > handle all three of these cases. This is the best I can think of: >> do-meth: func [obj [object!] meth [word! path! block!] args [block!]] [ [do compose [(to-path compose [obj (to-block :meth)]) (args)] [ ] >> do-meth obj 'f [1] 1 none none >> do-meth obj 'f/ref [1 2] 1 true 2 >> do-meth obj compose [f (pick [ref []] random 2)] [1 2] 1 true 2 >> do-meth obj compose [f (pick [ref []] random 2)] [1 2] 1 none none == 2 >> do-meth obj compose [f (pick [ref []] random 2)] [1 2] 1 none none == 2 >> do-meth obj compose [f (pick [ref []] random 2)] [1 2] 1 none none == 2 >> do-meth obj compose [f (pick [ref []] random 2)] [1 2] 1 true 2 Regards, Gabriele. -- Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
[REBOL] Parsing question Re:
Short answer - It depends (doesn't it always :) ) Long answer, If I assume there is no relationship between the 5th occurence of "something" (A) and the 9th occurrence of "whatever" (B) then the answer is no - you probably cannot do it in one rule. The reason being is that you want parse to essentially go back and process the input a second time in order to find B. So, need to call parse once to find (A), again to find (B) and then just do a copy/part A B. If however, there is a relationship, like all 9 occurrences of "whatever" always follow A then yes you can probably do it in a single parse rule. So what you need to do to use parse is to identify the rules that the page structure follows - or at least a pattern that you can exploit. If you have a concrete example, it might help. Brett. - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 05, 2000 5:52 AM Subject: [REBOL] Parsing question > is it possible to parse a page with the following pseudo-rule: > > copy from the 5th occurrence of "something" to the 9th occurrence of > "whatever" > > I have found lots of references to thru and to but I can't quite get my head > around how to use them to perform this. > > Many Thanks, > > Jamie > >
[REBOL] Daemon Workaround - Linux
Workaround for starting a process as a daemon on LINUX. 1. create a txt file called whatever you want it called 2. put in the file your command line commands to launch your script as follows: rebol -c /path/to/script/script.r 3. telnet into your server, you must be root to do this so "su -" to login as root via telnet 4. copy the text file to one of the following directories which can be found in the /etc directory: cron.daily cron.half-hourly cron.hourly cron.monthly cron.quarter-daily cron.quarter-hourly (PICK THIS ONE) cron.weekly 5. now check what time it is by typing "date" 6. if you like you can be more accurate and look at the chron file which is plain text in that file you can see all the times that are setup for the above directories to be executed (well the files inside them anyway) so if it says: 03,18,33,48 * * * * root run-parts /etc/cron.quarter-hourly (12:03, 12:18, 12:33, 12:48, every 15 minutes) 04,34 * * * * root run-parts /etc/cron.half-hourly (12:04 12:34, every half-hour) 01 * * * * root run-parts /etc/cron.hourly (12:01 every hour) 05 0,6,12,18 * * * root run-parts /etc/cron.quarter-daily (12:05 AM 6:05 AM 12:05 PM 6:05 PM, 4 times a day) 02 4 * * * root run-parts /etc/cron.daily (4:02 AM every day) 22 4 * * 0 root run-parts /etc/cron.weekly (4:22 AM every Sunday I think) 42 4 1 * * root run-parts /etc/cron.monthly (4:42 AM first day of every month) so the idea here is that you put it into 1 of these directories, obviously it should be the one that has the most hits that is /cron.quarter-hourly and wait for the thing to rollover and auto-start your program/script now would be a good time to see what time it is "date" and just wait until the thing has passed your start-time 7. So now check to see if it is running by trying to do whatever it is u do to check to see if it is running (the program/script that is) 8. If running properly, "rm script.r" remove the script from the cron directory and be sure to store it somewhere for later use if necessary like the /tmp directory thats it, a bit of a hassle but at least it gets the job done when you have no other way to achieve it. Good Luck, Jeff
[REBOL] TECHNICAL ESSAY/CHALLENGE(s) - "Expression Based"? Re:(3)
[EMAIL PROTECTED] wrote: [do-in diffs either even? num [[up/by num]] [[down/by num]]] > > (using COMPOSE here you may get closer to your hypothetical > > syntax...) > > Being a Bear of Small Brain (and I was up late last night and > haven't had sufficient coffee yet this morning), I must ask for > an example of what you had in mind here. >> num: 1 == 1 >> reduce [make path! compose [(pick [up down] even? num) by] 'num] == [down/by num] >> num: 2 == 2 >> reduce [make path! compose [(pick [up down] even? num) by] 'num] == [up/by num] Not as elegant as I'd like it to be... Regards, Gabriele. -- Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
[REBOL] Conversion bug?
The following appears to be buggy. >> to-string "hi" == "hi" >> to-binary to-string "hi" == #{6869} >> to-binary "hi" == #{6869} ...no surprise... >> to-string first ["hi"] == "hi" >> to-binary to-string first ["hi"] == #{6869} >> to-binary first ["hi"] == #{6869} ...still no surprise... >> to-string ["hi"] == "hi" >> to-binary to-string ["hi"] == #{6869} >> to-binary ["hi"] ** Script Error: Invalid argument: hi. ** Where: to binary! :value ...LUMPY GRAVY! Not only is it a big surprise that the conversion fails, the error message is highly misleading! I suspect either the conversion failure, the error message, or both to be bugged. -jn-
[REBOL] simple parse and copy question Re:
The "copy" you see in the parse rule is not the same as the copy at the command line. Parse rules are made up from a dialect specific to parse. That is, the "code" you find in a parse rule is not executed like ordinary script, it is instead interpreted by the parse function. When the parse function encounters the word "copy" in a parse rule it applies its own specific meaning - just like you could if you had a function that processed words in a block. Check out the documentation on parse and you will find that the result of using copy (in parse) is to copy the input stream from the current position for as long as the next match pattern is valid. In contrast, the bits of code you find in a parse rule between a "(" and a ")" are normal rebol commands. This allows you to have the power of rebol script from within parse. Another thing you will see in parse rules is a set-word like "here-i-am:". Again, when parse encounters this set-word it applies its own specific meaning, in this case it is to assign the word "here-i-am" to the current location of the input-stream. See the documentation for an example of this use. Hope that explains it. Brett. - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 04, 2000 10:24 PM Subject: [REBOL] simple parse and copy question > > >> help copy > USAGE: > COPY value /part range /deep > > considering: > > "parse page [thru copy text to ] " > > copy is evaluted towars the RIGHT side, copies values into WORD! text > > am I to take this as it is? can someone explain exactly why this > particular example works this way. > > > regards > > Sharriff Aina > med.iq information & quality in healthcare AG > >
[REBOL] Problem with try [ open/direct/binary tcp://... ] Re:(3)
Hello, Elan, I'd like to suggest a minor tweak in terminology that I think would help avoid confusion in other contexts than this present problem. I think it is in harmony with your fundamental point, but extends it to cover a bit more territory. Anyone who doesn't want the long discussion is invited to skip ahead to the heading "THE TROUBLE WITH STRINGS!!!" -- or even the heading "THE PUNCH LINE!!!", where there are some specific questions about type conversion confusion. -jn- [EMAIL PROTECTED] wrote: > [...problem-specific background and examples snipped... > > Nevertheless the results are surprising in some instances. > That is because one would expect that REBOL uses a SYMMETRICAL > CONVERSION model, which it doesn't. > What I mean is: > > A SYMMETRICAL CONVERSION MODEL in REBOL would look something > like this: > > 1. In REBOL data always occurs in association with a datatype. > The combination of data with a datatype is a value. > > 2. CONVERSION means disassociating some data from its current > datatype and associating it with a different datatype, while > leaving the data unmodified. Its value representation changes > because it is now associated with a different datatype. > This process -- changing the type/interpretation WITHOUT changing the internal data -- is referred to in other languages as TYPECASTING or (in the aggressive-abbreviation mentality of c) simply CASTING. I'm used to seeing the word "conversion" used in the more general sense of creating/returning a value of a different type which is "equivalent" (in a well-defined way!) to the original. This process may include the necessity of changing the representation. Consider these examples: >> fee: {abc} == "abc" >> length? fee == 3 >> fie: to-binary fee == #{616263} >> length? fie == 3 Without knowing the internals of REBOL implementation, one can still safely say that it's POSSIBLE that this is simply casting, as there's no logical necessity for the data bits to change, but only the type bits. >> foe: #"A" == #"A" >> length? foe ** Script Error: length? expected series argument of type: series port tuple struct. ** Where: length? foe >> fum: to-string foe == "A" >> length? fum == 1 This would be an example of conversion, where BY DEFINITION there is information required for a string (e.g., its length) that has nothing to do with the value of a single character. (And, with the phrase "by definition" I refer to the inherent concept of string, not the details of REBOL's implementation of them.) > > 3. CONVERSION INTEGRITY means that converting a value to a > different datatype and back to the original datatype must > result in the same value it originally had. The reason is that > the data was not modified during the conversion. > This is an important point. My only suggestion is to call this TYPECASTING INTEGRITY, so that we can then let the phrase "conversion integrity" (or perhaps "...consistency") cover more ground. If we read the following remarks with "typecasting" substituted for "conversion", I think the point is undamaged. > REBOL does not follow this symmetrical conversion model. > REBOL's conversion does not maintain CONVERSION INTEGRITY. > REBOL's CONVERSION implementation is not always symmetrical. > This means that in some instances REBOL does not limit > itself to modifying the datatype associated with the data that > is being converted, instead, the data itself is modified as well. > > Some of the examples you show show REBOL supporting symmetrical > conversion. For instance > [...examples snipped...] > > 5. I think it is reasonable to expect that REBOL's conversion > routines maintain CONVERSION INTEGRITY. Unfortunately that is > not true. Examples: > [... more examples snipped...] > > Is REBOL's current implementation of ASYMMETRICAL CONVERSION, > i.e. a conversion that permits the modification of the data > and does not limit itself to modifying the representation of > the data by associating the data with a different datatype, > more useful - albeit occasionally surprising - than a > symmetrical conversion would be? > An an aside to this last point, let me add that inconsistency has a cost -- it requires extra effort to learn/teach/use the concepts where inconsistencies emerge. While I'm not saying that inconsistencies are automatically evil, I would suggest they are an unnecessary cost unless there's some significant benefit that offsets that cost. Now, back to the main idea... Now let's add the idea of "conversion consistency" as follows (with my numbers an extension of Elan's list): 6. I think it's reasonable to have the idea of canonical (or "standard", if one prefers) internal and external representations for each datatype in the language. The basic conversion mechanism should ensure that when a value is converted to a different type (assuming, of course, that the conversion makes logical se
[REBOL] Problem with try [ open/direct/binary tcp://... ] Re:(9)
[EMAIL PROTECTED] wrote: > It appears that using a block as the second argument, when the first > argument is of any-string! type, causes the contents of the block > be treated as strings. Yup, INSERT uses FORM to convert values that are not of the ANY-STRING! (pseudo)type to strings. The point is, BINARY! values should not be converted, because you CAN insert binary values in ANY-STRING!s without conversion. Furthermore, insert something #{1234} should (AFAIK) be equivalent to insert something [#{1234}] > > INSERT shouldn't use FORM when inserting a BINARY!. I'm sending > Do you mean "shouldn't" in the sense of > > 1) "contradicts the official specification", or If you have such a thing, please send it to me! ;-) > 2) "doesn't do what I expected", or > 3) "doesn't seem to me to do The Right Thing"? I can't read Carl's mind, but I assume that it wasn't his intention to have the two expressions above behaving differently. > there is one which I've overlooked, I'll be VERY grateful if you > will tell me where it is (and it may very well be Carl's massive :-) > tome of yesterday evening -- I just haven't finished reading it!) I didn't have the time either... > Of course, I generally hold your experienced expectations -- as > in (2) -- or your good taste in programming -- as in (3) -- in > very high regard! Thank you very much. But I'm sure you're far more experienced than me in programming. :) I'm just a student after all, Gabriele. -- Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
[REBOL] rebol script as a daemon Help me please...
I would like to start a Rebol script as a daemon under Linux at boot up. Any ideas how to do this? I have screwed around with it but can't make it work correctly. When I do run it from command line works fine. But then I try to run it in the background, it runs but you can't access it via the web since it is a form of the sid-server.r script. In addition: here is scenario using Telnet to work with my remote linux system which serves our website i can run the server script while connected via telnet, but once I disconnect it kills my process nohup does not seem to help neither does redirecting output to Null and running in background So how the hell do you start program/script and keep it running as a daemon in the background even after logging off the system? HELP! Thanks, Jeff
[REBOL] simple parse and copy question
>> help copy USAGE: COPY value /part range /deep considering: "parse page [thru copy text to ] " copy is evaluted towars the RIGHT side, copies values into WORD! text am I to take this as it is? can someone explain exactly why this particular example works this way. regards Sharriff Aina med.iq information & quality in healthcare AG
[REBOL] Antwort: Command question Re:(3)
[EMAIL PROTECTED] wrote: > > Core to support at least 1 free DB, or create one yourselves! I > > Elan's book < www.reboltech.com > includes a DBMS written entirely in > REBOL. > > People have also mentioned connnecting to MySQL via /COMMAND and ODBC, > but that just seems like such a kludge. > > Another interesting idea has been to connect to MySQL via TCP. No one > wanted to work on that before because of /COMMAND. But now that it > seems /COMMAND will add a licensing fee to every application > distributed using it, people might be more interested in alternatives > now. What's more - with /Command and existing web servers (e.g. Apache) you are left with CGI, while others have free PHP solution integrated as Apache module ... make your conclusion yourself :-) However - we have /Core based Apache module, so I think TCP/IP solution has its place here. I just haven't checked it out yet. But - the only one real solution to me seems real rebol componentisation, e.g. having per component pricing, allowing me to get REBOL/Apache for free (if it will be free) and let's say buy /Library component for it, as Jeff implemented MySQL library wrapper. What's more - I would even pay for such wrapper. But currently there is no way how to combine above factors ... That was the first layer of the problem - the second one is imho serverless dbms system for rebol/core. With all Oracle, DB2, MySQL you are supposing the system is running strong SQL server solution. But that's not always the case. So Elan showed us the way with his DBMS system. What I would be interested in is XBase (.dbf) solution - it doesn't require server, but rebol script driver would be probably slow ... Maybe we could also agree upon some standard plug-ins system, as proposed by Andrew Martin on rebmail list, and then Elan's or other solution would be just one of plug-ins ... the idea: REBOL/ /Plug-ins /Allen_K_cool_menu /other-menu /dbms /inactive Allen_K_cool_menu.cfg other-menu.cfg dbms.cfg the activation/deactivation of plug-in would be decided upon presence of file in /plug-ins directory, and deactivation just means moving appropriate .cfg file into /inactive subdir ... plug-ins are scripts, probably should function as separate modules (once modules are introduced to rebol), should represent certain domain specific dialects, etc... So far Andrew calls plug-ins components, but it should change imho as rebol uses 'component name for /View, /Shell, /Library etc. components. ... all is opened yet - we don't have modules yet, we don't have final VID yet, and so I am just curious, if using 'stylize aproach will be powerfull enough to handle more complex gui areas (components, widgets), as menu is for e.g. PS: sorry for slight off-topic comment ... :-) Cheers, -pekr- > The industry is very much in a try-before-you-buy mode right now, and > I'm not sure how trial versions would work with /COMMAND's licensing > structure. > me too ... > > -Ted.
[REBOL] Parsing question
is it possible to parse a page with the following pseudo-rule: copy from the 5th occurrence of "something" to the 9th occurrence of "whatever" I have found lots of references to thru and to but I can't quite get my head around how to use them to perform this. Many Thanks, Jamie Jamie Lawrence.vcf
[REBOL] Antwort: Command question Re:(2)
> Core to support at least 1 free DB, or create one yourselves! I Elan's book < www.reboltech.com > includes a DBMS written entirely in REBOL. People have also mentioned connnecting to MySQL via /COMMAND and ODBC, but that just seems like such a kludge. Another interesting idea has been to connect to MySQL via TCP. No one wanted to work on that before because of /COMMAND. But now that it seems /COMMAND will add a licensing fee to every application distributed using it, people might be more interested in alternatives now. It's not clear to me whether /COMMAND is using a driver format, like DBI or JDBC. If so, it would be nice if there were a free version of /COMMAND that supported free databases. So you could start with something like Elan's DBMS for the free version, and then offer licensed upgrades to Oracle or OBDC backends. The industry is very much in a try-before-you-buy mode right now, and I'm not sure how trial versions would work with /COMMAND's licensing structure. -Ted.
[REBOL] CGI Re:(2)
Though, as noted on an earlier message on this list, doing so means that you will only get one value from a multi-select input. Brett. - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 04, 2000 8:08 PM Subject: [REBOL] CGI Re: > Sharriff Aina wrote: > > Sorry to bother you with this newbie question: > > Why does one have to "make object!" after a "decode-cgi" ? just curious... > > Actually, one doesn't have to, but it's safer for your software if you so, > as you can put arbitrary Rebol code in the cgi url. Putting the results of > the decode-cgi in a object minimises the damage the Rebol code can do. > > Andrew Martin > ICQ: 26227169 > http://members.nbci.com/AndrewMartin/ > http://members.xoom.com/AndrewMartin/ > -><- >
[REBOL] CGI Re:
Sharriff Aina wrote: > Sorry to bother you with this newbie question: > Why does one have to "make object!" after a "decode-cgi" ? just curious... Actually, one doesn't have to, but it's safer for your software if you so, as you can put arbitrary Rebol code in the cgi url. Putting the results of the decode-cgi in a object minimises the damage the Rebol code can do. Andrew Martin ICQ: 26227169 http://members.nbci.com/AndrewMartin/ http://members.xoom.com/AndrewMartin/ -><-
[REBOL] Problem with try [ open/direct/binary tcp://... ] Re:(2)
Hi Eric, you point out that INSERT (and APPEND and JOIN) appear to use FORM to convert values contained in blocks, whereas they use TO STRING! to convert values which are not contained in blocks. If you observe how TO STRING! processes values contained in blocks, you will find that TO STRING! itself acts no different from FORM with respect to blocks. If the functions you inspect use nothing but TO STRING! to convert values (string! or block! values), then the results will be exactly the ones you observed. Some of your results are unexpected because REBOL does not use a symmetrical conversion model. The question is, is that good? [EMAIL PROTECTED] wrote: > > It seems that INSERT uses FORM to convert values contained in blocks before > inserting them, and TO STRING! to convert values which aren't contained in > blocks. Most of the time the results of TO STRING! and FORM are the same, but > there are several differences. > [snipped examples displaying similarities and differences between FORM and TO STRING!] > > These differences correspond exactly to the behavior of INSERT, APPEND and > JOIN: > > >> append "" to binary! "binary" > == "binary" >> to string! to binary! "binary" == "binary" > > >> append "" reduce [to binary! "binary"] > == "#{62696E617279}" Here you conclude that REBOL appears to be using FORM instead of TO STRING!, because a block is being converted. However, TO STRING! does the exact same thing: >> to string! reduce [to binary! "binary"] == "#{62696E617279}" > > >> append "" first [abc/def/ghi] > == "abcdefghi" >> to string! first [abc/def/ghi] == "abcdefghi" > > >> append "" [abc/def/ghi] > == "abc/def/ghi" Again you note the similarity to using FORM. However, TO STRING! acts no different: >> to string! [abc/def/ghi] == "abc/def/ghi" > > >> append "" ["abc" "def" "ghi"] > == "abcdefghi" >> to string! ["abc" "def" "ghi"] == "abcdefghi" > > >> append "" [["abc" "def" "ghi"]] > == "abc def ghi" >> to string! [["abc" "def" "ghi"]] == "abc def ghi" In all cases TO STRING! behaves as FORM would with respect to blocks. Nevertheless the results are surprising in some instances. That is because one would expect that REBOL uses a SYMMETRICAL CONVERSION model, which it doesn't. What I mean is: A SYMMETRICAL CONVERSION MODEL in REBOL would look something like this: 1. In REBOL data always occurs in association with a datatype. The combination of data with a datatype is a value. 2. CONVERSION means disassociating some data from its current datatype and associating it with a different datatype, while leaving the data unmodified. Its value representation changes because it is now associated with a different datatype. 3. CONVERSION INTEGRITY means that converting a value to a different datatype and back to the original datatype must result in the same value it originally had. The reason is that the data was not modified during the conversion. REBOL does not follow this symmetrical conversion model. REBOL's conversion does not maintain CONVERSION INTEGRITY. REBOL's CONVERSION implementation is not always symmetrical. This means that in some instances REBOL does not limit itself to modifying the datatype associated with the data that is being converted, instead, the data itself is modified as well. Some of the examples you show show REBOL supporting symmetrical conversion. For instance >> binary-block: reduce [to binary! "binary"] == [#{62696E617279}] >> to string! binary-block "#{62696E617279}" and >> to block! to string! binary-block == [#{62696E617279}] The final result of converting the string representation of the data contained in the block binary-block is a block containing the same data. That is appropriate. 5. I think it is reasonable to expect that REBOL's conversion routines maintain CONVERSION INTEGRITY. Unfortunately that is not true. Examples: >> to string! ["abc" "def" "ghi"] SHOULD RETURN ~~ {"abc" "def" "ghi"} INSTEAD IT RETURNS == "abc def ghi" Therefore >> to block! to string! ["abc" "def" "ghi"] results in == [abc def ghi] i.e. a block of words, whereas CONVERSION INTEGRITY would require it to return == ["abc" "def" "ghi"] a block containing strings, which was what the original block contained. Another example is >> to block! to string! [["abc" "def" "ghi"]] which returns == [abc def ghi] Under a symmetrical model this should result in == [["abc" "def" "ghi"]] What happens is that during the string conversion [["abc" "def" "ghi"]] was converted to "abc def ghi", whereas following a symmetrical model it should have been converted to {["abc" "def" "ghi"]}. Only the outer block should have been replaced by a string. Instead the element of the outer block (a block containing three strings) was stripped, and in addition the three strings contained in the block were converted to character sequences. Additional space characters were inserted, separating the character sequences that were originally strings. Is REBOL's current implementation of ASYM
[REBOL] CGI
Hi guys! Sorry to bother you with this newbie question: Why does one have to "make object!" after a "decode-cgi" ? just curious... Sharriff Aina med.iq information & quality in healthcare AG Gutenbergstr. 42 41564 Kaarst tel.: 02131-3669-0 fax: 02131-3669-599 www.med-iq.de
[REBOL]
It´s stated somewhere that HASH! and LIST! types are better for data retieval, by what factor and why exactly? are there any special sort or retieve commands or functions that are not documented? I habe´nt found any I´m using Blocks to try to implement a user list of 40-50 users. Sharriff Aina med.iq information & quality in healthcare AG
[REBOL] ODBC, XML and REBOL -->something worth considering
Hi Gurus! I´m not much of a programmmer, but I´m sure some guru or maybe RT itself would find this useful: http://odbc.linuxave.net ODBC Socket Server is an open source database access toolkit that exposes Windows ODBC data sources with an XML-based TCP/IP interface. The main uses of this toolkit are: Allows Linux, UNIX, Macintosh, or any other TCP/IP capable OS to access ODBC (or OLE DB) databases running on Windows systems. For instance, you could have a Web data-warehouse application with a Linux web server running Perl and all your data on MS SQL Server. Allows small-databases such as MS Access to be accessed across TCP/IP networks Is something like this feasible? if it works with PERL, why should´nt it work with REBOL? Sharriff Aina med.iq information & quality in healthcare AG