Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Is there a REBOL construct similar to the "map" word as used in Logo ?

 [1/19] from: gerardcote:sympatico:ca at: 27-Jun-2002 22:50


Hello, First I'd like to thank everybody that helped me elucidate my previous question about the use of the SET word for doing multiple assignments from 2 blocks, specially Joel for the detailed explanation he furnished to me. Now is another question relative to the word "map" I already used in Logo for working on agregates - that is data collections - and doesn't seem to exist per se in the same form under REBOL. May be I don't really need it for solving the following case but nevertheless I would like to get some advice about something similar in REBOL if anyone exists that is different than the two ones I found myself when using the "forall" and "foreach" words. Here is an example of what I am just trying to get when using the Logo "map" construct : Extract the initials of a complete name by getting the first letter from each of the first and the last names contained in a block. Using the REBOL syntax this could be done with the following statement :
>> print initials [George Harrison]
[G H] Under Logo, the "map" statement is used to work on complete data collections by using a single statement that shows a very concise syntax - from which stems my interest for this "map" word. For example to extract the initials above I can put "map" to work in a function named "initials" as this : to initials :name <-- Here "to" plays the same role as the "func" word under REBOL output map "first :name <-- "output" simply ends the function and returns the resulting value end to the current context A detailed explanation of how the function operates appears below. After the "initials" function has been defined, the user of the program can call it with the command that follows after the ? Logo prompt below : ? show initials [George Harrison] "show" is similar to the print in REBOL. [G H] <--- Results returned when "initials" is evaluated. This simply defines a function named "initials" that accepts an input parameter called "name" the body itself is trying to display something that the "map" statement applies to each member of the input parameter "name". Here this "something" is the action represented by the lit-word "first". It actually takes the first letter of each word contained in the list submitted as a parameter to the initials function and return all of them in a block enclosed in square brackets. I know that I can use "foreach" and "forall" to solve this problem (look below for my solutions) but can somebody tell me if there is a REBOL word able to follow very closely the syntax used by the Logo "map" construct ? I already tried the following alternatives that all seem to work as expected for my previous problem :
>>my-sentence: [this is a simple sentence]
== [this is a simple sentence]
>> foreach word my-sentence [print first to-string word]
t i a s s
>> forall my-sentence [print first to-string my-sentence]
t i a s s The sole reason I plan to look further in the direction of a REBOL "map" clone is that I want to experiment some other concept that looks very promising and seems more powerful than what I actually know. The man who is the lead developer for the UCB-Logo I am also playing with while learning REBOL - Mr. Brian Harvey - names this promising and powerful concept a "template-based iteration". Other functional languages also frequently use the term "anonymous function" for something that looks a bit related to the question-marked items in the following examples but it seems that's all there is to it, as far as I know of. In fact I already found under REBOL some ways to achieve results similar to those offered by the Logo "map" construct. But the actual syntax I use is longer and has a different form than the one I look for (maybe I am only dreaming awake... with the hope to get something that don't really exists under REBOL !!!). Whatever the case, efficiently achieving the same results would probably require to use the PARSE word but I am just curious to know if someone is aware about the existence of any current REBOL construct for achieving similar results for the simple cases provided below. This REBOL construct - if it really exists - would completely eliminate the need for me to write even the simplest parsing rules for such trivial cases. Here are 2 specific obvious uses of the Logo "map" construct as I would like it to be in REBOL too : ? show map [? * ?] [2 3 4 5] <-- Applies the product of an item with itself to each member of [4 9 16 25] the second list. ? show (map [word ?1 ?2 ?1] [a b c] [d e f]) <--- this means create words that are combinations of 3 letters [ada beb cfc] the first and third ones being taken from the first list while the second onecomes from the second list. Thank you in advance for any information relative to such a construct if any. Regards, Gerard P.S. If nobody has heard of a REBOL clone for this "map" construct, I plan to write one myself since I want to experiment with these concepts under REBOL exactly as it is possible to do so with Logo. If I am succesful with the implementation and I find this is really unavoidable to work without it, I'll share it with everybody interested by this.

 [2/19] from: al:bri:xtra at: 28-Jun-2002 16:28


