[REBOL] Rebol the goal directed programming.

2000-06-23 Thread lmecir

Brian pointed me to the goal directed programming (Anrew, you
beast!...), and I started to think about its feasibility in Rebol.

The first sign of the goal directed programming is Rebol Any
function.

To make something similar I tried to write a Break-transparent
while function. The task is easy to accomplish with recursion, I
tried to use another approach (modify existing Rebol While).
Here's the result:

inblock: func [
{returns a block containing a value}
value [any-type!]
] [
head insert/only copy [] get/any 'value
]

transp-break: func [
{a transparent break function}
/return value [any-type!]
] [
throw either return [
append/only copy [
bt-while break/return first
] inblock get/any 'value
] [
[bt-while break]
]
]

bt-while: func [
{a break-transparent While}
[catch throw]
cond-block [block!]
body-block [block!]
/local orig-break blk
] [
; change Break to Transparent-break and save the original
set [break orig-break] reduce [:transp-break :break]
; do cycle and save the result
error? set/any 'blk try [
catch [
append/only copy [
bt-while first
] inblock while cond-block body-block
]
]
; restore Break
break: :orig-break
; error or foreign throw?
either any [
error? get/any 'blk
not block? get/any 'blk
'bt-while  pick :blk 1
] [
if error? blk: try [throw get/any 'blk] [
throw :blk
]
] [do next blk]
]

{
Example

repeat i 4 [
j: 0
bt-while [j: j + 1 j = 4] [
print ["i: " i "j: " j]
if j = 2 [break]
]
]

}

Known issues:

1) the Try doesn't catch all errors (throw errors not catched -
feedback #3484).

2) Catch cannot resume named Throw - a Rebol design flaw?




[REBOL] recursive RIP Re:(2)

2000-06-23 Thread deadzaphod

I just compared the two versions and the version you posted differs from my 
original in the placement of whitespace..

   Cal Dixon ([EMAIL PROTECTED])   =-]

--


From: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: [REBOL] Re: recursive RIP
Date: Thu, 22 Jun 2000 19:58:48 -0700

Hello [EMAIL PROTECTED]

On 22-Jun-00, [EMAIL PROTECTED] wrote:
 
  I'm guessing that somebody out there has modified the original RIP
  script to be recursive.  I'm in the middle of some stuff and could
  sure use that right about now.  Anyone want to help me out and mail it
  to me, post it to the list, or post it to REBOL.org?
 
  Thanks,
 
  Sterling
 
This is odd the file that daedzaphod sent is diiferent that the 1 I have so
here is that 1.
Regards
--
Captain, we´re sorry. We thought you were dead. - I was. I´m better now.
-- Drazi and Sheridan
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
 rip1.r 


Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com




[REBOL] Bugs etc.

2000-06-23 Thread deadzaphod

   While working on my latest project I've run into a couple of bugs in 
REBOL/Core 2.2.0 (at least on Win98, but I think they're cross-platform 
problems).  I've been able to work around them, but it makes me really hope 
for a release of 2.3 soon..

   The first bug is already fixed in REBOL/View 0.9.8.3.1, but I figured I 
should report it just to be sure the fix gets put into core.  The 
'clean-path mezzanine function (and things built on it like 'change-dir) 
spits out an ugly block of internal data from it's parse rule if it is given 
a path that ends in "..".
Example of the broken behavior:
clean-path %..
["rebol/.." "Desktop/rebol/.." "WINDOWS/Desktop/rebol/.." 
"C/WINDOWS/Desktop/rebol/.."]
== %/C/WINDOWS/Desktop/
clean-path %editor/..
["editor/.." "rebol/editor/.." "Desktop/rebol/editor/.." 
"WINDOWS/Desktop/rebol/editor/.." "C/WINDOWS/Desktop/rebol/editor/.."]
== %/C/WINDOWS/Desktop/rebol/

   The other bug is in the 'select native (which is also used by the 'switch 
