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

syntax across languages

 [1/24] from: tomc::darkwing::uoregon::edu at: 5-Nov-2003 22:43


came accross an interesting site on "syntax across languages" which is soliciting help with constructs in various languages including rebol. They are currently missing 120 syntax constructs for rebol. http://merd.net/pixel/language-study/syntax-across-languages/

 [2/24] from: greggirwin:mindspring at: 6-Nov-2003 0:29


Hi Tom, TC> came accross an interesting site on "syntax across languages" TC> which is soliciting help with constructs in various languages TC> including rebol. TC> They are currently missing 120 syntax constructs for rebol. Looks like it would be a real pain to contribute manually though. Have to write a script to help us do it. :) -- Gregg

 [3/24] from: maarten:vrijheid at: 6-Nov-2003 8:33


> came accross an interesting site on "syntax across languages" > which is soliciting help with constructs in various languages > including rebol. > They are currently missing 120 syntax constructs for rebol.
Most of them are available in REBOL but not in the comparison. If I only had time...

 [4/24] from: joel:neely:fedex at: 6-Nov-2003 7:20


Hi, Maarten, and all, There's a serious question at the end of all the yammering below! ;-) Maarten Koopmans wrote:
>>came accross an interesting site on "syntax across languages" >>which is soliciting help with constructs in various languages >>including rebol. >>They are currently missing 120 syntax constructs for rebol. > > Most of them are available in REBOL but not in the comparison. If I only > had time... >
I can relate! On the other hand, I'm also ambivalent their terminology; the table of contents maintains the "syntax" pretense, but there are really three different levels being addressed (somewhat indiscriminantly): 1 lexical rules (e.g. structure of a user-defined name/word) 2 higher-order syntax (e.g. structure of an "if" statement) 3 language features (e.g. "get type/class [of] object/instance/value") I'd be glad to be updated, but I haven't seen (1) fully documented anywhere for REBOL. (Remember recent -- and not so recent -- posts about what characters are allowed in a word? IIRC most such questions get resolved by trial and error or advice from someone who's already traveled that road, not by pointing to section x.y in the manual.) As for (2), it doesn't exists! I'm not trying to be pedantic here, but sincerely believe that one of the early steps to "getting" REBOL is to realize that e.g. THERE IS NO "IF" STATEMENT, but merely some functions (IF, IF/ELSE, EITHER) that take an argument of type [LOGIC! NONE!] and one or two arguments of type [BLOCK!] and, if you so choose, YOU CAN WRITE YOUR OWN. Being pragmatic, I know that a short answer to the question: "How can I say the likely equivalent of if (buff [0] == '\0') { p--; } else { p = q % ++r; } is either zero? length? buff [ p: p - 1 ][ p: q // r: r + 1 ] but that doesn't necessarily help the questioner make the leap to p: either zero? length? buff [ p - 1 ][ q // r: r + 1 ] or even more REBOL-ish reconceptualizations of the programming task. That brings me to (3), where IMHO it becomes most clear that efforts such as the page in question often become either too encylpaedic for ease of use, or else too superficial for useful ... use. It's one thing to take two languages that share most of their conceptual base (e.g. Pascal and C, ALGOL and Pascal, etc.) and address in a fairly complete way the questionS (plural emphasized): - What are the correspondences between the languages (i.e. for those features that are conceptually similar, how does one "respell" from one notation to the other)? In this category, explaining that Pascal uses "begin ... end" for sequences of statements, while C uses "{ ... }" is reasonable. - What are points of NON-CORRESPONDENCE between the languages, and what effect does that have on one's programming/design thinking? In this category, the nesting of lexical scope (e.g. procedures defined locally to enclosing procedures in Pascal, vs. the flatter, assembly- like model of C) can cause one to think and design quite differently. I should also add that many of the issues under the second point above often become significant when [only when?] designing programs that deal with larger-than-toy problems. But when approaching languages with substantially different conceptual models, the second issue becomes so dominant that the first issue is either irrelevant or misleading IMHO. For example, what is the REBOL equivalent for the elementary PROLOG idiom conc( [], L, L ). conc( [X | L1], L2, [X | L3] ) :- conc( L1, L2, L3 ). ??? As much as we might like to write conc: 'join that just won't cut it, when trying to understand why last( Item, List ) :- conc( _, [Item], List ). works. Inspired by discussions on this list, I started putting together some recipes for a Perl-to-REBOL cookbook. I say "started" because I was smacked in the face by the above issues on the very first recipe, which dealt with the Perl substr function. You see, in Perl, substr can be used both as an lvalue and an rvalue (a distinction which doesn't exist in REBOL). And OBTW, using an rvalue string expression as an rvalue in Perl implicitly copies, while an lvalue string expression mutates... And OBTW, the Perl splice function (more or less) does for arrays what substr does for strings, but REBOL blocks are the closest analog to arrays, and block! and string! types are both subsumed in the REBOL meta-type series! so instead of defining SUBSTR, shouldn't one actually define SUBSER and ... So instead of a one-page recipe, I suddenly had a very long chapter (I know you can't believe that I found lots to say on such a narrow topic ;-) and began to question whether anyone would bother to read it! On the other hand, I don't want to spend the effort to produce something that ends up being so superficial that it's a read-once-and-throw-away (as is the case with too many books and articles in the computing field IMHO). So, here's my question (or two... sorry! ;-) Does the attempt to provide a Berlitz-phrase-book mapping across really different languages do more harm than good, or is it a reasonable foot in the door for beginners? Would a (for example) Perl-to-REBOL cookbook be of enough value to justify the (substantial) effort to produce it with reasonable quality and completeness, and would there be a large enough market for such a thing to have reasonable ROI? Where could I place the balance between simplicity/brevity versus honesty/completeness to maximize the value? With only a hint toward to the recent thread started by Petr, I have to admit that there are many more things about REBOL to play with than I have time for, there are many more ways to (try to) help REBOL grow than I can fit in, and REBOL is only a small part of my life agenda (with many work obligations and other responsibilities/commitments). I have to work hard at budgeting my increasingly tight discretionary time to those areas that have the greatest value (in multiple senses of the word). Any/all feedback/comments are welcome! -jn-

 [5/24] from: maarten:vrijheid at: 6-Nov-2003 15:04


