search for: llength

Displaying 6 results from an estimated 6 matches for "llength".

Did you mean: length
2018 Feb 26
0
Parallel assignments and goto
...se, is to not do that, but then I can?t handle expressions inside calls to ?with?. And I would really like to, because then I can combine tail recursion with pattern matching. I can define linked lists and a length function on them like this: library(pmatch) llist := NIL | CONS(car, cdr : llist) llength <- function(llist, acc = 0) { ? ? cases(llist, ? ? ? ? ? NIL -> acc, ? ? ? ? ? CONS(car, cdr) -> llength(cdr, acc + 1)) } The tail-recursion I get out of transforming this function looks like this: llength_tr <- function (llist, acc = 0) { ? ? .tailr_env <- rlang::get_env() ? ? cal...
2011 Nov 28
5
window manager interface commands for linux
How can i replicate this in Linux: source(file.choose()) I've tried source(tkgetOpenFile()) but with no luck
2018 Feb 27
2
Parallel assignments and goto
...I can?t handle expressions inside calls to ?with?. And I would really like to, because then I can combine tail recursion with pattern matching. > > I can define linked lists and a length function on them like this: > > library(pmatch) > llist := NIL | CONS(car, cdr : llist) > > llength <- function(llist, acc = 0) { > ? ? cases(llist, > ? ? ? ? ? NIL -> acc, > ? ? ? ? ? CONS(car, cdr) -> llength(cdr, acc + 1)) > } > > The tail-recursion I get out of transforming this function looks like this: > > llength_tr <- function (llist, acc = 0) { > ?...
2006 Nov 07
1
Better way to create tables of mean & standard deviations
...- aggregate(y, FUN=mean, ...) temp.sd <- aggregate(y, FUN=sd, ...) temp.length <- aggregate(y, FUN=length, ...) txtlabs <-makeLabel(label,length(temp.mean$x)) temp <- data.frame(mean=temp.mean$x,stdev=temp.sd$x,n=temp.length$x,row.names=txtlabs) } makeLabel <- function(label,llength,increaseLag=FALSE) { x <- c() for(cnt in 1:llength) { if(increaseLag == TRUE && mode(cnt/2)) { } x[cnt] <- paste(label,cnt) } x } and can use the following commands to create tables of means etc. print(summary.aggregate(data.ceramic$Y,"Lab",by=list(data.ceramic...
2018 Feb 27
0
Parallel assignments and goto
...to ?with?. And I would really like to, > because then I can combine tail recursion with pattern matching. > > > > I can define linked lists and a length function on them like this: > > > > library(pmatch) > > llist := NIL | CONS(car, cdr : llist) > > > > llength <- function(llist, acc = 0) { > > cases(llist, > > NIL -> acc, > > CONS(car, cdr) -> llength(cdr, acc + 1)) > > } > > > > The tail-recursion I get out of transforming this function looks like > this: > > > > llength...
2018 Feb 11
4
Parallel assignments and goto
Hi guys, I am working on some code for automatically translating recursive functions into looping functions to implemented tail-recursion optimisations. See https://github.com/mailund/tailr As a toy-example, consider the factorial function factorial <- function(n, acc = 1) { if (n <= 1) acc else factorial(n - 1, acc * n) } I can automatically translate this into the loop-version