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
[376]
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.)
Steeve
9-Jan-2010
[418]
There is a burden.

When you add Something inside a sequence, you may have to swap all 
the followings caps/tiny letters :-)
Fork
9-Jan-2010
[419x3]
True, but renaming variables is a burden as well.  As it happens, 
each numeric constant, symbol, or path operator breaks the chain 
so you get to start anew
aaBBccDDeeFFgg... if you really do have a long long uninterrupted 
chain of that nature then there's a problem.  But I bet usually a 
number or path or symbol would pop in there.
Anyway, I'm not very interested in the super estoeric algorithms 
but do note that people get upvoted significantly for small solutions 
in languages like J: http://en.wikipedia.org/wiki/J_(programming_language)
Steeve
9-Jan-2010
[422]
if each new word always begin with a capital letter, you don't have 
anymore the problem.
You just lost the compression of the ":" char. Not a so huge loss
Fork
9-Jan-2010
[423x2]
Problem is that single character words play a huge part in this
Every variable in your program in most cases will be only one letter.
Steeve
9-Jan-2010
[425]
So what ?
3A