mezzanine where I noticed this behavior).  The problem exists in both /Core 
and /View.  This one was really a pain to track down when it came up in my 
code, for some reason a function that worked normally for most input 
(importing text into a buffer) replaced the text with the value url! for no 
apparent reason when given a block.  I finally discovered that the switch 
statement I was using to act based on the type of the input was searching 
for a value of type block! rather than the value block!.  At first it 
appeared to be a quirk of 'switch, but then I discovered that it actually 
came from 'select.  Then I thought that it was only an undocumented feature, 
but a bit of experimenting showed that the behavior was not entirely 
consistant and should probably be changed.

Examples:
normal operation:
select reduce [ string! [1] datatype! [2] block! [3] "foo" [4] ] string!
== [1]

undocumented feature operation:
select reduce [ "foo" [4] string! [1] datatype! [2] block! [3] ] string!
== [4]
select reduce [ string! [1] datatype! [2] block! [3] "foo" [4] ] block!
== datatype!

normal, but dangerously inconsistant operation:
select reduce [ string! [1] datatype! [2] block! [3] "foo" [4] ] datatype!
== [2]

My feeling is that the undocumented behaviour is useful, but should probably 
be optional (available with a refinement) and that 'datatype! should not be 
a special case.

   Cal Dixon ([EMAIL PROTECTED])

--


Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com




[REBOL] Rebol the goal directed programming. Re:

2000-06-23 Thread Al . Bri

[EMAIL PROTECTED] wrote:
 Brian pointed me to the goal directed programming (Andrew, you beast!...),
and I started to think about its feasibility in Rebol.

 The first sign of the goal directed programming is Rebol Any function.

Can you enlighten us about goal directed programming? I'm unfamiliar with
the term (and may be the meaning).

Andrew Martin
Animalistic Rebol
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--




[REBOL] Rebol the goal directed programming. Re:(2)

2000-06-23 Thread lmecir

Hi,

I should probably point you to Icon programming language as the
best source.

Ladislav

 Can you enlighten us about goal directed programming? I'm
unfamiliar with
 the term (and may be the meaning).

 Andrew Martin
 Animalistic Rebol
 ICQ: 26227169
 http://members.xoom.com/AndrewMartin/
 --






[REBOL] real life examples tutorial page?

2000-06-23 Thread bebox

hi all
i am fairly new to rebol but have done some programming c++/vb...
i was wondering what the list would think about having a page where 
newcomers can see some real life examples of what rebol is capable of.
i have looked thru the user guide and rebol.org but all examples are fairly 
basic and with little or no documentation...i know i learn alot better if i 
can see a question and then a well explained answer
you could have users upload a problem they have had at work and then a 
written explanation of how rebol helped to solve the problem.
as well as being a real life tutorial it would also give people new to the 
language a better idea of what it can do.

let me know what you think pls
many thanks
keith




[REBOL] CGI frustration

2000-06-23 Thread norsepower

Attached is a script which I am able to run successfully on a local 
machine, but when I configure it for my web space, it doesn't run. 
Here's some info:

I upload the script and chmod 755

There is one directory which must be accessible to the script. I give 
that directory "articles/" chmod 777

I use the correct shebang #!rebol -cs

My absolute path is correct.

I call the script using !--#exec cgi="/cgi-bin/news-site.cgi"--

I have other REBOL scripts running just fine in this web space, which 
means I have the correct binary uploaded and CGI does, in fact, work.

I'm at a loss.

If you care to help me out, change the configuration settings in the 
script and then upload the script along with the stylesheet.html 
document to a cgi-bin. You will also need to create a readable/
writeable directory named "articles/" in the top directory within the 
absolute path of your web space. Then, of course, you will have to send 
a couple of e-mails to a pop account.

#!rebol -cs

