[REBOL] How to get interval in tenth of sec ? Re:

2000-10-18 Thread larry

Hi Cristophe,

The short answer is NO.


Currently REBOL/Core/View can only return the system clock in seconds. With
Command, you can access a C runtime DLL to get better resolution. Better
time resolution has been requested on this mail-list, but I don't know if it
is on the RT "to do" list.

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 18, 2000 6:46 AM
Subject: [REBOL] How to get interval in tenth of sec ?


>
> Hi list:
>
> In the application i'm now developping, I need a mean to time a response
> interval to an item.
> I could use the classical :
>
> start-time: now/time
> delta-time: now/time - start-time
>
> but this produce a interval in seconds...
>
> I should need an interval in tenth of second !
>
> Does REBOL/Core 2.3.0.3.1 support any function like CPU ( ) in some other
> language ?
>
> Does anybody have any solution to this problem ?
>
> Thanks in advance !!!
>
> ;-) Christophe Coussement
>




[REBOL] Efficient binary functions Re:

2000-10-10 Thread larry

Hi Phil

Don't know about most efficient, but this is probably close:

foreach item reduce [v2 v3][append v1 item]

HTH
-Larry

- Original Message - 
From: [EMAIL PROTECTED] 
To: [EMAIL PROTECTED] 
Sent: Tuesday, October 10, 2000 5:48 PM
Subject: [REBOL] Efficient binary functions


Suggestions !!!
 
v1: #{01}
v2: #{03}
v3: #{44}
 
What's the most efficient way of concatenating v1, v2 and v3
 
Obviously.I can use:
 
append v1 v2
append v1 v3
 
However, if I have X vars to concatenate this is unwieldy.
 
Phil Hayes
 
 




[REBOL] generalities of addresses and values... Re:

2000-10-09 Thread larry

Hi Rishi

Well, there are a lot of issues raised by your questions. I am sure you will
get a number of responses. I will limit myself to a couple of quick
comments.

In many ways REBOL is closely related to the Scheme language.

1) In the Scheme community, pass-by-value means the arguments to a function
are evaluated by the interpreter before the function is called. This is true
of REBOL as well.

2)  In Scheme, all (well almost all) values are (at least conceptually)
pointers (references). So an arg may be evaluated, but the value is a
pointer. REBOL is similar, but more complicated.

In Rebol, if a function has a string or block argument, the argument is
evaluated before the function is called. But strings and blocks evaluate to
themselves. In the case of blocks, the words within the block and
recursively in all nested blocks are added to the symbol global table by the
interpreter before the function is called, but no further processing is
done. The block is then assigned to the local word defined in the function
spec which is in the symbol table local to the function.

But what is really passed into the function and assigned to the local arg
word is a pointer to the string or block.

Here is a short example which illustrates this behavior.

 >> s: "abcdef"
== "abcdef"
>> f: func [x][remove x]
>> f s
== "bcdef"
>> s
== "bcdef"
>> b: [1 2 3]
== [1 2 3]
>> f b
== [2 3]
>> b
== [2 3]
>>
>> x  ;x is a word local to the function f
** Script Error: x has no value.
** Where: x

Notice that modifying the block or string referenced by the local variable
x, also changes the original global value. To prevent that you would have to
use COPY to create a new copy either in the function call or within the
function itself.

HTH
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 09, 2000 11:55 AM
Subject: [REBOL] generalities of addresses and values...


> I'm a bit confused on how references work in Rebol. I wish there was a
chapter in the rebol core manual dedicated on this alone. Perhaps someone
could comment the general way addresses and values work in Rebol.
>
> Here is how I currently think it works...please correct me if I'm wrong.
>
> -all one-level series are passed/copied/attached by value.
> -all one-level objects are passed/copied/attached by value.
> -all one-level functions are passed/copied/attached by value.
> -all datatypes other than objects, series, and functions are
passed/copied/attached by value.
>
> -all deep series are passed/copied/attached by reference.
> -all deep functions (functions within functions or blocks within
functions) are passed/copied/attached by reference.
> -all deep objects (objects within objects or blocks within objects) are
passed/copied/attached by reference.
>
> did I miss anything?
>
> Rishi
>




[REBOL] Transpose Re:

2000-10-06 Thread larry

Hi Andrew, Joel

I'll throw in one more implementation of transpose. Way back last January
and December, Gerald Goertzel and I wrote many routines for linear algebra
and matrix manipulation. We tested many versions of basic matrix functions
like add, multiply, transpose and inverse for speed. Jerry won the speed
contest for transpose with this function which assumes matrices are in the
form created by the ARRAY function. (row major order)

transpose: func [m /local r c mt] [
   r: length? m
   c: length? m/1
   mt: array reduce [c r]
   repeat i r [
  repeat j c [
 poke pick mt j i  pick pick  m i j
  ]
   ]
   mt
]

Enjoy
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 06, 2000 2:11 AM
Subject: [REBOL] Transpose


