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

World: r3wp

[!REBOL3-OLD1]

Chris
9-Oct-2007
[4804]
I spent a long time learning the intricacies of R2 (aside from basic 
primers, it was my first language).  I don't suppose it will take 
as long to pick up R3, but hammering away at the console, figuring 
how different approaches work, interact, all the subtleties -- it'd 
be useful to learn sooner than later.  And given that R2 changed 
constantly as I was learning, I have no problem assuming R3/Core 
now may not be R3/Core of the actual release.
Maarten
9-Oct-2007
[4805]
.
btiffin
9-Oct-2007
[4806x4]
Post(s) that follow are the R3 Alpha version of the format function 
prepped for R2; at this stage, it could probably be called pad or 
align.  I've split the header from the function.
REBOL [
    Title: "Formatting dialect"
    Author: "Carl Sassenrath"
    Date: 01-Jun-2007
    Version: 2.99
    File: %format.r

    Purpose: "Simple, powerful string formatting; well padding at least"
    History: [
        01-Jul-2007 2.99 "Carl" "first R3 alpha"
        02-Sep-2007 2.99 "Bluey" "prepped for R2"
    ]

    Comments: {R3 format will be more powerful, this is a teaser version}
    Usage: {
        format rules values
          /pad padding-character; defaults to space
        rules include the following dialect messages;

          integer!              sets width left aligned (trailing spaces)

          negative integer!     sets width right aligned (leading spaces)

          string!           inserts the string based on position in rules

          char!          inserts the character based on position in rules

        rules can be a single message or a block! of formatting messages;

        rules can also be a word evaluating to a single or message block!
        Examples:
          format 5 12 == "12   "
          format -5 12 == "   12"

          format/pad [5 "---" -5] [12345678 1] "0" == "12345---00001]
    }
]
format: make function! [
    "Format a string according to the format dialect."
    rules {A block in the format dialect. E.g. [10 -10 #"-" 4]}
    values
    /pad p
    /local out val
][
    p: any [p #" "]
    unless block? rules [rules: reduce [rules]]
    unless block? values [values: reduce [values]]
    val: 0
    foreach item rules [
        if word? item [item: get item]
        val: val + switch/default type?/word item [
            integer! [abs item]
            string! [length? item]
            char! [1]
        ] [0]
    ]
    out: make string! val
    insert/dup out p val
    foreach rule rules [
        if word? rule [rule: get rule]
        switch type?/word rule [
            integer! [
                val: first values
                values: next values
                pad: rule
                if negative? rule [
                    val: form :val
                    rule: negate rule
                    pad: rule - length? val
                    if positive? pad [out: skip out pad]
                    pad: length? val
                ]
                change out val
                out: skip out pad
            ]
            string! [out: change out rule]
            char! [out: change out rule]
        ]
    ]
    if not tail? values [append out values]
    head out
]

printf: make function! [
    "Formatted print."
    fmt "Format"
    val "Value or block of values"
][
    print format fmt val
]
Rats;  I missed the Rights: Copyright 2007 REBOL Technologies in 
there...
sqlab
10-Oct-2007
[4810]
This does not look very well thought. It does not solve the issue 
with floating and decimal! numbers.
Gabriele
10-Oct-2007
[4811]
Chris: that's exactly why i've been saying all the time that we should 
just release whatever the state, instead of doing a feature complete 
"core" for xmas, which would only hurt RT and not help people here.
btiffin
10-Oct-2007
[4812]
Nope it's a step toward an end I do believe.  I like it as it allows 
for padding and alignment, but it's not the real format dialect yet, 
afaik.

sqlab; I'm smiling as I type this, so...

Psst, don't complain too loud or I might get cut off from showing 
off non-production sanctioned versions of functions.  I don't think 
the wait is going to be much longer but I feel for rebol trenchers 
and think the community deserves to see some of what is going on, 
so I asked to release a few mezzanines.


I was hoping it might motivate a rebol or two to expand on it, and 
reinforce the belief that community involvement is not only going 
to be a good thing, but a great thing.  Plus it's a good function 
for what is does imho.
Pekr
10-Oct-2007
[4813x2]
Gabriele - you constantly interpret it incorrectly. There was NO 
selection between Core for X-Mass and release ASAP as-is. Core for 
X-Mass was alternative to DON'T release at all, unless everything 
finished.
hopefully that will not matter soon.
btiffin
10-Oct-2007
[4815]
Hmm, my post looks a little weird coming out after Gabriele's.  I 
was in the midst of typing and staring down at the keyboard.  Sorry 
Gabriele;  the abrupt Nope that started my post wasn't meant in response 
to yours.  It was meant for the ...does not solve...
Louis
10-Oct-2007
[4816]
I've been studying some books on software engineering, and the more 
I learn the more I like rebol. As hard as it may be to be patient, 
I'm for not rushing RT.  Let them have the peace they need to devote 
themselves to producing the cutting edge technology we expect from 
them.  Let them do the work in the order they know to be most logical. 
Regular updates on progress would be encouraging, of course; especially 
for the pros here that need to be able to give their customers valid 
facts in order not to lose them.  Also, putting the major emphasis 
on a simplier, more capable View is great as far as I'm concerned, 
as View is what I've had the hardest time learning, and is also what 
I think will make the greatest difference for RT's success.
Pekr
10-Oct-2007
[4817x2]
I can see new View in web-browser plug-in along with new VID as a 
killer app in itself ....
I have the only "difficulcy" with View - it is when I try to think 
how to "integrate it with web the other way =  not View in a browser, 
but pure View app, being able to display html container. We would 
have to be able to link to mozilla embedding product, or khtml one, 
or create at least simple html viewer. But then I worry where do 
we end - creating View based web-browser? :-)
Graham
10-Oct-2007
[4819x2]
Brian, that wouldn't be too bad would it .. if you got cut off .. 
you'd just be like the rest of us!
Henrik .. was Carl going to release something today?
Pekr
10-Oct-2007
[4821x2]
ah, what a sarcasm :-) But I bear with you, Graham. My personal understanding 
is, that behind the scenes, Carl is preparing for the community release, 
using FireSide (DevBase), which should be ready as we speak. I await 
some news in few days, and we let you imediatelly know, what is going 
to happen next.
Graham - yes, he was - his FireSide (aka DevBase) R2 VID based tool. 
It is not created from scratch, as it was already used in the past, 
but Carl wanted to do some small changes, to better fit R3 model. 
It was supposed to be done yesterday or today. We will see.
Henrik
10-Oct-2007
[4823]
He said he was going to do so Monday, but had some things to tend 
to and so said Tuesday, but nothing was released Tuesday. Let's see 
what happens today. He usually starts talking in about 7-8 hours.
Pekr
10-Oct-2007
[4824]
yes, evening here in EU is morning in the Ukiah :-)
Henrik
10-Oct-2007
[4825x2]
For the record: I was opposed to the idea of Fireside from the beginning, 
because I thought he meant yet another forum/communications channel, 
since he talked a bit about allowing communication with "hundreds 
of users", not so impressive. We have enough of that with AltME.