Hi Joel, All the other questions are too hard, but...
> With only a hint toward to the recent thread started by Petr, I have > to admit that there are many more things about REBOL to play with than
<<quoted lines omitted: 4>>
> time to those areas that have the greatest value (in multiple senses > of the word).
Wow! You can do a bind 'word [ multiple values ] in your real life?
> Any/all feedback/comments are welcome! >
Are the alternatives or refinements? Oops... my lexer got stuck (again) ;-) --Maarten

 [6/24] from: joel:neely:fedex at: 6-Nov-2003 8:38


Hi, Maarten... Maarten Koopmans wrote:
> Wow! You can do a > > bind 'word [ multiple values ] > > in your real life? >
multitask-into-stress: func [word [word!] selves [block!]] [ forever [ foreach role selves [ do get in role word ] ] ] ; -)
>>Any/all feedback/comments are welcome! >> > > Are the alternatives or refinements? Oops... my lexer got stuck (again) > ;-) >
It's just a different dialect! ;-) -jn-

 [7/24] from: bry:itnisk at: 6-Nov-2003 16:07


>Does the attempt to provide a Berlitz-phrase-book mapping across really >different languages do more harm than good, or is it a reasonable foot >in the door for beginners?
I think it's a reasonable gauge for beginners to estimate the usefulness of the language for different tasks. If I am familiar with language x and I see examples in it that I feel are well done, focusing on a specific task, and then I see examples in language y which I am not familiar with, but it does the task in less code, and the code is understandable to me despite my unfamiliarity then I am likely to conclude that language y is a good tool for that particular type of task. If that task is one I am likely to be involved with frequently, then I am likely to want to investigate language y. If the languages are too similar I would probably say "ehh, that I already got."

 [8/24] from: maximo:meteorstudios at: 6-Nov-2003 10:54


