World: r3wp
[Dialects] Questions about how to create dialects
older newer | first last |
Steeve 9-Jan-2010 [426] | ABC would mean [A B C] with this new system |
Andreas 9-Jan-2010 [427x2] | and changing the case of text is something that can be relegated to a good editor :) |
g~$ in vim, to switch case for everything from the cursor to the end of line | |
Fork 9-Jan-2010 [429] | Well you're free to work out an example of a better dialect but you'll be parsing URLs or something... like where I can do Ab to get a: b how would you get it? |
Steeve 9-Jan-2010 [430] | A:B |
Fork 9-Jan-2010 [431x3] | >> type? A:B == url! |
You're starting to tread on the question of taking away things and making a non-superset | |
And you added a character :) | |
Steeve 9-Jan-2010 [434] | Yes i added a character but i don't have to take care of the correct alternation of uppercases |
Fork 9-Jan-2010 [435] | A character here, a character there... pretty soon you're talking about real whitespace! :) |
Steeve 9-Jan-2010 [436] | :-) |
Fork 9-Jan-2010 [437x6] | Implementation gets trickier if you're parsing urls, and you're impinging on the URL type at that point, which is an any-string and thus does give meaning to case. |
My goal was to only muck with words, which Rebol binding has promised to ignore | |
Er, ignore case | |
There are other issues: | |
>> 'A:B ** Syntax error: invalid "word-lit" -- "A:B" ** Near: (line 1) 'A:B | |
>> 'AB: ** Syntax error: invalid "word-lit" -- "'AB:" ** Near: (line 1) 'AB: | |
Steeve 9-Jan-2010 [443] | hey ! your parser is the weak point, it seems :-) |
Fork 9-Jan-2010 [444x4] | >> unmush ['aB] == ['a b:] |
>> unmush ['aB] == ['a b:] | |
That's the Rebol parser. I'm not taking strings as input, I'm taking Rebol blocks. It's a dialect. | |
If I were taking strings, sky's the limit... but, what's the point? | |
Steeve 9-Jan-2010 [448] | it doesn't bother, parse has not the limitations you pointed |
Fork 9-Jan-2010 [449x2] | >> parse ['AB:] [to end] ** Syntax error: invalid "word-lit" -- "'AB:" ** Near: (line 1) parse ['AB:] [to end] |
>> parse {'AB:} [to end] == true | |
Steeve 9-Jan-2010 [451x2] | what is the interest to try to construct something which has no sense in Rebol |
'AB: has no meaning | |
Fork 9-Jan-2010 [453x4] | I'm just playing devil's advocate for your suggestion to go putting colons in the input when the goal is to minimize source representation. |
I showed you my answer to get ['a b:] in a brief notation | |
>> unmush ['aB] == ['a b:] | |
From 5 chars down to 3, and it's legal to the Rebol parser. | |
Steeve 9-Jan-2010 [457x2] | ok i understand, i just proposed to avthe burden caused by a safe alternance of letter's casing |
avthe=avoid | |
Sunanda 9-Jan-2010 [459] | Following some thoughts of Christoph Budzinski back in December, I wrote a short article on an approach to REBOL code golf last month......It takes quite a different approach to yours. But as it was never published, your approach must have priority :) What I suggested in the article was: 1. we create a private group here to thrash out the principles and practicesl then launch a set of REBOL code golf challenges 2. current code golf is seriously flawed as it counts characters not lexical elements: variable1: variable1 + variable2 is much better code than: v1: v1 + v2 and should have the same golf score 3. in REBOL, the First Rule of Code Golf is: Parse always wins (this has been empirically observed over many REBOL code challenges) |
Fork 9-Jan-2010 [460] | Well, I understand the concern, but I didn't do it just to be weird. :) |
Steeve 9-Jan-2010 [461] | only to save ":" what a tremendeous gain !!! :-) |
Fork 9-Jan-2010 [462] | Stevee: But my point is you're forgetting the spaces, which are needed too, since colons cannot appear in words. |
Steeve 9-Jan-2010 [463] | i agree for saving spaces |
Fork 9-Jan-2010 [464x6] | Look at the Roman Numerals program [rSfeCs[Nse[i1v5x10l50c100d500m1000]twCi~J[JnCN]Kk+elJn[alN-j N0]'jJn]pK+j] |
Then look at what it unmushes to: | |
[r s fe c s [n: se [i 1 v 5 x 10 l 50 c 100 d 500 m 1000] tw c i ~ j [j: n cn] k: k + el j n [al n - j n: 0] 'j j: n] p k + j] | |
Saves 40%. The colons and the spaces are intertwined issues, just due to the rules of Rebol. And I feel that if the dialect wasn't parseable Rebol but a string it wouldn't rightfully be called a Rebol dialect. | |
Sunanda: Rebol definitely could get some publicity with empathetic people if it were to embrace the code golfers... | |
Sunanda: I feel from my experience with parse that it's the sort of thing that can, if it fits your problem, help you a great deal... but it often seems to be just short of the needed functionality. I feel if your task does not depend on knowing the true/false result of matching, then series operations are often better. I've been thinking "if you don't use the boolean result of parse, you probably aren't working on a task that needs parse." | |
Steeve 9-Jan-2010 [470] | Generally Rebolers don"t make any difference with dialects parsing a string or a loaded block. It's called dialect as-well. |
Sunanda 9-Jan-2010 [471] | My other main article point was: 4. Real golf has 18 holes per round. Most code golf plays just one hole. To be more realistic, there should be at least three holes -- ie after the first hole's scores are published, the challenge setter makes a modification to the challenge. Scores for that hole are (somehow) equated to the amount of original code the survives. |
Fork 9-Jan-2010 [472x3] | 5. you do not bring your sony robot, night vision goggles, laser guidance systems, etc. onto the golf course. You bring a bag of sticks and you use your own arm, eyes, and brain. |
Obviously people who do code golf come to it from different perspectives, I think Rebol's key here is just to engage by giving lively and flexible solutions which pique interest. I intentionally didn't clone the deranged "winner" of the roman numeral contest because he'd thrown out the program logic, it was no longer source code. I can edit, debug, and insert probe messages into mine easily. | |
>> rebmu [rSfeCs[Nse[i1v5x10l50c100d500m1000]twC (probe n) i~J[JnCN]Kk+elJn[alN-j N0]'jJn]pK+j] Input String: XIV 10 1 5 14 | |
Steeve 9-Jan-2010 [475] | REBIRDY would be a better suitable name for your dialect ;-) |
older newer | first last |