World: r3wp
[Rebol School] Rebol School
older newer | first last |
Geomol 7-Mar-2009 [2622x2] | And operators can also be prefix, which looks kinda weird: >> + 4 5 == 9 >> random + 4 5 == 2 |
List of operators: >> ? op! | |
kib2 7-Mar-2009 [2624] | Geomol: sorry for the delay, it was lunch time for me. It's the first langage where i see no operator priority (maybe with Lisp, but it's because of its notation). Thanks, and that may explain why I wasn't able to draw something correctly in a GUI app. |
BrianH 7-Mar-2009 [2625] | Having only a single level of operator precedence was done to make it faster to program in REBOL. It makes it easier to remember the precedence rules when reading or writing REBOL, something that anyone with experience in most programming languages can tell you is tricky at times. Having fewer language rules to remember makes the language less distracting from the programming process. Though it is also faster to run, as it makes DO simpler (and even moreso in R3). |
kib2 8-Mar-2009 [2626x2] | BrianH: this seems a right approach to me, it makes sense. |
How's responsible of Rebol wiki contents ? The docs on R3 GUI (written by Kr bacon) are really pleasant to read. | |
PatrickP61 10-Mar-2009 [2628x2] | Question to all How can I get the results of a PRINT to load into a block? ie File-list-blk: LIST-DIR |
or File-Details-blk: LIST-DIR/L | |
Steeve 10-Mar-2009 [2630] | just overide print functions during a short time |
PatrickP61 10-Mar-2009 [2631] | Can you give example such as getting the results of LIST-DIR/L? |
Steeve 10-Mar-2009 [2632] | hmm... something like that p: :print out: [] print: func [v][append out reform v] list-dir print: :p probe out |
PatrickP61 10-Mar-2009 [2633] | ahhh, so you temporarily capture the source of PRINT into P then clear a block called OUT then change the print to append results to it, then LIST-DIR will invoke the PRINT command to the new function and reset PRINT back to original defintion. |
Steeve 10-Mar-2009 [2634] | right |
Dockimbel 10-Mar-2009 [2635] | You can also use this script : http://www.rebol.org/view-script.r?script=capture.r do http://www.rebol.org/download-a-script.r?script-name=capture.r capture on list-dir capture off probe get-captured |
PatrickP61 10-Mar-2009 [2636x2] | tried it out, but no luck, R3 is giving Script error: list-dir does not allow set-word! for it's 'path argument I think I have to dig into the LIST-DIR a little more to see how it works I had hoped there would be an easier way to take the results of a PRINT and be able to load it into a block instead of putting to the console. |
Dockimbel, I'll give it a try | |
Steeve 10-Mar-2009 [2638] | it's because list-dir needs an argument not furnished in my example |
PatrickP61 10-Mar-2009 [2639] | Thank Steeve and Dockimbel, I think I can play with it a little more |
Dockimbel 10-Mar-2009 [2640] | If you use LIST-DIR in a script, you should provide the directory argument or enclose it with brackets like : do [list-dir] |
Steeve 10-Mar-2009 [2641x2] | or list-dir %. |
or (list-dir) | |
PatrickP61 10-Mar-2009 [2643] | good to know |
PatrickP61 12-Mar-2009 [2644x5] | I'm playing around with FORM-DATE.R from the rebol.org site and I'm having trouble with a couple of commands I am trying to define a new date-code of lowercase h to return the hour in regular time, not military time such that 13-24 would be 1-12. ie #"h" [PICK [ time/hour ( time/hour - 12 ) ] time/hour > 12 ] <-- pick the value of time/hour to be between 1-12 but when I try an example such as: am: does [form-date 2009-01-02/03:04:05 "%y%m%d %h:%M%P"] <-- I get "090102 time/hour - 12:04AM" hours is realy 03 pm: does [form-date 2009-11-12/13:14:15 "%y%m%d %h:%M%P"] <-- I get "091112 time/hour:14PM" how do I get r3 to evaluate the time/hour - 12 or the time/hour value before it picks the results? |
I see a small error in my conditions, it should read time/hour < 12 instead of > 12 | |
I will ask Christopher for his assistance, I think this may not be the right forum to answer this question. | |
Please disregard my post. I missed the fact that the upper case i handles this. | |
I guess I can answer my own question! :-) | |
Vladimir 27-Mar-2009 [2649] | I guess this is the best place to ask this question: I wrote many scripts in rebol that helped me a lot but they were all just that... small scripts (I think biggest of them all was 40-50 lines...). My question is, what would be "Rebol way" of writing more complicated applications in rebol ? Stuff like game or accounting application, something with many parts.... What would be differences from other languages? And why would it be better? :) What about dialects? Should rebol programmer start with making a specific dialect first? |
Chris 27-Mar-2009 [2650] | 'Dialect' is a good term for what a dialect is, but 'Domain Specific Language' is perhaps a better indicator of the problems dialects solve. |
Vladimir 27-Mar-2009 [2651] | ok... :) thats what I ment... So should one start from bottom, from basics? Like in in accounting "calculate tax for one item" and then make functions for all more complicated stuff ? something like that? |
Sunanda 27-Mar-2009 [2652] | A dialect is a good way of structuring a user interface. I think your question is more related to the underlying structure of the code that implements the whole application -- not just the dialect.. Does that sound about right? |
Vladimir 27-Mar-2009 [2653x2] | Yes.... for example I used Visual Fox pro a lot... and its great for stuff like that... It has Separate concepts like Database, Data entry forms, Print reports etc.... |
Or, how to make writing apps simpler ? | |
Chris 27-Mar-2009 [2655] | It's similar I suppose to prototyping with a GUI, designing the front-end first and building the application to drive it. I prefer working that way... |
Vladimir 27-Mar-2009 [2656] | I used asm, basic, pascal, c, database, clipper, foxpro.......... I kinda know how to use those in an efficient manner.... What about rebol? |
Henrik 27-Mar-2009 [2657] | Well, I tend to write a lot of small code files and string them together with a preprocessor. |
Vladimir 27-Mar-2009 [2658] | Designing gui in rebol is quite simple, with rebgui even more.... So one aproach would be: 1. Make interface look like it shoud be 2. attach code to be executed on events |
Henrik 27-Mar-2009 [2659] | I don't think there is a particularly REBOLish way to write large programs. You just figure out a reasonable way to do it. |
Vladimir 27-Mar-2009 [2660] | :) |
Chris 27-Mar-2009 [2661] | V: similar with dialects... |
Vladimir 27-Mar-2009 [2662] | So no magic rebol wand to make it better than the rest ? :) |
Henrik 27-Mar-2009 [2663] | actually there might be: generate REBOL code with REBOL. |
Vladimir 27-Mar-2009 [2664x2] | aha.... thats more like it :) |
I had an idea.... :) bare with me.... is it possible to start a script that would while running, change itself (file on disk), and than transfer control to this new version of itself ? | |
Chris 27-Mar-2009 [2666] | No reason why not. |
Henrik 27-Mar-2009 [2667] | I once built a db protocol using a dialect, which would generate the server side code and the client side code. Both sides were dialects too. This was wrapped inside another dialect which could build the server and multiple client programs by preprocessing and putting together multiple other scripts. Works pretty well and it takes about 5 minutes to add a new command to the protocol and update server and client. |
Vladimir 27-Mar-2009 [2668x2] | Henrik: What did you mean by generating code? When I started writing applications that requiered data entry, I always first wrote an object that takes text as input (something like this: "'Name' c20 'Address' c30 'Town' c30) and displays modal dialog with those fields, OK and Cancel buttons, and all the logic that is needed... So all my data entry dialogs looked and worked the same and all that usually fit in one screen of code.... |
I'll need a minute to understand what you wrote :) | |
Graham 27-Mar-2009 [2670] | I created the screens first .. then built the data structures and then the supporting code after that. |
Henrik 27-Mar-2009 [2671] | By generating code, I mean generating scripts, dialects or things that don't make sense or is too heavy to create in runtime. |
older newer | first last |