> Would a (for example) Perl-to-REBOL cookbook be of enough value to > justify the (substantial) effort to produce it with > reasonable quality
with any hobby, if that is what rebol is for you, the ROI comes from A: the fun/sense of accomplishement/use you have doing it on a personnal level or B: from the appreciation it will get from others. if (A) is not clearly present and (B) is not guaranteed, then I usually skim on the project, because there are many other (A) type projects (which aren't specifically rebol) to fill time anyways. If you don't have a company with 20 employes to convert, then such a reference work is indeed a daunting task.
> With only a hint toward to the recent thread started by Petr, I have >[...] > I have to work hard at budgeting my increasingly tight discretionary > time to those areas that have the greatest value (in multiple senses > of the word).
same here!! but I find solace in that persistence pays off, when the end goal is measured to be worth something i.e. (A) or (B) are guaranteed. -MAx

 [9/24] from: maximo:meteorstudios at: 6-Nov-2003 11:09


> -----Original Message----- > From: Joel Neely [mailto:[joel--neely--fedex--com]]
<<quoted lines omitted: 8>>
> ] > ]
The above is proof that rebol is an expresive language. ;-) here's my life dialect life: func [priorities [block!]] [ task: wait [familly job projects] either find in priorities task [ do task ][ append projects task ] ] note that the only control I have is in priorities. The task wait order is hard wired... ;-) -MAx

 [10/24] from: andrew:martin:colenso:school at: 24-Dec-2003 22:45


Joel wrote:
> As for (2), it doesn't exists! I'm not trying to be pedantic here,
but sincerely believe that one of the early steps to "getting" REBOL is to realize that e.g. THERE IS NO "IF" STATEMENT, but merely some functions (IF, IF/ELSE, EITHER) that take an argument of type [LOGIC! NONE!] and one or two arguments of type [BLOCK!] and, if you so choose, YOU CAN WRITE YOUR OWN. I totally agree. It's the step of breaking free from The Matrix of conventional programming languages. The other step is that words (and other values) can mean whatever you want them to mean. Andrew J Martin Attendance Officer Speaking in tongues and performing miracles. Colenso High School Arnold Street, Napier. Tel: 64-6-8310180 ext 826 Fax: 64-6-8336759 http://colenso.net/scripts/Wiki.r?AJM http://www.colenso.school.nz/ DISCLAIMER: Colenso High School and its Board of Trustees is not responsible (or legally liable) for materials distributed to or acquired from user e-mail accounts. You can report any misuse of an e-mail account to our ICT Manager and the complaint will be investigated. (Misuse can come in many forms, but can be viewed as any material sent/received that indicate or suggest pornography, unethical or illegal solicitation, racism, sexism, inappropriate language and/or other issues described in our Acceptable Use Policy.) All outgoing messages are certified virus-free by McAfee GroupShield Exchange 5.10.285.0 Phone: +64 6 843 5095 or Fax: +64 6 833 6759 or E-mail: [postmaster--colenso--school--nz]

 [11/24] from: lmecir:mbox:vol:cz at: 7-Nov-2003 8:28


Hi, ...
> Does the attempt to provide a Berlitz-phrase-book mapping across really > different languages do more harm than good, or is it a reasonable foot > in the door for beginners?
My 2 cents: it is reasonable, especially if it contains a reference to a more thorough text. I hate to write read once texts too, but I don't question the usefulness of this.
> Would a (for example) Perl-to-REBOL cookbook be of enough value to > justify the (substantial) effort to produce it with reasonable quality > and completeness, and would there be a large enough market for such a > thing to have reasonable ROI? Where could I place the balance between > simplicity/brevity versus honesty/completeness to maximize the value?
It is up to you, but it will find its readers, I bet. ...
> Any/all feedback/comments are welcome! > > -jn-
-L

 [12/24] from: antonr:iinet:au at: 7-Nov-2003 18:44


I just sent in the Various section for rebol. http://merd.net/pixel/language-study/syntax-across-languages/Vrs.html Anton.

 [13/24] from: antonr:iinet:au at: 7-Nov-2003 20:17


I just completed Functions & Control Flow and sent them off. Anton.

 [14/24] from: antonr:iinet:au at: 7-Nov-2003 21:00


Just sent the two sections - Types - Object Oriented & Reflexivity. Anton.

 [15/24] from: antonr:iinet:au at: 8-Nov-2003 1:51


I just sent also the sections: Package, Module; Strings; Booleans; Bags and Lists; Various Data Types; Mathematics; Threads (easy :) which completes all the sections, I think. Anton.

 [16/24] from: greggirwin:mindspring at: 7-Nov-2003 10:28


