Jump to content

Wikipedia talk:Sandbox

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 151.74.14.142 (talk) at 00:27, 2 April 2008 (→‎The fourth dimention ?). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.


[www.internetisseriousbusiness.com] a a 'a' b c —Preceding unsigned comment added by Pborten (talkcontribs) 20:39, 1 April 2008 (UTC)[reply]

The fourth dimention ?

It is said that the fourth dimention of space is time. But As for as I think that time has its own 3 dimentions so it is itself a dimentioned entity rather than assisting other dimentioned entity like space.--Neeraj 21:56, 1 April 2008 (UTC)

No, it's four dimensions of space-time. Time no more "assists" space than space "assists" time. But if you want to have three-dimensional time, go right ahead, it would be damn useful if you could go off on a perpendicular and get a couple of hours sleep-in. JЇѦρ 00:19, 2 April 2008 :::::(UTC)



"what if I don't want to return from the topmost enclosing non-closure, but from a closure 2 levels up? and if I can't, why not?"
I think JavaScript lets you do that, but through an improper use of a differently aimed construct, so I'm writing this just for comparison sake (since this method could make one of the javascript examples to behave like the Smaltalk one on the "^" operator). Furthermore, this method requires an explicit handling of the "exit point", yet it's very easy and maybe obvious: just use
throw
instead of
return
and capture the result as an exception, wherever you need it.

Of course, that's not the right way one should use :::::// The first function passed is the condition to be tested, and is expected to evaluate as
// true or false; the second one is the block to be executed if the test condition evaluates to
// true, and may optionally return a value; the third is the alternative block to be executed
// and may optionally return a value. One of such optional values is returned (null or undefined
// if none is supplied). The calling function might assign the result value to a somewhat variable,
// or let the function-block to handle it. A preferred way to call this function and easily handle
// variables as in a standard if-else statement is throughout internal functions, as shown in
// the alertMax function below.
function if_else(ifcond, ifblock, elseblock){
var result = null;
var doIF = ( ifcond() ) && ( result = ifblock() ); //when ifcond evaluates to true ifblock is
//called and results assigned to result,
var doELSE = (! ifcond() ) && ( result = elseblock() ); //otherwise elseblock is called in
//the same fashion.
return result;
}
// Comparing values by calling if_else function with opportune parameters.
function alertMax( a, b ){
var max = if_else(
function(){ return (a >= b); },
function(){ alert( a + " is greater than or equal to " + b); return a; },
function(){ alert( b + " is greater than " + a); return b; }
); //note functions passed as ifblock and elseblock alerts different text;
//this shows the alternate execution of statements-equivalent functions works.
alert("Max computed value is: " + max);
}
alertMax(6, 5);
alertMax(8, 9);

--151.74.14.142 (talk) 00:17, 2 April 2008 (UTC) xeal[reply]