When he talked about the existing framework, the working prototype, 
the source code altering and finally the code submission model, I 
changed my mind. I think this tool can be very powerful.
The first version will be done in R2, since VID3 is not yet up to 
the task (missing styles).
Pekr
10-Oct-2007
[4827x2]
Small teaser - doing some basic tasking testing in console. I thought 
tasking does not work yet, but apart from missing IPC:// scheme it 
seems to work:


>> test: make task! [wait 10 print ["Does tasking work?" newline]]
== task!
>> do test
Begin Task
== task!
>> print "Doing something else in conDoes tasking work?

End Task
sole"
Doing something else in console

>> test: make task! [wait 10 print ["Does tasking work?" newline]]
== task!
>> do test
Begin Task
== task!
>> print "Doing something else in console..."
Doing something else in console...
>> Does tasking work?

End Task

>>
ah, put test in console twice, sorry for that. The first time 10 
sec was too short for me to type another print statement, so it is 
intermixed ....
Graham
10-Oct-2007
[4829]
but is it debugged?
Henrik
10-Oct-2007
[4830]
Don't know if this is interesting to you, but:


http://www.hmkdesign.dk/rebol/files/082390c9260a1a8ce96cedddd8aad803-83.html#unique-entry-id-83

:-)
Pekr
10-Oct-2007
[4831]
Thanks Henrik - it surely is VERY interesting and I suggest every 
one to read it, to get bigger picture of what VID3 is going to be 
about. It answers many worries in non-technical language, easy to 
understand main concepts ....
Kaj
10-Oct-2007
[4832]
Great stuff
Louis
10-Oct-2007
[4833]
Henrik, thanks! Very interesting.
Will
10-Oct-2007
[4834]
Very nice ! Thanks !
Claude
10-Oct-2007
[4835]
thank you for this interesting introduction of V3D ;-)  (means VID3)
Graham
10-Oct-2007
[4836]
Guess it needs to be tested in practise to see if this approach does 
indeed scale better.
Henrik
10-Oct-2007
[4837]
ah, Graham, good blog topic there. :-) it scales pretty well.
Graham
10-Oct-2007
[4838x3]
Have any complex GUIs been written yet in V3 ?
a close button that close the window down .. but say I need to add 
additional functionality?
do I need to create a new type of close button?
Henrik
10-Oct-2007
[4841]
there is an effects lab written in VID3 that would be impossible 
to make in VID or at least very difficult. would probably require 
2-3000 lines of VID code.
Kaj
10-Oct-2007
[4842]
view layout [h1 "Goodbye, complex world!"]
Henrik
10-Oct-2007
[4843]
Kaj, layout isn't necessary anymore :-)
Graham
10-Oct-2007
[4844]
'layout is redundant in V3 !
Kaj
10-Oct-2007
[4845]
See, far too much to keep up with! :-)
Henrik
10-Oct-2007
[4846]
it's still there, but built into View
Graham
10-Oct-2007
[4847x2]
how about alignments
grouping etc
Kaj
10-Oct-2007
[4849]
And a good reason to educate people ;-)
Graham
10-Oct-2007
[4850x2]
Rebgui has done a lot of work here
with containers that allow you to create groups of widgets that move 
in concert
Henrik
10-Oct-2007
[4852]
Graham, I will get to that. I may make another blog post on that. 
But VID3 behaves similarly to QT or GTK in this respect now.
Graham
10-Oct-2007
[4853]
don't know QT/GTK