r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3-OLD1]

BrianH
28-May-2009
[14558x2]
Well, that has to be done by functions that are not inherent to the 
datatype, addon functions. Those addon functions can be built in 
or put into plugins, or both.
Except for the conversion to blocks, which is supported as of alpha 
55.
Steeve
28-May-2009
[14560x3]
are you serious ?
to block! and to binary! should be provided
especially to binary!
aswell as-binary
BrianH
28-May-2009
[14563x2]
Yes they should. And they will, along with better binary conversion 
methods than to-binary.
AS-BINARY and AS-STRING will not exist in R3 - no type aliasing allowed.
Steeve
28-May-2009
[14565]
Wtf, i want the reference of the hardstored binary data of the vector.
What the prob ? it's stored as a binary stream
BrianH
28-May-2009
[14566]
It's a safety issue. That kind of access will be done through accessor 
functions.
Steeve
28-May-2009
[14567]
you mean the data will be copied ?
BrianH
28-May-2009
[14568]
I mean the access will be through functions which will hide the internal 
implementation. That doesn't mean the data will be copied.
Steeve
28-May-2009
[14569]
there is nothing to hide, a vectors is a binary serie
BrianH
28-May-2009
[14570]
That's the plugin model, in theory (we'll see in practice). R2-style 
structs and routines are insecure.
Steeve
28-May-2009
[14571x2]
so to secure it, there will be a copy. If not it can be secured
*can't be
BrianH
28-May-2009
[14573x2]
It can be secured if access is through bounds-checked accessors.
By "we'll see in practice", I mean that the current model is not 
yet documented, and has gone through design changes this month.
Steeve
28-May-2009
[14575x2]
i don't see your point, if i want a binary serie of the internal 
data of a vector, it's to do all sort of operations we can do on 
binaries
accessor will not protect anything
BrianH
28-May-2009
[14577]
Except inserting, or changing the length, or changing the data to 
something the vector type doesn't support, or...
Steeve
28-May-2009
[14578x2]
Oh Geez, you want protect the vector from modifications ?
So forget my request, vectors will be of no use
i will continue to manage my indexes with plain binaries
BrianH
28-May-2009
[14580]
No, I want to protect the vector from *bad* modifications. That's 
easy to do, as long as you *don't* do type aliasing.
Steeve
28-May-2009
[14581x3]
what kind of bad modification could exist with a binary serie ? there 
is noone.
To my mind a vector should be just a wrapper on a binary serie.
just a new handy way, to modify or get values from a binary
BrianH
28-May-2009
[14584x2]
That's my point. There are no bad modifications to binaries, but 
there *are* bad modifications to vectors, depending on the type.
There are unsupported floating point numbers (inf, nan), and vectors 
must be a multiple of their component parts' size.
Steeve
28-May-2009
[14586x2]
The types are limited to integers so there are no *bad* modifications.
Oh yes, i forgot about floats
BrianH
28-May-2009
[14588]
No, decimals are supported too.
Steeve
28-May-2009
[14589]
yeah yeah ,my bad...
BrianH
28-May-2009
[14590]
(slow altme)
Steeve
28-May-2009
[14591x2]
i vote to discard decimals, if it can be of any help :)
they can use fixed point decimals instead, so users will not complain
BrianH
28-May-2009
[14593]
Ladislav will complain :(
Steeve
28-May-2009
[14594]
who's that ? :-)
BrianH
29-May-2009
[14595]
Quick discussion needed, and here because more people need to chime 
in:


There is a proposal to change the name of the MAP function to MAP-EACH. 
Here's why:

- There's a map! type, and this function is unrelated - except in 
CS theoretical terms, which is why we suggest the name MAP-EACH.

- The other functions that have the name of a type without the ! 
are constructors for that type. The map! type could use one.
- This function is behaviorily one of the *EACH family already.

- This is *not* the functional language map function, and it might 
be good to emphasize that...


In functional languages, functions like map take functions as parameters. 
However, such languages tend to be compiled and the function values 
they take are constructed ahead of time. Since REBOL is interpreted 
and functions are created at runtime, that kind of code pattern tends 
to be inefficient. That is why REBOL control and loop functions tend 
to take blocks instead, and have any argument words to those blocks 
as a separate parameter: It's much more efficient that way.


There is precedent: The REBOL function that corresponds to the functional-langage 
filter function is REMOVE-EACH.


We ask this question now because now is the time to make the change, 
if ever. Not many functions in R3 use MAP yet (the only one I can 
think of off the top of my head is LOAD). This will change when we 
do a hand-optimization pass of the mezzanines, and it will definitely 
be too late once we hit beta.


What do you all think? Please chime in in the next couple days if 
you can (and have an opinion).
Oldes
29-May-2009
[14596]
No problem to rename it now
BrianH
29-May-2009
[14597]
I'm taking votes. If it happens it will likely do so in the next 
release.
Sunanda
29-May-2009
[14598]
Thanks for the opportunity to comment.....
I'll vote yes to renaming it away from 'map.

Not sure 'map-each is an _ideal_ alternative, but it is better than 
'map for the reasons given by BrianH.
Janko
29-May-2009
[14599]
My vote: I don't want it to be called MAP because of reasons you 
named.. anything reasonable else is ok... 


I can't decide if I like map-each remove-each *-each ... naming convention... 
 

just thinking outloud..

1) you named fold/reduce accumulate ... if you name map/filter in 
similar vein they could be something like  map -> transform  translate 
  alter   apply ?     remove-each -> filter  purge ...


2) common to these functions is that they take a block of code (and 
a series) ... each hints about the serries but maybe more specific 
about them is first part - block of code (function in classic functional).... 
one idea for the common word that hints about  do something with 
block of code as a rule IMHO is with


map -> map-with , transform-with , ... ; remove-with  filter-with 
purge-with ;  fold-with ??
Pekr
29-May-2009
[14600]
I am OK with renaming too. OTOH I too dislike map-each, remove-each 
names, but not a big deal here ...
Janko
29-May-2009
[14601]
(agh ... altme ate my post 2 times!!)


I use the similar with naming for other types of combinators ( functions 
taht take blocks of code) for example


with-sqlite %a.db [ SQL "select * from t;" ]   ( opens db ; runs 
block of code (could bind to words but not needed here) ; closes 
db  ; returns result )
Henrik
29-May-2009
[14602]
I'm fine with changing it.
Vladimir
29-May-2009
[14603]
Two questions:
1.  is there a way to load-gui from local file ?
2. How is unicode in rebol3 working ?  (is it working ? ) :)
BrianH
29-May-2009
[14604x2]
Well, one advantage for calling them something other than map and 
filter is that you could put functional map and filter functions 
in a module somewhere and not have naming conflicts. They'll be less 
efficient and less flexible, but at least the functional programming 
fans would be happy :)
The only reason the *EACH makes sense is the word parameter that 
comes first:
    foreach x data [code]  ->  For each x in data do code
    remove-each x data [code]  ->  Remove each x in data if code
    map-each x data [code]  >  Map each x in data to code
Steeve
29-May-2009
[14606]
i don't like verbose naming conventions.
Maxim
29-May-2009
[14607]
vote for change.


funny that I sometimes add the 'in word when typing code ... then 
rebol pops an error... ehhehe  that 'in doen't work on blocks.  ;-)