REBOL [ 
   Title:   "News Site" 
   Date:07-June-2000 
   Version: 2.0 
   File:%news-site.cgi 
   Author:  "Ryan C. Christiansen" 
   Email:   [EMAIL PROTECTED] 
   Rights:  "Copyright (C) Ryan C. Christiansen 2000" 
   Purpose: {
   
  INPUT:

  A CGI executable script which checks a POP e-mail account for new mail, verifies 
the e-mail is from a qualified contributor (or deletes the e-mail), converts the 
contents of the e-mail object (as understood by REBOL) into a "make object!" 
expression saved to a file. These "make object!" expressions are set up as news 
articles, including values for headlines, subheadlines, bylines, titles, body text in 
paragraphs, reference numbers, file names, and approval status.

  OUTPUT:

  A CGI executable script which dynamically creates the front page of a 
news-oriented web site. Currently prints the following as text/html output...
  -html head and meta information.
  -stylesheet information.
  -banner information.
  -news headlines, bylines, articles, and article reference numbers.
   } 

   Comment: {
   
  The "make object!" expressions created by this script are used to create 
text/html output which is a news-oriented Web page. The style of the text/html output 
is dependent upon a cascading style sheet which is loaded upon execution. Your browser 
must support cascading style sheets in order for the script to display the articles 
properly by default.

   } 

   History: [ 

1.0 [   13-May-2000
{Made scoop.cgi a public release}
"Ryan"
]

2.0 [   22-June-2000
{Renamed to News Site. New features include:
-articles are now saved as object expressions instead of as 
html-formatted text files. Object expressions including the following variables:
'headline
'subheadline
'article-post-date
'byline
'title
'body (with each paragraph as a separate string in a 
series of strings)
'reference-number
'obj-file-name
'approval
-the resultant text/html output is now entirely dynamic. New 
features include:
-alternating DIV styles
-dynamic banner creation
-dynamic html and meta creation
}
"Ryan"
]
   ]
]


; -
; -- CUSTOMIZATION AND CONFIGURATION SECTION --
; -


pop-username: "username"
pop-password: "password"
pop-mail-server: "mail.domain.dom"

absolute-path: "absolute/path/"

number-of-headlines: 5

unapproved-article-folder: "articles/"

approved-article-folder: "articles/"

headline-stylesheet: %stylesheet.html

page-title: "The News and Mail"
meta-keywords: {REBOL Internet Messaging Language scripting Web development}

publication-name: "The News and Mail"
copyright-info: {copy Ryan C. Christiansen, 2000}

page-width: 480

headlines-width: 480

;-- listing of e-mail addresses which are valid for posting news

