« first day (1355 days earlier)      last day (2425 days later) » 

3:54 AM
Matching JSON with RebMu Pa(rse) (just validates, not extracts):
S[any[" "|"^-"|"^/"]]
Npp[opt"-"smDGopt["."smDG]opt[["e"|"E"]opt["+"|"-"]smDG]]
T[{"}any["\"["u"4 hx |"\"|"/"|"b"|"f"|"r"|"n"|"t"]| not["\"|{"}]skip]{"}]
B["["sOPT[vANY[s","sV]]s"]"]
O["{"sOPT[tS":"sVany[s","sTs":"sV]]s"}"]
V["null"|"true"|"false"| n | t | o | b]
paA[sOPTvS]
275 characters—though newlines are optional. Would be nice to dicern '| from mushing, but that'd conflict with functions...
Could also shorten OPT and SKIP parse commands.
And there's no shortcut for CHARSET or BITSET!
 
4:07 AM
7
A: Write a JSON validator

user300PHP : 297 285 264 253 characters <?=preg_match(<<<'R' ~([\h ]*)({(?1)((("([^"\\\0- ]| |\\(["\\/bfnrt]|u[\dA-Fa-f]{4}))*")(?1):(?1)((?5)|-?(0|[1-9]\d*)(\.\d+)?([Ee][+-]?\d+)?|(?2)|true|false|null))(((?1),(?1))(?4))*)?}|\[(?1)((?8)((?13)(?8))*)?(?1)])(?1)\z~A R ,`cat`)?'Valid':'Invalid'; score: ...

The Rebmu is clearer, of course. :-)
 
Can get it down to 252 by moving individual value definitions into the main 'V block. Easy!
 
Don't think I can spare the | unfortunately.
 
@HostileFork Shame, but I suppose another symbol could fill in.
 
Well it's not about the symbol as much as it is about not being able to have a breaking thing with such narrow application when trying to broadly optimize 2 char sequences
It's been a while since I thought about it but there were some nuances to why I picked various ones to do different things.
 
With a two-character CHARSET replacement, would be down to 248.
 
4:15 AM
Can't think of a good 2 character one there from alphabetics, but the "constructor space" is something that is open for future expansion
 
CR ?
 
Already carriage return in Rebol proper
; This set needs to have thought given to them.
; they breaks symbols; a^b becomes a^ b but A^b bcomes a: ^b
; ^foo is therefore good for construction functions which are going
; to target an assignment but little else. getting a ^ in isolation
; requires situations like coming in front of a block or a string
; literal so it might make sense to define it as something that is
; frequently applied to series literals. decoding base-64 strings
; might be an option as they are used a lot in code golf.
So maybe something like ^c as a character set generator but could have flexible behavior if you passed a word to it as well
 
There's A~ for constructing Arrays, H~ for constructing HTTP URLs, why not C~ for Charsets?
 
^cAB for instance taking the letters in the word, turning to string, making a character set.
Relying too much on the mu-library is something I've pushed against, but, it is the "next frontier" of thinking through how to pack a library in.
Without something that can do basic matrix stuff, too many problems lose to J etc.
My plan was to try and be more "one-to-one" in providing the features of a popular library vs. making-stuff-up.
 
I get that—would assigning C~ to CHARSET be any different to assigning A~ to ARRAY though?
 
4:29 AM
@rgchris Well...just that the direction there needs some scrutiny, been trying to keep it on the back burner with a more rigorous set of rules. But why not take those charsets you put in parse and make them global? I was already proposing they would be... we like to be able to do a find whitespace ch or find digit ch. Doesn't seem to be conflict... dg for digit, maybe dgh for digit/hex... ltl for letter/lower, ltu for letter/upper... ws for whitespace.
Would have to dig up our character classes, but there's an incubator.reb there to throw in whatever you think is useful. Solving code golf problems with them isn't a bad way to see how handy they are.
 
Indeed. Even then, general purpose character classes aren't going to solve every problem. A comfortable 234 assuming C~ for CHARSET and stripped of newlines:
Wc~" ^-^/"S[anyW]Yc~"\/bfrnt"Qc~{\"}
T[{"}any["\"["u"4 hx | y]| notQskip]{"}]
Vpp["null"|"true"|"false"|opt"-"smDGopt["."smDG]opt[["e"|"E"]opt["+"|"-"]smDG]| t |"{"sOPT[tS":"sVany[s","sTs":"sV]]s"}"|"["sOPT[vANY[s","sV]]s"]"]
paA[sOPTvS]
 
Worth thinking about. But I have an inner "construction zone" thought about that set and don't want anyone getting attached to how it's used yet.
Is your concern that ws in general may run you afoul of the spec by being too general? If so you could do wsa for whitespace/ascii, maybe.
I'd rather go to a three-letter charset constructor instead of bleed into ~ at this point
chs
 
No—I certainly think matching RegEx character shortcuts would be a good start point, just that building charsets are a key part to setting Parse aside.
 
It's hard to say, because I was considering with that proposal I had about how the make functions might use the tildes that Rebol/Red proper might think of going to object~ or ~object to distinguish the verbs from the nouns.
Rebmu design favors the tailing syntax, and it looks a little better.
But then it can't be substited with "create" or "make" as you read it. If that matters.
 
Btw, not making prescriptions—just throwing out some thoughts. RebMu Parse has been a touch intriguing, just exploring the issues...
 
4:42 AM
Sure, glad you're having fun w/it :-)
 
Could you imagine approaching work every day facing code like your PHP example?? Ugh...
 
Well that's part of why Rebmu needs to exist. I don't think your comment is off the mark. As the quote I've cited before from Niklaus Wirth said:
"Increasingly, people seem to misinterpret complexity as sophistication, which is baffling -- the incomprehensible should cause suspicion rather than admiration. Possibly this trend results from a mistaken belief that using a somewhat mysterious device confers an aura of power on the user."
Yet, I do think, people take a certain joy in the unreadability or perceived cleverness of their code. Some people demand ugliness of a sort; and they feel they are "on top" when they can win these types of contests.
 
RegEx is the poster-child for that, I'd say.
 
yesterday, by rgchris
Given that people apparently like heavily truncated pattern matching, perhaps it's only now after having been mushed that Parse can take over the universe.
^-- that remark
 
It does seem to have a certain cache—probably because it does span several languages, and particularly as it's in the browser.
@HostileFork Yep, it was intended firstly as humour, but I recognise a certain truth in it too. It gets absurd as it seems RegEx is getting built up to handle recursive patterns. Makes you want to scream—WHY ARE YOU DOING THAT? LOOK HOW COOL PARSE IS!
Now at least Parse can be just as cool in SIGNIFICANTLY fewer characters. For those to whom that is important.
 
5:03 AM
@rgchris Well, why not we add those character classes to incubator--using the refinements, as we were thinking of them. And in the cases that can't handle see how well you can fare with CHS. If you have a charset-related problem and want to define c as CHS because you wind up using it a lot in a problem, I was trying to come up with some clever methods of that. .cCHS to map it to c or however I had it. Some strategy like that.
The push and pull here is on that "clarity" thing and I don't want it to be CX or what would be "unclear" out of the box. And I'm still on the fence on the generators and how to use the remainder of 2-character space
Maybe incubator could be a separate project we can use in lots of projects as a submodule, with several different files in it for each proposal, and name the individual files by their curecode tickets (or something).
 
 
3 hours later…
7:37 AM
Does anyone know a good website where there are lots of exercises a beginner to programming can do to aid in learning rebol? I read the tutorial by "Nick" but I think I learn better by doing exercieses.
 
@user3398747 you can check scripts on rebol.org
 
@user3398747 I'm sure there are general excercises on the web that you could find and see if you can solve them in Rebol.
 
@user3398747 There are programming puzzles there on the code golf stackexchange, and if you need help improving a Rebol solution we can help. Not all puzzles focus on trying to write the shortest program; some are just coding challenges to see technique. If you solve a puzzle with Rebol and do want to get it shorter, we have a secret weapon: Rebmu
 
@user3398747 I'd suggest to find something useful to yourself, small and achievable and try that. For example, when the mobile phone I wanted was out of stock and no date of in stock, I wrote a script that would check hourly and alert me to when the out of stock message disappeared. It alerted, I bought my phone, out it went out of stock again an hour later. It was an easy script, but very useful.
 
7:53 AM
Thanks, I'll look into all that
 
 
1 hour later…
8:58 AM
@rgchris It looks like background-position in StyleTalk requires specific order of values. canvas top center returns background-position: top center, however canvas center top returns background-position: top only. The order shouldn't matter.
 
 
2 hours later…
11:20 AM
@earl - when I run rlwrap r3 seems that r3 manages directly I/O, as when ran standalone. Any suggestion?
 
@giuliolunati Rebuild r3 with -DHAS_SMART_CONSOLE to get a rlwrap-friendly binary.
 
 
2 hours later…
1:08 PM
I have pushed my changes with external C function access to github: github.com/zsx/r3/tree/ffi on branch ffi
3
Build instruction: Once you check out the branch, go to directory "make":
$make -f makefile-64 clean
$make -f makefile-64 r3-view-linux
There are some testing files under make/tests, they can also be seen as examples
I've only documented about "struct!" at: github.com/zsx/r3/wiki
One thing I forgot to mention, as the external function access is done with the help of libffi, you need it (and the development files) installed on your system
 
 
2 hours later…
3:01 PM
@earl I wonder if one could detect it somehow... I noticed similar problem, when running R3 inside MSYS2 console.
MSYS2 is using ConsoleZ = github.com/cbucher/console
Red is not working in it:/
 
 
1 hour later…
4:25 PM
I need a PARSE rule to check if a string has identical first and last char, as "abca" or "gfthbmig". Obviously I could do this without PARSE, but that's an example for back-reference ...
Thank @earl !
@earl I mean, for that
 
5:13 PM
>> parse "gfthbmig" [set x [skip] any [to x] x]
 
; Brought to you by: tryrebol.esperconsultancy.nl
== true
 
@giuliolunati Skip up to x, any number of times, then match an x? Edge cases notwithstanding.
 
posted on July 17, 2014 by Szeng

I have pushed my changes to R3 with external C function access to github: http://github.com/zsx/r3/tree/ffi on branch ffi

 
I still think that would be clearer as [set x char! any [to x] x] or [set x any-type! any [to x] x] if you wanted the rule to be generic and work on other series. And I still don't like next as synonym for skip.
It would be nice if reverse was working, parse tolerated comma in a way compatible with do, and you could say for instance [set x any-type! , any skip , reverse , x]
 
6:19 PM
@giuliolunati Ah, the to x won't work if there's an x in the middle. Hm.
>> parse "gfthgbmig" [set x [skip] any [to x] x]
 
; Brought to you by: tryrebol.esperconsultancy.nl
== false
 
Hm, so why doesn't that infinite loop? Is parse guaranteed in some way to not infinite loop if you don't use any paren code or set/get positions?
I was confused by the combination of "must make progress consuming things up until x because there will always be more x" and then "will be left in front of an x in the final state", but that's wrong.
 
@rebolbot
parse "gfthgbmig" [set x [skip] any [to x x] end]
 
; Brought to you by: tryrebol.esperconsultancy.nl
== true
 
@rebolbot
parse "gfthgbmig" [set x [skip] any thru x end]
 
6:25 PM
@giuliolunati Please continue.
; Brought to you by: tryrebol.esperconsultancy.nl
== true
 
@rebolbot
parse "gfthgbmigh" [set x [skip] any [to x x] end]
 
; Brought to you by: tryrebol.esperconsultancy.nl
== false
 
Ending a parse rule with "end" is a no-op
 
@rebolbot parse "gfthgbmig" [set x any thru x]
 
@giuliolunati Please continue.
 
6:28 PM
If "g" is a match then you could use "any thru" I guess, and then "some thru" if you need at least "gg" to count for the test.
 
@rebolbot
parse "gfthgbmig" [set x any thru x]
 
; Brought to you by: tryrebol.esperconsultancy.nl
== false
 
@HostileFork right!
 
You can't use x in the "any thru x" rule if its the target of the set, as it hasn't been set yet.
>> parse "gfthgbmig" [set x [skip] any thru x]
 
; Brought to you by: tryrebol.esperconsultancy.nl
== true
 
6:30 PM
>> parse "gfthgbmi" [set x [skip] any thru x]
 
; Brought to you by: tryrebol.esperconsultancy.nl
== false
 
@HostileFork why [skip] and not skip?
>> parse "gfthgbmig" [set x skip any thru x]
 
; Brought to you by: tryrebol.esperconsultancy.nl
== true
 
>> parse "gfthgbmi" [set x skip any thru x]
 
; Brought to you by: tryrebol.esperconsultancy.nl
== false
 
6:33 PM
Cargo-cult programming. I tried set x skip for something and it didn't work earlier. Thought I changed it and that was what made it work. Looks like it's fine.
 
@hostilefork Once again your help is decisive for me!
:-)
 
@giuliolunati Well, not like I know what I'm doing. But glad we could figure out a solution. If you wanted to make that a Q&A it could be good to summarize, as we haven't had much Rebol Q&A lately.
 
 
2 hours later…
8:50 PM
To people who understand these things, is @ShixinZeng's C interface give us similar functionality to that of Rebol2 now?
If so, is the bounty still active ? :)
 
9:05 PM
@HappySpoon it's similar and more powerful
 
@ShixinZeng in that case, await the new Atronix builds with great interest! Thanks
Are there going to be non-gui Atronix builds?
 
@HappySpoon probably, but it's my intention to make the GUI build also runnable without X
If it's not, please let me know
 
ok, great
 
9:48 PM
@ShixinZeng Great work! Is there going to be a way to remove the dependency (or integrate FFI into the build?) Not familiar with how that may work
 
 
1 hour later…
10:59 PM
If I start a rebol process from my main app, is there also a way I can kill it?
 

« first day (1355 days earlier)      last day (2425 days later) »