This 'Map function might be suitable for your requirements. Thanks again to Joel and Ladislav! [ Rebol [ Name: 'Map Title: "Map" File: %"Map.r" Author: "Andrew Martin" eMail: [Al--Bri--xtra--co--nz] Date: 18/Oct/2001 Acknowledgements: [ "Joel Neely" "Ladislav" ] Purpose: {Maps or applies the function to all elements of the series.} Example: [ Map func [n [number!]] [n * n] [1 2 3] ;== [1 4 9] Map [1 2 3] func [n [number!]] [n * n] ;== [1 4 9] Map [1 2 3 4 5 6] func [a] [print [a]] ;1 ;2 ;3 ;4 ;5 ;6 ;== [] Map [1 2 3 4 5 6] func [a b] [print [a b]] ;1 2 ;3 4 ;5 6 ;== [] Map [1 2 3 4 5 6] func [a b c] [print [a b c]] ;1 2 3 ;4 5 6 ;== [] ] Requires: %Arguments.r ] Map: function [ {Maps or applies the function to all elements of the series.} Arg1 [any-function! series!] Arg2 [any-function! series!] /Only "Inserts the result of the function as a series." ][ Result Results Function Series ][ any [ all [ any-function? :Arg1 series? :Arg2 (Function: :Arg1 Series: :Arg2) ] all [ any-function? :Arg2 series? :Arg1 (Function: :Arg2 Series: :Arg1) ] throw make error! reduce [ 'script 'cannot-use rejoin [ {"} mold 'Map " " mold type? :Arg1 {"} ] rejoin [ {"} mold type? :Arg2 {"} ] ] ] Results: make Series length? Series do compose/deep [ foreach [(Arguments :Function)] Series [ if not unset? set/any 'Result Function (Arguments :Function) [ either only [ insert/only tail Results :Result ][ insert tail Results :Result ] ] ] ] Results ] ] Andrew Martin ICQ: 26227169 http://valley.150m.com/ -><- ----- Original Message ----- From: "Gerard Cote" <[gerardcote--sympatico--ca]> To: <[rebol-list--rebol--com]> Sent: Friday, June 28, 2002 2:50 PM Subject: [REBOL] Is there a REBOL construct similar to the "map" word as used in Logo ?

 [3/19] from: lmecir:mbox:vol:cz at: 28-Jun-2002 12:23


Hi Gerard, you may find MAP and more interesting functions in http://www.rebolforces.com/~ladislav/highfun.r Moreover, you can have a look at http://www.rebol.cz/cffr.html -L ----- Original Message ----- From: "Gerard Cote" Hello, First I'd like to thank everybody that helped me elucidate my previous question about the use of the SET word for doing multiple assignments from 2 blocks, specially Joel for the detailed explanation he furnished to me. Now is another question relative to the word "map" I already used in Logo for working on agregates - that is data collections - and doesn't seem to exist per se in the same form under REBOL. May be I don't really need it for solving the following case but nevertheless I would like to get some advice about something similar in REBOL if anyone exists that is different than the two ones I found myself when using the "forall" and "foreach" words. Here is an example of what I am just trying to get when using the Logo "map" construct : Extract the initials of a complete name by getting the first letter from each of the first and the last names contained in a block. Using the REBOL syntax this could be done with the following statement :
>> print initials [George Harrison]
[G H] Under Logo, the "map" statement is used to work on complete data collections by using a single statement that shows a very concise syntax - from which stems my interest for this "map" word. For example to extract the initials above I can put "map" to work in a function named "initials" as this : to initials :name <-- Here "to" plays the same role as the "func" word under REBOL output map "first :name <-- "output" simply ends the function and returns the resulting value end to the current context A detailed explanation of how the function operates appears below. After the "initials" function has been defined, the user of the program can call it with the command that follows after the ? Logo prompt below : ? show initials [George Harrison] "show" is similar to the print in REBOL. [G H] <--- Results returned when "initials" is evaluated. This simply defines a function named "initials" that accepts an input parameter called "name" the body itself is trying to display something that the "map" statement applies to each member of the input parameter "name". Here this "something" is the action represented by the lit-word "first". It actually takes the first letter of each word contained in the list submitted as a parameter to the initials function and return all of them in a block enclosed in square brackets. I know that I can use "foreach" and "forall" to solve this problem (look below for my solutions) but can somebody tell me if there is a REBOL word able to follow very closely the syntax used by the Logo "map" construct ? I already tried the following alternatives that all seem to work as expected for my previous problem :
>>my-sentence: [this is a simple sentence]
== [this is a simple sentence]
>> foreach word my-sentence [print first to-string word]
t i a s s
>> forall my-sentence [print first to-string my-sentence]
t i a s s The sole reason I plan to look further in the direction of a REBOL "map" clone is that I want to experiment some other concept that looks very promising and seems more powerful than what I actually know. The man who is the lead developer for the UCB-Logo I am also playing with while learning REBOL - Mr. Brian Harvey - names this promising and powerful concept a "template-based iteration". Other functional languages also frequently use the term "anonymous function" for something that looks a bit related to the question-marked items in the following examples but it seems that's all there is to it, as far as I know of. In fact I already found under REBOL some ways to achieve results similar to those offered by the Logo "map" construct. But the actual syntax I use is longer and has a different form than the one I look for (maybe I am only dreaming awake... with the hope to get something that don't really exists under REBOL !!!). Whatever the case, efficiently achieving the same results would probably require to use the PARSE word but I am just curious to know if someone is aware about the existence of any current REBOL construct for achieving similar results for the simple cases provided below. This REBOL construct - if it really exists - would completely eliminate the need for me to write even the simplest parsing rules for such trivial cases. Here are 2 specific obvious uses of the Logo "map" construct as I would like it to be in REBOL too : ? show map [? * ?] [2 3 4 5] <-- Applies the product of an item with itself to each member of [4 9 16 25] the second list. ? show (map [word ?1 ?2 ?1] [a b c] [d e f]) <--- this means create words that are combinations of 3 letters [ada beb cfc] the first and third ones being taken from the first list while the second onecomes from the second list. Thank you in advance for any information relative to such a construct if any. Regards, Gerard P.S. If nobody has heard of a REBOL clone for this "map" construct, I plan to write one myself since I want to experiment with these concepts under REBOL exactly as it is possible to do so with Logo. If I am succesful with the implementation and I find this is really unavoidable to work without it, I'll share it with everybody interested by this.

 [4/19] from: gerardcote:sympatico:ca at: 28-Jun-2002 12:14


Andrew wrote : ----- Original Message ----- From: "Andrew Martin" <[Al--Bri--xtra--co--nz]> To: <[rebol-list--rebol--com]> Sent: Friday, June 28, 2002 12:28 AM Subject: [REBOL] Re: Is there a REBOL construct similar to the "map" word as used in Logo ?
> This 'Map function might be suitable for your requirements. Thanks again to > Joel and Ladislav!
<<quoted lines omitted: 17>>
> ;== [1 4 9] > Map [1 2 3 4 5 6] func [a] [print [a]]
... Hi Andrew, I find this solution a very interesting one. At least enough for my current needs. I'll make en extensive study of it and may be I'll come back with comments if necessary. Thanks to all contributors for this great solution. Gerard

 [5/19] from: gerardcote:sympatico:ca at: 28-Jun-2002 13:24


Hi Andrew, I was just fooled by the name of the original contributors for your own version of the "Map" construct. So I was looking on their respective Reb Site in a quest for the "Arguments.r" function required by your "Map" script. In fact I subsequently received a message from Ladislav qui also offers me his own "Map" version. And this is what shed some light on me - YOU are the real author of the submitted revised version of the "Map.r" script as listed below while Ladislav and Joel are the originators and/or contributors. As it is not our first talk I was able to find the referred "arguments.r" script by myself on your web site. So I thank you all three, and any other who may have contributed to this and other constructs - since I also found Ladislav's ones on his Reb site under the Highfun.r script. It will be a pleasure to analyze and play all this new stuff !!! Great fun in perspective on rainy summer days... Gerard

 [6/19] from: greggirwin:mindspring at: 28-Jun-2002 11:39


Hi Gerard, << Now is another question relative to the word "map" I already used in Logo for working on agregates - that is data collections - and doesn't seem to exist per se in the same form under REBOL. >> There area few versions floating around out there. Here's one by Larry: ; Larry Palmiter map: func [fn blk args /local result][ result: copy [] repeat el blk [append/only result fn :el args] return result ] ; Use it like this for a named function (note the : prefix is needed to delay ; full evaluation). ; ; >> map :to-integer ["123" "45667"] ; == [123 45667] ; ; If the named function needs a refinement switch you delay evaluation with a ; leading ' , like this: ; ; >> map 'sine/radians [0 30 90] ; == [0 -0.988031624092862 0.893996663600556] ; ; You can also use it with an anonymous function (defined on the fly) like ; this: ; ; >> map func [x][x * x] [1 2 3] ; == [1 4 9] HTH! --Gregg

 [7/19] from: gerardcote:sympatico:ca at: 28-Jun-2002 13:25


Hello Ladislav, I just left your Reb site in quest for the arguments.r script before I read your message. Thanks for your Highfun.r I think I'll love to analyze and play with it... Gerard

 [8/19] from: gerardcote:sympatico:ca at: 29-Jun-2002 0:10


Hello Gregg, You just sent me this "map" definition from Larry :
> ; Larry Palmiter > map: func [fn blk args /local result][ > result: copy [] > repeat el blk [append/only result fn :el args] > return result > ]
Thanks for this alternative "map" implementation that looks promising too. It seems that I am not the first REBOL newbie that sees an interest in this construct ... While looking at how this version was implemented, one question hurts my head that you may be able to answer while I am searching myself for more information about it. Where does the "el" word used in the repeat construct come from ? I don't see it anywhere being assigned a value or passed as a parameter before it is used and I find this a little strange. Is it a constant already known by REBOL, is there something missing, some part I don't understand or what else ? Regards, Gerard

 [9/19] from: al:bri:xtra at: 30-Jun-2002 10:25


Gerard Cote wrote:
> > repeat el blk [append/only result fn :el args] > Where does the "el" word used in the repeat construct come from ? >> help repeat
USAGE: REPEAT 'word value body DESCRIPTION: Evaluates a block a number of times or over a series. REPEAT is a native value. ARGUMENTS: word -- Word to set each time (Type: word) value -- Maximum number or series to traverse (Type: integer series) body -- Block to evaluate each time (Type: block) 'el is a word that "refers" to each ELement in 'blk. The line could be rewritten as: foreach Element blk [append/only result fn :Element args] I hope that helps! Andrew Martin ICQ: 26227169 http://valley.150m.com/

 [10/19] from: al:bri:xtra at: 29-Jun-2002 9:39


I forgot to post the 'Arguments script that my 'Map requires. [ Rebol [ Name: 'Arguments Title: "Arguments" File: %"Arguments.r" Author: "Andrew Martin" eMail: [Al--Bri--xtra--co--nz] Date: 22/Mar/2002 ] Arguments: function [ "Returns the arguments of the function." F [any-function!] ] [ Arguments ] [ Arguments: make block! 2 foreach Argument pick :F 1 [ if refinement? :Argument [ break ] append Arguments :Argument ] Arguments ] ] Andrew Martin ICQ: 26227169 http://valley.150m.com/ -><- ----- Original Message ----- From: "Gerard Cote" <[gerardcote--sympatico--ca]> To: <[rebol-list--rebol--com]> Sent: Saturday, June 29, 2002 4:14 AM Subject: [REBOL] Re: Is there a REBOL construct similar to the "map" word as used in Logo ?
> Andrew wrote : > > ----- Original Message ----- > From: "Andrew Martin" <[Al--Bri--xtra--co--nz]> > To: <[rebol-list--rebol--com]> > Sent: Friday, June 28, 2002 12:28 AM > Subject: [REBOL] Re: Is there a REBOL construct similar to the "map" word
as used in Logo ?
> > > This 'Map function might be suitable for your requirements. Thanks again
to
> > Joel and Ladislav! > > [
<<quoted lines omitted: 10>>
> > ] > > Purpose: {Maps or applies the function to all elements of the
series.}
> > Example: [ > > Map func [n [number!]] [n * n] [1 2 3]
<<quoted lines omitted: 5>>
> Hi Andrew, > I find this solution a very interesting one. At least enough for my
current needs. I'll make en extensive study of it and may be
> I'll come back with comments if necessary. > Thanks to all contributors for this great solution.
<<quoted lines omitted: 3>>
> [rebol-request--rebol--com] with "unsubscribe" in the > subject, without the quotes.
-- Attached file included as plaintext by Listar -- -- File: Arguments.r [ Rebol [ Name: 'Arguments Title: "Arguments" File: %"Arguments.r" Author: "Andrew Martin" eMail: [Al--Bri--xtra--co--nz] Date: 22/Mar/2002 ] Arguments: function [ "Returns the arguments of the function." F [any-function!] ] [ Arguments ] [ Arguments: make block! 2 foreach Argument pick :F 1 [ if refinement? :Argument [ break ] append Arguments :Argument ] Arguments ] ]

 [11/19] from: joel::neely::fedex::com at: 28-Jun-2002 15:52

Re: Is there a REBOL construct similar to the "map" word as usedin Logo


Hi, Gerard, As you've seen, this topic has been kicked around quite a bit... ;-) You might be interested in http://www.escribe.com/internet/rebol/index.html as a general resource for hysterical (ermmm hisTORical) discussions, or http://www.escribe.com/internet/rebol/m13736.html for another variation on the specific MAPLIST theme. Gerard Cote wrote:
> Now is another question relative to the word "map" I already used > in Logo for working on agregates - that is data collections - and > doesn't seem to exist per se in the same form under REBOL. >
One of the reasons that some things we expect from other languages do not appear to be in REBOL is that they're so easy to write for yourself! Yet another small variation is to accept an arbitrary series and return a result of similar type (string versus block): map: func [[throw] f [any-function!] s [series!] /local r] [ r: make block! length? s foreach val s [insert/only tail r f get/any 'val] either any-string? s [ make string! r ][ r ] ]
>> map func [c] [c + 1] "Hello!"
== {Ifmmp"}
>> map func [c] [c + 1] <document>
== "epdvnfou"
>> map func [c] [c + 1] [2 4 6 8]
== [3 5 7 9]
> Here are 2 specific obvious uses of the Logo "map" construct as > I would like it to be in REBOL too : > > ? show map [? * ?] [2 3 4 5] <-- Applies the > product of an item with itself to each member of > [4 9 16 25] the > second list. >
With the above definition, you can do this:
>> map func [n] [n * n] [2 3 4 5]
== [4 9 16 25]
> ? show (map [word ?1 ?2 ?1] [a b c] [d e f]) <--- this means > create words that are combinations of 3 letters > [ada beb cfc] the > first and third ones being taken from the first list while > the second onecomes from the second list. >
Due to differences in handling of arguments between Logo (and LISP) versus REBOL, I'd make that a separate function: mapn: func [[throw] f [any-function!] s [series!] /local n v r] [ n: length? first s foreach ss s [if n > length? ss [n: length? ss]] r: make block! n loop n [ insert/only tail r do join [f] map :first s s: map :next s ] r ] which allows such uses as:
>> mapn :+ [[1 1 1 2 2 2] [1 2 3 10 20 30]]
== [2 3 4 12 22 32] or your example:
>> mapn func [a b] [rejoin [a b a]] [["a" "b" "c"] ["d" "e" "f"]]
== ["ada" "beb" "cfc"] Hope this helps! -jn-

 [12/19] from: gerardcote:sympatico:ca at: 29-Jun-2002 9:44

Re: Is there a REBOL construct similar to the "map" word as used in Logo


Hello Ladislav, I just left your Reb site in quest for the "arguments.r" script related to the Map.r script submitted by Andrew Martin in a recent post. However I was fooled by the fact that your name was referred by the script and I was sure you were the author of the revised version with Joel. In fact I discovered you had your own plain "map.r" that was different from the one sent by Andrew Martin before I read your reply message. Thanks for your Highfun.r Did you really find many occasions to use them often since they were written ? I think I'll love to analyze and play with all the functions it contains ... If I can permit discussing briefly with you on another different matter, I'd also like to ask you two more questions about the submission you did, somewhere near the end of october 2001, for REBOL enhancements recommendations - as seen on the REBOL FORCES.COM web site - for getting better REBOL internals performance and getting a greater cohesion for many mentioned pieces like locality of objects, etc... Do you know what RT did about these recommendations ? Did they integrate it partly in Core 2.5 ? Do you know if they planned to take them into account and what about their implementation schedule for them if any ? Regards, Gerard

 [13/19] from: joel:neely:fedex at: 29-Jun-2002 8:19

Re: Is there a REBOL construct similar to the "map" word as usedin Logo


(I sent something similar to this yesterday, but it never showed up on the list. If it ever does emerge, please forgive the duplication.) Hi, Gerard, As you can tell, this has been kicked around before... ;-) Gerard Cote wrote:
> Now is another question relative to the word "map" I already > used in Logo for working on agregates - that is data collections
<<quoted lines omitted: 3>>
> similar in REBOL if anyone exists that is different than the two > ones I found myself when using the "forall" and "foreach" words.
I've observed a number of cases where features from other languages aren't built into REBOL, but are really easy to implement oneself. Since functions are first-class values in REBOL, you can build all sorts of interesting control and higher-order functions. Here's another variation from the past: map: func [ [throw] f [any-function!] b [block!] /all /local result item ][ result: make block! length? b foreach val b [ if any [found? item: f val all] [ append/only result item ] ] result ] Which does the basics:
>> map func [x] [x * x] [1 2 3 4 5 6]
== [1 4 9 16 25 36] The point of the /ALL refinement is that we can create filters by using a simple helper function: ident: func [[throw] f [any-function!] x [any-type!]] [ if f x [x] ] which evaluates either to the second argument or to NONE, depending on whether the second argument passes the test specified in the first argument.
>> ident :even? 3
== none
>> ident :odd? 3
== 3 With both of these in hand, one can either map a test across a collection and get the pass fail results:
>> map :even? [1 2 3 4 5 6]
== [false true false true false true] or use the test to select the desired elements
>> map func [x] [ident :even? x] [1 2 3 4 5 6]
== [2 4 6]
> >> print initials [George Harrison] > [G H] > >> map :first ["George" "Harrison"]
== [#"G" #"H"]
> Other functional languages also frequently use the term "anonymous > function" for something that looks a bit related to the question- > marked items in the following examples but it seems that's all > there is to it, as far as I know of. >
Reread the documentation on FUNC. It is a built-in function that produces a function value, which (as I mentioned above) is a first- class type in REBOL, meaning that it can be assigned, passed as an argument, or returned as the result of an evaluation.
> ? show map [? * ?] [2 3 4 5] <-- Applies the > product of an item with itself to each member of > [4 9 16 25] the > second list. >
As above:
>> map func [x] [x * x] [2 3 4 5]
== [4 9 16 25]
> ? show (map [word ?1 ?2 ?1] [a b c] [d e f]) <--- this means create > words that are combinations of 3 letters > [ada beb cfc] > the first and third ones being taken from the first list while > the second onecomes from the second list. >
There are two parts to this one; - just use FUNC for the "anonymous function" to be applied, - due to the way REBOL handles arguments, I'd probably code the multiple-arguments version separately. Constructing a collection of arguments by transposing/slicing from a collection of argument lists could be done this way: mapn: func [ [throw] f [any-function!] b [block!] /local n result ][ n: 0 foreach bb b [n: max n length? bb] result: make block! n loop n [ append/only result do join [f] map :first b b: map :next b ] result ] which behaves as follows:
>> mapn :+ [[1 2 3 4][10 20 30 40]]
== [11 22 33 44] Then your sample problem could be represented in REBOL (among many other ways! ;-) as:
>> mapn func [a b] [rejoin [a b a]] [["a" "b" "c"] ["d" "e" "f"]]
== ["ada" "beb" "cfc"] Hope this helps! -jn- -- ; Joel Neely joeldotneelyatfedexdotcom REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] { | e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]

 [14/19] from: greggirwin:mindspring at: 29-Jun-2002 11:21

Re: Is there a REBOL construct similar to the "map" word as used in Logo


Hi Gerard, << While looking at how this version was implemented, one question hurts my head that you may be able to answer while I am searching myself for more information about it. Where does the "el" word used in the repeat construct come from ?...>> It's a word that lives in the context of the REPEAT block (bind gurus please correct my explanation!). I.e. it is a word that you don't have to declare and won't have a value outside the iteration construct.
>> b: [a b c]
== [a b c]
>> repeat i length? b [print i]
1 2 3
>> i
** Script Error: i has no value ** Near: i The same thing works for other iteration constructs as well. I think it's a very nice feature. --Gregg

 [15/19] from: gerardcote:sympatico:ca at: 30-Jun-2002 9:25


Hi Andrew, Seems like I didn't do my homework at all with the fundamentals of REBOL study. I simply considered that my current foundation of similar-like constructs coming from the other 3GL was sufficient but in fact after looking at some CORE DOC I was completely in the field. Sorry for this trouble I was giving you. You were kind enough to answer me this way but I'll ask myself before annoying any other people the next time I will be faced with some similar self-evident "look at it by yourself before asking others" information. Thanks again Andrew! Regards, Gerard

 [16/19] from: gerardcote:sympatico:ca at: 30-Jun-2002 9:59


Andrew wrote:
> I forgot to post the 'Arguments script that my 'Map requires.
Thank you Andrew for this delicate attention. As I suspected you had put it inside your "values.r" script, I got it and looked at it. It was there and all went OK. Bye, Gerard

 [17/19] from: gerardcote:sympatico:ca at: 30-Jun-2002 9:55

Re: Is there a REBOL construct similar to the "map" word as usedin Logo


Joel wrote :
> Hi, Gerard, > As you've seen, this topic has been kicked around quite a bit... ;-)
<<quoted lines omitted: 4>>
> http://www.escribe.com/internet/rebol/m13736.html > for another variation on the specific MAPLIST theme.
I already began to scan this archive for the EDITOR keyword but I fail to do so for the MAPLIST and related ones. I sould have done and I will. Thanks to remember me that the past is still nowadays a real value to preserve and can be real boon to our present! :-)
> One of the reasons that some things we expect from other languages > do not appear to be in REBOL is that they're so easy to write for > yourself! >
You are right and I will try my teeth to some new stuff very soon but I was also interested in knowing directly WHO is currently listening to this ML and shows or has shown in the past some interest for this kind of advanced material and who was disposed to foster this one with newbies. I am also a very curious "animal"... Hope this didn't shock anybody to much. I will try to take other ways from now on and I will leave the ML for its real use ... Because like the young boy in the tale whose I forgot the name and repeatdly was calling for help when there was not any wolf in the forest ... I would not be a remnant when I will need real help. But I found this exchange very informative about the real nature of everyone who participated in. Thanks everyone for their contribution. I now return to study my REBOL fundamentals and look at some other advanced scripts before coming back.
> Yet another small variation is to accept an arbitrary series and > return a result of similar type (string versus block): >
...
> Due to differences in handling of arguments between Logo (and LISP) > versus REBOL, I'd make that a separate function: >
... Thanks Joel for all your suggestions. I really appreciate the way you (and many other contributors) are analyzing (from so many points of view) the not so simple situations I submitted for reflexion for finally gettin and exposing so thoroughly clean and well thought solutions. It's something I will try to take as a model for my own work from now on - even if I often did my best on some simpler tasks. May be I will need again the definitive advice of many such many great "thinkers" in a near future ;-) So stay ready ... I'll be glad to recontact you when needed! Regards, Gerard

 [18/19] from: lmecir:mbox:vol:cz at: 30-Jun-2002 18:38

Re: Is there a REBOL construct similar to the "map" word as used in Logo


Hi Gerard, <<Gerard>> Hello Ladislav, ... Thanks for your Highfun.r Did you really find many occasions to use them often since they were written ? <</Gerard>> The most often used functions are: MAP, ACCUM, CFOR and SFUNC, not necessarily in that order, but I use them quite regularly. <<Gerard>> ... I'd also like to ask you two more questions about the submission you did, somewhere near the end of october 2001, for REBOL enhancements recommendations - as seen on the REBOL FORCES.COM web site - for getting better REBOL internals performance and getting a greater cohesion for many mentioned pieces like locality of objects, etc... Do you know what RT did about these recommendations ? Did they integrate it partly in Core 2.5 ? Do you know if they planned to take them into account and what about their implementation schedule for them if any ? <</Gerard>> Well, first of all, even the list members didn't agree with me completely. RT found some of my suggestions interesting. The trouble is, that some recommendations may mean deep changes and RT surely want to maintain backward compatibility. For example a more goal directed error handling is incorporated into Core 2.5, although it differs from my proposal.

 [19/19] from: lmecir:mbox:vol:cz at: 30-Jun-2002 22:10


Hi, <<Gregg>> ... It's a word that lives in the context of the REPEAT block (bind gurus please correct my explanation!). I.e. it is a word that you don't have to declare and won't have a value outside the iteration construct. ... <</Gregg>> I am not sure that Gregg's explanation needs a correction. Nevertheless, if we are picky, we can say something more complicated, e.g.: It's a word that lives in a context created by the REPEAT function. The function binds its BODY argument to the context. The latter is a little bit more accurate than saying that "... it lives in the context of the REPEAT block", because a context of a block is not defined in Rebol. -L

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted