Please create an account to participate in the Slashdot moderation system


Forgot your password?

Comment Re:Show me some example code (Score 1) 382

Well, I haven't used MATLAB itself for a while - I do use Octave a bit though. So, try this

a = sin

In Octave I get

error: sin: too few arguments

instead i need to do

a = @sin

whereas the equivalent,

a <- sin

works in R. In other works, functions look just like other kinds of data in R, but a bit different in MATLAB (not much admittedly)

Another difference, I think, is the way that scope works. Example: a function which, given n, returns a function which increments n (Paul Graham's incrementor exercise)

f <- function(n){
    function() {
        n <<- n + 1

g <- f(2)
h <- f(-3)

#returns 3
#returns -2
#returns 4
#returns -1

Can you write this function, easily, in MATLAB?

Comment Re:Octave is more an alternative to MATLAB (Score 1) 382

Octave is great if you are moving from MATLAB to a free tool, because it has a similar syntax (IIRC it lags the MATLAB launguage by a couple of versions). But, in my view at any rate, R has a nicer language than either, and was well worth learning. You're right that R is stats oriented, but not some much that you feel crippled by it in use.

Comment Re:Show me some example code (Score 5, Informative) 382

I use R a great deal. Think of it as an alternative to MATLAB, or Excel, rather than C or perl or lisp or whatever you like to use as a general purpose language. So, compared to MATLAB, functions are first class objects (rather like lisp), so, you can write functions that take functions as arguments, and return them as well, just as though
they were simple variables. It handles
vectors rather easily, and has decent plotting tools.

#quick example

# function, which, given numerical arguments a and b, and a function g, returns a function of x
f - function(a,b, g){
    function(x){ a * x + g(b * x)}

f1 - f(1,2.5,sin)
x - seq(-pi,pi,l=100)


Submission + - Microsoft uses legacy formats to push OOXML (

kazade84 writes: The BBC reports that we will lose access to data stored in legacy formats as we move to newer standards. The National Archives have made a deal with Microsoft to set up virtual machines running old versions of Windows and Office to access the legacy files to prevent them being lost forever.

The report, although interesting, seems like another marketing attempt by Microsoft to push OOXML as a 'standard' format and makes me wonder why these legacy files aren't just converted to ODF?

Slashdot Top Deals

UNIX is hot. It's more than hot. It's steaming. It's quicksilver lightning with a laserbeam kicker. -- Michael Jay Tucker