reporters: make object! [

total-reporters: 3

reporter1: make object! [
email-address: [EMAIL PROTECTED]
full-name: "Ryan C. Christiansen"
person-title: "Editor-in-Chief"
]

reporter2: make object! [
email-address: [EMAIL PROTECTED]
full-name: "Ryan C. Christiansen"
person-title: "Editor-in-Chief"
]

reporter3: make object! [
email-address: [EMAIL 

[REBOL] CGI frustration Re:

2000-06-23 Thread norsepower

Never mind. Sorry.




[REBOL] (NT) View home

2000-06-23 Thread zoon

How does View determine it's home? I see where it reads home, but where does the
actual value come from? I have it installed in E:\Program Files\_Rebol\View and
when I try to check for updates, it tells me there's a problem and I should set
up the Network stuff. When I try to do that, it asks for permissions to write
E:\Program Files\Rebol\View\user.r, which of course doesn't exists. If I try to
rename _Rebol to Rebol, I get a permission denied message. Wha?




-- 
Pete Wason|"LWATPLOTG"|[EMAIL PROTECTED]|[EMAIL PROTECTED]|CUCUG|TA|PHX




[REBOL] Return From Middle Of Script?

2000-06-23 Thread rsnell

I have a script that 'do(es) another script.
The called script assembles a string and returns
it to the caller by placing the string word as
the last line in the script.  Fine.

But the called script has numerous places where
an error can occur and I would like to return
a partially assembled string at that point.
How to do this?  'return only works in a function
and 'halt doesn't seem to allow the script to return
the last evaluated argument.

In psuedocode what I want is:

if (some condition)
[
return "string1"
]

but I obviously can't use 'return and the following:

if (some condition)
[
"string1"
halt
]

does not return "string1" to the caller.

There doesn't appear to be a 'goto call where I can just
go to the end of the script either.

How are you guys accomplishing this sort of thing?  (And more
philosophically - why can't you use 'return in a script?)

TIA,

Rodney




[REBOL] recursive RIP Re:(3)

2000-06-23 Thread sterling


By the way, thanks to everybody who posted those fixed up scripts.  It 
saved me some work I didn't have time to spend.  I'm not out of the
hotseat yet so I better run.

Thanks again! (:

Sterling




[REBOL] Return From Middle Of Script? Re:

2000-06-23 Thread lmecir

Hi,

 I have a script that 'do(es) another script.
 The called script assembles a string and returns
 it to the caller by placing the string word as
 the last line in the script.  Fine.
 
 But the called script has numerous places where
 an error can occur and I would like to return
 a partially assembled string at that point.
 How to do this?  'return only works in a function
 and 'halt doesn't seem to allow the script to return
 the last evaluated argument.
 
 In psuedocode what I want is:
 
 if (some condition)
 [
 return "string1"
 ]
 
 but I obviously can't use 'return and the following:
 
 if (some condition)
 [
 "string1"
 halt
 ]
 
 does not return "string1" to the caller.
 
 There doesn't appear to be a 'goto call where I can just
 go to the end of the script either.
 
 How are you guys accomplishing this sort of thing?  (And more
 philosophically - why can't you use 'return in a script?)
 
 TIA,
 
 Rodney
 
 

you can try:

result: catch [
do script
]

and in script:

if some-condition [
throw string1
]




[REBOL] real life examples tutorial page? Re:

2000-06-23 Thread tim

Keith:
I can see where you are coming from... I've been programming
for years and earn a living at it, and new to rebol, I initially
had a similar viewpoint. 
I have found this mailing list and many members to be extremely helpful. 
The rebol development team is definitely very talented and this list
is also a wonderful resource. Keep using it!
Tim
At 09:57 PM 6/23/00 +1000, you wrote:
hi all
i am fairly new to rebol but have done some programming c++/vb...
i was wondering what the list would think about having a page where 
newcomers can see some real life examples of what rebol is capable of.
i have looked thru the user guide and rebol.org but all examples are fairly 
basic and with little or no documentation...i know i learn alot better if i 
can see a question and then a well explained answer
you could have users upload a problem they have had at work and then a 
written explanation of how rebol helped to solve the problem.
as well as being a real life tutorial it would also give people new to the 
language a better idea of what it can do.

let me know what you think pls
many thanks
keith






[REBOL] load

2000-06-23 Thread danielsz

  Does anybody know what the markup refinement for load does ?
  Like in :

  load/markup %file
  

--
[EMAIL PROTECTED]
http://perso.worldonline.fr/mutant






[REBOL] Re: A data inconsistency Re:(10)

2000-06-23 Thread giesse

Hello [EMAIL PROTECTED]!

On 22-Giu-00, you wrote:

 l *Unset*

[...]

 l The problem is, that the difference
 l between words initialized to None, Unset or any other legal
 l value is small. You see some difference just because you see,
 l that Unset is a "second class" Rebol value as opposed to None,
 l which is "first class". 

Hmm... this is an interesting point. I'd really like to hear what
Carl has to say about this...

 l The possible alternatives:

 l 1) Use initialized words and have no exception to the rule,
 l that we can get the value of any word. In this case the
 l simplicity wins. Example:

 lreduce [:word]

 l We may miss some typo protection.

Or, context should be made a little more flexible, with the
ability to add and remove words. Words would no more be added to
system/words; UNSET would remove a word from its context; words
not present in any context would simply be left "unbound" (causing
the error "Word has no value" instead of the current "Word is not
defined in this context"); when setting an unbound word, it would
be added to system/words. A refinement could then be added to SET
to make it possible to add a word to a specific context, so we
would gain the ability to easily extend objects, too.

I think it would be possible to retain a good deal of backward
compatibility this way --- only scripts that explicitly use UNSET!
would break, and perhaps attention would be needed for all those
NONEs that would result from "expressions without result".

Carl? :-)

 l *Armed errors:*

[...]

 l Well, that is one side of reasoning. The other one is, that
 l our code should be able to process values. As long as errors
 l are armed, they are only "second class" values that cannot be
 l handled with normal code without too much complication. OTOH,
 l disarmed Error can be handled with usual code. If we introduce
 l "second class" values, we may introduce complications too. I
 l am pretty sure, that even the Rebol interpreter could be
 l simpler and faster without the "second class" values.

Changing the way ERROR!s work would cause more compatibility
issues, tough; I'd like to hear from other subscribers what they
think about this...

Regards,
Gabriele.
-- 
Gabriele Santilli [EMAIL PROTECTED] - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/




[REBOL] Return From Middle Of Script? Re:(2)

2000-06-23 Thread leshert

Why not something like this:

-- start doer.r: --
REBOL []

do-thing: func [] [
; do your script here
return 1
]

do-thing
--- end doer.r 

Then you can just

 do %doer.r
== 1
-- 
Tim Lesher
[EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 23, 2000 13:08
To: [EMAIL PROTECTED]
Subject: [REBOL] Return From Middle Of Script? Re:


Hi,

 I have a script that 'do(es) another script.
 The called script assembles a string and returns
 it to the caller by placing the string word as
 the last line in the script.  Fine.
 
 But the called script has numerous places where
 an error can occur and I would like to return
 a partially assembled string at that point.
 How to do this?  'return only works in a function
 and 'halt doesn't seem to allow the script to return
 the last evaluated argument.
 
 In psuedocode what I want is:
 
 if (some condition)
 [
 return "string1"
 ]
 
 but I obviously can't use 'return and the following:
 
 if (some condition)
 [
 "string1"
 halt
 ]
 
 does not return "string1" to the caller.
 
 There doesn't appear to be a 'goto call where I can just
 go to the end of the script either.
 
 How are you guys accomplishing this sort of thing?  (And more
 philosophically - why can't you use 'return in a script?)
 
 TIA,
 
 Rodney
 
 

you can try:

result: catch [
do script
]

and in script:

if some-condition [
throw string1
]




[REBOL] load Re:

2000-06-23 Thread sterling


It is meant for dealing with markup languages like HTML, XML, and
sothers in a simple way; try:

foo: load/markup http://www.yahoo.com

or any other site you like.  You'll see that you get back a block of
tags and strings... it kind of unzips the web page.

Sterling

   Does anybody know what the markup refinement for load does ?
   Like in :
 
   load/markup %file
   
 
 --
 [EMAIL PROTECTED]




[REBOL] Return From Middle Of Script? Re:(3)

2000-06-23 Thread rsnell

Thanks for the suggestions.  I like Tim's idea better
since it's easier on the caller (caller can just 'do
the script like normal) and probably a little 
less overhead (try/catch exception handling).

Still seems like maybe a script should be able to just
return a value at any point.

Thanks again,

Rodney
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 23, 2000 11:32 AM
To: [EMAIL PROTECTED]
Subject: [REBOL] Return From Middle Of Script? Re:(2)


Why not something like this:

-- start doer.r: --
REBOL []

do-thing: func [] [
; do your script here
return 1
]

do-thing
--- end doer.r 

Then you can just

 do %doer.r
== 1
-- 
Tim Lesher
[EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 23, 2000 13:08
To: [EMAIL PROTECTED]
Subject: [REBOL] Return From Middle Of Script? Re:


Hi,

 I have a script that 'do(es) another script.
 The called script assembles a string and returns
 it to the caller by placing the string word as
 the last line in the script.  Fine.
 
 But the called script has numerous places where
 an error can occur and I would like to return
 a partially assembled string at that point.
 How to do this?  'return only works in a function
 and 'halt doesn't seem to allow the script to return
 the last evaluated argument.
 
 In psuedocode what I want is:
 
 if (some condition)
 [
 return "string1"
 ]
 
 but I obviously can't use 'return and the following:
 
 if (some condition)
 [
 "string1"
 halt
 ]
 
 does not return "string1" to the caller.
 
 There doesn't appear to be a 'goto call where I can just
 go to the end of the script either.
 
 How are you guys accomplishing this sort of thing?  (And more
 philosophically - why can't you use 'return in a script?)
 
 TIA,
 
 Rodney
 
 

you can try:

result: catch [
do script
]

and in script:

if some-condition [
throw string1
]




[REBOL] View equation solver Re:(2)

2000-06-23 Thread rebol . phb

Think I'll wait for Rebol/Draw before I attempt that ;-))
Though I do have a few ideas for some more maths utilities 

Cheers Phil

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 23 June 2000 00:26
Subject: [REBOL] View equation solver Re:


 
 
 
 f(x)=0,
 thanks, Phil, that was fun!
 
 can we get a graph with that?
 -galt
 
 
 




[REBOL] using floppies?

2000-06-23 Thread tim781

Hi, I'm running some scripts
from floppies and am wondering
what's the fastest way. Will the
entire script be loaded into memory?

thanks... timmmy :)




[REBOL] RE: Dos shell replacements

2000-06-23 Thread dynalt

On 22.6.2000 at 09:05 Ian D. Stewart wrote:
the most commonly
recommended shell replacements being 4DOS (sorry, don't have a URL),
[Garold L. Johnson] http://www.jpsoft.com is the URL for 4DOS, and related
shells.
Garold (Gary) L. Johnson
DYNAMIC Alternatives
[EMAIL PROTECTED]
562 802 1639





[REBOL] igpay atinlay

2000-06-23 Thread ralph

No language is complete without a function for converting from English to
Pig Latin.

I thus do my part to make REBOL complete by offering my first version of the
'piglatin' function, to wit:

--
use it like so:


 do %piglatin.r
Script: "English to Pig Latin" (none)
 help piglatin
USAGE:
PIGLATIN

DESCRIPTION:
 English to Pig Latin
 PIGLATIN is a function value.
 piglatin
Enter phrase to be translated? (no punctuation or caps yet)

the only good thing about free advice is that the price is right

hetay  onlyyay  oodgay  hingtay  aboutyay  reefay  eefayray  adviceyay
isyay  hattay  hetay  ricepay  icepayray  isyay  ightray



here is the code:

REBOL [
TITLE: "English to Pig Latin"
ITLETAY: "Englishyay otay Igpay atinlay"
AUTHORYAY: "Ralph Roberts"
ATEDAY: 23-June-2000
]

piglatin: func ["English to Pig Latin"][

vowels:["a" "e" "i" "o" "u"]
consonants:["b" "c" "d" "f" "g" "h" "k" "j" "l" "m" "n"
"p" "q" "r" "s" "t" "v" "w" "x" "y" "z"
]

print "Enter phrase to be translated? (no punctuation or caps yet) "
phrase: input

a: parse phrase " "
foreach word a [
switch: 0
atinlay: word
foreach vowel vowels [
vowel: to-char vowel
if vowel = first atinlay [
insert tail atinlay "yay"
prin [atinlay " "]
switch: 1
]
prin ""
]

foreach consonant consonants [
consonant: to-char consonant
if consonant = first atinlay [
b: first atinlay
insert tail atinlay b
insert tail atinlay "ay"
remove head atinlay first atinlay
if switch  1 [prin [atinlay " "]
]
]
prin ""
]

]
print ""
]
--

Enjoyyay,

--Ralph Roberts