« first day (850 days earlier)      last day (2930 days later) » 
00:00 - 08:0008:00 - 00:00

8:00 AM
@GrahamChiu probe sys/*parse-url/user-char
>>make bitset! #{000000001F3EFFD47FFFFFE17FFFFFE8}
 
@RebolBot /x probe value? 'print ; testing to see if ' makes it thru
 
@GrahamChiu probe value? 'print ; testing to see if ' makes it thru
>>true
 
KK.
8:24 AM
I have a function that returns true if the input is an email!
How do I make sure it returns false if its not an email
is-email: func [input-thing] [
    if (type? input-thing) = email! [
        return true
    ]
]
Currently, it behaves like:
>> ie-email k.sd
** Script Error: k.sd has no value
** Near: ie-email k.sd
 
use either for if/else
 
@KK. or just use email? function
 
@GrahamChiu Yeragenius.
 
KK.
@rebolek No, sorry.
>> email? kk.a
** Script Error: kk.a has no value
** Near: email? kk.a
@GrahamChiu @rebolek r2
 
@kk, is kk.a set to anything?
 
8:31 AM
@KK. You will get the same error with your function, because Rebol evaluates kk.a word and it has no value. You need to prevent it from evaluating to prevent this error. This can be done for example by putting the value into block: email? first [ kk.a ]
 
KK.
@Adrian No. Let me try this way.
@Adrian @rebolek you are right.
 
>> e?: func [ 's ][ either unset? get/any 's [ false ][ email? s]]
>> e? asdfsf
== false

>> e? a@b
== true
should work on R2 as well
@HostileFork umm... don't you mean rebolbot?
 
Yes, your bot
Are you running Rebol remotely?
 
KK.
@GrahamChiu what does unset? do
 
no, on my laptop .. still waiting for the OK
 
KK.
8:36 AM
@GrahamChiu wait.
>> e?: func [ 's ][ either unset? get/any 's [ false ][ email? s]]
 
@KK. Not following totally but please note the difference in quoting arguments between R2 and R3...
3
Q: Why doesn't Rebol 3 honor quoted function parameters that are parenthesized?

HostileForkThe DO dialect uses series of category PAREN! for precedence, and will usually boil away the underlying parentheses structure prior to invoking a function. However, it used to be possible in Rebol 2 to specify in a function's definition that you wanted it to suppress evaluation of parentheses at...

 
KK.
@GrahamChiu If the value 's is a rebol datatype, then you check for email! if not you simply return false.
 
if the 's has no value then false otherwise test for email
>> a: "something"
== "something"

>> unset 'a
>> a
** Script error: a has no value
'unset can be used to reclaim memory for the Garbage collector
get gets the value of 's
get/any also allows getting unset! values
Unfortunately the help command does not return a value .. it prints to the console so my bot can't process help commands without a rewrite of 'help
 
@GrahamChiu Shouldn't help return something structural?
 
@HostileFork I'm thinking it should
 
8:51 AM
@GrahamChiu If it were properly done with newlines in the right places, I think it wouldn't be that distracting. We should mock it up.
It would be "a little weird" but Rebol's weird already so why not "go with it" and be actually useful?
 
it's not helpful at present
 
@GrahamChiu Would be nice if "print help foo" did something useful. Perhaps there can be a print dialect?
Best of both worlds.
help foo => readable structure, "okay" not too hard to look at... print help foo => well, okay if you insist.
print as it stands today is making me uneasy.
Too much implicit behavior, too little dialect.
 
print also fails to return anything
 
@GrahamChiu I like that about print. I wouldn't change that.
It's the true "end of line"
You printed it, and... it's gone.
 
and that's why you have all these work rounds
 
9:04 AM
Long live return #[unset!] :-)
No you have the workarounds because help is crappy, and breaks the faith.
 
you have to define things like 'emit to construct a string
 
Or put () at the end of the function.
 
wouldn't be easier if print returned values ?
 
The faith is outlined in Was XML flawed from the start. If you buy into it, then things like help should return Rebol structure, not spew garbage onto stdio.
And then a nice result from print help foo. Trust me, I'm a scientist.
 
@HostileFork Yes. I redefined help to do this with CGI.
 
9:07 AM
help does have modes .. eg help/doc for R3
perhaps that should be help/web
 
Anyways, 3am here, time to sign off... but really interesting day for Rebol chat, in the microcosm that it is, and some good blogging and investments from new talent. And BrianH posted my function proposal for me. I guess I'll call it a success. :-)
 
KK.
9:24 AM
@HostileFork Good night.
 
9:36 AM
I really don't like the change from help foo to print help foo. Help is used mainly in console, if you need to output something from help, I preffer adding a refinement to help than changing current behaviour.
 
I guess it was never envisioned that help would be online
 
I guess it was and that's the reason why there's /doc refinement that opens documentation in browser.
 
that's a console function; I meant as a web service
 
Still, the main usage would be in console.
 
9:51 AM
sure .. but there should be more flexibility in the way it returns information
refinements modify behaviour so perhaps that the way to go
 
Can't you catch stdout for web service, so it would work like print in CGI?
 
@rgchris says he had to modify help
maybe there should be a general piping mechanism
 
10:25 AM
@GrahamChiu Perhaps not, but it's handy for debugging.
 
KK.
10:47 AM
>> is-tag?: func ['val] [either unset? get/any 'val [false] [tag? val]]
>> is-tag? <a>               ; case 1
== true
>> is-tag? a                   ; case 2
== false
>> is-tag? <a                 ; case 3
** Syntax Error: Invalid tag -- <a
** Near: (line 1) is-tag? <a
What can I do for handling case 3?
BTW, I am using r2.
 
<a cannot be loaded to Rebol. If you want to check values that are not Rebol datatypes, they should be in string.
 
 
1 hour later…
12:10 PM
posted on February 27, 2013 by cyphre

changes details: -fixed refinement/arg bug in DECOMPRESS -fixed CRC32 calculation/verification in ZLIB code in DECOMPRESS/GZIP mode Carl, maybe it would be better to change the /GZIP refinement to /CRC32 ? What do you think? I think it is better as the feature is not fully compatible with GZIP format but it just uses different checksum type (instead of the default adler-32) We can always

 
 
2 hours later…
1:49 PM
 
2:10 PM
Help my Rebol article get to the front page: news.ycombinator.com/item?id=5292381
2
 
@SomeKittens Great work!! I'm afraid I don't have one of those accounts. Maybe someone here does. Rebol makes the news there sometimes I've seen, although I guess most of the last times it made it all the comments were like "open source = too little, too late" :-/ Well, too late yes, but time will tell what we wind up accomplishing.
 
2:25 PM
@HostileFork: since your new-line change made it to r3 mainline (congratulations!), I wonder whether you want to define some tests to make sure new-line keeps working as expected...
 
@Ladislav Well, I added it because Red needed it to still work under R3... :-) My main test goal is to see the Red and Rebol test suites come together and bring best of both worlds... each test can be marked as [Red] or [Rebol] or [Rebol Red]... so if I become involved in testing more it will be to make that happen
ATM my programming focus, when I have the time and energy to focus on programming, is finishing making sure the R3 red port has no regressions
 
KK.
@SomeKittens I will link my blog post when it is ready to your news.ycombinator post
 
@KK. Thanks, do you have a HN account?
 
KK.
@SomeKittens Only made one after watching your other post there.
 
@KK. Let me know when you submit your article, I'll upvote it (would appreciate your upvote too)
 
KK.
2:40 PM
@SomeKittens I do not know how upvotes work there. I am not able to upvote, maybe thats because I have no posts there.
 
@KK. Huh. HN isn't well documented, so I can't give a canon answer
 
KK.
@SomeKittens 12 to 14 hours ago, I would have starred that :-)
 
 
2 hours later…
5:02 PM
Any Rebol experts here? I want to see about the feasibility of an idea I had.
 
@SomeKittens I still hesitate to call myself an "expert". I've clocked very little time with practical Rebol. But I know a thing or two about programming in general, and I kind of "get" Rebol, so... if that's good enough.. Ok
@Neal / Naftali... welcome!
 
@HostileFork hi?
 
@Neal Welcome? :-) What brings you to chat today? Are you interested in learning "new things"?
 
@HostileFork I am not sure...
 
:)
 
5:04 PM
You seem very hostile.
 
@Neal My handle is a joke. You can read about what it means and why I came up with the joke here, if you like: hostilefork.com/about
 
What I want is a bit like a crawler: load a webpage, grab certain types of links on that page, then parse content from those pages
 
@HostileFork hmmmmmmm
 
@Neal Some people like the avatar. @SomeKittens says it kept him in the room, I think.
 
@HostileFork ok then.
 
5:06 PM
Angry Cartoon Fork FTW
 
I showed up, complimented @HostileFork on the avatar/name, and he convinced me to stay
 
The reason it thumbnails so well is that I drew the favicon for my site and thought "hmm. That's... actually... pretty good."
 
KK.
@Neal Hello.
 
@Neal I also drew the Rebol logo, and favicon. What's your impression? rebolsource.net
Bear in mind, I'm just a fanboy, I didn't make the language or ever work for RebolTech
 
@KK. hi
@HostileFork lol idk what rebol is, so i am not sure haha
 
5:08 PM
@Neal So what's your favorite programming language?
 
@HostileFork javascript.
followed by php
followed by c++
followed by english
:-D
 
@SomeKittens Feasible :)
 
How do I get the HTML of a website? I'm blanking on the right term
 
@Neal Heh. Okay. So you are used to what we might call "imperative programming". Have you dealt any with functional programming, or homoiconic languages... basically, any "fringe" stuff like Haskell or Lisp. (I hesitate to call this fringe because many people use it, but thing is, Rebol is even fringe-ier)
 
@SomeKittens viewsource?
 
5:11 PM
@SomeKittens: read http://some.page.com
 
@HostileFork I have used LISP. I did not like it that much
 
@SomeKittens If you're in Rebol 3 and want a string, you have to to string! read http://some.page.com because you get the bytes by default. It doesn't assume a decoding.
 
@HostileFork Thanks, that's what I was looking for.
 
@Neal Lisp is awkward as hell, but there's a great idea in there. Rebol has some of what makes Lisp awesome without being so stupid ugly.
 
@HostileFork eh?
 
5:15 PM
@Neal Well you know Lisp has all that CAR and CDR and weirdness. Rebol is much simpler. first [a b c] gets you a. next [a b c] gets you [b c]. It's more literate, but that's just the beginning.
 
@HostileFork baaah
 
@Neal Baaaah humbug. Why's that no good in your eyes?
 
Neal doesn't like things he doesn't understand. He doesn't like most things.
</kidding>
 
@HostileFork ehhh I like the way I program. what can I do in rebol that I cannot do elsewhere?
@SomeKittens no you're probably right. It takes me a while to get into new things.
 
You can do anything in any Turing-complete language. Why use one with limited featuers?
 
5:17 PM
@Neal Technically speaking, absolutely nothing.
This is the nature of computation.
 
@HostileFork So why use it then? any faster, better, stronger?
 
@Neal Beyond what you can imagine, yes. :-) Lots of faster, better, stronger. (Love that song.) You can start by downloading it and it will be downloaded almost before you click, no install. rebolsource.net
Work It Harder Make It Better - Do It Faster, Makes Us stronger - More Than Ever - Hour After - Our Work Is Never Over is a good Rebol anthem.
I'm a bit annoyed at the "our work is never over" aspect, though. :-/
 
KK.
@Neal I am learning Rebol for the sole purpose of being able to talk to cool people, and language implementors like @BrianH @Sunanda @earl @GrahamChiu @Adrian @rgchris and others. May not seem very tempting to you, but it is very good for me :-) :-)
 
There's really no way of describing the rush of watching brilliant people create a brilliant language
I'm trying to get all the URLs pointed to by the src attribute.
parse (to string! read news.ycombinator.com) [any {src="} (print
 
KK.
Hello @mhd
 
5:23 PM
What do I say to get "all characters up through the next double quotation mark"?
 
@SomeKittens Well what @rgchris would say, if he were here, is break your problem down into subproblems.
 
@KK. hmmmm
 
@HostileFork Yeah, thus my next question about chars through "
 
@SomeKittens And it depends how formal you want to get... what if someone in the body of the HTML says, just in passing conversation as you did, Hey guys I was thinking about src="foo" and it's inside a div...
 
I'm not worried about that at this point
Try to get it working then get it working right
 
5:26 PM
@SomeKittens Well I dunno, I like formalism. And if you care about that, the right thing to do is going to be to turn the thing into structure FIRST, before doing scraping. And that drives the entire approach.
 
@SomeKittens: parse page [any [thru {src="} copy link to {"} (do-something)]]
 
@rebolek I like long-term thinking, that's why I said what I said. And it should be (do-something link)
 
@HostileFork What do you mean by that?
 
@HostileFork No need to turn it into some structure when you need just copy links.
 
KK.
@Neal with the guidance of the great folks here, I am starting a rebol blog. The first post is still in the works, but you might want to take a look if google allows you. Of course, its not as great as your blog. And @SomeKittens is gonna blog about Rebol as well.
I am a big noob for now.
 
5:28 PM
@rebolek See this is the kind of sloppy thinking that's gotten us in a world with all these loopholes and such, a brittle buggy world... I mean, I'm all for "you get what you pay for" but I'd put a big fat comment on that going "HACK!!!!!"
I thought we were like, trying to fix that.
 
It may be do-something link but it's not necessary, that depends on the structure of your code.
 
@KK. I might look into it. but not for today...
 
Hello all over here. And thanks for increasing the points for me so I can even post messages ;)
 
@KK. When are you publishing that?
 
KK.
@Neal No issues. :-) Its incomplete today.
 
5:29 PM
@Cyphre No problem
 
@Neal We're here a lot lately. Not trying to spam or annoy SO, but this is so much better than IRC it's not even funny. Kudos to the devs.
 
KK.
@SomeKittens Ran into an issue with dealing with non-rebol-compliant code. So after I deal with it.
 
@HostileFork well, why you need to turn it into structure, when you just need to get links and that's all? All this structuralism will take to XML lands.
 
@HostileFork :-)
 
KK.
is-tag? <a ; breaks (for @SomeKittens)
 
5:30 PM
Slightly more deliberate example:
collect [
    non-quotes: complement charset {"}
    parse/all webpage [any [thru {src="} copy link some non-quotes {"} (keep link)]]
]
 
@Cyphre hi!
 
KK.
@Cyphre Hello.
 
@Cyphre Hi, good to see you around :)
 
@Cyphre You're welcome. :-) And welcome!!! @KK. @SomeKittens, Cyphre is kinda famous in Rebol land.
 
@rgchris What does keep do?
 
5:32 PM
@KK. You can't do that, as <a is not a valid Rebol value. You need to test it as a string. is-tag? "<a"
 
KK.
@rebolek but
>> type? "<a"
== string!
 
@KK.:
`>> type? try [load "<a"]
== error!

>> type? try [load "<a>"]
== tag!`
 
@SomeKittens It's supposed to work with 'collect. Collect creates a block then runs some code. If you 'keep within that code, it'll add to collect's block.
>> collect [repeat x 10 [keep x]]
== [1 2 3 4 5 6 7 8 9 10]
 
KK.
@rebolek Yes. @HostileFork also told me this. He also told me that I would either get an error for non-compliant code, or the code would run fine.
Is there some way that I can get to know if a value is not compliant, and then simply return false from the function.
 
@KK. I'm sure when you grasp this you will look back on these questions and go "OH, I see" :-) LOAD turns strings into structure, there are two outcomes: "It worked, here's your structure" and "It failed". You can use that but the input to LOAD is a string, not a structure...
 
KK.
5:37 PM
@rebolek @HostileFork You guys might be thinking of me as a knob-head in this case, but I really do not know what to do. Trying some other way might take a day or two more ( very lazy person here) :-)
 
LOAD works or it doesn't. DO of a url! or a file! will load those guys up as strings, and process them, and again you have the two outcomes. There is simply no way to do what you are asking, it's... just... not the way it works!
 
use TRANSCODE/ERROR -- its a sort of LOAD with error recovery>> transcode/error to-binary "1 2 <a"
== [1 2 make error! [
code: 200
 
And it doesn't not do it because it's broken. It's because it is logically inconsistent. :-)
 
KK.
@HostileFork So, now I know one way (incomplete tag) it can break the code. What if there are other ways? (there must be)
 
not sure if you already discussed this case regarding incomplete tag parsing:
>> load "<a word 12.456 <tag> 1 %file"
== [<a word 12.456 <tag> 1 %file]

so the REBOL loader get confused here so you need to have the '<' '>' pairs balanced in your data source
(or better use string parser)
 
KK.
5:44 PM
@Cyphre Yes, thats what I meant when I said I am a lazy person. But just a thought, I think what I want here conflicts with data-is-code way of doing things in Rebol.
 
Alright, now I want everything but a certain string.
 
@KK. LOAD is for dialects. Dialects are defined as valid rebol code. Thus LOAD is happy to fail if data is not valid REBOL. Transcode lets you gather errors and bypass them. It's a lower-level abstraction.
 
thru {href="http://} copy link some non-quotes {"} (keep link) ;Do I run another parse in the parens?
 
KK.
@Jina Does transcode work with r3 only? (I am currently using r2)
 
@KK I think the data-is-code term have to be said in some context. If you are trying to force the DO dialect to accept any data then you'll fail.
 
KK.
5:49 PM
>> help transcode
No information on transcode (word has no value)
 
@KK. R3 only, yes. You can kind of do the same with LOAD/NEXT in R2 with some error wrapping.
val: load/next "1 2 <a"
 
@SomeKittens Depends on the complexity of your needs:
nq: complement charset {"}
weblink: ["http://" some nq]
collect [
	parse/all webpage [
		any [
			thru {src="}
			[copy link weblink {"} (keep to-url link)
			| copy link some nq {"} (keep to-file link)]
		]
	]
]
Don't think you need parse/all—is that obsolete in R3?
You can keep honing your rules to varying degrees of specificity, but the premise is more or less the same.
 
Ok, how do I say "some nq OTHER than {given string}"
 
github.com/rebolsource/rebol-test updated, still wanting to find more people able to write new tests for Rebol in accordance with the documentation that can be found in rebol.org/art-display-article.r?article=n28vx
 
KK.
6:06 PM
@Jina I downloaded r3, and transcode is working.
>> transcode/error to-binary <a>
== [a #{}]

>> transcode/error to-binary "<a"
== [make error! [
code: 200
type: 'Syntax
id: 'invalid
arg1: "tag"
arg2: "<a"
arg3: none
near: "(line 1) <a"
where: [transcode]
] #{}]
How can I get it into the function?
>> is-tag?: func ['val] [either unset? get/any 'val [false] [tag? val]]
 
@SomeKittens Match {given string} first.
 
KK.
I tried mostly around the get/any 'val part (playing with the " ' " etc. )
But with errors.
 
thru {src="} [given-string {"} | copy link some nq {"} (keep link)]
 
KK.
>> is-tag?: func ['val] [either unset? (transcode/error get/any 'val) [false] [t
ag? val]]
>> is-tag? <a>
** Script error: transcode does not allow tag! for its source argument
** Where: is-tag?
** Near: is-tag? <a>

>> is-tag?: func ['val] [either unset? get/any (transcode/error 'val) [false] [tag? val]]
>> is-tag? <a>
** Script error: transcode does not allow word! for its source argument
** Where: is-tag?
** Near: is-tag? <a>

>> is-tag?: func ['val] [either unset? get/any (transcode/error val) [false] [tag? val]]
 
@KK. what are your test cases? — is-tag? "<a" is-tag? "<a>" is-tag? <a> Any more?
 
6:15 PM
:7964313 Something like this - but much more elegant


raw: to-binary  "1 2 <a 2"
clean: copy []

loaded: transcode/error raw
while [0 <> length? loaded][
    either not error? loaded/1 [
	    append clean loaded/1 loaded: next loaded
  ][
   loaded: transcode/error  loaded/2
   ]
 ]
 
How do I iterate over a block! ?
 
KK.
@rgchris Only is-tag? <a and is-tag? <a>
I was just checking my is-tag? function out. And there was a problem. @GrahamChiu solved it. Then I was again checking, and caught this problem.
 
Does load use transcode under the covers? If so, it would be useful to be able to get at the info gathered upon failure and be able to proceed to act at least upon what is loadable correctly. Otherwise, like @Jina suggests, you need to do two passes and this seems redundant.
 
@Adrian Yes—'load is built on 'transcode.
@Jina Cleaned up version:
is-tag?: func [data [string!]][
	data: to binary! data
	collect [
		data: transcode/error data
		while [0 <> length? data][
			keep data/1
			data: either not error? data/1 [next data][transcode/error data/2]
		]
	]
]
 
thanks, Chris
 
6:27 PM
@rgchris 'is-tag? isn't the right word for this function.
 
@rgchris Should complement charset not be used with Rebol 3 now handling Unicode? I seem to remember that, at least memory-wise, it would be an issue because of the greater, disjoint character space.
 
@Adrian As I understand it, it is effectively a 'not charset, so it's a negative match rather than positive.
>> complement charset {"}
== make bitset! [not bits #{0000000020}]
 
Sure, but the problem comes from the fact that the Unicode character space is quite large so that not of a single character bitset results in a pretty huge bitset to test against.
When you were dealing only with ASCII, it wasn't so much of an issue. At least this is what I think I recall reading about this.
Maybe, I'm talking nonsense, though. @BrianH, can you give an opinion here?
 
KK.
6:44 PM
@Adrian @rgchris @Jina Thanks for help. I am gonna sleep now (midnight here). Will continue tomorrow.
 
nite @kk
 
Pleasant dreams!
 
@rgchris Much better - thanks!
 
@Jina It's a good premise, I wonder how far it can be refined—the fabled 'load-junk...
 
@rgchris Under the hood rebol must be doing something like that when loading a script.
 
6:49 PM
Hi @JeremyBanks - what brings you to the Rebol/Red chat? Random drop-in to see what the fuss is about?
@rgchris Was it Brian Tiffin that kept asking for this?
 
I've seen @HostileFork's talking about it for a while, and it sounds interesting, so I thought I'd add it to the list of channels I often read.
 
@Jina In R3, you can source load.
@Adrian Yes, I gave it a bash in R2: reb4.me/r/junk but it's awfy slow.
 
@JeremyBanks k, so you've hear the spiel before :-)
 
@Adrian Yup, and it does sound cool, but I've got enough to learn at the moment that I don't think I'll really be diving into it much. We'll see.
 
@Adrian in R3 charsets can have an internal flag that says whether they should be considered to be a normal inclusive charset or a negative, exclusive charset. If you do complement of a charset, it returns a new charset with a copy of the same internal data but with that flag flipped. That is how we deal with the Unicode charset memory issue.
 
7:00 PM
So it's not an issue, then. Good to know. I should've guessed from the output @rgchris had, above where you don't have the complement, but retain the original with a prefixed not.
 
7:13 PM
@rebolbot /x probe "hello"
 
@GrahamChiu probe "hello"
>>hello
 
Can you indent the source by 4 spaces to get it in fixed font?
 
Does it work that you can mix code with text?
>>hello
so looks like it has to be two separate messages
 
yeah
 
I think I hit a scoping issue, what am I doing wrong?
getPlaintext: function [url] [
  html: to string! read url
]

foreach url urls [
  print url
  print getPlaintext [url]
]
Error:
** Script error: getPlaintext has no value
** Where: foreach catch either either -apply- do
** Near: foreach url urls [
    print url
    print getPlaintext [url...
Also, read can't do https. Is that a known issue or am I doing it wrong?
 
7:21 PM
@SomeKittens for https, you'll need the Saphiron builds
print getPlainText url
>> getplaintext: func [ url][ to string! read url ]
>> foreach url urls [ print url print getplaintext url ]
should work ..
In your example you passed a block! to the getPlaintext function, and 'read expects a port! or file! type
 
@GrahamChiu why that error, though?
 
Switching to func fixed it. What's the difference?
 
@Adrian yeah, it's really bad error reporting now...
 
It's not getPlaintext that has no value
 
Ah, the joys of working in an Alpha language.
 
7:27 PM
@Adrian It's still an issue with some combinations of characters because charsets aren't sparse, so in some cases there is just no way to save RAM and still use charsets. Which is why we have TO or THRU multiple in R3.
 
Should there be a CC issue for this error or will the fact that function, as it is, will be dropped make that redundant?
 
posted on February 27, 2013 by Sunanda

[Bug] One of these DIVIDEs is not like the others: 1.0 / .1 == 10.0 ;; good - divide decimal! 1 / .1 == 10.0 ;; good - divide integer! 1x1 / .1 == 10x10 ;; good - divide pair! 1.1.1 / .1 == 9.9.9 ;; strange - divide tuple! (R2 gets it right)

 
getplaintext: function [ url][][ to string! read url ]
the second block contains user vars
 
At least until issue.cc/r3/1973 goes through.
 
Actually @SomeKittens's error was due to the fact that the function spec has three blocks, not two as he had it so it was incorrectly defined.
 
7:33 PM
@Adrian oh yeah .. looks like it was a script and not console
 
@SomeKittens, are you clear on the difference between func and function now?
 
function allows me to define local vars?
 
Well, even with func you can do that by using /local in the spec, but with function you just list the words you want to be local in the second block
 
getplaintext: func [ url /local html ][ html: to string! read url ]
getplaintext: funct [ url ][ html: to string! read url ] ; html is local
 
except there's no reason for making `html local :-)
or having it in the first place if that's all that the function does
 
7:40 PM
getplaintext: function [ url ][ html ][ html: to string! read url ]
In a function, the last value, if there is one, is returned so the html is not required
 
8:08 PM
posted on February 27, 2013 by BrianH

[Comment] (Back to the humor...) For replicating the old definition of FUNCTION, to be used with FUNC as FUNC TION, or with FUNCT as FUNCT ION: ion: tion: func [spec [block!] vars [block!]] [compose [(spec) /local (vars)]] That constructs the real spec block from separate spec and local vars, like the old FUNCTION. Whether additional locals are gathered depends on where you put the space (us

 
@JeremyBanks glad to hear I've gotten on the radar of the powers that be. :-) Rebol is a trip. It's brain candy.
@JeremyBanks the hard thing to process is that for a language as freaking old as it is, the spec is still in flux. It's the eternal tweaker project for nutty systems designers. But regardless of its potential in deployment, it's a great Swiss Army Knife... you won't regret learning a little about it, the danger is if you get "too involved"...
And then you'll be like us. :-/
Want to try some Snow Crash... ? :-)
 
@HostileFork Jeeze. Has it been many of the same people working on it for all this time?
 
@JeremyBanks You ever hear of AmigaOS? The guy who made it was on the kernel exec team of Amiga, broke off and made this...announced in '97, released in '98. And yeah, same cast of characters more or less. But it got open sourced in December. I drew the icon. Like it? :-) rebolsource.net
 
@JeremyBanks some of us showed up later. I started using it in late '99, and working on it in '07.
 
Interesting.
 
8:22 PM
@Respectech here was one of the original people working on it, and he's back now.
 
@JeremyBanks The open sourcing brought people back, two years went by without a peep or a new binary drop from RebolTech. No bugfixes, no communication. Look at page three of your "how to kill a language guide" and you will see this being done quite by the book. But now... it's all ours... (well except for the trademark and name). Anyway, watch us work.
 
@HostileFork Was it closed source but free before then, or was it commercial?
 
@JeremyBanks The basic version was free, there were some variants that you had to pay for.
 
@JeremyBanks at first it was closed source but gratis, with more advanced tools, apps and services that they charged for. Then with R3 it was open/closed hybrid gratis. Now it's open.
 
@JeremyBanks But the guy pulled the same thing the TextMate guy did. He only open sourced his incomplete vision of the new product, hoping people would finish it. Meanwhile the stable previous version remains closed source. This annoys some people, but I'm cool with it, because there have been a lot of v2.0 => v3.0 changes that are systemic and we can't go back on that.
Rebol 2 is dead to me. But people keep talking about it, much to my annoyance.
 
8:30 PM
R3 is the version where we fix the design flaws of R2, many of which only became apparent after a decade of use, so no offence is intended. Rebol is a powerful enough language that it would be possible to emulate R2 in R3 if we really have to, but you can still use R2 if that's your thing.
 
@JeremyBanks It's programming crack cocaine, and we'd love to give you a first time's free sort of thing. We'll do your work for you, just to show you why it's awwwesommme. Consider us at your service.
 
@JeremyBanks So you know Lisp, I'd imagine?
 
@HostileFork Yes. I haven't used it for any serious projects, but I've played with Clojure a lot and tried most other big lisps at least a little.
 
@JeremyBanks Same difference. Okay, well, Rebol inherits strongly from Lisp, because all homoiconic languages sort of play the same game.
Code-As-Data paradigm. That part's not new.
In fact, from a marketing standpoint with kids coming here from the JavaScript room, I often forget that many people participating in programming are completely unaware of these ideas...
 
8:35 PM
"Code-as-data... you mean like JSONP?"
 
I try so hard to pitch to people who already know Lisp or Clojure or whatever by describing Rebol as a delta to those understood concepts, that I often forget that... uh... a lot of people don't know those concepts. So I'm attacking it as the wrong level.
 
Yeah, that's a big concept to fit into a pitch when someone might not be giving you a lot of time.
 
@JeremyBanks Douglas Crockford, of JSLint and JSON invention fame, credits Rebol as a big piece of his inspiration for JSON. He once tried to clone Rebol, called his project "Freeball" :-)
Lot of Rebol clone attempts prior to the much overdue open sourcing.
@JeremyBanks So given how much you know, you're a tough person to talk to. I don't know where to start. It's... deep. Did you see my Zen Cow question? :-)
2
Q: How to use Unicode codepoints above U+FFFF in Rebol 3 strings like in Rebol 2?

HostileForkI know you can't use caret style escaping in strings for codepoints bigger than ^(FF) in Rebol 2, because it doesn't know anything about Unicode. So this doesn't generate anything good, it looks messed up: print {Q: What does a Zen master's {Cow} Say? A: "^(03BC)"!} Yet the code works in Reb...

I keep trying to push Rebol people, who hide behind a gated community app, written in Rebol, to come out and use a system that's better but isn't written in Rebol. They kick and scream most of the time.
Anyway, so I am trying to get them to realize the value of what's being built here.
And encode institutional knowledge with questions and answers, and jump-start the idea that Rebol people accept that StackOverflow is awesome... and not get turned off by "points" and what not.
They are tough customers.
@JeremyBanks Anyway, print {Q: What does a Zen master's {Cow} Say? A: "^(03BC)"!} is a good microcosm of an example of a clever design decision in Rebol. Instead of tapdancing between single and double quotes, you use an asymmetric string delimiter. As long as there are matched pairs inside the content, you don't need escaping.
 
Neat. If they're unbalanced, how do you quote it?
 
@JeremyBanks Carets are the escape character in Rebol, which is pretty sensible, because who uses carets?
And the choice of the fundamental language BEGIN/END concept as square brackets is purposeful too. You don't have to push shift to get them on most keyboards. Hehehe
Hence my logo design, and why [o] is the Rebol logo.
 
8:44 PM
Ah, that makes sense. When you first pointed out the logo to me I thought "I'm sure there some meaning here that I'm missing".
 
@JeremyBanks It's meaningful, I once made it out of clay... I took a job at an art store for a while, I got an employee discount on clay. :-P
@JeremyBanks if you haven't noticed yet, I'm insane. But, erm, let's pretend it's in a good way for now.
 
I'm trying to write a function that gets everything that isn't a tag in a HTML page, but this is only returning whitespace:
getPlaintext: func [url] [
  html: to string! read url
  non-lt: complement charset "<"
  return collect [
    parse html [
      any [
        thru ">" [copy text non-lt "<" (keep text)]
      ]
    ]
  ]
]
 
@JeremyBanks Rebol is a language construction set. It doesn't force your hand when you have ideas about how you wish the language worked... it is based on a notion called "dialecting". I fumed and yelled and threw hissy fits for years trying to get it open sourced, and now it is, so I can actually go evangelize and it feels good to be able to do it. It's catching on quick, since December.
 
@SomeKittens is this for a tutorial, or for practicality? (We know you're writing a tutorial, but this might not be for it.)
 
Er, yes. It's an idea I had brewing for a while and Rebol is just the language for it. (but I'd also like to write a blog post on it.)
 
8:54 PM
; Practical, for R3
remove-each x load/type url 'markup [tag? x]

; Practical, for R2
remove-each x load/markup url [tag? x]
 
@SomeKittens Quick FYI, you probably already know, but Rebol is like Ruby, well, I mean--no, it isn't--but it is at least in the respect that you don't need "return" statements at the end because every block evaluates in the DO dialect to the last expression.
 
@HostileFork Nice edit
 
@SomeKittens Well I have to be careful with my words, sometimes I say things and then read it and go "wait, no that's totally not what I meant". :-)
I can't just assume people will discern what I meant based on what I said.
 
@HostileFork especially on the internet
@BrianH that just returns 0
Wait, it returns a non-zero number when I do it right
 
@SomeKittens Sorry, I forgot that Carl changed the return value of remove-each (there was a ticket about that). Here's the revised version:
 
9:04 PM
@BrianH Ah yes, was tripped up by this—this ticket?
 
; Practical, for R3
remove-each x data: load/type url 'markup [tag? x] data

; Practical, for R2
remove-each x data: load/markup url [tag? x] data
@rgchris I'm not sure that I agree with the change, but since it is easy to work around and gives you more information (the number of elements removed) I'm sure I will learn to live with it.
 
@BrianH It'd be nice to know for sure whether it's intended or a bug...
I've used it more than a few times in scripts expecting the block returned.
 
@rgchris it was intended, but it's still early enough to change our minds if that is appropriate. The decision needs revisiting, to either confirm it or undo it. The new return value is more information, but I'm not sure whether that information is particularly valuable when compared to the loss of chaining. We should discuss it in that ticket.
That code does illustrate one major difference between Rebol and many more pure functional languages: Rebol has modifying operations. We can do non-modifying stuff when it's appropriate, but when it's not we can use the modifying stuff for speed.
 
@BrianH Thanks. In hindsight, what I told you isn't what the project needs. Lemme get back to you
 
0
A: How do I pick elements from a block using a string in Rebol?

moliadDid you know Rebol has a native path type? although this doesn't exactly answer your question, I tought I'd add a reference on how to use paths directly in Rebol. Rebol has a lot of datatypes, and when you can, you should leverage that rich language feature. Especially when you start to use an...

 
9:21 PM
@SomeKittens I was working on the tutorial version, but it's harder of course. Do you want to save empty strings between tags? Do you want to handle tag attributes which might have arrows in them? Do you want the result as a block of strings or as a combined string? If this is for a tutorial, you might want to make the function in stages.
 
I'm re-thinking the project, which was to pull the string data out of the links on the front page of Hacker News
The problem is programatically getting the text that was in the article and not the other stuff.
 
posted on February 27, 2013 by rgchris

[Comment] The change appears to violate the rule of least surprise, though that could just be conditioning from having used it for many years. Is the new behaviour#(151)returning the number of items removed#(151)addressing a common problem? It'd also be straightforward to replicate and would seem (to me, at least) to be more deliberate: length? block - length? remove-each item block [condi

posted on February 27, 2013 by Sunanda

[Bug] It can if the integer is negative (results are same in R2) 1.2.3.4.5.6 or -1 == 0.0.0.0.0.0 1.2.3.4.5.6 and -1 == 1.2.3.4.5.6 1.2.3.4.5.6 xor -1 == 0.0.0.0.0.0 1.2.3.4.5.6 or -1111111111 == 0.0.0.0.0.0 1.2.3.4.5.6 or -11111111111 == 255.255.255.255.255.255 (Suggest this should be disallowed, as it is if the args are reversed)

 
@SomeKittens Well, load's markup parser is your friend because it will split out the tags for you. After that, block parse looking for tags, then check for the tag attributes that HN uses to indicate the start of their document. After that, it's easy to pick out the text.
 
I've already got the part that grabs the URL's. The problem is loading the content of those.
 
@somekittens screenscraping will always be fragile as the markers you use to find the payload may change at any time. may be more stable to parse their RSS feed.
 
9:27 PM
I may just put this aside for a while
They don't have RSS
 
@SomeKittens that is where load's markup parser helps you. It will handle reading the url, converting it to string, then splitting the string into a block of tags and non-tags. Once you have that block it is easy to work with. You don't even need to use parse, you can use find-all.
 
@SomeKittens I see an rss link in their footer?
 
Hmm. Worth a shot
@Jina You're right, sorry
 
@Jina CC has RSS, but the feed doesn't have enough information. The screenscraping is a stopgap until the feed can be improved.
 
@BrianH yep, poor rss info is a problem with that approach
 
9:33 PM
@SomeKittens This is how it looks (load/markup—R2, load/type 'markup—R3): reb4.me/cc/mrk?s=http://news.ycombinator.com
 
@rgchris What do you mean?
 
@SomeKittens Load/Markup (and the R3 equivalent) is a great tool for scraping.
(this is how I approached scraping the CureCode pages: reb4.me/r/load-curecode)
It appears that most links on your page are preceded by <td class="title">. Not saying this'd work, but an approach could be: collect [parse load/type hacker-news 'markup [some [thru <td class="title"> copy link tag! copy anchor string! (keep reduce [link anchor])]]]
Oops, should be set link tag! set anchor string!
 
9:49 PM
why set and not copy?
 
'Set is specific to block parsing, it sets the given word to the matched value, not the portion of the series matched (copy).
parse [<tag>][set link tag!] == link: <tag>
parse [<tag>][copy link tag!] == link: [<tag>]
 
If I understand correctly: With set, tag? link == true and with copy block? link == true
 
Yep.
 
thanks!
 
No worries! A little shortened, doing length? on the result gives me 62.
collect [parse load/type hacker-news 'markup [some [thru <td class="title"> copy link [tag! string!] (keep link)]]]
(should be 60, but we get that extra one at the end)
 
10:03 PM
posted on February 27, 2013 by BrianH

[Comment] Sunanda, please write your code examples so that they show the current and expected results. Being R2-compatible is only a goal when R2 is correct - likely in this case, but we can't know that without seeing what R2 and R3 does with the same code. Also, unless we keep a record of the erroneous behavior in the ticket, we won't know what it previously did that was wrong after the bug is

 
@rgchris ** Script error: PARSE - invalid rule or usage of rule: tag!
Wait, my bad again
 
@HostileFork Do you have any references for that "Freeball" thingie?
 
10:21 PM
posted on February 27, 2013 by abolka

[Comment] I'd also prefer reverting this change back to R2's behaviour. I find the ability to chain remove-each calls far more important in practice than obtaining the number of removed elements.

 
 
1 hour later…
11:36 PM
posted on February 27, 2013 by adrians

[Issue] In looking over the tuple! datatype documentation, is seems that it is quite limited given that it has a very general sounding name. From the R2 documentation: "It is common to represent version numbers, Internet addresses, and RGB color values as a sequence of three or four integers." Some examples are given there (my comments added): 1.3.0 2.1.120 1.0.2.32 ; version - quite

 
00:00 - 08:0008:00 - 00:00

« first day (850 days earlier)      last day (2930 days later) »