Wow Anton! You've been busy! Thanks for doing all that. -- Gregg

 [17/24] from: antonr:iinet:au at: 8-Nov-2003 10:43


That's alright. It was interesting to see all the syntax, and it reminded me of some syntax from c that I've been missing. Also good for some ideas, especially in list handling. Anton.

 [18/24] from: antonr:iinet:au at: 14-Nov-2003 12:34


Those who were interested in this may have noticed the site is down. The reason is the webhost was hacked last week, so Pixel sent me his mirror site: http://people.mandrakesoft.com/~prigaux/language-study You can see the rebol additions there. Anton.

 [19/24] from: lmecir:mbox:vol:cz at: 15-Nov-2003 1:13


Hi Anton,
>Those who were interested in this may have noticed >the site is down. The reason is the webhost was hacked >last week, so Pixel sent me his mirror site: >http://people.mandrakesoft.com/~prigaux/language-study > >You can see the rebol additions there. > >Anton. >
thank you. My observations: - you are saying, that the normal equality operator is deep as well as shallow ... - runtime evaluation: I suggest to add "...and dialect evaluating functions..." - actually, every function is created as anonymous in Rebol. After the creation you can give it a name. - function composition isn't COMPOSE - you wrote "if/then", but you probably meant "if/else" - exception catching is more likely TRY, than CATCH (?) - all but the first element can be NEXT probably - we can use JOIN/REJOIN to join a list of strings - exponentiation: ** works too - number negation: (- a) works too -L

 [20/24] from: antonr:iinet:au at: 15-Nov-2003 23:21


Thanks Ladislav, for your corrections. I have sent this also to the maintainer, Pixel. I am not completely sure what function composition means. Pixel said: "function composition is a function taking 2 functions and returning a new one." Looking at some Haskell posts I see it kind of glues two functions together, passing the result from the first function into the second one. There are (resolvable) problems when the number of arguments are not the same, but, anyway... Doesn't this just mean that this is function composition: add: func [a b][a + b] mul3: func [a][a * 3] add-mul3: func [a b][mul3 add a b] ? Or it doesn't count because the "composition" is specified in the body block, whereas Haskell does it by referring only to the function names. Also, let me just clarify that string joining can be done with JOIN or REJOIN. Anton.

 [21/24] from: g:santilli:tiscalinet:it at: 15-Nov-2003 14:03


Hi Anton, On Saturday, November 15, 2003, 1:21:46 PM, you wrote: AR> add: func [a b][a + b] AR> mul3: func [a][a * 3] AR> add-mul3: func [a b][mul3 add a b] These are two ways to do it in REBOL: f*g: func [f g] [func [x] compose [(:f) (:g) x]] f*g: func [f g] [func [x] use [f' g'] [f': :f g': :g [f' g' x]]] so that: add2: func [x] [x + 2] mul3: func [x] [x * 3] add2-mul3: f*g :mul3 :add2 Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/

 [22/24] from: lmecir:mbox:vol:cz at: 15-Nov-2003 19:14


Anton Rolls wrote:
>I am not completely sure what function composition means. >Pixel said: "function composition is a function taking 2
<<quoted lines omitted: 13>>
>is specified in the body block, whereas Haskell >does it by referring only to the function names.
It "doesn't count", an answer in Rebol (needs some polishing): composition: func [ f [any-function!] g [any-function!] ] [ use [f' g' body] copy/deep [ f': :f g': :g body: [f' g'] foreach arg first :g [ insert tail body reduce ['get/any to lit-word! arg] ] func load mold third :g body ] ] Usage: add-mul3: composition :mul3 :add -Ladislav

 [23/24] from: tomc:darkwing:uoregon at: 15-Nov-2003 12:07


a couple more.. Various: comparison (returns 3 values (i.e. inferior, equal or superior)) sign? a - b Control Flow: loop (for "a la C" (while + initialisation)) for index inital limit step [...]

 [24/24] from: antonr:iinet:au at: 16-Nov-2003 15:16


Thankyou, Ladislav, Gabriele and Tom. I have forwarded your notes on to Pixel. Anton

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