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

World: r3wp

[Dialects] Questions about how to create dialects

Pekr
24-Aug-2009
[368]
>> view layout [b: btn "OK" red [probe b/effect]]
[colorize 255.0.0 128 extend 14]
Henrik
24-Aug-2009
[369]
you need to check feel/redraw to make sure the effect is not overwritten 
by it
MaxV
24-Aug-2009
[370]
If I put 
b/effect: [ gradient  0x-1  0.255.0 0.255.0]
??
Pekr
24-Aug-2009
[371x3]
MaxV - to study it further, you can type following in console - print 
mold get-style 'button
Should work, remember to call show b in you code ...
also remember, there are two button versions - button, and btn - 
slightly different. You might also be interested to look into RebGUI 
VID alternative ...
MaxV
24-Aug-2009
[374]
Yes, yes. 

I'm trying to write a italian guide to Rebol, but now it's coming 
R3, and VID will be changed significantly., so I use Rebol just for 
the programs I need. 

I think that Rebol is what a programmer really needs, but finding 
guides about it is so difficult...
Pekr
24-Aug-2009
[375x2]
>> view layout [b: button "OK" red [probe reduce [b/color b/font/colors 
b/effect]]]

[255.0.0 [255.255.255 255.180.75] [gradient 0x-1 255.32.32 223.0.0]]
yes, R2 was kind of rather badly documented. And VID2 is really not 
that easy to hack, extend, beyond what it does. In the past I was 
reluctant to use RebGUI, because it looked rather unatractive, but 
that is not case anymore ....
MaxV
24-Aug-2009
[377]
Yes, I was confused by b/color
Pekr
24-Aug-2009
[378]
hmm, seems b/color is the red color. b/font colors is font colors 
- normal and over, b/effect - dunno ...
MaxV
24-Aug-2009
[379]
well b/color after initialization is ignored, so I have to change 
effect
Pekr
24-Aug-2009
[380x7]
this is the button's init function part - it looks if you have image 
for button, and if not, then:

            if not any [effect effects] [
                either color [
                    effects: reduce [

                        reduce ['gradient 0x1 color + 32 color - 32]
                        either all [block? colors colors/2] [

                            reduce ['gradient 0x-1 colors/2 + 32 color/2 - 32]
                        ] [

                            reduce ['gradient 0x-1 color + 32 color - 32]
                        ]
                    ]
                ] [
                    effects: [
                        [gradient 0x1 66.120.192 44.80.132]
                        [gradient 0x-1 66.120.192 44.80.132]
                    ]
                ]
either color

  means, if you have submitted a color facet in VID level ... e.g. 
  button red
I was not succesfull changing only 'effect. You have to change b/effects 
block, because of following engage/redraw code imo:

if face/effects [face/effect: pick face/effects not state]
>> view layout [b: button "OK" [probe reduce [b/color b/font/colors 
b/effect b/effects]]]
[44.80.132 [255.255.255 255.180.75]
    [gradient 0x-1 66.120.192 44.80.132] [
        [gradient 0x1 66.120.192 44.80.132]
        [gradient 0x-1 66.120.192 44.80.132]
    ]
]
If you change only b/effect, it will be rewritten by redraw imo ....
view layout [b: button "OK" red [b/effects/1: [gradient 0x1 100.100.100 
120.120.120]]]
From there on, you can work out your final solution imo ...
MaxV
24-Aug-2009
[387]
Yess!  Effect is the color of the button pushed, effects normal button 
state.
Thank you
Pekr
24-Aug-2009
[388x3]
Effect is the actual color in actual state imo. Remember that you 
can call 'show in many places. Effect is initialised upon button 
state by redraw code: "pick face/effects not state"
You just have to do a little math, if you want the gradient. From 
the oce you can see how to aproach it - VID applies +- 32 tuple offset 
...
oce=code
MaxV
24-Aug-2009
[391]
OK Thanks
Fork
9-Jan-2010
[392x5]
I took a bit of a Rebol break for the new year.  But last night I 
had an idea that just wouldn't get out of my head.  It happened after 
I read about "code golf" on StackOverflow.  The premise is to use 
the fewest characters possible to solve a problem using a general 
purpose language (albeit perhaps one optimized for such a game, like 
"GolfScript")
Some of the things people do are utterly ridiculous.  They compile 
assembly to DOS .COM files and claim the resulting hex bytes constitute 
program code because you can feed them into the console.  Other approaches 
obfuscate the code beyond belief to where you really can't make the 
slightest change to them--they are effectively not source, but the 
result of a bizarro compilation--often written using some kind of 
assistive tool or calculator.
Philosophically, it would seem Rebol could compete, if the functions 
had shorter names--which is easy enough (Huffmanize natives and the 
mezzanine, whatever).  But the whitespace policy for words is a bit 
of a problem.  Then I thought of what I called "mushing"
>> unmush [aBcDe/fG/h]
== [a b c d e/f g/h]
>> unmush [AbCdE/Fg/H]
== [a: b c d e/f: g/h:]
Steeve
9-Jan-2010
[397]
interesting
Fork
9-Jan-2010
[398]
Still parseable Rebol, but each time you switch the case it's a conceptual 
word break.
Steeve
9-Jan-2010
[399]
and how do you decipher a set-word ?
Fork
9-Jan-2010
[400x8]
Here's a 77 character Roman Numeral to integer converter:
rSfeCs[Nse[i1v5x10l50c100d500m1000]twCi~J[JnCN]Kk+elJn[alN-j N0]'jJn]pK+j
If you start a mushing sequence with a capital letter that indicates 
the desire for a set-word
http://hostilefork.com/2010/01/08/modest-proposal-for-code-golf-in-rebol/
And I just pushed the source for a proof of concept to GitHub: http://github.com/hostilefork/Rebmu/blob/master/rebmu.r
Just came up with it last night, so, it's what it is
But I bet that it could put Rebol on the map as a code golf language.
Wait, that's a 72 character translater.  The 77 one was different. 
 :)
Steeve
9-Jan-2010
[408]
but in fact it's a little bit cheating, the code cannot be execute 
as-is.

Is there a real difference with the following idiom used to shorten 
rebol sources
>> do load decompress #64{...........}
Fork
9-Jan-2010
[409x3]
My goal was to create a language you can program in on paper
I suppose technically you can base-64 encode by working it out on 
paper, but I think it has moved out of the domain of being program 
source code at that point.
The parse dialect also cannot execute as is.  Thus are dialects.
Steeve
9-Jan-2010
[412]
ok the point is that you may be able to understand the code with 
normal human abilities
Fork
9-Jan-2010
[413x5]
Right.  And in 1 day of getting used to it, I can pretty easily translate 
the above Roman Numeral code as I read it
A little awkward, but, not so bad when compared to things that have 
disposed the entire program logic into constants like n=1;$.+=n/2-n%n=10**(494254%C/9)%4999while 
C=getc;p$.
Also it's not corrupting the language (much).  If you learn this 
"rebmu" dialect you'll be learning a useful language and your knowledge 
will transfer.  As opposed to GolfScript which is just garbage.
(But good for a CS class, or whatever.)
(As most joke languages are.)