> Joel wrote:
> > Finally, I'd considered handling the structure-traversing issues
> separately from the data-manipulation issues, by defining (this version is
> VERY quick and dirty):
> >
> > >> transpose: function [b [block!]] [w i s r] [
> > [r: make block! w: accum length? b/1 map b :length? :min
> > [repeat i w [
> > [s: make block! length? b
> > [foreach c b [append/only s c/:i]
> > [append/only r s
> > []
> > [r
> > []
> > >> transpose [[1 2 3 4 5] ["a" "b" "c" "d" "e"]]
> > == [[1 "a"] [2 "b"] [3 "c"] [4 "d"] [5 "e"]]
> > >> transpose [[1 2 3] [14 15 16] [27 28 29]]
> > == [[1 14 27] [2 15 28] [3 16 29]]
>
> I've cleaned it up a bit:
>
> [
> Rebol [
> Name: 'Transpose
> Title: "Transpose"
> File: %"Transpose.r"
> Author: "Andrew Martin"
> eMail: [EMAIL PROTECTED]
> Date: 5/October/2000
> Enhancement: 'Transpose
> Acknowledgements: "Joel Neely"
> Example: [
> transpose [[1 2 3 4 5] ["a" "b" "c" "d" "e"]]
> ; [[1 "a"] [2 "b"] [3 "c"] [4 "d"] [5 "e"]]
> transpose [[1 2 3] [14 15 16] [27 28 29]]
> ; [[1 14 27] [2 15 28] [3 16 29]]
> ]
> ]
>
> Transpose: function [
> [catch]
> "Transposes Matrices"
> Matrix [block!]
> ][
> Results Width Height Column
> ][
> Results: make block! Width: length? Matrix/1
> Height: length? Matrix
> repeat Index Width [
> Column: make block! Width
> foreach Row Matrix [
> insert/only tail Column Row/:Index
> ]
> insert/only tail Results Column
> ]
> Results
> ]
>
> ]
>
> >> transpose [[1 2 3 4 5] ["a" "b" "c" "d" "e"]]
> == [[1 "a"] [2 "b"] [3 "c"] [4 "d"] [5 "e"]]
> >> ; [[1 "a"] [2 "b"] [3 "c"] [4 "d"] [5 "e"]]
> >> transpose [[1 2 3] [14 15 16] [27 28 29]]
> == [[1 14 27] [2 15 28] [3 16 29]]
> >> ; [[1 14 27] [2 15 28] [3 16 29]]
>
> > Critiques/comments/debugging welcome!
>
> I totally agree. :-)
>
> Andrew Martin
> ICQ: 26227169
> http://members.nbci.com/AndrewMartin/
> -><-
>
>




[REBOL] debug help Re:

2000-10-06 Thread larry

Hi Ryan

Yup, I get the same result. In console mode I read your index.r file as:

REBOL [] icon "test" %test

This is a bug in the View Test Panel (demo-init). Apparently your index.r
file is too short for the test-panel progress bar to function correctly. You
should report this to feedback or directly to [EMAIL PROTECTED]

For a workaround, you could try adding a message using the summary keyword.

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 06, 2000 1:56 PM
Subject: [REBOL] debug help


> Could someone try to pull up www.hypermenu.com/index.r from there view
> browser and let me know what happens.  I keep getting this error:
>
> ** Math Error: Attempt to divide by zero.
> ** Where: pbar/data: b / l show
> >>
>
> Thanks,
> --Ryan
>




[REBOL] Bug! - 'second on object containing ONE hash! has TWO hash! !! Re:(2)

2000-10-05 Thread larry

Hi Eric

Well, you beat me to it again. Just a quick comment. You wrote

> >> o/self/self/self/self/self/self/h
> == make hash! []
>
> This is with the non-experimental REBOL/Core. It's interesting that /View
> thinks it's necessary to put the ... indicating recursion when there's no
> recursion involved. Maybe THAT's a bug.

The line:

>>o/self/self/self/self/self/self/h

certainly indicates recursion. What is curious is that the ... shows up for
the value block of the hash and has never showed up for the obvious
recursive self-reference of 'self.

I would be interested in your comments on the puzzle I gave in my own
response to Andrew, if it ever appears on the list.

See you
-Larry

> Eric
>





[REBOL] Bug! - 'second on object containing ONE hash! has TWO hash! !! Re:

2000-10-05 Thread larry

Hi Andrew

Well, the TWO hash is not a problem and has always been this way. Remember
that every object! has the reference 'self as its first element. Second
returns a block with the values of every set-word in the object including
the complete object as the value of 'self. Probe avoids showing the value of
'self.

It is interesting that second shows the actual hash as having the value
[...] which is the new indicator for a recursive block, hash, list, object,
etc. Probe shows the actual value, as does

>>mold second second o

It would be nice to hear from RT as to whether the [...] in your example is
the intended behavior.

In any case, everything about the object and it use is functional, it can be
saved, loaded, etc. You can bind to the hash, etc.

BTW The same thing happens with when you put a block, list, or another
object in the outer object.

Here is a related fun puzzle ;-)

>> b: [1 2]
== [1 2]
>> b/2: b
== [1 [...]]
>> save %junk.txt b
>> b2: load %junk.txt
== [1 [...]
]
>> second b
== [1 [...]]
>> second b2
== [...]
>> first second b
== 1
>> first second b2
== ...

So it is possible to create a block which cannot be saved and loaded. This
may be a bug in load. Only RT knows what lurks in the heart of REBOL. ;-)

Cheers
-Larry

PS You can make a recursive block which cannot be saved and loaded.
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, October 05, 2000 8:40 PM
Subject: [REBOL] Bug! - 'second on object containing ONE hash! has TWO hash!
!!


> Bug! - 'second on object containing ONE hash! has TWO hash! !!
>
> REBOL/View 0.10.35.3.1 30-Sep-2000
> Copyright 2000 REBOL Technologies.  All rights reserved.
> >> o: make object! [h: make hash! []]
> >> o/h
> == make hash! []
> >> second o
> == [
> make object! [
> h: make hash! []
> ] make hash! [...]]
> >> append o/h 1
> == make hash! [1]
> >> second o
> == [
> make object! [
> h: make hash! [1]
> ] make hash! [...]]
> >>
>
> I'm fairly sure that this line:
> make hash! [...]
> shouldn't be present in 'o.
>
> Andrew Martin
> ICQ: 26227169
> http://members.nbci.com/AndrewMartin/
> -><-
>
>




[REBOL] List! series [Was: blank] Re:(2)

2000-10-04 Thread larry

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] Problem with try [ open/direct/binary tcp://... ] Re:(9)

2000-10-03 Thread larry

Hi Carl

> >yeah, REBOLs build-in binary capabilities are a bit strange sometimes :-/
> >## to binary! 100
> >== #{313030}
>
> Doesn't that seem like a bug?
>

Yes, now that you mention it, this has bothered me all along.  It is often
frustrating that to-binary returns the ascii bytes of the string
representation of integers and decimals. It would be useful and logical if
to-binary actually returned the IEEE754 representations for integer and
decimal arguments. This would be very helpful for those few of us who are
interested in using REBOL for engineering and scientific numeric work.

Possibly things are the way they are because the binary type is an
any-string. I guess the internal representation for the data of a binary is
just the same sequence of bytes as a string. Consider

>> to-string to-binary 100
== "100"
>> to-binary 100
== #{313030}
>> to-binary to-string #{313030}
== #{313030}
>>  to-string #{313030}
== "100"

In other words, to-binary and to-string are mutually inverse operations.
They just show different ways of looking at the same underlying byte
sequence.

Cheers
-Larry





[REBOL] Problem with try [ open/direct/binary tcp://... ] Re:(7)

2000-10-02 Thread larry

Hello [EMAIL PROTECTED],

This will get you started:

>> a: #{012345} b: #{6789}
== #{6789}

This will reverse the bytes, you need head because reverse leaves series
pointer at the tail.
>> head reverse a
== #{452301}

And this puts it back.

>> head reverse a
== #{012345}

To "join" two binary values.

>> append a b
== #{0123456789}
>>

Cheers
-Larry

You wrote:

> I'm finding that REBOL's a pretty nice tool to get close to the protocol.
> Out of curiosity, how do you reverse byte order, for things like the
length
> header?  And I havn't seen an elegant way to concatenate binary! type
data.
> Join would be nice.
>
> >> probe join #{012345} [ #{0123} ]
> #{012345237B303132337D}
>
> >> ; This makes me cringe
> >> probe to-binary join to-string #{012345} [ to-string #{6798} ]
> #{0123456798}
> == #{0123456798}
>




[REBOL] System/? Re:(2)

2000-09-30 Thread larry

Hi Jeff

You wrote:

> PROBE SYSTEM
>
>   and a huge pile (~64k) of source code will fly by

The size with Windows versions seems to be larger. I used the following line
of code:

>> write %probe-sys.txt mold system

Core 2.4.37.3.1 produces a file of size 218 kB.

View 0.10.34.3.1 produces a file of 656 kB.

That is for view without the demo-object loaded (i.e., I set start-view?:
off in the user.r file), if the demo-object is loaded (default start-up)
there is an out of memory error.

Cheers
-Larry





[REBOL] Antwort: Compiler for Rebol ? Re:(16)

2000-09-28 Thread larry

Hi Joel

Just a small clarification. You wrote:


>> searchname: func [who [string!] /local k v] [
[foreach [k v] foo [
[if v/name = who [return v]
[]
[]

Actually the declaration of k and v as local vars to the searchname function
is unnecessary as in your example they are never used.  The foreach function
binds the words in it's first arg (also k and v in your example) as local to
it's own context. The outer k and v are unused. Here is a short example:

>> f: func [/local k][
[k: 1
[foreach [k]["a" "b"][print k]
[print k
[]
>> f
a
b
1
>>

Cheers
-Larry






[REBOL] Bug? Rebol/View not able to read nbci site? Re:

2000-09-26 Thread larry

Hi Andrew

I just tried the second Andrew's icon for your rebsite, the one on the right
in the sites window, and it seems to work OK, although the first one has the
same problems as before.  Wondering what made the difference?

Cheers
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, September 26, 2000 1:16 AM
Subject: [REBOL] Bug? Rebol/View not able to read nbci site?


> This fails:
> read http://members.nbci.com/_XMCM/AndrewMartin/RESUME.HTM
>
> on several pages with either network timeout or:
>
> 
> 
> NBCi 404 Error
>
> 
>
> Yet my site can be read with my browser?
>
> I'm using this version of Rebol:
> >> rebol/version
> == 0.10.34.3.1
>
> and it's the very latest version with the correct code for hash!.
>
> Andrew Martin
> Feeling like a failed Jedi apprentice...
> ICQ: 26227169
> http://members.nbci.com/AndrewMartin/
> http://members.xoom.com/AndrewMartin/
> -><-
>
>




[REBOL] Rebcam doesn't work ... Re:(2)

2000-09-25 Thread larry

Hi Jochen, Petr, all

The reb-cam.r script has already been fixed by AllenK, the author.  It is
just a question of getting the updated version on the RT rebsite.

Cheers
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 25, 2000 12:00 PM
Subject: [REBOL] Rebcam doesn't work ... Re:


> On Mon, 25 Sep 2000, you wrote:
> > Hello,
> >
> > has anyone the same problem with latest /View? Trying to run rebcam
returns
> > following error:
> >
> > ** Script Error: face is missing its face argument.
> > ** Where: do face/action
> > ->>
>
> Yes same here, it seems to be a problem with carls new way of handling
> actions (that are now functions)
> I'll take a look at the script
>
> Regards
> Jochen Schmidt
>




[REBOL] HTTP Authentication Re:(3)

2000-09-20 Thread larry

Hi Brett

I don't have a setup to use this for http, but I often use it with ftp.
AFAIK this is the standard URL format for accessing a password protected
http site. You might need to specify a path/page.

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 20, 2000 7:30 PM
Subject: [REBOL] HTTP Authentication Re:(2)


> Thanks Larry but no go. It returned:
>
> HTTP/1.1 403 Forbidden.
>
> Have you seen the method you suggested work? Wondering if it is the server
> I'm trying to access.
>
> Brett.
>
>
snip




[REBOL] HTTP Authentication Re:

2000-09-20 Thread larry

Hi Brett

You can connect this way:

print read http://usrname:[EMAIL PROTECTED]/

HTH
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 20, 2000 6:15 PM
Subject: [REBOL] HTTP Authentication


> When I point my browser to a particular website it displays a dialog box
> asking for username and password, to which I fill it in and I get my info.
>
> How do I achieve this with Rebol?
>
> Thanks,
> Brett.
>
> --
> >> my-rebol-stuff
> == http://www.codeconscious.com/
>
>




[REBOL] Essay on Associative Data Stores Re:(3)

2000-09-19 Thread larry

Hi Joel, Ole

What Joel writes about tradeoffs is true, but the most important thing to
know is that the REBOL hash! datatype only hashes strings (a little missing
documentation). For other datatypes, you just get a more expensive block
with no speed benefits. Jim has said that he will extend it to hash numbers
as well, but no schedule on that.

Cheers
-Larry

PS Joel, I have really enjoyed your recent essays and benchmarks.

-excerpt from original message
> >
> > BTW, using a hash! for the "keys" array would probably be a better
> > idea than just using a block!, as I currently do. _If_ find/only
> > works faster on hash! lists, that is (it should be, but I don't
> > know).
> >
>
> Disclaimer: I've not done the empirical testing of this hypothesis
> for the REBOL implementation of  hash! , so PLEASE take this as
> speculation.
>
> My general experience is that hashing vs. array/list lookup is
> subject to tradeoffs.  There is overhead (both space and time)
> with hashing, which makes it perform more poorly than simpler
> but straightforward lookup schemes for small cases.  As the size
> of the data collection grows, however, that overhead amortizes
> nicely.  Ultimately, for "large enough" collections of data,
> the hash table beats array/list algorithms -- the best way to
> determine how large is large enough, of course, is to run some
> benchmarks, which I'd like to do some time when my higher
> priorities have been handled (and there are LOTS of them! ;-)
>
> -jn-
>




[REBOL] A bug in sorting on dates/times? Re:

2000-09-17 Thread larry

Hi Carl

Yup, I get the same thing.

REBOL/View 0.10.33.3.1 10-Sep-2000
Copyright 2000 REBOL Technologies.  All rights reserved.
Type DEMO to run demo if it is disabled
>> dates: [10-Sep-2000/18:24:13-5:00 10-Sep-2000/18:24:02-5:00]
== [10-Sep-2000/18:24:13-5:00 10-Sep-2000/18:24:02-5:00]
>> sort dates
== [10-Sep-2000/23:24:02-5:00 10-Sep-2000/23:24:13-5:00]
>> dates
== [10-Sep-2000/23:24:02-5:00 10-Sep-2000/23:24:13-5:00]
>>
Also the same with latest experimental builds of Core and Command.

-Larry

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, September 17, 2000 2:54 AM
Subject: [REBOL] A bug in sorting on dates/times?


> I think I've found a bug in 'sort when it's sorting a block of dates. 
> (This is using the experimental Amiga version of REBOL/View
> 0.10.31.1.1.)
> 
> With two files saved as file1 and file2, this is what I get when I
> enter the following...
> 
> >> dates: []
> == []
> >> insert dates modified? %file1
> == []
> >> insert dates modified? %file2
> == [10-Sep-2000/18:24:02-5:00]
> >> dates
> == [10-Sep-2000/18:24:13-5:00 10-Sep-2000/18:24:02-5:00]
> >> sort dates 
> == [10-Sep-2000/23:24:02-5:00 10-Sep-2000/23:24:13-5:00]
> >> dates
> == [10-Sep-2000/23:24:02-5:00 10-Sep-2000/23:24:13-5:00]
> 
> Those first times returned by the dates block are correct, but notice
> how they've jumped from 18hrs... to 23hrs... after being sorted? 
> Sort shouldn't alter what it's sorting, right?
> 
> I've submitted this to feedback, but do others get similar results?
> 




[REBOL] serializing? Re:(2)

2000-09-14 Thread larry

Hi Gabriele

Just a small cautionary note. I have recently noticed that SAVE and LOAD do
not always work.  For instance, in REBOL/VIEW 0.10.33.3.1

>> layo: layout [box 200x200 red]

layo is a face object.

>> view layo ;works fine

>> save %layo.sav layo   ;writes a large file (about half a megabyte)

The file contains indicators of recursive blocks/objects i.e. [...]. So it
will not load back in a valid form.

>> layo2: load %layo.sav

>> view layo2   ;no red box

I have reported this to feedback, but had no response so far.

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 14, 2000 8:33 AM
Subject: [REBOL] serializing? Re:


> [EMAIL PROTECTED] wrote:
>
> > This is called serialization of an object. Is there an easy way to do
this in rebol?
>
> Have a look at the function SAVE. The counterpart is LOAD.
>
> HTH,
>Gabriele.
> --
> Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer
> Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/
>




[REBOL] rebol weak points (i think) Re:(7)

2000-09-10 Thread larry

Hi Carl

Hey, thats great...  I always wondered how you guys incorporated new natives
;-)  ROTFL

But, seriously, I did not mean to imply that there *should* be a REBOL
compiler. Personally, I much prefer to develop code using an interactive
interpreter. I just wanted to make the point that one *could* make a REBOL
compiler with a few restrictions on late binding, etc. (which would not
effect most folks code). I am pleased that you agree.

BTW I just wiped my local www.rebol.com directory and reloaded all the
scripts using View 10.33.3.1.  Everything ran OK except the boing.r demo
which still redefines load-image and do-events. It's looking good.

Could you say a few words more about index files (on the ALLY list or in
publish). I see the new ones have the keyword 'always. Does that cause the
local copy to be refreshed every time?  Does summary work yet?  Would you
like us to put the byte size of files in the icon entries?

Cheers
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, September 10, 2000 6:34 PM
Subject: [REBOL] rebol weak points (i think) Re:(6)


> So, why don't you guys just use the 'compile function?
>
>fast-sort: compile function [data [block!] return: [block!]] [a
[integer!]] [...]
>print type? :fast-sort
>native!
>
> 
>
> Turns out, you *can* write a compiler for REBOL.  However, to do so you
need to make "promises" about a function.  You, the programmer, certify that
the contents of the function is indeed compilable (by not using very late
bound tricks).
>
> The benefit of the above is that you can use the rest of the REBOL
environment for meta stuff... like preprocessing what you will compile.
>
> -Carl
>
-snip




[REBOL] rebol weak points (i think) Re:(5)

2000-09-10 Thread larry

Hi Chris

I agree.  I don't see where Andrew's question presents any real problem. I
suspect the primary problems with developing a compiler for REBOL are 1) The
language design (or at least implementation) are not yet complete and 2) The
semantics are somewhat irregular, so that there would be an awful lot of
special cases to deal with.  Scheme is another language which, in fact, is
rather similar to REBOL in many ways (in REBOL 1.x, it was very similar,
including continuations) and Scheme comes with a compiler as well as an
interpreter (see the DrScheme package from Rice University
http://www.cs.rice.edu/CS/PLT/packages/drscheme/.  It is free and rather
small (just a few MB) and supports threads, GUI programming, and tcp.

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, September 10, 2000 4:20 PM
Subject: [REBOL] rebol weak points (i think) Re:(4)


>
> >Try compiling this:
> >
> > do ask "Please enter some Rebol code: "
>
> FORTH and Lisp systems don't seem to have a problem with this. Most Common
Lisp
> systems I know are compiled and have interactive input. See Corman Lisp
for an
> example (http://www.corman.net). Generally the compiler is part of the run
time
> and compiles the entered code on the fly.
>
> Chris.
> --
> http://www.double.co.nz/cl
> http://www.double.co.nz/dylan
>
>




[REBOL] Compression And Encryption Re:

2000-09-10 Thread larry

Try

http://www.rebol.com/library/html/encrypt.html

You will also find some scripts that deal with using the built-in compress
and decompress functions.

HTH
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, September 10, 2000 4:05 PM
Subject: [REBOL] Compression And Encryption


> Is there anyone or anywhere i can learn to make a rebol encryption script
or
> a compression script?
>




[REBOL] Fixes View: 0.10.29 Re:(2)

2000-09-04 Thread larry

Hi Paul

One of the major changes with build 10.28 and 10.29 is in the syntax for
stylize.  See the original announcement for View prebeta5 on the rebol.org
ally list.  Briefly, stylize now requires a syntax similar to that for
layout (details not yet published).  For a temporary fix, just change
stylize to styliz (no "e").  Your program should work.

To do it right the stylize arg block should be changed to:

form-styles: stylize [
txt12: text  font [color: black shadow: none]
txt16: txt12 font [size: 16]
name:  txt12 100x24 font [align: 'right]
namv:  txt12 with [size: none]
inp:   field 240x24
]

Then it will work.

HTH
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 04, 2000 1:19 PM
Subject: [REBOL] Fixes View: 0.10.29 Re:


> I just ran a few scripts checking the latest Sept 3 posting.  Looks
> something may have happened.  I tried to run the entry-form.r script
> (inserted below).  It gives me an error.  Use to work with previous /View.
>
> Paul Tretter
>
>
> REBOL [ ]
>
> form-styles: stylize [
> txt12 text  [font: [color: black shadow: none]]
> txt16 txt12 [font: [size: 16]]
> name  txt12 [size: 100x24 font: [align: 'right]]
> namv  txt12 [size: none]
> inp   field [size: 240x24]
> ]
>
> address-form: layout [
> styles form-styles
> backdrop 200.190.170
> txt16 bold "Address Book Entry"
> box  460x4 168.168.168 across
> name "First Name:" fn: inp 80x24
> namv "Last Name:"  ln: inp 165x24 return
> name "Street Address:" sa: inp 330x24 return
> name "City:"   ci: inp 100x24
> namv "State:"  st: inp 60x24
> namv "Zip:"   zip: inp 79x24  return
> box  460x4 168.168.168 return
> name "Home Phone:" hp: inp return
> name "Work Phone:" wp: inp return
> name "Email Address:"  ea: inp return
> name "Web Site:"   ws: inp return
> box  460x4 168.168.168 return
> indent 110
> button "Enter" [save-data]
> button "Cancel" [quit]
> ]
>
> save-data: does [
> data: reduce [
> fn/text ln/text sa/text ci/text st/text zip/text
> hp/text wp/text ea/text ws/text
> ]
> print data
> ]
>
> view address-form
>
>
>
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 03, 2000 6:23 PM
> To: [EMAIL PROTECTED]
> Subject: [REBOL] Fixes View: 0.10.29
>
>
> Hmmm. Seems like a lot broke recently in REBOL/View experimental.  Just
> posted a newer one that works better... more reliable for http, email,
> graphics, etc.  Give it a try.
>
> Looks like I'm spending too much time this weekend writing tests and fix'n
> bugs.  And I wanted to work on REBOL/Express!
>
> -Carl




[REBOL] problems with local vars??? Re:(6)

2000-08-18 Thread larry

Hi Galt

You raise some interesting questions. I don't have time right now to go into
much detail on this, so just a couple of quick comments.

> p.s. although Rebol may be "interpreted",
> the body and params and etc. have been fully
> "load"-ed and that means they are like typed
> tokens and bound words that are ready to roll.

make function! which can be used directly and is called by 'func and
'function takes two block args: spec and body.  The spec block contains a
spec which is a REBOL dialect.  It is parsed (internally) with the spec
dialect rules to determine the meaning. make function! creates a local
enviroment or frame with bindings for the local words. The local words
include each arg, each refinement (as a word!), each refinement arg, as well
as each local specified with /local.  These are all bound locally and have
the value unset!.

When the function is executed, the interpreter evaluates the refinements to
true or false, and evaluates the args and refinement args and binds the
local words in the local frame to those values or, as appropriate to none.
The interpreter then simply evaluates 'do body-block.

third :f gives the original spec and first :f gives the word list including
/local to separate those values specified with local.  In both cases, the
words in the returned block are not bound to the local context of the
function. These are "dead" blocks, the original versions in the function
cannot be modified by appending something to the "dead" blocks. In other
words, the spec cannot be modified after the function is created, it is used
during the function creation process (i.e. by make). After creation, these
blocks provide reflective info about the function. Of course, they *can* be
used to create a new function with the same spec or with a modification of
the spec.

second :f is different. It returns a "live" block of code (the body) with
the contained words bound to the local frame of the function f.  This block
of code can be modified with and extended (with append etc. using 'bind if
necessary) after the function is created.  It seems clear that the
interpreter executes the function by 'do-ing this body block.

> It's not like a lot of simple interpreters which are converting
> straight from source as just a string of characters
> for each and every line.

Well, it is not a string, it is a block defined within a context.

> when the function definition is executed
> that baby creates the function! value and
> assigns it to the function's name word,
> and that value sure isnt just a string! of code.

As above, I think the body is a block of code with words bound in a private
frame, which *is* actually evaluated by the interpreter each time the
function is called. Of course, the arg values are bound to the local words
first. Recursion requires more explanation.  See some of the recent posts on
contexts by Ladislav.

> so that makes sense and the interpreter can run
> pretty fast.  I am sure that it is the same
> with Logo, Lisp, Scheme, etc...  I think the
> series type is also something that helps make
> Rebol fast.  I don't recall seeing its like
> in those other cousins of Rebol.

REBOL blocks and more generally series combine the access and modification
features of Scheme lists (head, tail, next, first) and Scheme vectors (pick,
poke, at).

Most of the above is just my current best guess about how function creation
works.

Cheers
-Larry

snip




[REBOL] protect-system caveat Re:

2000-08-18 Thread larry

Hi Grant

This looks like a bug in 'help.  You should send it to feedback.  The
problem is caused by doing the

>> help protect-system

before doing protect-system.

Done in the other order, everything works OK.
snip
Script: "User Preferences" (31-Oct-1999/18:54:30-8:00)
>> protect-system
>> help protect-system
USAGE:
PROTECT-SYSTEM

DESCRIPTION:
 Protects all system functions and the system object from redefinition.
 PROTECT-SYSTEM is a function value.
>> first: 5
** Script Error: Word first is protected, cannot modify.
** Where: first: 5
>>

BTW You can use 'source to look at the code for both 'help and
'protect-system.  If you do

>>source protect-system

before doing 'protect-system, it does not cause this problem, which is one
reason I think the bug is in 'help.

HTH
-Larry


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 18, 2000 12:01 PM
Subject: [REBOL] protect-system caveat


> Setting protect-system seems to incapacitate 'help':
>
> >> help protect-system
> USAGE:
> PROTECT-SYSTEM
>
> DESCRIPTION:
>  Protects all system functions and the system
> object from redefinition.
>  PROTECT-SYSTEM is a function value.
> >> protect-system
> >> help protect-system
> ** Script Error: Word type-name is protected, cannot
> modify.
> ** Where: type-name: func [value] [
> value: mold type? :value
> clear back tail value
> join either find "aeiou" first value ["an "] ["a
> "] value
> ]
> if
> >>
>
> Bummer, huh?
>
> __
> Do You Yahoo!?
> Send instant messages & get email alerts with Yahoo! Messenger.
> http://im.yahoo.com/
>




[REBOL] returning an object from a function, sort of Re:

2000-08-17 Thread larry

Hi Pete

Not sure exactly what you want, but here is a start.  Because you want the
arg of the factory function to become the name of an object, it is probably
best to require it to be a word.  The interpreter will then throw an error
if the arg is not a valid REBOL word before the function is called. This is
also consistent with your stated call syntax

>> logo-factory Logo1; the arg Logo1 is a word in this call, not a
string

We don't want the arg to be evaluated, so we need to quote it in the arg
list (there are other ways of accomplishing the goal, but this is a good
one).  The following function generates the named object and also shows how
to use the given arg in definitions local to the returned object.

>> logo-factory: func ['arg [word!]] [set arg make object! [name: arg]]
>> logo-factory logo1;note REBOL is case insensitive
>> probe logo1

make object! [
name: 'logo1
]
>> logo1/name
== logo1
>> type? logo1/name
== word!

HTH
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 17, 2000 8:36 AM
Subject: [REBOL] returning an object from a function, sort of


> hiall
>
> btw, I sent a message almost identical to this one from my home account
last
> night, and it isn't here. Is it because the list doesn't rec that other
account?
>
> anyway...
>
> I've got a function called logo-factory that accepts a string argument,
and
> should return an object referenced by a word = the passed string. ie., if
I type
>
> *logo-factory Logo1*
>
> I should get the same result as if I typed
>
> *Logo1: make object! []*
>
> I'm befuddled as to how to do this exactly -- I'm sure the answer is right
under
> my nose ;-)
>
> Here's sort of what I have so far:
>
> *
> logo-factory: func [
> "Creates and returns a named logo object."
> name [string!] "The name of the object to be created."
> ][
> ? make object! [
> type: "text"
> text: ""
> pict: #{}
> file: ""
> altt: ""
> switch-type: func [
> "Toggles the logo object's type between 'text' and 'pict'."
> ][
> type: either type = "text" ["pict"]["text"]
> ]
> ]
> ]
> *
>
> Obviously, there's a lot missing here, like handling an argument string
which
> can't be used as a valid word, etc. Other functions like get-pict and
> write-html, etc., also need to be added.
>
> Any and all suggestions are welcome!
>
>
> --
> Pete Wason|"LWATPLOTG"|[EMAIL PROTECTED]|[EMAIL PROTECTED]|CUCUG|TA|PHX




[REBOL] word Re:(3)

2000-08-14 Thread larry

Hi Fantam

You wrote:
> What a wonderful explanation. Thank you for the insight, Larry.
>
You are welcome!  I realized after my post that there is another important
point about 'bind and contexts which I failed to mention.

I showed you how to bind the words in the code block to the local variable
'member

>> block: ["a" "b" "c"]
>> code: [print member]
>> foreach member block [do bind code 'member]
a
b;member in code bound to local var member
c

What I failed to mention is that the use of bind is permanent (until some
other 'bind occurs) so that the after the foreach loop the global block
referenced by 'code remains bound to the local context of foreach.

>> get second code
== "c"

This is a side effect of using 'bind as above, and may not be the desired
effect. It can also lead to a crash when accessing the value of the code
block if there has been a 'recycle or garbage collection which destroys the
local context of the 'foreach function.  The easy way to leave the original
code block unchanged is to copy before the bind.

>> code: [print member]
>> get second code
** Script Error: member has no value.
** Where: get second code

So 'member is bound to the global context but has no value.

>> foreach member block [do bind copy code 'member]
a
b;member in COPY of code bound to local var 'member
c
>> get second code
** Script Error: member has no value.
** Where: get second code

The global code block remains unchanged.

In general, it is probably better, when possible, to define code blocks in
the context in which they will be used, as there are further complications
with nested sub-blocks as well as in figuring out how to do the necessary
binding when the functions, function calls, and code blocks are complex. In
addition, when modules are added to REBOL some of our current code relying
on bind may be broken.

Cheers
-Larry





[REBOL] problems with series of objects Re:

2000-08-13 Thread larry

Hi Raimund

You are close.  The problem is the items in my-serie are words, not the
values (objects, in this case) to which the words refer.

Try

this-book: get first my-serie
print this-book/info

The GET will dereference the word 'book1, returning the object itself.

If you want the serie to contain the actual objects, you can do this

my-serie: reduce [book1 book2]

then your original access code works

this-book: first my-serie
print this-book/info

HTH

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 13, 2000 2:58 PM
Subject: [REBOL] problems with series of objects


>
>
> Hi,
>
> I try to have a series of self defined objects and pick one of the objects
to
> access it.
>
> Here is the code I use:
>
> REBOL []
>
> book: make object! [
> author:
> title:
> info: none
> ]
>
> book1: make book []
> book1/author: "Fritz the Cat"
> book1/title: "That is the title of book1"
> book1/info: "That is info of book1"
>
> book2: make book []
> book2/author: "Fritz the Cat"
> book2/title: "That is the title of book2"
> book2/info: "That is info of book2"
>
> my-serie: [book1 book2]
> this-book: make book []
>
> this-book: first my-serie
>
>
> print this-book/info
>
>
>
>
> And here comes the output:
>
> raimund@linux:~/Development/rebol/Tests > rebol
> REBOL/View 0.9.9.4.2 1-Jun-2000
> Copyright 2000 REBOL Technologies.  All rights reserved.
> Type DEMO to run demo if it is disabled
> >> do %test_objects.r
> ** Script Error: Cannot use path on word! value.
> ** Where: print this-book/info
> >>
>
>
>
> How can I access the info from this-book? I can make an assignment like
> this-book/info: "This book info" but I can not print it??
>
> Can anyone help me on that??
>
> Thanx
>
> Raimund
>  --
> <->
> 42 war schon immer einge gute Antwort;-))




[REBOL] word Re:

2000-08-13 Thread larry

HI Fantam

The problem is that the word 'member inside the block referenced by 'code is
bound to the global context when the script is loaded, and it remains so
when the "do code" is executed inside the foreach loop.  However,

foreach member block [...]

creates a local variable, also called 'member which will be set (bound)
successively to the items contained in 'block. The name of the iterator
variable is irrelevant to the problem.  You will get the same problem if you
say

foreach x block [...]

because the local variable 'member is never used in the foreach body block.

You can use the function 'bind to bind the words in the external (to the
function foreach) 'code block to the local context of the foreach function
by binding the block to the local variable 'member.

>> block: ["a" "b" "c"]
== ["a" "b" "c"]
>> code: [print member]  ;context for member made here, value given later
== [print member]
>> member: 5
== 5
>> foreach member block [do code]
5
5;member in code bound to global context
5
>> foreach member block [do bind code 'member]
a
b;member in code bound to local var member
c

The latter gives the same result as moving the 'code definition inside the
foreach loop.

>> foreach member block [code: [print member] do code]
a
b
c

Some caution is necessary when using advanced functions like bind.  For
instance, in a more general case than yours, there might be some words in
the external block that need to retain the values of their global binding
despite the fact that those words are also used locally in the calling
function and others that need to be rebound to the calling function's local
context.  In such a case, using bind as above will not give the desired
effect.

The thing to remember is that words have values only within a context, and
the same word may have different values in different contexts.

HTH

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 13, 2000 8:39 AM
Subject: [REBOL] word


>   I am confused. Consider this small script:
>
> REBOL []
>
> block: ["a" "b" "c"]
> code: [print member]
> foreach member block [do code]
>
> Upon execution, I get :
>
> ** Script Error: member has no value.
> ** Where: print member
> >>
>
> I guess I have to use 'bind or 'use somewhere, but I'm not sure which
> and how.
>
> Thanks for your help
> --
> Fantam
>
>




[REBOL] what if you squish one of your words? Re:

2000-08-11 Thread larry

Hi Galt

Well, it happens to the best of us, even Carl.  Eric Long told me a great
story where a line of code he wrote redefined ALL of the system/words
including 'quit.  Th simple answer is to put

protect-system

in your user.r file. It can be before or after any other words you define in
user.r.  You will then get an error message if you attempt to redefine a
system word.  You can still do so hwoever (system-protect is on)

>> print: 5
** Script Error: Word print is protected, cannot modify.
** Where: print: 5
>> print2: :print  ;you can save the word in question
>> unprotect 'print  ;unprotect the word
>> print: 5 ;redefine it
== 5
>> print ;the value of print is the integer 5
== 5
>> print: :print2  ;restore the value
>> protect 'print  ;restore protection
>> print  ;print works again
** Script Error: print is missing its value argument.
** Where: print
>> print: 5   ;and it's protected
** Script Error: Word print is protected, cannot modify.
** Where: print: 5
>>

I use system-protect although some experts feel they know all the
system/words well enough to make it unnecessary.  With the new versions of
Core, View, and Command appearing frequently it is getting harder to keep
track mentally.

HTH

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 11, 2000 3:14 PM
Subject: [REBOL] what if you squish one of your words?


> what if you make screw up like I did
> the other day and kill one of your critical
> key functions.
>
> e.g.
>
> first: "oh, well, it's only a vital rebol word!"
>
> now, I can't get to the original value of the word 'first
> to restore it.  It is a native, and even if I
> run another copy of rebol.exe to check out what it was
> set to, I still don't know if there is a way to set it back.
>
> Usually, it wouldn't matter, I suppose.
> But occasionally you may be in the middle of
> something you don't want to lose.
>
> Is there any way to recover?
>
> -Galt
>
> p.s. I tried this, but it didn't work with a lot
> of functions, including source or help which use first.
>
> first: func [x][pick x 1]
>
> I guess first is heavily overloaded.
> I think it works differently with ports, too.




[REBOL] Finding the previous value in a string Re:(3)

2000-08-11 Thread larry

Hi Allessandro

Yes, there are at least 2 caveats to the approach of converting the string
to a block of  REBOL words with

>> string: "This is a string with some words"
== "This is a string with some words"
>> b: to-block "This is a string with some words"
== [This is a string with some words]
>> type? first b
== word!

The first caveat is that not everything we may want as "words" is a valid
REBOL word.

>> to-block "This is a string |\funny"
** Syntax Error: Invalid word -- |\funny.
** Where: (line 1) This is a string |\funny

So the conversion fails.

The second caveat is that the REBOL dictionary only holds 2558 words.

>> repeat j 3000 [append b to-word join 'word j]
** Internal Error: No more global variable space.
** Where: to word! :value
>> length? first rebol/words
== 2558

CAUTION: There is no way to remove words from the dictionary, the GC does
not touch them.  In order to create a new word after this experiment, you
will have to start a new REBOL session.

So if there are many unique "words" in the string, you will permanently tie
up space in the REBOL dictionary.

Galt's solution:

string: "This is a string with some words"
blk: parse/all string " "
print first back find blk "with"

is much better, because it converts the string to a block of string! values
rather than a block of REBOL words.

If you want to just parse on any whitespace (including linefeed, etc), you
can use

>> parse string none
== ["This" "is" "a" "string" "with" "some" "words"]

which in this case gives the same result as parse/all string " "

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 11, 2000 3:00 PM
Subject: [REBOL] Re: Finding the previous value in a string Re:


> >- Open Your Mind -<
>
>
>
> Quoting from [EMAIL PROTECTED]'s message (11-Aug-00 22:47:59).
>
> s> ; How about this:
> s>
> s> string: "This is a string with some words"
> s> select head reverse to-block string 'with
>
> ... or maybe ...
> first back find to-block string 'with
>
> s> ; Or...
> s>
> s> to-string select head reverse to-block string 'with
> s>
> s> ; ... if you need it converted back into a string.
>
> ... or maybe ...
> to-string first back find to-block string 'with
>
>
> There is some caveat with my approach, but I'm falling down due to severe
lack of sleep and I can't remember it, so goodnight. :-)
>
>
>
>
> Alessandro Pini ([EMAIL PROTECTED])
>
> "Have you been getting enough sleep?" "More or less. Mostly less."
(E.M.H.P. & Janeway)
>




[REBOL] contexts and words Re:

2000-08-11 Thread larry

Hi Galt

You wrote:
> Paths are a little weird, and so on...
> You can't get to the parts of a path
> as if it were a block.

Actually you can:

>> third 'a/b/c
== c

or if the path is referenced by a word

>> p: 'a/b/c
== a/b/c
>> type? :p
== path!
>> third :p
== c

or if the path is in a block

>> blk: ["string" a/b/c]
== ["string" a/b/c]
>> type? second blk
== path!
>> third second blk
== c

The trick is to prevent evaluation of the path in the same fashion as with
functions.  Also you can convert between paths and blocks.

>> to-block :p
== [a b c]
>> to-path to-block :p
== a/b/c

HTH

-Larry





[REBOL] Getting Rebol Word List Re:(6)

2000-08-07 Thread larry

Hi Tim

>> type? :break
== native!
>> type? :func
== function!
>> type? :add
== action!
>> type? :+
== op!

Any-function is a pseudotype which includes function!, action!, op!, and
native! (i.e. the action any-function? returns true for any of these).  Try

help native!
help function!
etc

to get a list of the currently defined values of that type.

Other pseudotypes are series, any-block, and any-string.
This topic is discussed (to some extent) in the docs. Elan's book provides
more info.

HTH
-Larry


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 07, 2000 3:57 PM
Subject: [REBOL] Getting Rebol Word List Re:(5)


> I'm a little confused about the distinction between
> any-function? and function?
>
>   any-function? :break
> == true
> but
> function? :break
> == false
>
> Can anyone enlighten me? I see
> that the function below uses any-function?
> Thanks
> Tim
snip-




[REBOL] Depth of recursion stack

2000-08-06 Thread larry

Hi all

The use of recursive functions in REBOL is limited by the depth of the
recursion stack.  Here is a simple test of the depth using Core 2.4 on
Win98. The len? function gives the same result as the built-in length?
function, but uses recursion.

>> len?: func [s [series!]][either empty? :s [0][1 + len? s: next :s]]
>> len? array/initial 1115 1
== 1115
>> len? array/initial 1116 1
** Internal Error: Stack overflow.
** Where: either empty? :s [0] [1 + len? s: next :s]
>> len? array/initial 1115 1
== 1115

Apparently the stack allows for 1115 recursive calls.

Comments? Other examples?

-Larry




[REBOL] reverse Re:

2000-08-02 Thread larry

Hi Boleslav

Try

>> head reverse "abcd"
== "dcba"

Reverse leaves the current pointer at the tail of the reversed block.

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 30, 2000 11:16 PM
Subject: [REBOL] reverse


> Zdravim,
>
> has anybody ever tried reverse?
> On my 2.3.0.1.1 I get some strange results:
>
> >> reverse 1.2.3.4;for tuple!
> == 4.3.2.1;is it okay
> >> reverse 1x5;for pair!
> == 5x1;is it okay too
>
> this was okay, strange results now:
>
> >> reverse "abcd"
> == ""
> >> reverse #{a1b2}
> == #{}
> >> reverse [a b c d]
> == []
> >> reverse [1 2 "a" "b"]
> == []
>
> etc etc etc...
>
>
> Louci se
> --
> ---
> Boleslav Brezovsky, NOT know as Kryptoplex, maybe on [EMAIL PROTECTED]
> member of R.U.R (means RobotenUndRebol this week)
> www.volny.cz/weirddream   MUSIC&SOUND
listen.to/sintezar   ---

>
>




[REBOL] For those new to list and notetab-gateway users. Re:

2000-08-02 Thread larry

Hi Brett

Nice work!

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 01, 2000 10:24 PM
Subject: [REBOL] For those new to list and notetab-gateway users.


> Hi,
>
> 1) I've created a web page of a collection of posts that have been sent to
> this list over the last few months. By no means is it a complete list. It
is
> just messages that caught my eye while learning Rebol. So if you have been
> on the list for a while you will not find anything new there, but you may
> find your own message :)
>
> 2) Regarding the notetab-gateway I mentioned earlier on the list. I've
fixed
> a bug in the notetab-gateway.r script (used to truncate input to 10k) and
> I've updated the matching clipbook library so that it is a lot more clear
on
> how to call Rebol from Notetab.
>
> The page for both of these is http://www.zipworld.com.au/~bhandley/rebol
>
> Brett.
>




[REBOL] converting I.P. Addresses to integer Re:(2)

2000-08-01 Thread larry

Thanks Eric

Excellent. Also faster. I thought about changing to Horner's method (what
you used) but I was too tired. BTW, the local 'z is now superfluous.

Cheers
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: Larry Palmiter <[EMAIL PROTECTED]>
Sent: Tuesday, August 01, 2000 9:00 AM
Subject: [REBOL] converting I.P. Addresses to integer Re:


>
> Hi Larry,
>
> You wrote:
>
> >tup-to-num: func [x /local out][
> > out: 0.0
> > x: head reverse parse to-string x "."
> > repeat j 4 [
> >  out: out + (256.0 ** (j - 1) * to-integer x/:j)
> > ]
> >]
>
> How about ... ?
>
> tup-to-num2: func [x /local z out][
>   out: 0.0
>   repeat j length? x [
> out: out * 256 + pick x j
>   ]
> ]
>
> See you,
> Eric
>




[REBOL] converting I.P. Addresses to integer Re:

2000-07-31 Thread larry

Hi Tim

>> tup-to-num 207.69.132.8
== 3477439496

HTH
-Larry

---code---

REBOL [
 Title: "Convert IP to number"
 Author: "Larry Palmiter"
 Date: 31-Jul-2000
 File: %tup-to-num.r
 Comment: {
Must be decimal because REBOL
does not support 32 bit unsigned.
Assumes 4 items in tuple
 }
]

tup-to-num: func [x /local out][
 out: 0.0
 x: head reverse parse to-string x "."
 repeat j 4 [
  out: out + (256.0 ** (j - 1) * to-integer x/:j)
 ]
]
  
- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 31, 2000 10:17 PM
Subject: [REBOL] converting I.P. Addresses to integer


> Hello:
> 
> How can an I.P. address be converted to an integer?
> 
> to-integer 207.69.132.8
> Is illegal as far as rebol is concerned, but
> when you really think of it:
> 207.69.132.8 really represents a 32-bit integer
> right?
> 
> So, is there any easy way to do this, or do I have
> to convert it to a string, parse it and to some
> bit-wise shifting?
> 
> TIA
> Tim




[REBOL] Context Stuff Re:

2000-07-31 Thread larry

Hi Paul

Just guessing about your problem, if this is not the answer, you will need
to show us some code. I guess you have something like:

f: func [arg /local str][ ...
str: ""
...
do something that appends something to string
...
]

If so, the problem is not really contexts, but the nature of series literals
in REBOL. If you want an empty string each time the function f is entered,
replace

str: ""

with

str: copy ""   ;creates a new empty string each time

HTH
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 31, 2000 5:39 PM
Subject: [REBOL] Context Stuff


>
> Ok, I have been trying to understand this context stuff.  I know have a
> reason to.  I created a function and have a "word" within a while function
> embedded within.  The problem is that the function does everything I want
> the first time.  However the "word" within the while function continues to
> hold the last value.  I can do a source on the function and see the last
> value within.  How can I have the function return the string value to
> nothing at the end of exection.
>




[REBOL] Truncation Re:

2000-07-31 Thread larry

Hi Paul

Well for numbers of absolute magnitude less than 2,147,483,647 (i.e., within
the range of the integer datatype) you can do this:

>> to-integer 47.2393
== 47

HTH
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 31, 2000 10:31 AM
Subject: [REBOL] Truncation


> How do you truncate a number.  For example if I have the following:
>
> num: 47.2393
>
> How do I get just the 47.  I want to return only the first part before the
> decimal and do NOT want to round the number.
>
> Paul Tretter




[REBOL] A datatype puzzle

2000-07-30 Thread larry

Hi all

Playing around with REBOL datatypes, I created a (slightly perverse) puzzle.
I made a block! referenced by 'blk which shows these properties at the
console:

>> blk
== []
>> print blk

>> length? blk
== 1
>> first blk
>> get to-word first blk
== 30-Jul-2000/17:06:27-7:00
>> x: 1234
== 1234
>> get to-word first blk
== 1234
>> blk
== []

Now the puzzle part. How did I create the block?  Is there a bug here
somewhere?

Cheers
-Larry

Hint: I only used datatypes, no user functions or objects were created.




[REBOL] REBOL SCOPING / CONTEXT EXPLANATIONS Re:(4)

2000-07-27 Thread larry

Hi Brett

Good job!  Your "explanation" agrees well with the one I came up with.  Just
one small correction.

You wrote:
> So that "get b" evalutes to b1. "get-it b1" calls the function in the
object
> and thus returns the value of the word "b" in the object that is
associated with "b1".
> This value (a string) is then appended to the value (a block) of the
global word "var".
> 3.3.3) The same goes for the other two iterations, except that for "b3" a
> function of the nested object returns the value of "a" in that context.

Actually the value of the word 'b in the object referenced by 'b1 is the
block [a], which is then appended to the global 'var block.  The same for
'b2.  For 'b3, get-it returns the function func [][a].  So that

>> print mold var
[a a func [][a]]

The 3 instances of the word 'a are each bound to the separate contexts of
'b1, 'b2, and 'b3 respectively. The evaluation of the a's is done by the
print command which reduces the block before forming it, i.e. 'print block
prints the string that would be produce by 'reform block.

>> reduce var
== ["Time" "for you" "to leave!"]
>> reform var
== "Time for you to leave!"

I have included below the script that I used to investigate certain key
points in Carl's Conundrum. It also shows how one can access the same data
in the anonymous object without using the encapsulated get-it func. Of
course, Carl's example was very contrived -- how else could one short script
have 15 uses (one hidden in 'b2) of the word 'b. :-)

BTW The problem with recycle which I posted can be avoided by naming the
anonymous object created by the function 'b.

o: make object! [

Fun stuff :-)
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 27, 2000 8:45 AM
Subject: [REBOL] REBOL SCOPING / CONTEXT EXPLANATIONS Re:(3)


> Well this deserved a response, since it's has consumed so much of my time
:)
> I do not claim my response to be elegant, but I hope it is practically
> accurate.
> And I want to know if I'll be eligible for that master's degree!

> A description of Carl's Completely Confusing Complex Contexts.
>
> b: function [] [b] [
>  make object! [
>   b1: make object! [a: "Time" b: [a]]
>   b2: make b1 [a: "for you"]
>   b3: make b2 [a: "to leave!" b: does [a]]
>   set 'b [b1 b2 b3]
>   get-it: func [b] [get in b 'b]
>  ]
>  b
> ]

> var: []

> foreach b b: b bind [append var get-it get b] first b
---snip rest---
--code---
REBOL [
 Title: "Carl's conundrum"
 File: %context.r
 Date: 20-Jul-2000
]

b: function [][b] [
 print ["^/function entry: local b type is" type? :b]
 make object! [
  b1: make object! [a: "Time"  b: [a]]
  b2: make b1 [a: "for you"]
  b3: make b2 [a: "to leave!"  b: does [a]]
  set 'b [b1 b2 b3]
  get-it: func [b] [get in b 'b]
 ]
 print ["^/after object: global b type is"
  type? get in system/words 'b
 ]
 print ["^/after object: local b type is" type? :b]
 b
]

print ["^/after function def: global b type is" type? :b]
var: []
foreach b b: b bind [
 print ["^/in foreach: local b is" :b "with value" mold get b]
 append var get-it get b
] first b

print ["^/value of global b is" mold :b]
print ["^/value of global var is" mold var]
print var

print "^/Direct access (not using get-it) to data in object^/"
var2: copy []
foreach x b [append var2 get in get :x 'b]
print mold var2
print var2
;end of script




[REBOL] Words, Bindings and Contexts. (7) Re:

2000-07-26 Thread larry

HI Ladislav

Very cool!  Use of simulated behavior (implemented in REBOL) is a concise
and precise way of expressing one's thoughts about the workings of REBOL
functions.  I find it much more informative than lengthy attempts to
describe in ordinary language how functions work.

I have followed your Words, Bindings, and Contexts posts with great
interest.  I have learned a lot from your discussions and hope to see more.
Just a couple of quick questions:

Can you say more about Dangerous Contexts?  For instance:
>> f: func [x][return x]
>> first :f
== [x]
>> type? first first :f
== word!
>>value? first first :f;REBOL crashes on any attempt to examine the
words in first :f

Isn't this just a bug in REBOL?  Why does it not return an error instead of
crash?

How about a modifying to sim-func to allow handling of /local and
refinements?  Then it would be a more complete model of func.

Thank you again for sharing this excellent material.

-Larry


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 25, 2000 1:37 PM
Subject: [REBOL] Words, Bindings and Contexts. (7)


> I see, that the fact, that my series didn't explain the behaviour
> of functions WRT Recursion and Binding is a flaw. Here is the
> continuation (a model of the behaviour):
>
> ; Model of Rebol function:
> ; 
snip--




[REBOL] Bug in 'use? Re:(11)

2000-07-25 Thread larry

I have been confused for a long time about contexts (touted as an important
feature of the REBOL language) and the related issues concerning 'bind.  It
seems to me that a good explanation of the workings of contexts from RT is
long overdue.

At least tell us if this is for sure a bug and if it is what should have
been the output from Gabriele's example.  Should it have been [2 2 2]?

More confused than ever :-(

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 25, 2000 10:21 AM
Subject: [REBOL] Re: Bug in 'use? Re:(9)


> Hello [EMAIL PROTECTED]!
>
> On 25-Lug-00, you wrote:
>
>  c> That looks like a bug.  -Carl
>
> Hmm... do you have some little spare time to tell us how contexts
> work? Isn't binding done word-by-word? Isn't hierarchy achieved by
> multiple pass binding?
>
> You're confusing me, now. :-)
>
> Regards,
> Gabriele.
> --
> Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer
> Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/




[REBOL] REBOL SCOPING / CONTEXT EXPLANATIONS Re:(3)

2000-07-20 Thread larry

Hi Carl

Just trying to figure out your context test and noticed that recycle causes
an invalid page fault under Win98 Core 2.3 when running this script.

REBOL [
 Title: "Carl's context test"
 File: %context.r
 Date: 20-Jul-2000
]

b: function [][b] [
 make object! [
  b1: make object! [a: "Time"  b: [a]]
  b2: make b1 [a: "for you"]
  b3: make b2 [a: "to leave!"  b: does [a]]
  set 'b [b1 b2 b3]
  get-it: func [b] [get in b 'b]
 ]
 b
]

var: []
foreach b b: b bind [append var get-it get b] first b
recycle ;recycle here causes crash when doing print
print var

Wondering if there is a simple explanation for this?  Seems like something
about the context referencing is destroyed by recycle.

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 20, 2000 10:10 AM
Subject: [REBOL] REBOL SCOPING / CONTEXT EXPLANATIONS Re:(2)


> Good explanation. Fun with contexts. I like the "do" not "try" zen yoda
thing.  Nice touch.  Here's the next one to zen.  "Fetch these objects from
my hand..."
>
> b: function [][b] [
> make object! [
> b1: make object! [a: "Time"  b: [a]]
> b2: make b1 [a: "for you"]
> b3: make b2 [a: "to leave!"  b: does [a]]
> set 'b [b1 b2 b3]
> get-it: func [b] [get in b 'b]
> ]
> b
> ]
>
> var: []
> foreach b b: b bind [append var get-it get b] first b
> print var
>
>
> Sorry, too little sleep and not enough indefinite extent
> makes me write like perl.  Nah...
>
> -Carl
>
> PS: Actually, explain it, and there's not much left to say.
> Really!  Plus, MIT will throw in a Master's Degree for you.
>
> Hint: it's much easier to explain than it looks. But, you've
> got to use a dialect to do it.  (Now I'll be quiet.)
>
>




[REBOL] ENBASE bug Re:

2000-07-20 Thread larry

Hello <[EMAIL PROTECTED]>

Well enbase and debase do have some bugs that have been reported to
feedback, but your example is not a bug, although one could question the way
REBOL currently handles these matters.

Enbase/base takes a string arg and converts each byte of the string to a
string representation of the byte in one of the supported bases.

In your example the ascii character "2" is a byte with the decimal value 50
and the hexadecimal value 32 and a binary value of 00110010.

>> to-char 50
== #"2"

>> to-string to-char 50
== "2"

>> enbase/base "2" 2
== "00110010"

>> enbase/base "2" 16
== "32"

So this is correct because the binary string "00110010" corresponds to the
hex string "32".

If you want the answer as a REBOL binary! value of character 50 dec == 32
hex == "2" ascii == 00110010 bin

>> to-binary "2"  ;REBOL binary is displayed as 2 hex digits but is
just 1 byte and same byte as #"2"
== #{32}

Perhaps you wanted the binary string value for the ascii character with
index 2 which corresponds to a byte with the decimal value 2, hex value 2,
and binary value 0010?

>> enbase/base to-string to-char 2 2  ;a little awkward
== "0010"

If you want the answer as a REBOL binary! value use

>> to-binary to-string to-char 2
== #{02}

I have attached a very short script which prints an ascii table for REBOL
with dec, char, hex, and binary forms.

HTH  if not please ask more questions.

-Larry

-code--

REBOL [
 Title: "Binary-string stuff"
 Author: "Larry Palmiter"
 File: %binarystring.r
 Date: 16-Jul-2000
]

repeat j 256 [
 i: j - 1
 print reduce [
  i
  mold hs: copy skip to-string to-hex i 6
  mold to-char i
  do join "#{" reduce [hs "}"
  ]
 ]
]

Original message:

> Does anyone know if enbase/base refinement has a bug.  When I do the
> following:
>
> a: "2"
> enbase/base a 2
>
> I get:
>
> >>"00110010"
>
> This must be a bug or I need more understanding.
>
>
> --
> Is your email secure? http://www.pop3now.com
> (c) 1998-2000 secureFront Technologies, Inc. All rights reserved.
>


REBOL [
Title: "Binary-string stuff"
Author: "Larry Palmiter"
File: %binarystring.r
Date: 16-Jul-2000
]

repeat j 256 [
i: j - 1
print reduce [
i
mold hs: copy skip to-string to-hex i 6
mold to-char i
do join "#{" reduce [hs "}"
]
]
]


[REBOL] roundoff? Re:

2000-07-18 Thread larry

Hi Ralph

To really do correct rounding for all possible decimal values requires a bit
of work in REBOL.  Problems with overflow, round nearest even, etc.  For all
the gory details see the script decimal.r archived at rebol.org. But just
for fun here is a way to use to-money. May fail to give correct results with
decimal! input too large in magnitude or with too many digits of precision.

>> round: func [x][to-decimal replace to-string to-money x "$" ""]
>> round 1.0051
== 1.01
>> round 1.0049
== 1
>> round -1.0049
== -1
>> round -1.0051
== -1.01

BTW This works better than your roundoff function for negative values:

>> roundoff -1.0051
== -1

Cheers
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 18, 2000 6:57 PM
Subject: [REBOL] roundoff?


> I needed a simple two decimal place round off function for a script this
> evening.
>
> This is what I came up with:
>
> roundoff: func ["Rounds off to 2 decimal places" a][
> a: a * 100
> b: a - to-integer a
> a: to-integer a
> if b > .5 [a: a + 1]
> a: divide a 100
> ]
>
> Here's how it works:
>
> >> roundoff 10.567890
> == 10.57
> >> roundoff 10.56
> == 10.56
>
> Can anyone improve on this, or is there a function already in REBOL I
> overlooked?
>
> Okay, yes, to-money does it:
>
> >> to-money 10.567
> == $10.57
> >> to-money 10.563
> == $10.56
>
> but I want the decimal! type.
>
> --Ralph Roberts
>
>




[REBOL] shortcut? Re:(2)

2000-07-18 Thread larry

Hi Gisle

Nice solution.  I would like to add a small clarification.  When you use
insert/dup it places 5 references to the one instance of the series into the
new block.

>> a: head insert/dup copy [] "series" 5
== ["series" "series" "series" "series" "series"]

>> a/2/1: #"a";change first character of second series in block
== "aeries"

>> a
== ["aeries" "aeries" "aeries" "aeries" "aeries"] ;They are all changed!

BTW adding copy before "series" will not change the behavior because
insert/dup only evaluates it once.

If we want independent copies of the series in the new block, we need to use
a different approach.

>> b: copy [] loop 5 [append b copy "series"]
== ["series" "series" "series" "series" "series"]

>> b/2/1: #"a"
== "aeries"

>> b
== ["series" "aeries" "series" "series" "series"];only second series
changed

Now they are independent.

Which one you want depends on what you want to do with the block.

Cheers
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 18, 2000 7:52 AM
Subject: [REBOL] shortcut? Re:


>
>
> You mean like this?:
>
> >> a: head insert/dup copy [] "series" 5
> == ["series" "series" "series" "series" "series"]
>
> Type 'help insert' to get more info.
>
> Cheers,
> Gisle
>
---snip-




[REBOL] Relative to Absolute Paths (again). Re:

2000-07-16 Thread larry

Hi Bruno

Try this:

parse page: read http://site [
 some [
 thru "=^"/" here: (insert back here "http://site")
 ]
 to end
]

Note the use of 'back

HTH
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 16, 2000 12:23 PM
Subject: [REBOL] Relative to Absolute Paths (again).


> Hello.
>
> I once asked about this problem and it's partially solved (thanks to
> everyone that helped me), but there is one minor problem that I'm usable
to
> solve.
>
> What I want to do is read and HTML page and change all relative paths
to
> absolute ones. For example:
>
> Change
> 
> To
> http://site/path/file">
>
> or
>
> Change
> 
> To
> http://site/path/file">
>
> Here is the partial solution to the problem:
>
> parse page: read http://site [
> some [
> thru "=^"/" here: (insert here "http://site")
> ]
> to end
>
> The problem here is that, with this code, I end up with something like
>
> http://sitepath/file">
>
> As you can see, the "http://site" string is being inserted in the
wrong
> position. How do I fix it in the above sample code?
>
> Thanks.
>
> -Bruno
>
> --
> Bruno G. Albuquerque ([EMAIL PROTECTED]) BeDevId 15362
>  Grupo Brasileiro de Usuarios de BeOS - Presidente
>http://beos.din.uem.br
>
> "I am returning this otherwise good typing paper to you because someone
> has printed gibberish all over it and put your name at the top."
> -- English Professor, Ohio University




[REBOL] Reading Binary data Re:(3)

2000-07-16 Thread larry

Hi Tim

Seems that skip does not work with open/direct/binary although it does work
with open/direct.  This may be a bug.

In the meantime, you can advance the file pointer with copy/part:

>> fp: open/direct/binary %test-char.r
>> copy/part fp 10  ; returned value discarded when run in a script
== #{6162636465666768696A}
>> print to-string buffer: copy/part fp 10
klmnopqrst
>> close fp
>>

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 16, 2000 8:56 AM
Subject: [REBOL] Reading Binary data Re:(2)


> Hi Jim:
> That part worked thanks! However, if have not gotten
> the results that I had hoped for.
> I had assumed that skip fp 10 would take me to offset
> 10. It appears that it has not.
>
> TestBin.txt contains the characters:
> "abcdefghijklmnopqrstuvwxyz"
>
> The following code :
> ;===
> fp: open/read/direct/binary %TestBin.txt
> skip fp 10
> print to-string buffer: copy/part fp 10
> close fp
> ;===
> produces:
>
> >> do %BinFile.r
> abcdefghij
>
> The result I would be looking for in buffer
> would be "klmnopqrst"
>
> So it appears that skip fp 10 is not advancing
> the "file pointer" to offset 10.
>
> what would I do to make that happen?
> Thanks
> Tim
---snip---




[REBOL] bugs in Rebol/Core 2.3 Re:

2000-07-15 Thread larry

Hi Cal

Looks like RT forgot to implement /case for 'unique.  You should send it to
feedback.

Your second bug does not show up on my Win98 machine.  Using a fresh
instance of REBOL/Core:

>> system/version
== 2.3.0.3.1
>> t
== "azbrbar"
>> find/any/case t "B*"
== none
>> find/any/case t "b*"
== "brbar"
>> find/case t "B"
== none
>> find/case t "b"
== "brbar"

Seems OK.  Perhaps previous definitions or executed programs messed
something up on yours.

Cheers

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 15, 2000 3:14 PM
Subject: [REBOL] bugs in Rebol/Core 2.3


> Found two more bugs (both in Rebol/Core 2.3 on Win98, haven't checked
other
> versions).
>
> First, the recently added 'unique function ignores the /case refinement.
> it doesn't even look at it's refinement, it just passes its argument to
> 'union.
>
> Second (this is the weird one), find/any (search w/ wildcards) is broken.
> Until I started writing this I thought I had the problem pegged down, but
> now I can't seem to reproduce my previous results to show you, now I get
> unrelated bad results. Anyway here is an example of find/any/case failing:
>
>>> t
>== "azbrbar"
>>> find/any/case t "B*"
>== "rbar"
>>> find/case t "B"
>== none
>
> previously I had been getting starnge behavior when the string being
> searched in was not at its head, I don't have time to keep messing with it
> at the moment, but it definately is not working correctly.
>
> 
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com




[REBOL] func[func] Re:(11)

2000-07-14 Thread larry

Hi Jake

Nice to hear from others with interest in symbolic programming in REBOL.  I
believe there are a few of us on the list.

I think most of the things that have been presented on this list concerning
symbolic and functional programming in REBOL and issues with scoping and
context have been discovered through a lot of experimentation and guesswork
as opposed to "intuitive grasp" (speaking for myself of course) and through
interchanges with others on this list.  Some of the things you have seen
referenced in the last few weeks were the result of many iterations
involving several people over a period of several weeks.  Hopefully, more
complete documentation of REBOL from the creators is on the way.  That would
help a lot.

BTW If you figure out any neat ways to do some of these symbolic things,
please let us know :-)

-Larry


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 12, 2000 3:32 PM
Subject: [REBOL] func[func] Re:(10)


> [EMAIL PROTECTED] wrote:
>
> > BTW When I was first learning REBOL last fall I tried programming many
of
> > the samples from the "Wizard Book" by Sussman et. al..  I found that it
was
> > not really possible to write programs with the same behavior as the
Scheme
> > examples, possibly because of the lack of dynamic binding in REBOL.
> > Presumably in REBOL 1.x this was possible.
>
> I was planning do to exactly the same thing when I get a chance!  It
> looks like some of the messages that have been posted to this list over
> the past few weeks should be very helpful.  I feel bad because, while I
> can realize that there is a lot of subtle stuff going on with issues
> like when variables are bound, I don't seem to have the intuitive grasp
> of how things work that other people on this list do.. or rather, I have
> to work a little bit harder to figure out what's going on.. and an
> exercise like porting the samples from the Wizard Book should bring
> things into a closer focus for me.
>
> -Jake




[REBOL] Rebol script tag in html to do from inside rebol Re:

2000-07-12 Thread larry

Hi Galt

The command is not correct (I seem to have deleted the e-mail from which you
quoted).  It should be just

do http://www.rebol.com/library/scripts/inhtml.r

Use of READ is what causes the problem.

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 12, 2000 9:28 AM
Subject: [REBOL] Rebol script tag in html to do from inside rebol


>
>
>
> It doesn't work for me:
>
> >> do read http://www.rebol.com/library/scripts/inhtml.r
> connecting to: www.rebol.com
> ** Syntax Error: Invalid word -- messages,.
> ** Where: (line 2) email messages, WEB pages, news groups, etc.
> >>
>
> -galt
>
>




[REBOL] func[func] Re:(9)

2000-07-11 Thread larry

Hi Galt

You wrote:

> I have a question:
> Is the function f inside each object in saved actually pointing
> to the same code, or is it a separate instance completely?

AFAIK the functions in each of the stored objects are all independently
created.  They look identical when using 'source because 'source does not
indicate the context.  One of the real shockers in REBOL is that contexts
allow things to look identical which are not because of the context.  A nice
example due to Gabriele IIRC:

data: []
use [x][x: 5 append data 'x]
use [x][x: 6 append data 'x]
use [x][x: 7 append data 'x]

>> data
== [x x x]
>> reduce data
== [5 6 7]


> I see now of course that z sure looks like a free variable,
> resolving to the context of the object?  Does an object have a context,
too?
> Does the object reach into the context of f and tweak it's value, or does
> it run f inside it's own object context?

I think that what we are doing in returning 'f is making an entity in the
context local to 'make-add available externally. So we are able to directly
reference the function inside the unnamed object inside the local block
'saved inside the function 'make-add.  And the value of 'z is also known in
the context of the unnamed object.

It should also be possible to modify the contents of the 'saved block (for
instance delete some of the objects) and still have the other functions
work.  Cautions on GC and internal stack overflow errors.

BTW When I was first learning REBOL last fall I tried programming many of
the samples from the "Wizard Book" by Sussman et. al..  I found that it was
not really possible to write programs with the same behavior as the Scheme
examples, possibly because of the lack of dynamic binding in REBOL.
Presumably in REBOL 1.x this was possible.

One way of looking at the encapsulated 'make-add is that while REBOL does
not natively provide them, it can be used to create (somewhat cumbersome)
structures which emulate certain features of languages like Scheme.

Cheers

-Larry





[REBOL] func[func] Re:(7)

2000-07-11 Thread larry

Oops,

Cut and paste of wrong version led to omission of  /local. Should have been:

make-add: func [x /local saved][
  saved: []
  get in last append saved make object! [
  z: x
  f: func [y][+ z y]
  ] 'f
 ]

The original as given below is identical to Jeff's except that the stored
objects are shown when doing

>>source make-add

but 'saved is still a global word.  With /local as above, 'saved is known
only in the context of the function make-add.

Sorry for the confusion

-Larry

- Original Message -
From: Larry Palmiter <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 10, 2000 8:04 PM
Subject: [REBOL] func[func] Re:(6)


> Hi Jeff
>
> You wrote:
> >   save-em: copy []
> >   make-adder: func [x][
> >   get in last append save-em make object! [
> >   z: x f: func [y][+ z y]
> >   ] 'f
> >   ]
> >
> >   The above creates new contexts to hold the different values
> >   of X in your separate add functions.  (It also creates new
> >   functions that use those X values).
>
> Nice and it works.
>
> One can also tidy things up by encapsulating the block of saved items in
the
> function which also illustrates a practical use of the behavior of literal
> blocks contained in functions.
>
> make-add: func [x][
>  saved: []
>  get in last append saved make object! [
>  z: x
>  f: func [y][+ z y]
>  ] 'f
> ]
>
> Cheers
>
> -Larry
>




[REBOL] func[func] Re:(6)

2000-07-10 Thread larry

Hi Jeff

You wrote:
>   save-em: copy []
>   make-adder: func [x][
>   get in last append save-em make object! [
>   z: x f: func [y][+ z y]
>   ] 'f
>   ]
>
>   The above creates new contexts to hold the different values
>   of X in your separate add functions.  (It also creates new
>   functions that use those X values).

Nice and it works.

One can also tidy things up by encapsulating the block of saved items in the
function which also illustrates a practical use of the behavior of literal
blocks contained in functions.

make-add: func [x][
 saved: []
 get in last append saved make object! [
 z: x
 f: func [y][+ z y]
 ] 'f
]

Cheers

-Larry




[REBOL] Browser? Re:(3)

2000-07-06 Thread larry

Hi Pete

In order for the reb page to work, the PUBLIC subdirectory of the /View home
path on your machine must exist before the reb page is accessed.  You may
need to create it manually.

HTH
-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 06, 2000 2:00 PM
Subject: [REBOL] Browser? Re:(2)


> [EMAIL PROTECTED] wrote:
> >
>
> >
> > REBOL []
> > do http://www.2b1.de/
>
> >> do http://www.2b1.de/
> ** Access Error: Cannot make directory /c/Program
> Files/REBOL/View/public/www.2b1.de/.
> ** Where: m-dir path return path
> >>
>
> ???
>
> --
> Pete Wason|"LWATPLOTG"|[EMAIL PROTECTED]|[EMAIL PROTECTED]|CUCUG|TA|PHX
>




[REBOL] Status words Re:

2000-06-22 Thread larry

Hi Harry

The globally known words are returned in a block by

words: first system/words

You can print them one to a line with

foreach word first system/words [print word]

You can use WHAT to list all functions.

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 22, 2000 4:36 PM
Subject: [REBOL] Status words


> Did not find any word in the dictionary to list all native words and user
> defined words, is there one?
>
> Forth has a word to list all the words in the dictionary.  Logo has
commands
> to list user defined words and variables.  Would be nice if Rebol has
> something similar.
>
>
> --
> Harry Parshall Jr.
> [EMAIL PROTECTED]
>




[REBOL] Optional Arguments Working? Re:(3)

2000-06-21 Thread larry

Hi Rodney

Yeah, mine does that too.  It is even weirder than that.  Look at this
script.  When no args are supplied, the function f is not called, when an
arg is supplied for the 6th call, the function is called all 6 times!  I
think you have found a genuine REBOL bug and have CC'd our correspondence to
feedback.  Of course, the bug credit is yours.

Cheers

Larry

REBOL []

print {
 Bug in optional args called from script.
 If  123 is removed from the 6th call to f,
 f is not called at all.
}


f: func [a [any-type!]][print "f got called"]

f
f
f
f
f
f 123
halt

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 21, 2000 11:35 AM
Subject: [REBOL] Optional Arguments Working? Re:(2)


> Hi Larry,
>
> My user.r is minimal - just a set-net[] and a
> system/view/ check for /View beta 4.1 (v 0.9.9.3.1).
> No other scripts get invoked before this (it happens
> on a fresh instance of /View after a reboot).
>
> I am using WinNT4 SP3.
>
> Here is one difference I just noticed, though.  If
> I type the f: function directly in the console window
> and then invoke it by typing f - it works and I get
> "hello" back.  If I put the same thing in a script
> called test.r (below) and type do %test.r - I get
> nothing printed.
>
> Does this also happen for you?  I get the same behavior
> on my home Win98 machine using /Core.
>
> Thanks,
>
> Rodney
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 21, 2000 11:06 AM
> To: [EMAIL PROTECTED]
> Subject: [REBOL] Optional Arguments Working? Re:
>
>
> Hi Rodney
>
> >> source f
> f: func [a [any-type!]][print "hello"];cut-and-pasted from your
> e-mail
> >> f
> hello
> >> f "abc"
> hello
> >>
>
> Hmm, all of the example from the user guide and your function, F, work
fine
> on my setup using Viewbeta4.1 on Win98.  What OS are you using?  What is
in
> your user.r file and other scripts that may have been invoked before the
> code in question?
>
> -Larry
>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, June 21, 2000 9:19 AM
> Subject: [REBOL] Optional Arguments Working?
>
>
> > Maybe this has been discussed on the list before
> > but if I copy/paste the example in the users-guide
> > about how to use optional arguments in a function:
> >
> > print-vals: func [arg1 arg2 [any-type!]] [
> > print either value? 'arg2 [[arg2 arg1]][arg1]
> > ]
> >
> > print-vals "abc"
> > abc
> >
> > print-vals "abc" 123
> > 123 abc
> >
> > I never get the example results.  If I don't really pass a
> > second value to print-vals I get a "Script Error - "abc" has
> > no value".  If I try:
> >
> > f: func [a [any-type!]][print "hello"]
> >
> > f
> >
> > Now I get no Script Error but the function never gets called
> > ("hello" doesn't print unless I actually pass an arg).
> >
> > I've tried this with the same results on /Core, /Command, and /View.
> >
> > What am I doing wrong?
> >
> > TIA,
> >
> > Rodney
> >
>




[REBOL] Optional Arguments Working? Re:

2000-06-21 Thread larry

Hi Rodney

>> source f
f: func [a [any-type!]][print "hello"];cut-and-pasted from your
e-mail
>> f
hello
>> f "abc"
hello
>>

Hmm, all of the example from the user guide and your function, F, work fine
on my setup using Viewbeta4.1 on Win98.  What OS are you using?  What is in
your user.r file and other scripts that may have been invoked before the
code in question?

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 21, 2000 9:19 AM
Subject: [REBOL] Optional Arguments Working?


> Maybe this has been discussed on the list before
> but if I copy/paste the example in the users-guide
> about how to use optional arguments in a function:
>
> print-vals: func [arg1 arg2 [any-type!]] [
> print either value? 'arg2 [[arg2 arg1]][arg1]
> ]
>
> print-vals "abc"
> abc
>
> print-vals "abc" 123
> 123 abc
>
> I never get the example results.  If I don't really pass a
> second value to print-vals I get a "Script Error - "abc" has
> no value".  If I try:
>
> f: func [a [any-type!]][print "hello"]
>
> f
>
> Now I get no Script Error but the function never gets called
> ("hello" doesn't print unless I actually pass an arg).
>
> I've tried this with the same results on /Core, /Command, and /View.
>
> What am I doing wrong?
>
> TIA,
>
> Rodney
>




[REBOL] how to do the string comparison Re:

2000-06-20 Thread larry

Hi tZ

>> a: "helloworld"
== "helloworld"
>> found? find a "hello"
== true

>>help find   ; for more info

-Larry

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 20, 2000 3:24 PM
Subject: [REBOL] how to do the string comparison


> Hello,
> 
> Can anyone help me on the following problem?
> 
> How can I detect a string which is a part of another string?
> e.g, a: "helloworld"
>  b: "hello"
> 
> How can i tell b is part of a?
> 
> Thanks a lot.
> 
> tZ
> 




[REBOL] teeny-bits-of-time/2 Re:(6)

2000-06-20 Thread larry

Hi Petr

> > In December 99, I ran a lot of timings for linear algebra operations in
> > REBOL, for instance matrix multiplication, matrix inversion, LU
> > decomposition, etc. on 100x100 randomly generated matrices.  The bottom
line
> > was that REBOL was about 80-300 times slower than MATLAB which uses
highly
> > optimised C-code for the same operations.
>
> Uh oh, hmm, so much? Matlab is interpreted too, no? But well, MathWorks
has
> great know-how and I believe matrix operations run natively.

Yes, MATLAB is an interpreter, and a very nice one.  But the work is done by
calls to a compiled C-code library.  So entire matrix inversion, etc. is
done in C, only array addresses and sizes are passed to the library
functions.  As a result the runtimes are (nearly) comparable to that of a
pure C program.

> I requested matrix operations being added to rebol, but got no reply. I
think
> they are "basic advanced" math stuff :-) Well, at least my friend havily
using
> Matlab told me that having such functionality natively implemented in
REBOL,
> would open us the whole field for "fast" image effect creations ... And at
later
> stage, such stuff could be moved into separate /Math module(s).

Of course with Command we could write our own matrix package in C, FORTRAN,
PASCAL, etc. and call the functions from REBOL.

A nice approach to math libraries is that used by Python.  There is a free,
public-domain add-on called Num-Py distributed by Lawrence Livermore
Laboratories in source code form (check at http://www.python.org).  This
package is a stripped down version of LAPACK Lite, one of the premier
numeric function libraries for linear algebra.  It does most of what one
would need including FFT, SVD, LUD, linear regression, and matrix
operations.  It is implemented by a fairly thin Python wrapper class which
hides the intricacies of the function calls.  It is fast!  Only 2 to 4 times
slower than MATLAB for the operations I timed.

I am interested in possibly creating a wrapper in Command for the Num-Py
library (or more ambitiously for LAPACK Lite itself).  I would need some
help from a bona-fide C-coder, familiar with details of external library
calls (alignment, arg order, byte reversing, mem pointers, etc.).  For us
numeric types, this would be a wonderful enhancement to REBOL!  And very
useful for image processing as you note.

IMO using an interpreted language like REBOL to issue high-level math
commands in compiled binaries gives us the best of both worlds.  In fact,
one of the world's largest and most computationally intensive simulation
programs "The Digital Orrery" uses this approach with Scheme as the
high-level interpreted programming language.

-Larry

> -pekr-
> > -Larry





[REBOL] teeny-bits-of-time/2 Re:(4)

2000-06-20 Thread larry

Hi Rodney

I found your test results interesting.

> I don't quite understand a couple of things.  The first is how
> GetSystemTime() can be faster than time() (since it is splitting
> out all the fields year, day, etc.).  The second is why it takes
> Rebol so long.  I of course would expect Rebol to take a longer
> time but it seems a little excessive on the outset.  Maybe Rebol
> has no way of "compiling" a statement and interprets it each time?

My guess is that REBOL is a (nearly) pure interpreter, so no "compiling" to
byte-code or equivalent is involved.

> Note that just comparing a C example of incrementing an integer
> a million times vs the Rebol equivalent shows that Rebol is about
> 4 times slower with this task - again, not totally unexpected but
> it does seem like a lot slower.

Actually pretty fast for an interpreted language.  But see below for a more
realistic comparison.

> Another wierd thing I don't understand is if I replace the
> 'while loop in the Rebol example with a 'for loop, the result
> is around 20 seconds!  Thus, using a 'for loop in Rebol is
> slower than using a 'while loop which doesn't seem right to
> me.  I tried the same thing with the C examples and for loops
> are a little faster than while loops, but not much.  Maybe
> Carl and Co. have some clue about this.

Yes, there are differences in the speed of various simple looping constructs
in REBOL.  On 450MHz Win 98 machine with Viewbeta 4.1, I get:

>> t1: now/time loop 10'000'000  [] t2: now/time  t2 - t1
== 0:00:01

>> t1: now/time repeat j 10'000'000  [] t2: now/time  t2 - t1
== 0:00:01

>> t1: now/time j: 0 while [j < 10'000'000] [j: j + 1] t2: now/time  t2 - t1
== 0:00:21

>> t1: now/time  for j 1 10'000'000 1 [] t2: now/time  t2 - t1
== 0:00:50

LOOP is the fastest method, closely followed by REPEAT, WHILE is the next
fastest, and FOR is very slow.  The reason FOR is so slow is that unlike the
others which are NATIVE's, FOR is a function written in REBOL.  You can use
"source for" in order to see the code.  WHILE is slower because it needs to
increment the index using REBOL and also evaluate the REBOL termination
condition. With REPEAT the incrementing of the index is done by the
underlying C-code.  There is no connection between the C FOR and the REBOL
FOR.

> So, not sure what all this means or if there is any way to optimize
> the Rebol operations.  My main concern is that the only way
> to have a timer in Rebol and still perform other processing is
> to loop and call 'now each time which obviously takes a big chunk
> of time.

I think RT should either increase the accuracy of NOW or create a timer
function, in either case returning a result with millisecond precision (the
least significant digits may be inaccurate or set to zero on some systems).
The Command version allows you to directly call the C-runtime library
functions for timing if you wish.

> One bug I saw, even though the users-guide says that refinement of /second
> should work on a date! type, it does not in Rebol/Core.  Maybe
> this is fixed in /View?

The docs are misleading. Actually, /second is a refinement for the time!
datatype:

>> t: now/time
== 13:27:44
>> type? t
== time!
>> t/second
== 44

One needs to exercise caution in interpreting the simple loop timings above
because in many cases the operations in the loop block will require enough
time to make the overhead insignificant.  If not, then use LOOP or REPEAT
when possible.

In December 99, I ran a lot of timings for linear algebra operations in
REBOL, for instance matrix multiplication, matrix inversion, LU
decomposition, etc. on 100x100 randomly generated matrices.  The bottom line
was that REBOL was about 80-300 times slower than MATLAB which uses highly
optimised C-code for the same operations.  This is a more realistic
comparison for numerics intensive work.  These REBOL times are comparable
with those achieved in other interpreted languages, indeed much better than
some.

-Larry

> Rodney





[REBOL] layout/style ? Re:

2000-06-19 Thread larry

Hi z

Try

>> view layout/parent  ..

The name was changed from style to parent in Viewbeta 4.1.

-Larry

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 19, 2000 1:55 PM
Subject: [REBOL] layout/style ?


> in /view i tried 
> 
>   view layout/style [ ... ] [ cust-feel: make feel [ ..some-feel.. ]
> ]
> 
> and i got 
> 
>   ** Script Error: layout has no refinement called style.
> 
> 
> what am i suppose to do if (possible?) to adjust feel through layout?
> appreciate help.
> 
> 
> -z
> 
> __
> Do You Yahoo!?
> Send instant messages with Yahoo! Messenger.
> http://im.yahoo.com/
> 




[REBOL] REBOL and the unix shell Re:

2000-06-13 Thread larry

Hi Jeff

Very nice!  I really like short command utilities like these.

-Larry
 
- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, June 11, 2000 11:56 PM
Subject: [REBOL] REBOL and the unix shell


> 
> Say folks: I put up an article I wrote this weekend on using
> REBOL with the unix shell.  It's a part of some other domain specific
> REBOL materials I've been assembling.  Have a look and please feel
> free to send me any feedback you have.
> 
> http://www.cs.unm.edu/~whip/rebol-unix-shell.html
> 
>  -jeff
> 
> If your mailer is configured to be able to DO emails, then hopefully
> this will take you there:  
> 
> REBOL [] browse http://www.cs.unm.edu/~whip/rebol-unix-shell.html
> 




[REBOL] solved (was detach-image: func (was: %detach.r ) ) Re:(2)

2000-06-13 Thread larry

Hi Eric

Welcome back!  Your detach function works like a charm on my e-mail text
file.  The file was produced with:

write %msg.txt read pop://user:pass%pop-server

Cheers

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 13, 2000 3:12 AM
Subject: [REBOL] solved (was detach-image: func (was: %detach.r ) ) Re:


>
> Hi,
>
> I don't know how helpful it will be, but here's the function I use for
> detaching attachments. It only works for four types of encoding (the type
has
> to be specified), and only for attachments that have an associated file
> name, but it's a pretty simple and general solution, I think. All the
> attachments it can handle will be written into the current directory. If
> the same file name appears more than once the first one will be
overwritten.
>
> Eric
>
snip---




[REBOL] solved (was detach-image: func (was: %detach.r ) ) Re:(8)

2000-06-12 Thread larry

Hi Allen, Ryan

Allen, good catch there.  But there may also be a problem with finding the
start of the base64.  Looking at an e-mail in my pop mailbox:

--=_NextPart_000_0025_01BFD481.83702DE0
Content-Type: image/jpeg;
 name="bay.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="bay.jpg"

/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a
HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy
...

Won't the appearance of the Content-Disposition line cause the code to fail
on this e-mail?
Are the blank lines just before and after the base64 required by the MIME
standard?
Perhaps best to find "image/jpeg" and then find the blank line before the
start of the base64 with "^-^-" ?
Can we find the end of the base64 by looking for the blank line after?
I suppose, we would like to get the image file name as well?

Sorry for the stupid questions, but I don't know much about this.

Cheers

Larry


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 12, 2000 6:18 PM
Subject: [REBOL] solved (was detach-image: func (was: %detach.r ) ) Re:(7)


>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, June 13, 2000 9:13 AM
> Subject: [REBOL] solved (was detach-image: func (was: %detach.r ) ) Re:(6)
>
>
> > This now works (with .jpg images, at least)...
>
> The reason for that is below..
>
> > parse/all email-contents [thru {base64^/^/} copy text to {==} (append
> > > > image-code text)]
>
>  = is only used for  padding in Base64  There is no guarantee that == will
> be the terminator of base64 encoded data.
>
> To find the end you have to go to start of the boundary and trim the
excess.
>
> parse/all email-contents [thru {base64^/^/} copy text to {--} (append
> image-code trim copy text)]
>
> It will work more reliably. "--" will begin a boundary and "-" cannot
appear
> as a char inside base64.
>
>
> Cheers,
>
> Allen K
>
>




[REBOL] downloading big files Re:(3)

2000-06-12 Thread larry

Hi Galt

I set system/schemes/default/timeout: 0:0:45.  With a 384kbs DSL connection,
I was able to download the rm file without any trouble.  Used View beta 4.1,
Win98 450MHz, 128 MB ram. The file is 14827 kilobytes, a little over 1 hour
of music.  Also downloaded it using IE 5, in about the same amount of time.

Not sure how much timeout can be increased or if it works in all cases, but
the server was pretty fast with a consistent download speed of about 37
kilobytes/sec which is close to the DSL max transfer rate. It is likely that
View has improved networking code.

-Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 12, 2000 3:52 PM
Subject: [REBOL] downloading big files Re:(2)


>
>
>
> Sterling,
>
> I spoke too soon, I still got a timeout!
>
> >> go
> url= http://www.grafxsource.com/RnaG/6-3-00-Caitlin-45.rm
> ** Access Error: Network timeout.
> ** Where: data: copy a
>




[REBOL] detach-image: func (was: %detach.r ) Re:(6)

2000-06-12 Thread larry

Hi Ryan

Oops, forgot to say you might need to do a TRIM/ALL on the text string to
get rid of whitespace, before doing the DEBASE operation.

-Larry

- Original Message -
From: Larry Palmiter <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 12, 2000 3:33 PM
Subject: [REBOL] detach-image: func (was: %detach.r ) Re:(5)


> Hi Ryan
>
> Here's the answer.  Do not add the "64{" and "}", just use DEBASE/BASE
Your
> TEXT  var is already a string! datatype.  Look at this:
>
> >> bin: read/binary %bay.jpg
> == #{
> FFD8FFE000104A4649460001010100480048FFDB00430008060607060508
> 0707070909080A0C140D0C0B0B0C1912130F141D1A1F1E1D1A1C1C20242E...
>
> >> bin64: enbase/base bin 64
> ==
>
{/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0
> aH
> BwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQk...
>
> >> write/binary %test.jpg debase/base bin64 64
>
> The JPG is restored.  I e-mailed myself bay.jpg as an attachment using
> base64 encoding,  read my pop mail box into a file,  extracted the base64
> image with a text editor and it was exactly the same as BIN64 above.
>
> HTH
>
> Larry
>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, June 12, 2000 1:38 PM
> Subject: [REBOL] detach-image: func (was: %detach.r Re:(4))
>
>
> > Here is where I'm at...
> >
> >
> > detach-image: func [
> > "detach an image file from the contents of an email"
> > email-contents [string!] "the content of an email"
> > ][
> > image-code: copy []
> >
> > if find/any email-contents {image/jpeg} [
> > parse/all email-contents [thru {base64^/^/} copy text to {==} (append
> > image-code text)]
> > ]
> >
> > insert image-code "64#{" append image-code "}"
> > ]
> >
> >
> > >>img: detach-image msg/content
> >
> > >>write/binary %img.jpg img
> >
> > Still does not display an image in a browser and is unreadable by an
image
> > viewer.
> >
> > -Ryan
> >




[REBOL] detach-image: func (was: %detach.r ) Re:(5)

2000-06-12 Thread larry

Hi Ryan

Here's the answer.  Do not add the "64{" and "}", just use DEBASE/BASE  Your
TEXT  var is already a string! datatype.  Look at this:

>> bin: read/binary %bay.jpg
== #{
FFD8FFE000104A4649460001010100480048FFDB00430008060607060508
0707070909080A0C140D0C0B0B0C1912130F141D1A1F1E1D1A1C1C20242E...

>> bin64: enbase/base bin 64
==
{/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0
aH
BwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQk...

>> write/binary %test.jpg debase/base bin64 64

The JPG is restored.  I e-mailed myself bay.jpg as an attachment using
base64 encoding,  read my pop mail box into a file,  extracted the base64
image with a text editor and it was exactly the same as BIN64 above.

HTH

Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 12, 2000 1:38 PM
Subject: [REBOL] detach-image: func (was: %detach.r Re:(4))


> Here is where I'm at...
>
>
> detach-image: func [
> "detach an image file from the contents of an email"
> email-contents [string!] "the content of an email"
> ][
> image-code: copy []
>
> if find/any email-contents {image/jpeg} [
> parse/all email-contents [thru {base64^/^/} copy text to {==} (append
> image-code text)]
> ]
>
> insert image-code "64#{" append image-code "}"
> ]
>
>
> >>img: detach-image msg/content
>
> >>write/binary %img.jpg img
>
> Still does not display an image in a browser and is unreadable by an image
> viewer.
>
> -Ryan
>




[REBOL] set in object 'variable "string" Re:

2000-06-07 Thread larry

Hello RChristiansen

Here is one way to do what you want:

>> ob1: make object! [x: "hello"]
>> ob1: make ob1 [y: "world"]
>> probe ob1

make object! [
x: "hello"
y: "world"
]

The line

 ob2: make ob1 []

will clone ob1 and any definitions placed in the argument block will be
added to those in ob1.  If a varname in the block is already in ob1, it will
be redefined to the new value in ob2.

HTH

Larry


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 07, 2000 10:42 AM
Subject: [REBOL] set in object 'variable "string"


> How can I add a string to an existing object? The available documentation
> does not explain this.
>
> Here is my console session...
>
> >> test-object: make object! [x: "string"]
> >> probe test-object
>
> make object! [
> x: "string"
> ]
>
> >> set in test-object 'y "another string"
> ** Script Error: set expected word argument of type: any-word block.
> ** Where: set in test-object 'y "another string"
>
> >> another-string: "another string"
> == "another string"
> >> set in test-object 'y another-string
> ** Script Error: set expected word argument of type: any-word block.
> ** Where: set in test-object 'y another-string




[REBOL] Windows path question Re:

2000-06-04 Thread larry

Hi A.D.ing

Try

file:/d/autoexec.bat

You can also access files in the more standard way:

print read %/d/sub1/sub2/my-file.bat

HTH

Larry

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, June 04, 2000 7:31 PM
Subject: [REBOL] Windows path question


> 
> Hi!
> 
> to access a file from the current drive I use
> 
> file://autoexec.bat ;for c:\autoexec.bat
> 
> How I can access the d:\autoexec.bat file?
> 
> (on a Windows platform)
> 
> Thanks in advance,
> A.D.ing
> http://www.zonator.com
> 
> 




[REBOL] REBOL/View examples Re:

2000-06-02 Thread larry

Hi Bo

Very nice!  Everything works fine.

Cheers

Larry

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 02, 2000 5:46 PM
Subject: [REBOL] REBOL/View examples


> Here are some REBOL/View button examples which are pretty easy to
> do.
> 
> Have fun!
> -- 
>Bohdan "Bo" Lechnowsky
>REBOL  Adventure Guide
>REBOL Technologies 707-467-8000 (http://www.rebol.com)
>   Download the REBOL Messaging Language for all Platforms
> 




[REBOL] color-code.r problem Re:

2000-05-30 Thread larry

Hello mijit

REPEND is a recent addition to /Core currently only shipped with /View or
/Command.  It will be in the new version of /Core due very soon.  Meanwhile
you can use the source:

repend: func [
{Appends a reduced value to a series and returns the series head.}
series [series! port!]
value
/only "Appends a block value as a block"
][
head either only [insert/only tail series reduce :value
] [
insert tail series reduce :value
]
]

HTH

Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 30, 2000 11:27 AM
Subject: [REBOL] color-code.r problem


> I keep getting a
> >> write %color-script.html color-code read %color-code.r
> ** Script Error: repend has no value.
> ** Where: repend out data
>
> I do not know what happened? Did I miss another script critical to the
> execution of this one?
>




[REBOL] hidden variables in objects? Re:(12)

2000-05-28 Thread larry

Howdy Jeff

You wrote:

>   ..all the assignments happen before self is evaluated and no words
> wind up being UNSET or END.
> 
>Everything is peachy about all this, but object words shouldn't
> ever be END. They should be UNSET in these conditions-- A minor little
> bug. ;)

So what is END?

Larry





[REBOL] Mailing List Maintenance Re:(2)

2000-05-26 Thread larry

Hi Tim

Your subject should have been: REBOL memory use or similar.  To answer your
question:

On PIII Win98 REBOL/Core initializes using 2.54 Mb of memory.  Large string
variables require 1 byte per character.  Large blocks require 16 bytes per
item for items of type char!, integer!, none!, and decimal!.

HTH

Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 25, 2000 8:18 PM
Subject: [REBOL] Mailing List Maintenance Re:


> Hi:
> For a presentation:
> Does any have a ball-park figure for how much memory
> rebol/core uses?
>
> Comparisons of different OSs would be welcome.
> Thanks
> Tim
>
>
>




[REBOL] variable not local? Re:

2000-05-22 Thread larry

Hi Ryan

Same gotcha as the one I just answered.  To initialize an empty block or
string within a function body or more generally within another block, you
need to use 'copy.  In your code

changecontent-parts: [] tocontent-part: copy []

HTH

Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 22, 2000 4:38 PM
Subject: [REBOL] variable not local?


> Loading the following functions and then using the expression...
>
> convert-email-object msg
>
> ...where "msg" is an e-mail object loaded from a mailbox...
>
> produces too many values for the "body" word in the resultant object...
>
> make object! [
> headline: "Nixon said he will run again"
> subheadline: "Aides said his health is of no concern"
> body: ["first paragraph first article" "" "" "second paragraph second
article"
> "" "first paragraph second article" "" "" "second paragraph second
article" ""]
> ]
>
> Somehow, the "content-parts" variable in the breakdown-content function
> carries over from one operation to a second operation. Why is this
> happening?
>
> Thanks.
>
> -Ryan
>
>
>
> functions used...
>
>
> ; -- BREAKDOWN-SUBJECT --
>
> breakdown-subject: func [
> "breakdown an e-mail subject field into its parts"
> msg [object!] "e-mail message"
> /local
> subject-info [string!] "the Subject line of the e-mail"
> subject-parts [block!] "the parts of the Subject line of the e-mail"
> ][
> subject-info: msg/subject
> subject-parts: []
> foreach part parse/all subject-info ":" [
> append subject-parts part
> ]
> ]
>
>
> ; -- BREAKDOWN-CONTENT --
>
> breakdown-content: func [
> "breakdown an e-mail content field into its parts"
> msg [object!] "e-mail message"
> /local
> article-info [string!] "the body text of the e-mail"
> content-parts [block!] "the paragraphs of the body text of the e-mail"
> ][
> article-info: msg/content
> end-of-paragraph: rejoin [{.} newline]
> content-parts: []
> foreach part parse/all article-info end-of-paragraph [ append
content-parts part ]
> ]
>
>
> ; -- BREAKDOWN-EMAIL --
>
> breakdown-email: func [
> "breakdown an e-mail message object and convert it to an article object"
> msg [object!] "e-mail message"
> /local
> subject-pieces [block!] "a block containing the parts of the Subject line
of the e-mail"
> content-pieces [block!] "a block containing the paragraphs of the body
text of the e-mail"
> article [object!] "an object containing the parts of a news article"
> ][
>
> subject-pieces: breakdown-subject msg
> content-pieces: breakdown-content msg
>
> make object! [
> headline: subject-pieces/1
> subheadline: subject-pieces/2
> body: content-pieces
> ]
> ]
>
>
> ; -- TIME-IN-DIGITS --
>
> time-in-digits: func [
> "convert the date and time from 'now' into a string of digits"
> sun-dial [date!] "the current date and time from 'now'"
> ][
> year: to-string sun-dial/year
> month: to-string sun-dial/month
> if (length? month) < 2 [insert month "0"]
> day: to-string sun-dial/day
> if (length? day) < 2 [insert day "0"]
>
> current-time: sun-dial/time
> hour: to-string current-time/hour
> if (length? hour) < 2 [insert hour "0"]
> minutes: to-string current-time/minute
> if (length? minutes) < 2 [insert minutes "0"]
> seconds: to-string current-time/second
> if (length? seconds) < 2 [insert seconds "0"]
>
> rejoin [year month day hour minutes seconds]
> ]
>
>
> ; -- CONVERT-EMAIL-OBJECT --
>
> convert-email-object: func [
> "convert an email object into an object a news article object and write it
as a file"
> msg [object!] "e-mail message"
> /local
> file-name [string!] "a string of digits used to name a file"
> complete-file-name [string!] "a file name using a string of digits and an
extension"
> ][
>
> now-digits: time-in-digits now
>
> object-name: rejoin ["article" now-digits]
>
> generate-object: rejoin [ reform [ "save" rejoin
[{%absolute/path/articles/} object-name {.r}] ] " " reform [rejoin
[object-name ":"] "breakdown-email msg"] ]
>
> do generate-object
>
> ;temp-one: find person 'full.name
> ;set in article 'byline temp-one/2
>
> ;temp-two: find person 'reporter.title
> ;set in article 'title temp-two/2
>
> wait 1
> ]




[REBOL] strange Re:

2000-05-22 Thread larry

Hi Felix

This is one of the standard REBOL gotchas.  The assignment list: [] creates
a literal block and all subsequent references are to the same block.  That
is why it just gets longer and longer.  To do what you want use

list: copy []

which will create a new empty block each time it executes.

HTH

Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 22, 2000 3:16 PM
Subject: [REBOL] strange


Hi!

I have the following code:

num: 30
to: load %file
until [
  list: []
  print length? list
  loop num [
elem: first to
if elem [ append list elem ]
to: next to
  ]
  print length? list
  print "---"
  tail? to
]

It gives

0
30
---
30
60
---
60
90
---
90
120
---
120
150

Shouldn't list length be set to zero by
list: []
???

Felix P|tsch

--
http://www.ph-cip.uni-koeln.de/~puetsch
Of course I'm crazy, but that doesn't mean I'm wrong.





[REBOL] inserting block into block Re:

2000-04-15 Thread larry

Hi Chris

Use the /only refinement to append:

append/only a b

Cheers

Larry

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 15, 2000 5:31 PM
Subject: [REBOL] inserting block into block


> Hi folks,
> 
> I have a question.
> 
> Let a be [one two three] and b be [1 2 3].
> How do I get b into a so that a looks like [one two three [1 2 3]].
> 
> With append a b I get  [one two three 1 2 3] - but I need [1 2 3] as
> block within a!
> 
> Please help, thanks in advance!
> 
> Chris Langreiter
> langreiter.com




[REBOL] stocks2.r Re:

2000-03-20 Thread larry

Hi there

You can try sending an e-mail to [EMAIL PROTECTED] requesting a copy of
View beta. AFAIK, this is the official way to get a copy.

HTH

Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 20, 2000 3:18 PM
Subject: [REBOL] stocks2.r


> stocks2.r
> No you didn't confuse me...but how do you get a copy of view?  Just
looking at this script it looks like fun!
>




[REBOL] official guide Re:

2000-03-14 Thread larry

Hi Ryan

The release date is listed as April 2000. You can read three chapters here:

http://www.pbg.mcgraw-hill.com/betabooks/feb00/goldman/index.html

HTH

Larry


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 14, 2000 9:12 AM
Subject: [REBOL] official guide


> Has anyone gotten their hands on the REBOL Official Guide yet?
>
> I ordered it through Barnes & Noble two weeks ago and they are having
> trouble getting a copy.
>
> I am wondering how it is written (i.e. what level of programming knowledge
is
> the reader expected to have?)
>
> Also, does the book cover parse pretty well?  And how about CGI?  Are
there
> a lot of useful scripts on the CD-ROM?
>
> Thanks.
>
> Ryan Christiansen
> Consultant
> SEI Information Technology
>



[REBOL] Weird stuff with time Re:(2)

2000-03-09 Thread larry

Howdy folks

Looking at those weird time! values must have boggled my brain.  Please read
"hour" for "year" in my previous post #121264. The message is copied below
with correction. (Bo: can you substitute for previous post to feedback?)

Sorry for the confusion

Larry

- Original Message -
From: Larry Palmiter <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, March 09, 2000 11:35 AM
Subject: [REBOL] Weird stuff with time Re:


> Hi Allen
>
> Interesting. I think the largest time value for hour which works in the
> expected way is:
>
> >> 596522:10:12;this is ok (and far beyond any reasonable hour
> value)
> == 596522:10:12
>
> >> 596523:10:12
> ** Syntax Error: Invalid time -- 596523:10:12.
> ** Where: (line 1) 596523:10:12
>
> REBOL allows integers to be entered for the hour which are larger than
> allowed by the REBOL integer! datatype. This is probably not what was
> intended. Also there are further anomalies.
>
> >> to-time probe rejoin [2 ** 32 ":10:12"]  ;multiples of 2 ** 32
> produce 0 for the hour
> "4294967296:10:12"
> == 0:10:12
>
> >> to-time probe rejoin [2 ** 32 + 1 ":10:12"]   ;we can add 1 and the
hour
> increments
> "4294967297:10:12"
> == 1:10:12
>
> >> to-time probe rejoin [2 ** 32 - 1 ":10:12"]   ;but if we subtract, big
> surprise!
> "4294967295:10:12"
> == -0:49:48
>
> The largest value for hour which does not lead to an error for the 'rejoin
> block is:
>
> >> to-time probe rejoin [999 ":10:12"]
> "999:10:12"
> == 183645:36:20
>
> This limitation is due to the way 'form works, if we enter a larger value
> directly, we get
>
> >> 1000:10:12
> == 183646:36:20
>
> The weird numbers are due to some sort of wrapping of the integer values.
> The behavior is complex, so the explanation you requested will likely have
> to come from someone at Rebol Tech with access to the underlying C-code.
>
> One simple fix would be to return the "Invalid time" error for values of
> hour greater than 596522.
>
> I am copying this to feedback as a bug. You, of course, deserve full
credit
> for the discovery. Good catch!
>
> Cheers
>
> Larry
>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, March 09, 2000 4:44 AM
> Subject: [REBOL] Weird stuff with time
>
>
> > Whilst testing to find the upper limits of time/hour (for an up-time
> > monitoring script)
> > I came across these anomalies in time!
> >
> > Can anyone explain what is happening here?
> > How come some large numbers for hours give an error and others
> > return bizare numbers?
> >
> >  x: 2000:10:12
> > == 2000:10:12
> > >> x: 20:10:12
> > == 20:10:12
> > >> x: 200:10:12
> > ** Syntax Error: Invalid time -- 200:10:12.
> > ** Where: (line 1) x: 200:10:12
> > >> x: 200:10:12
> > ** Syntax Error: Invalid time -- 200:10:12.
> > ** Where: (line 1) x: 200:10:12
> > >> x: 2000:10:12
> > ** Syntax Error: Invalid time -- 2000:10:12.
> > ** Where: (line 1) x: 2000:10:12
> > >> x: 2:10:12
> > ** Syntax Error: Invalid time -- 2:10:12.
> > ** Where: (line 1) x: 2:10:12
> > >> x: 20:10:12
> > ** Syntax Error: Invalid time -- 20:10:12.
> > ** Where: (line 1) x: 20:10:12
> > >> x: 200:10:12
> > == -231041:32:12
> > >> x: 2000:10:12
> > == 75676:02:44
> > >> x: 2:10:12
> > == -436287:32:44
> > >> x: 20:10:12
> > == 409308:53:56
> >
> > Cheers,
> >
> > Allen K
> >
>



[REBOL] Weird stuff with time Re:

2000-03-09 Thread larry

Hi Allen

Interesting. I think the largest time value for year which works in the
expected way is:

>> 596522:10:12;this is ok (and far beyond any reasonable year
value)
== 596522:10:12

>> 596523:10:12
** Syntax Error: Invalid time -- 596523:10:12.
** Where: (line 1) 596523:10:12

REBOL allows integers to be entered for the year which are larger than
allowed by the REBOL integer! datatype. This is probably not what was
intended. Also there are further anomalies.

>> to-time probe rejoin [2 ** 32 ":10:12"]  ;multiples of 2 ** 32
produce 0 for the year
"4294967296:10:12"
== 0:10:12

>> to-time probe rejoin [2 ** 32 + 1 ":10:12"]   ;we can add 1 and the year
increments
"4294967297:10:12"
== 1:10:12

>> to-time probe rejoin [2 ** 32 - 1 ":10:12"]   ;but if we subtract, big
surprise!
"4294967295:10:12"
== -0:49:48

The largest value for year which does not lead to an error for the 'rejoin
block is:

>> to-time probe rejoin [999 ":10:12"]
"999:10:12"
== 183645:36:20

This limitation is due to the way 'form works, if we enter a larger value
directly, we get

>> 1000:10:12
== 183646:36:20

The weird numbers are due to some sort of wrapping of the integer values.
The behavior is complex, so the explanation you requested will likely have
to come from someone at Rebol Tech with access to the underlying C-code.

One simple fix would be to return the "Invalid time" error for values of
year greater than 596522.

I am copying this to feedback as a bug. You, of course, deserve full credit
for the discovery. Good catch!

Cheers

Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 09, 2000 4:44 AM
Subject: [REBOL] Weird stuff with time


> Whilst testing to find the upper limits of time/hour (for an up-time
> monitoring script)
> I came across these anomalies in time!
>
> Can anyone explain what is happening here?
> How come some large numbers for hours give an error and others
> return bizare numbers?
>
>  x: 2000:10:12
> == 2000:10:12
> >> x: 20:10:12
> == 20:10:12
> >> x: 200:10:12
> ** Syntax Error: Invalid time -- 200:10:12.
> ** Where: (line 1) x: 200:10:12
> >> x: 200:10:12
> ** Syntax Error: Invalid time -- 200:10:12.
> ** Where: (line 1) x: 200:10:12
> >> x: 2000:10:12
> ** Syntax Error: Invalid time -- 2000:10:12.
> ** Where: (line 1) x: 2000:10:12
> >> x: 2:10:12
> ** Syntax Error: Invalid time -- 2:10:12.
> ** Where: (line 1) x: 2:10:12
> >> x: 20:10:12
> ** Syntax Error: Invalid time -- 20:10:12.
> ** Where: (line 1) x: 20:10:12
> >> x: 200:10:12
> == -231041:32:12
> >> x: 2000:10:12
> == 75676:02:44
> >> x: 2:10:12
> == -436287:32:44
> >> x: 20:10:12
> == 409308:53:56
>
> Cheers,
>
> Allen K
>



[REBOL] Money Trouble? Re:(2)

2000-03-06 Thread larry


Hi Mike

Thanks for reminding me of the stated fixes for REBOL 2.2.0.

> Fixes
>
> Here are the fixes made to this version since version 2.1.2.
>
>  Small fractions of the money datatype are now correctly rounded to
two
> digits.

Interesting, but apparently untrue. My version of REBOL:

>> system/version
== 2.2.0.3.1

Cheers

Larry


From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 06, 2000 11:16 AM
Subject: [REBOL] Money Trouble? Re:


> Larry,
>
> I had similar problems about a month ago using to-money. They are
> documented on the mailing list archive as #'s 103862 and 104138.
>
> I also noticed the following in the Release Notes for REBOL/Core Version
> 2.2.0 :
>
>
> Fixes
>
> Here are the fixes made to this version since version 2.1.2.
>
>
>  Small fractions of the money datatype are now correctly rounded to
two
> digits.
>
>
> Mike.
>
>



[REBOL] Money Trouble?

2000-03-06 Thread larry

Hi folks,

Over the weekend I was playing with the REBOL money! datatype and discovered
some problems. Using the REBOL/Core console:

>> x: $10
== $10.00

>> y: x + .01
== $10.01

>> y - x
== $0.00 ;surprising result, displayed value is not correctly
rounded

We can check what is happening by retreiving the decimal value from the
money values:

>> dx: second x
== 10

>> dy: second y
== 10.01

>> dy - dx
== 9.79E-3 ;this is the actual numeric value of y - x, it
should round to .01

The problem seems to be incorrect or absent rounding of the difference:

>> to-money dy - dx
== $0.00

Checking when to-money will return .01 vs .00:

>> a: to-money "9.99934E-3"
== $0.00
>> b: to-money "9.99935E-3"
== $0.01

Clearly both of these values should round to $.01.

There some other anomalies also:

>> (y - x) * 1.01
== $0.00

>> (y - x) * 1.1
== $0.01

>> (y - x) * 10;displayed result is wrong by a factor of ten
== $0.01

>> (y - x) * 100  ;displayed result is correct
== $1.00

These problems are not due to the round-off intrinsic to decimal values.
Even in the worst case we have 15 significant digits of precision. The
example shows incorrect rounding in the 4th significant digit.

I wonder whether others have noticed this problem?

Note: this has been CC'd to feedback as a bug.

Cheers

Larry





[REBOL] Return value from a Script??? Re:(3)

2000-03-03 Thread larry

Hi Gabriele

Thanks for the correction. Silly of me to overlook the most simple method of
returning a value from a script.

Ciao,

Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 03, 2000 4:58 AM
Subject: [REBOL] Return value from a Script??? Re:(2)


> [EMAIL PROTECTED] wrote:
>
> > There is no formal mechanism for a script to return a value. There are
> > several distinct ways to use scripts:
>
> Actually, every script returns a value, in the same way as every
> block returns a value. DO will return the last value in the script
> (in the same way as it returns the last value in a block).
>
> Ciao,
> /Gabriele./
> o) .-^-. (--o
> | Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila |
> | GIESSE on IRC \ \-\_/-/ /  http://www.amyresource.it/AGI/ |
> o) `-v-' (--o
>



[REBOL] Return value from a Script??? Re:

2000-03-02 Thread larry

Hi Mike

There is no formal mechanism for a script to return a value. There are
several distinct ways to use scripts:

1) As a function or object library. Then

do %my-script.r   ;loads the functions for use in the console or
within another script.

2) A script can set values for some global variables, which are then used
from the console or within a second script (more general case of 1) ).

In your example below, Script2.r could simply create a global variable:

(in Script2)
script2-return: [value1 value2 other-block "etc"]

Then Script1 can simply use 'script2-return in the code following the call
of Script2.

3) A script could write a file of results using 'load or 'write and these
could be read in by another script.

By designing scripts with these ideas in mind, it is probably not really
necessary to have an explicit return mechanism.

Hope this helps

Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 02, 2000 5:37 PM
Subject: [REBOL] Return value from a Script???


> Hello,
>
> Is it possible for a script to return a value in a similar manner that a
> function does? I've suddenly realised that i have been developing scripts
> but don't seem to have any way for them to communicate with each other?
>
> As in:
>
> Script1.r
> REBOL []
>
> ...
>
> do/args %Script2.r arg
> 
>
> ...
>
> Thanks.
>
> Mike.
>



[REBOL] Sending bytes to TCP port? Re:

2000-03-01 Thread larry

Hi Stan

At the present time, REBOL does not directly support these sorts of
operations. However, it is possible to do it using REBOL. I don't really
have the time to write all of the pieces up, but these comments may get you
started.

1) REBOL's binary! datatype is the closest thing to your "Smalltalk
ByteArray".

2) REBOL does not support 2-byte integers or unsigned integers, only 4 byte
signed integers.

3) You do not specify whether the binary integers need to be byte-reversed
or not. Intel, Motorola 68xxx, and some others require the bytes in each
binary numeric type to be reversed, other machines do not.

4) I don't understand your last entry "12 byte numeric field"?

I have included a small function which will translate REBOL integers into
byte-reversed 2-or-4 byte binary values.

Here is a simple hand calculation example of how to use this function in
conjunction with the binary! datatype which will (hopefully?) work for your
example. I have assumed you want the numbers byte-reversed, if not remove
the "reverse" from TO-BYTE. Notice the binary is displayed in hex digits, so
2 digits/byte.

>> bin: to-byte 694
== #{B602}
>> append bin to-byte/long 251
== #{B602FB00}
>> append bin to-byte 1
== #{B602FB000100}
>> append bin to-binary " 2000-18-15.01.57.00"
== #{
B602FB0001002020202020323030302D31382D31352E30312E35372E3030
30303030
}
>> head insert/dup tail bin to-byte 0 6
== #{
B602FB0001002020202020323030302D31382D31352E30312E35372E3030
30303030
}

;write/binary my-port bin
;or
;insert my-port bin ;port should set up for binary I/O

=TO-BYTE FUNCTION==

to-byte: func [int [integer!] /long][
 head reverse do join "#{" [(copy skip (to-string to-hex int) either
long [0][4]) "}"]
]

Note: there is no checking for sign, so  TO-BYTE will only work properly for
unsigned 2-byte up to 32767 and unsigned 4-byte up to 2147483647. It is
fairly easy to add code to allow REBOL negative integers to be
re-interpreted as the high-half unsigned's.

Someday I will make a whole package for binary signed/unsigned integers, but
no time now. I also have a function for extracting a REBOL integer from a
2/4 byte binary value. Let me know if you need it.

Hope this helps

Cheers

Larry


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 29, 2000 5:53 AM
Subject: [REBOL] Sending bytes to TCP port?


> Hi,
>
> I need to send a sequence of 694 bytes to a TCP port.  My quetion is: How
do
> I collect these bytes?  (In Smalltalk I would use a ByteArray).
>
> I need to send, for example:
>
> 694 as unsigned short (2 bytes)
> 251 as unsigned long (4 bytes)
> 1 as unsigned short (2 bytes)
> ...
> "2000-02-18-15.01.57.00", padded left with spaces,
> as 28 byte character field
> ...
> 0, padded left with 0's, as 12 byte numeric field
> ...
>
> My first reaction is to write functions like the following, but I don't
know
> what to use for the byte-stream.  Suggestions for other approaches also
> welcome.
>
> add-u-long func [
> integer [integer!] byte-stream []
> /local byte
> ][
> for shift-amount -24 0 8 [
> byte: bit-and (bit-shift integer shift-amount) 255
> append byte-stream byte
> ]
>
> Thanks in advance,
>
> Stan




[REBOL] ftp limits? Re:(3)

2000-03-01 Thread larry

Hi Nigel, Sterling

There does appear to be some kind of problem with the REBOL ftp is this
instance. I was able to get the dir listing with WS-FTP although the server
was slow (took about 150 seconds).

With REBOL I got (don't need the user e-mail if set-net has e-mail
configured):

>> system/schemes/default/timeout: 5000
== 5000
>> list-dir ftp://ftp.europe.ibm.com/aix/fixes/cad/other/catia_oem_v4/IRIX/
connecting to: ftp.europe.ibm.com
** User Error: Server error: tcp 421 Timeout (1800 seconds): closing control
connection..
** Where: list-dir
ftp://ftp.europe.ibm.com/aix/fixes/cad/other/catia_oem_v4/IRIX/

I had no problem getting the dir lists for each of the parent directories
using REBOL, so I am inclined to agree with your speculation that the number
of files or the time required for the server to send them is part of the
problem. Based on the tests with WS-FTP, the server should have sent back
the dir-list in about 180 seconds, REBOL apparently was unable to receive or
acknowledge this, leading to the server timeout at 1800 seconds.

The results of using 'trace/net are shown below. I have CC'd this to
feedback, perhaps Sterling or someone else at Rebol tech can diagnose the
problem? (I see Sterling has already replied:-)

I just tried WS-FTP a seond time. It took 120 seconds for the dir-list to
start downloading. The dir-list was fine.

Hope this helps

Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 01, 2000 12:53 AM
Subject: [REBOL] ftp limits? Re:(2)


> Thanks for that. The directory that causes the problem is set drwxr-xr-x
and
> all the files are -r--r--r--. So I don't think this is the same problem.
>
> This certainly looks like a bug in Rebol to me. The directory downloaded
> through an ftp client results in a 137k download (about 1500 files). I
> suspect the problem is caused by the number of files.
>
> I really do need an answer on this - if Rebol cannot do what I want I need
> save my efforts and look elsewhere.
> If anyone want to give it a try...
>
> system/schemes/default/timeout: 1000
> print read
>
ftp://anonymous:[EMAIL PROTECTED]/aix/fixes/cad/other/catia_o
> em_v4/IRIX/
>
> Replace email_address with you correct email address (all activity is
> logged)
>
> Depending on proxy/no proxy/Rebol platform you always get some error or
> timeout without the directory listing ever being received.
>
> Thanks
>
> Nigel
>
-snip

TRACE/NET RESULT==
>> system/schemes/default/timeout: 500
== 500
>> trace/net on
>> list-dir ftp://ftp.europe.ibm.com/aix/fixes/cad/other/catia_oem_v4/IRIX/
URL Parse: none none ftp.europe.ibm.com none
aix/fixes/cad/other/catia_oem_v4/IRIX/ none
Net-log: ["Opening tcp for" FTP]
connecting to: ftp.europe.ibm.com
Net-log: [
none ["220" "230"]]
Net-log: "220-"
Net-log: "220- Welcome to ftp.europe.ibm.com"
Net-log: "220- *  "
Net-log: "220-"
Net-log: {220- You are connected to the FTP gateway for IBM Europe's}
Net-log: {220- Electronic Customer Support Facility. This server is brought
to you by }
Net-log: "220- the IBM Global Services(UK) Web Server Team."
Net-log: "220-"
Net-log: {220- WARNING: Access and usage of this computer system is
monitored.}
Net-log: {220- Unauthorized access is prohibited and is subject to
criminal }
Net-log: "220- and civil penalties. "
Net-log: "220-"
Net-log: {220- Login using the "anonymous" userid. Please supply your email
address}
Net-log: {220- when prompted for a password.  If you have any odd problems,
try logging }
Net-log: {220- in with a minus sign (-) as the first character of your
password. This}
Net-log: {220- will turn off a feature that may be confusing your client
program.}
Net-log: "220-"
Net-log: {220- Please send any questions, comments, or problem reports about
this}
Net-log: "220- server to [EMAIL PROTECTED]"
Net-log: "220-"
Net-log: {220- ***}
Net-log: "220-"
Net-log: "220- Dear user,"
Net-log: "220-"
Net-log: {220- The fixdist download at this site is temporarily
unavailable.}
Net-log: {220- Please reconfigure your fixdist client to point to one}
Net-log: "220- of the following sites."
Net-log: "220-"
Net-log: {220- United Statesservice.software.ibm.com198.17.57.66}
Net-log: {220- Canada   rwww.aix.can.ibm.com204.138.188.126}
Net-log: {220- Germany  www.ibm.de  192.109.81.2}
Net-log: {220- Nordic   ftp.nordic.ibm.com  193.12.214.80}
Net-log: "220-"
Net-log: "220- We apologize for any inconvenience caused.  &qu

[REBOL] Ally list Re:

2000-02-29 Thread larry

Hi Cal

You could try sending e-mail to [EMAIL PROTECTED] begging to be subscribed to
the ALLY list.:-)  Should work.

Ciao

Larry
'
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 28, 2000 9:00 PM
Subject: [REBOL] Ally list


> How do I subscribe to the ALLY list?  I've been playing with the
REBOL/View
> beta, but I don't know how to get on the list to discuss it.. really
> frustrating...
> TIA,
>
> Cal Dixon ([EMAIL PROTECTED])
> -><-
>
> __
> Get Your Private, Free Email at http://www.hotmail.com
>



[REBOL] Testing REBOL/View Beta List Re:(4)

2000-02-28 Thread larry

Hi Carl

Here is the header I got with your post "REB Site Updated":

>From [EMAIL PROTECTED] Sun Feb 27 17:03:32 2000
Received: by mail.ecotope.com from localhost
(router,SLMail V2.7); Sun, 27 Feb 2000 17:03:32 -0800
Received: by mail.ecotope.com from brando.rebol.net
(199.4.95.216::mail daemon; unverified,SLMail V2.7); Sun, 27 Feb 2000
17:03:31 -0800
Received: from office.rebol.net (IDENT:[EMAIL PROTECTED] [192.168.1.9])
 by brando.rebol.net (8.9.3/8.9.3) with SMTP id SAA19286;
 Sun, 27 Feb 2000 18:13:28 -0800
To: [EMAIL PROTECTED]
From: [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
Date: Sun, 27 Feb 2000 17:11:14 -0800
Subject: [ALLY] REB Site Updated
Message-Id: <[EMAIL PROTECTED]>
X-REBOL: 2.2.0.4.2 "The Internet Messaging Language (TM) WWW.REBOL.COM"
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Precedence: bulk
X-Sender: [EMAIL PROTECTED]
X-Mailer: QUALCOMM Windows Eudora Pro Version 4.0
X-SELMA: [ALLY] 6798

Hope this helps

Cheers

Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 28, 2000 1:48 AM
Subject: [REBOL] Testing REBOL/View Beta List Re:(3)


> This problem sounds very odd.  We do not forward ALLY to LIST.  Either it
> is a bug in our email handling, or it is a bug in your client filters.
>
> I have not seen this problem here.  The original message did not appear on
my copy of the main REBOL list. I did not see any sign of the problem until
you posted your reply to the list.  I see no such duplication of messages
(however, I do a lot of message filtering, so it is possible that the
duplicates were filtered out on my side).
>
> Does anyone else see this problem?
>
> -Carl
snip---



[REBOL] New Floating-Point Functions

2000-02-27 Thread larry
e use of FORMAT.

There is way too much in this package to describe in this post, so I will
just present a few examples below. If there is interest, I am willing to
write a few short tutorial posts about floating-point in REBOL.

Have fun exploring REBOL numbers:-)

Larry



EXAMPLES 

REAL/SPLIT calculates the three components of the IEEE representation of a
double floating point value. These are the actual values used by the CPU
in numerical calculations.

>> set [sign exponent fraction] real/split pi
== [0 1024 2.57063812465794E+15]

>> (-1 ** sign) * (2 ** (exponent - 1023)) * (1 + (fraction * (2 ** -52)))
== 3.14159265358979

Numbers smaller in absolute magnitude than 2 ** -1022 (denormals, which have
an exponent component of zero) use a different formula:

>> set [sign exponent fraction] real/split probe 2 ** -1030
8.69169475979376E-311
== [0 0 17592186044416]

>> (-1 ** sign) * (2 ** -1074) * fraction
== 8.69169475979376E-311


REAL/SHOW returns a bit-string which shows the internal IEEE754 double
format. We have separated the 3 components with spaces for clarity. The
format is 64 bits wide with the leading bit being a sign bit (0 pos and
1 neg). The next 11 bits are the base-2 biased exponent. It is biased by
adding 1023 to the actual exponent so that internally all exponents are
non-negative. The remaining 52 bits are the fractional part of the binary
mantissa.

There are two types of doubles: normalized and denormalized. The
normalized values cover the range from 2 ** -1022 up to +Inf. The
denormalized values are equally spaced between 0 and 2 ** -1022 and have
an exponent of 0. The normalized values have an implicit binary point and
leading bit of 1 (i.e., the mantissa 010... represents 1.010...).

>> real/show ieee/min-real
== {0 000 0001}

>> real/show 0
== {0 000 }

>> real/show negate ieee/min-real
== {1 000 0001}

>> real/show ieee/get-next 1
== {0 011 0001}

>> real/show 1
== {0 011 }

>> real/show ieee/get-last 1
== {0 010 }

>> real/show ieee/max-real
== {0 110 }


REAL/TO-NATIVE returns the binary representation of a double. On some
machines(Intel and Motorola 68xxx), the 8 bytes are stored in RAM and on
disk with the bytes reversed (i.e., the least significant byte is the
first one encountered in memory). Reading in a file of doubles of unknown
format may require trying both reversed and and unreversed formats.

>> real/to-native pi
== #{400921FB54442D18}

>> real/to-native/rev pi
== #{182D4454FB210940}; configuration used in PC's

>> real/from-native real/to-native pi
== 3.14159265358979

>> pi - real/from-native real/to-native pi
== 0  ; converts back to exact value


REAL/WRITE and REAL/READ are meant for writing and reading decimal values in
native binary format. REAL/WRITE accepts a single numerical value or a block
of numerical values that may be nested to any depth, but the return value of
REAL/READ is always a flat block.

>> b1: [] for x 1 16 1 [append b1 square-root x]
== [1 1.4142135623731 1.73205080756888 2 2.23606797749979 ...

>> real/write %test.bin b1
16 decimal values written

>> bb1: real/read %test.bin
== [1 1.4142135623731 1.73205080756888 2 2.23606797749979 ...

>> b1/7 - probe bb1/7
2.64575131106459; square root of 7
== 0; is restored exactly

>> b2: real/to-matrix b1 4  ; convert to 4x4 matrix
== [[1 1.4142135623731 1.73205080756888 2] [2.23606797749979 ...

>> real/write %test.bin b2
16 decimal values written   ; the same values are written,

>> bb2: real/read %test.bin ; and read back into a flat block
== [1 1.4142135623731 1.73205080756888 2 2.23606797749979 ...


REAL/SAVE and REAL/LOAD are meant to be completely compatible with the
standard functions SAVE and LOAD, except that there will be no roundoff
error from saving and loading decimal or money values.

>> amount: [100 * $1.504]
== [100 * $1.50]

>> save %test-x.dat amount
>> do load %test-x.dat
== $150.00 ; large round-off error

>> real/save %test-y.dat amount
>> do real/load %test-y.dat
== $150.40 ; no error


IEEE/REBTEST makes ten successive minimum increments and decrements to the
target value, and tests whether EQUAL? returns TRUE when comparing
the results to the original value. In all cases EQUAL? should return
false. This example is done without ha

[REBOL] obtaining IP address of incoming connection Re:

2000-02-25 Thread larry

Hi Cal

I modified one of the web-servers on the REBOL site, to write the browser
IPs to the console. A couple of snippets should be enough to get you going.

 listen-port: open/lines tcp://:8080  ; port used for web connections
...
 http-port: first wait listen-port
  request: first http-port
...
 send-page: func [data mime] [
  insert data rejoin ["HTTP/1.0 200 OK^/Content-type: " mime "^/^/"]
  write-io http-port data length? data
  print [now http-port/host length? data http-port/port-id]
   ]

So after we have an active connection in http-port, properties at browser
end are found in http-port object: the browser IP is http-port/host and the
connection IP is in http-port/port-id. You can also do a reverse dns look-up
on the host IP and log the domain-name if desired.

Hope this helps

Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 24, 2000 8:04 PM
Subject: [REBOL] obtaining IP address of incoming connection


> Is there any way to determine the source address of an incoming TCP
> connection in REBOL?  I know it can be done in C and Perl, but I haven't
> found a way to get it in REBOL.
>
> I need to identify source addresses so I can add Common Log File support
to
> %webserv.r
>
> TIA,
>
> - Cal Dixon
>
> -><-
>
> __
> Get Your Private, Free Email at http://www.hotmail.com
>



[REBOL] URL-encoding Re:

2000-02-15 Thread larry

Hi Chris

Try:

>>myurl: to-url "Chris L"
== Chris%20L

Cheers

Larry

- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 15, 2000 3:52 PM
Subject: [REBOL] URL-encoding


> Hello folks,
> 
> I'm currently rewriting a simple Wiki-like system I wrote in Python a
> month ago in REBOL.
> 
> To easily transfer the existing content to the new system, I need to
> know ...
> 
> Is there any way to convert a string to an URL-encoded form in REBOL
> yet?
> A la "Chris L" to "Chris%20L"?
> Or do I have to write a translator for special characters myself?
> 
> Thank you very much for any answers.
> 
> For the records, I have to say that REBOL is definitely blessed with
> elegance as hardly ever seen before (especially in the field of computer
> languages). There are a few random crashes (bad thing about them - I'm
> often unable to reproduce them), but otherwise I'm totally fascinated!
> 
> Best regards,
> -- Chris
> _
> c h r i s langreiter - - - unterlangkampfen 3 2 7
> f o r m  is function -- autriche 6322 langkampfen
> 0 0 4 3 / (0) 5 3 3 2 / 8 7 6 0 7 c a l l - n o w
> w   w   w   .  l a n g r e i t e r  .   c   o   m
> 
> There are three kinds of lies:
> lies, damn lies, and statistics.
> --Benjamin Disraeli
> 



[REBOL] Demo of console animation, the REBOL City Music Hall REBOLettes Re:

2000-02-13 Thread larry

Hi Ralph

Applause, Applause, Another Chorus.

It wrapped in the e-mail but I managed to fix it.

Cheers

Larry ( who also did not have anything important to do Sunday evening :-)


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, February 13, 2000 7:08 PM
Subject: [REBOL] Demo of console animation, the REBOL City Music Hall
REBOLettes


Okay, okay--I'll quit after this, but one lady dancing was so much fun, I
did a whole chorus line.

Enjoy.

--Ralph

-snip---




[REBOL] Problem with to-money ??? Re:(5)

2000-02-13 Thread larry

Hi Andrew, Olivier

Actually MONEY! has about 16 decimal digits of precision. For instance:

>> x: to-money 2 ** 52 / 100
== $45035996273704.96
>> x - $.01
== $45035996273704.95
>> x + $.01
== $45035996273704.97

So money values are still precise to the nearest cent at 45 trillion (45
million million).  If the floating point arithmetic is properly handled, the
precision should remain at $0.01 up to 2 ** 53 which is about 90 trillion.

Cheers

Larry


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, February 13, 2000 5:37 PM
Subject: [REBOL] Problem with to-money ??? Re:(4)


> Olivier wrote:
> > I think that precision when dealing with money is very important (more
> important than speed). Money values should be handled internally as an
> string of decimal digits, as in COBOL.
> > Very big numbers are frequent when you deal with money : $1,000,000,000
> converted to a weakest currency can have 5 or 6 significant digits. They
is
> other problems when calculating in base 2 instead of base 10 : the numbers
> that have an infinite number of digit after the point are not the same. It
> has an impact on rounded values.
>
> I agree with this. REBOL should have a money class/value that handles
these
> problems better, rather than using floating point base 2 arithmetic.
>
> Andrew Martin
> ICQ: 26227169
> http://members.xoom.com/AndrewMartin/
> -><-



[REBOL] Glossary of terms Re:

2000-02-11 Thread larry

Hi Luis

One place to find WEB acronyms:

http://www.ucc.ie/acronyms/

Cheers

Larry


- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 11, 2000 8:03 AM
Subject: [REBOL] Glossary of terms


> Hi Rebols,
> 
> Where can I find a glossary of terms such us
> IMHO
> AFAIK
> Etc.?
> 
> Thank you
> 
> 
> --
> Luis Marzulli
> e-mail: [EMAIL PROTECTED]
> Caracas, VENEZUELA
> --
> Earn money when you or your friends are on the Web
> click --> http://www.alladvantage.com/go.asp?refid=BXX890
> 



[REBOL] problem with sort a file Re:(3)

2000-02-10 Thread larry

Hi Tiana

When you read in the file using READ/LINES each entry in the resultiing
block is a string. When you sort the block REBOL sorts the strings
lexicographically, so lines that that start with the character "2" will come
before lines that start with the character "6".  If you want them to sort by
date you could convert each line to a  block.

Like

>> file: read/lines %junk.txt
== ["2-Feb-2000  1   2" "1-Feb-2000  2   1" "6-Feb-2000  3   5" "24-Feb-2000
4
6"]
>> blk: make block! 10
== []
>> foreach line file [append/only blk to-block line]
== [[2-Feb-2000 1 2] [1-Feb-2000 2 1] [6-Feb-2000 3 5] [24-Feb-2000 4 6]]
>> sort blk
== [[1-Feb-2000 2 1] [2-Feb-2000 1 2] [6-Feb-2000 3 5] [24-Feb-2000 4 6]]
>>

Hope this helps

Larry


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 10, 2000 2:44 PM
Subject: [REBOL] problem with sort a file Re:(2)


> Hi, Mike
> Thanks for your reply.
>
> I use /skip because I thought it is for sectional sorting. in my file,
each
> record has 4 sections(e.g, 1-Feb-2000  bla bla bla). I just tried without
skip,
> it gave me the same result though. I guess this is might because of I read
it
> from a file?
>
> I use the following script and sample file,
>
> file: read/lines  %foo.txt
> blk: make block! 100
> blk: to-block file
> file2: sort blk
> write/lines  %foo2.txt file2
>
> which foo.txt is:
> 2-Feb-2000  1   2
> 1-Feb-2000  2   1
> 6-Feb-2000  3   5
> 24-Feb-2000 4   6
>
> the result foo2.txt is:
> 1-Feb-2000  2   1
> 2-Feb-2000  1   2
> 24-Feb-2000 4   6
> 6-Feb-2000  3   5
>
> It can't tell 24-Feb-2000 is larger than  6-Feb-2000. Why is it?



[REBOL] Map Function for Nested Blocks Re:(2)

2000-02-03 Thread larry

Hi Brian

Thanks for your comments. I am aware of the small stack space for recursion
and should have added a cautionary note in my post. I found your suggestions
for generalizing the MAP function interesting, but there a few problems with
your suggested code.

According to Eric the subtypes of any-block are:

any-block
block
list
lit-path
hash
paren
path
set-path

Of these, it seems to me that the functionality of MAP would be most useful
for the list, hash, and (when nested in a block) parens types. For the
others, I guess I would like to see some simples examples of how MAP would
be useful. But your function, renamed here to MAP2, has some problems:

>> a: make list! [1 2 3]
== make list! [1 2 3]
>> map2 to-string a
** Script Error: Cannot use make on datatype! value.
** Where: out: make type? :b length?

and similarly for hash.

I also tried a block with nested parens:

>> a: [1 2 (3)]
== [1 2 (3)]

>> map2 to-string a;this works, but
== ["1" "2" (3)]

>> map2/deep to-string a
** Script Error: tail expected series argument of type: series port.
** Where: insert tail series :value

Not sure whether you intended to map into the nested parens?

Some of these problems surfaced when I developing the MAP function which led
me to decide to stick to just dealing with blocks.

In my applications speed and simplicity are fairly important, and I have
found that attaining extra generality in REBOL tends to require a fair
amount of extra code to handle special cases and often incurs a noticeable
speed penalty.

In any case, MAP is a simple function and my main goal in posting it was to
illustrate the technique of passing a function with a get-word in the spec
and using the parens to handle function literals. This technique can be
applied to any function which requires a function passed as an input
parameter and IMHO results in a clean syntax for the function calls.

Your thoughts?

Larry

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 03, 2000 9:45 AM
Subject: [REBOL] Map Function for Nested Blocks Re:


> [EMAIL PROTECTED] wrote:
> >Here is a fast general map function which handles nested blocks
> [skip]
> >Any comments or discussion would be welcome.
> [skip]
> >===CODE===
> >
> >REBOL [
> >Title: "Map Function"
> >Date:  "24-November-1999"
> >Author: "Larry Palmiter"
> >Purpose: { Maps a function of one arg
> >onto a (nested) block of values.
> >}
> >]
> >
> >map: func [
> >"Maps a function onto elements of a block"
> >:f   "function (use parens for literal)"
> >b [block!]"block of values"
> >/deep "maps function into nested blocks"
> >/local out
> >][
> >out: make block! length? b
> >if paren? :f [f: f]
> >foreach el b [
> >either block? el [
> >either deep [
> >append/only out map/deep f el
> >][
> >append/only out el
> >]
> >][
> >append out f el
> >]
> >]
> >]
>
> All right Larry, how about this?
>
> map: func [
> "Maps a function onto elements of a block"
> :f [any-function! paren!] "function (use parens for literal)"
> b [any-block!]"block of values"
> /deep "maps function into nested blocks"
> /local out
> ][
> out: make type? :b length? :b
> if paren? :f [f: f]
> foreach el :b [
> either any-block? :el [
> append/only :out either deep [map/deep f :el] [:el]
> ][
> append :out f :el
> ]
> ]
> ]
>
> The changes allow you to map other block types and have
> function and paren elements. It's shorter too :)
>
> You're going to have to watch that recursion though...
> REBOL generally has limited stack space, so deeply nested
> blocks or ones with circular references will cause stack
> overflows. There are techniques for eliminating recursion,
> even ones that can be used here.
>
> Brian
>



[REBOL] Multidimensional arrays ... Re:

2000-02-03 Thread larry

Hi Petr

I will leave your first puzzle about 'change for someone else to elaborate.

There are various ways to write to an indexed element.  For your example,
the following is the fastest and also fairly easy to read:

>> ar: array/initial [3 4] copy ""
== [["" "" "" ""] ["" "" "" ""] ["" "" "" ""]]

>> i: 2   j: 3
== 3

>> poke pick ar i j "hello"
== ["" "" "hello" ""]

>> ar
== [["" "" "" ""] ["" "" "hello" ""] ["" "" "" ""]]

Hope this helps

Larry


- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 03, 2000 5:26 AM
Subject: [REBOL] Multidimensional arrays ...


> Could anyone elaborate on following, please?
>
> ->> ar: array/initial [3 4] copy ""
> == [["" "" "" ""] ["" "" "" ""] ["" "" "" ""]]
> ->>  change ar/1/1 "adfaf"
> == ""
> ->> ar
> == [["adfaf" "adfaf" "adfaf" "adfaf"] ["adfaf" "adfaf" "adfaf" "adfaf"]
> ["adfaf" "adfaf" "adfaf" "adfaf"]]
>
> How to simply write at any multidimensional array position? ar/:i/:j:
> value doesn't work ...
>
> Thanks,
>
> -pekr-
>



  1   2   >