Comments on: Finalizing image! as series (or not)

Carl Sassenrath, CTO
REBOL Technologies
15-May-2009 15:50 GMT

Article #0203
Main page || Index || Prior Article [0202] || Next Article [0204] || 12 Comments || Send feedback

From reading the prior blog comments about what is and is not a series, I would propose the following:

series? some-image
series? some-bitset
series? some-port

I'd also propose we use some kind of simple test (just for deciding, not to add to mezz), such as:

is-series?: func [s] [(length? s) = (index? back tail s)]

This test implies that the index position exists, can propagate and be modified. (Hopefully, all existing series datatypes pass it.)

If you think this test is not valid, and that some other test should be used, then mention it now. We will be closing this issue in a day or so, and it will be more difficult to change later.



15-May-2009 12:25:46
Ok, i can forget bitsets behaving as real series.

(Even, if i think it would be useful to manage large index of integers in a compact format).

Actually, vectors can replace that use case.

But to be a valuable challenger, vectors should allow the construction of 1 bit sized integers.

make vector! [integer! 1 1000][]

In that way, it could be used to construt very large indexes in a very compact format.

Brian Hawley
15-May-2009 12:26:59
That proposal sounds good. The test could use one more quality though:
(index? next s) <> (index? s)

For a series, the position changing functions need to return a new position as a reference, not modify a position internal to the data (like ports). The above test assumes that the series has contents after the current position, but the principle is sound.

15-May-2009 12:33:05

>>attempt [the_test]

should be added to avoid needless errors throwings doing the test.

Brian Hawley
15-May-2009 12:34:01
Steeve, you don't have to have bitsets be series for that purpose. All you have to do is make FOREACH work on bitsets. FOREACH works on other non-series already.

However, bitsets are currently not stored in a sparse manner, so unless the integers you are tracking have a lot of locality they won't necessarily be stored in a compact format. Vectors might be better for this.

Brian Hawley
15-May-2009 12:34:55
Let's consider the test to be metaphorical :)
15-May-2009 12:46:23
There are 5 pseudo objects in R3: image, gob, port, event and error. Of these, 3 have an implied series: image, gob and port. Arguably, port is sufficiently different not to be series. Apparently, gob was found to be different enough not to be series either. In my view, image has enough exceptions/subtleties w.r.t the applicability of series operations that it should also be out. This makes for a more consistent structure.
15-May-2009 12:55:16
Brian, i agree, it's not necessary the most compact format but it's really fast when whe are searching for a value in an bitset. To be fast when seeking in an index, is the priority, i should have explain that matter at first
Brian Hawley
15-May-2009 13:08:40
Meijeru, which operations for series don't have equivalent operations for images? Please list them here, so we can consider them. Perhaps some of them are bugs.

Btw, ports don't always have an implied series - only some schemes do (and that doesn't even include the modifying position functions). Command ports don't have underlying series at all.

Brian Hawley
15-May-2009 13:36:04
Steeve, bitsets can still be used for integer indexes as long as you use PICK and POKE. Path notation has been requested in ticket 759 (Thanks, Meijeru!). Series membership not required.
16-May-2009 4:31:52
BrianH, not defined on images: select, sort, reverse, find/alter (currently - may be an oversight), past?

also, I suspect that the test proposed works for gobs, but they are still out

Brian Hawley
16-May-2009 13:56:49
Those all sound like bugs, missing functionality. REVERSE and PAST? should work. FIND, SELECT and SORT could work with images, though they are much less useful. This all sounds doable.

ALTER should be removed from R3 and replaced by the new logic! flags, which need documenting and fixing. I don't know about gobs - haven't used them much yet.

17-May-2009 9:41:05
last also does not work on images currently, whereas first, second etc. do

Post a Comment:

You can post a comment here. Keep it on-topic.


Blog id:



 Note: HTML tags allowed for: b i u li ol ul font span div a p br pre tt blockquote

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

Updated 26-Mar-2017 - Edit - Copyright REBOL Technologies -