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

World: r3wp

[Core] Discuss core issues

Maxim
25-Jun-2010
[17131]
well after a little bit of screwing around I came up with this function:

	;-----------------
	;-     get-application-title()
	;-----------------
	get-application-title: func [
		/local script parent
	][
		parent: system/script
		until [
			script: parent
			parent: script/parent
			none? parent/header
		]
		script/title
	]
Ladislav
25-Jun-2010
[17132]
f: func[[catch]][print "kuk" throw make error! "bla"]  f
Fork
25-Jun-2010
[17133x2]
>> add 10 50%
== 10.5
Hmm, I find that a little disappointing, it would seem that if one 
is going to bother having a special datatype for percent it would 
come out as 15.
Maxim
25-Jun-2010
[17135]
percents represent the amount, its not just an alternate notation 
for decimal, like tags for strings.
BrianH
25-Jun-2010
[17136]
You are missing a multiplication.
Fork
25-Jun-2010
[17137]
Well, I know, but I just mean that if functions can detect what types 
they get then making [add (something) (percent)] do the same thing 
as [add (something) to-decimal percent] seems a little less exciting 
than if it "knew what you meant".  There's sort of a dimensional 
analysis thing... adding integers and percents doesn't make a lot 
of semantic sense unless you're speaking about adding a number to 
a percentage of itself.
Rebolek
25-Jun-2010
[17138]
There was very long debate on this, when percents were implemented 
and this is the result and you should have to live with it.
BrianH
25-Jun-2010
[17139x2]
Well, you are assuming that 10 is what the 50% was supposed to apply 
to. REBOL can't make that assumption - it has to do whatyou tell 
it to do, not what you want it to do.
Unless you want all numeric operations on the percent! type to include 
implicit multiplication.
Fork
25-Jun-2010
[17141]
http://www.wolframalpha.com/input/?i=10+%2B+50%25
Rebolek
25-Jun-2010
[17142]
Yes, Fork told REBOL to add 50% to 10. And result is 10.5 ...
Fork
25-Jun-2010
[17143x2]
OTOH: http://www.google.com/search?hl=en&source=hp&q=10+%2B+50%25&aq=f&aqi=h1g10&aql=&oq=&gs_rfai=
But if you asked me whether to go to Google Calculator or Wolfram 
Alpha as the source for mathematical intuition, I'd choose the latter 
myself.
BrianH
25-Jun-2010
[17145]
Yes, but he told  to add 50% of what to 10? That's the missing multiplication.
Fork
25-Jun-2010
[17146]
It's an issue of mathematical intuition, which I do believe is established. 
 "That'll be 19.99... plus 12 percent tax"
BrianH
25-Jun-2010
[17147]
Hey, it's early enough, make a proposal and submit it to CureCode. 
Be sure to check first to see if it's already there though.
Fork
25-Jun-2010
[17148x2]
Well it doesn't matter all that much, easy enough to work around. 
 I just wish Rebol showcased a bit more of its ability to have the 
cross product of behavior across types in examples where people would 
go "whoa, how'd it do that?" then... "oh, I see..."
One decision that I used to not think much of one way or another 
which I now really think is important is the idea that "none" is 
false? while 0 is not.
BrianH
25-Jun-2010
[17150x3]
And remrmber that the mathematical intuituin you mention isn't the 
same if you swap the arguments. Note that Wolfram swaps the arguments 
back if you put the percent first. That is because the intuition 
for 50% + 10 is that it result in 60%.
in -> be
Sorry, I've been getting the AltME freezes again. It's affecting 
my typing.
Fork
25-Jun-2010
[17153x2]
Regardless of other decisions, I feel like it's important to preserve 
the property that (a + b) = (b + a), as addition is... er, what's 
the word, commutative?
50% + 10% should be 60%, but 50% + 10 should equal 10 + 50% no matter 
what one decides otherwise.
BrianH
25-Jun-2010
[17155]
Yes, I had forgotten the word, thanks. Unfortunately, the mathematical 
intuition is not commutative.
Fork
25-Jun-2010
[17156x2]
Well that sounds more like linguistic intuition than mathematical 
intuition.
I didn't feel like saying percent again
BrianH
25-Jun-2010
[17158x2]
Intuition is a bit of misnomer here. What you are really saying is 
"expected behavior". And that is always in the eye of the peoson 
doing the expecting.
Great, now I have AltME freezes and a cat that is jealous of my computer 
- double whammy to my typing.
Fork
25-Jun-2010
[17160x6]
Natural programming is an interesting research area: http://www.google.com/search?hl=en&source=hp&q=10+%2B+50%25&aq=f&aqi=h1g10&aql=&oq=&gs_rfai=
They get lots of people in and give them a box of fruit containing 
apples, oranges, pears
And ask like hundreds of people "go to the box and bring me back 
something that's not an apple or a pear"
And no one (who isn't a snarky programmer) brings back a pear.
How much of this is cultural and how much is some deep embedded pattern 
instinct a la X bar theory is tough to say http://en.wikipedia.org/wiki/X-bar_theory
But if things like X bar theory and these studies have merit, one 
actually can say that "right answers" aren't necessarily as fluid 
as being in the eye of a particular beholder as we might guess.
BrianH
25-Jun-2010
[17166]
Or who is from a culture with a language that assumes that or is 
inclusive. You haven't worked with many people for whom non-Western 
languages are their primary thought-shaping languages, I take it.
Fork
25-Jun-2010
[17167x2]
Of course even then it's only right in a context, the context of 
human programmers... a time which will likely be coming to a swift 
end.  :)
Moving to "Chat"
Graham
25-Jun-2010
[17169]
go to the box and bring me back something that's not an apple Nor 
a pear
BrianH
25-Jun-2010
[17170]
We need parentheses grouping of statements in English :(
Graham
25-Jun-2010
[17171]
The english language is a bit loose ... and since the incorrect way 
of saying things is so common, one assumes that what's the speaker 
meant
BrianH
25-Jun-2010
[17172]
Correctness is in the eye of the beholder :)
Gregg
26-Jun-2010
[17173]
Fork, I would consider your desired behavior for an INCR function.
Henrik
2-Jul-2010
[17174]
what's the quickest way to determine whether a series is past end 
in R2 and then handle it?
Pekr
2-Jul-2010
[17175]
tail?
Henrik
2-Jul-2010
[17176]
that is not accurate enough
Sunanda
2-Jul-2010
[17177]
Why not?
Is
     (index? s) > length? s
any more accurate?
Henrik
2-Jul-2010
[17178x2]
oh well, used this:

all [series? :value greater? index? :value length? head :value]
Sunanda, didn't see your post, but thanks, it's what I use.
Geomol
2-Jul-2010
[17180]
Quickest for what you test for might be:

and series? s tail? s