Displaying 20 results from an estimated 3000 matches similar to: "anonymous function parsing bug?"
2016 Oct 21
3
anonymous function parsing bug?
Hi,
thx for the reply. Unfortunately that is not a simplified version of the
problem. You have a function, call it and get the result (numeric in,
numeric out in that case). For simplicity lets use the "return" case:
##
foobar<-function(x) { return(sqrt(x)) }(2)
##
which is a function (numeric in, numeric out) which is defined, then
gets called and the return value is a function
2016 Oct 21
0
anonymous function parsing bug?
Are you saying that
f1 <- function(x) log(x)
f2 <- function(x) { log } (x)
should act differently?
Using 'return' complicates the matter, because it affects evaluation, not
parsing.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Oct 21, 2016 at 8:43 AM, Wilm Schumacher <wilm.schumacher at gmail.com>
wrote:
> Hi,
>
> thx for the reply. Unfortunately
2016 Oct 21
0
anonymous function parsing bug?
Here is a simplified version of your problem
> { sqrt }(c(2,4,8))
[1] 1.414214 2.000000 2.828427
Do you want that to act differently?
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Oct 21, 2016 at 6:10 AM, Wilm Schumacher <wilm.schumacher at gmail.com>
wrote:
> Hi,
>
> I hope this is the correct list for my question. I found a wired behaviour
> of my R
2016 Oct 21
3
anonymous function parsing bug?
Hi,
Am 21.10.2016 um 18:10 schrieb William Dunlap:
> Are you saying that
> f1 <- function(x) log(x)
> f2 <- function(x) { log } (x)
> should act differently?
yes. Or more precisely: I would expect that. "Should" implies, that I
want to change something. I just want to understand the behavior (or
file a bug, if this would have been one).
As I wrote, in e.g.
2014 Aug 07
2
Global number of matches
Hi,
is there a way to get the number of all possible matches for a specific
query?
Some api call like
Xapian::doccount Xapian::Enquire::get_number_of_matches();
Best wishes
Wilm
2009 Nov 25
1
Question R's parser : - parsing "x=\n 1"
Hello
I was reading the source main/src/gram.y and had one question, how does R parse
x =
1
According the grammar:
prog : END_OF_INPUT { return 0; }
| '\n' { return xxvalue(NULL,2,NULL); }
| expr_or_assign '\n' { return xxvalue($1,3,&@1); }
| expr_or_assign ';' { return xxvalue($1,4,&@1); }
| error { YYABORT; }
;
So this should be of the 3rd
2016 Oct 21
0
anonymous function parsing bug?
Am 21.10.2016 um 18:10 schrieb William Dunlap:
>
> Are you saying that
f1 <- function(x) log(x)
f2 <- function(x) { log } (x)
should act differently?
yes.
But that would mean that {log} would act differently than log.
I suppose it is a matter of taste, but I say yuck.
As for 'return', don't use it if you want readable code. It is
like a goto but worse. It
2008 Nov 24
2
handling a matrix and .C
Hello R-devel,
I want to write extensions for R in C (maybe C++ and Fortran later) and it works fine, but there is one problem, which I cannot solve (in my view).
I want to handle a matrix from R in C. For arrays there is "as.double(...)", but nothing for a matrix.
I searched a while, but didn't find something.
Last I looked at the source code of e1071 and of the core itself and
2013 Nov 27
2
Question about embedding Xapian index in one file
Hi,
Xapian uses a directory as standard storage backend. Is that possible to
pack everything in a file (a tar file for example), and to tell
libxapian to open it (by telling him at which offset are the different
stuff)?
If this is not possible yet, would that be technically possible to
implement such a feature? How complex would that be?
Kind regards
Emmanuel
--
Kiwix - Wikipedia Offline &
2023 Nov 11
1
New syntax for positional-only function parameters?
6 ?????? 2023 ?. 22:54:24 GMT+03:00, mikkmart via R-devel <r-devel at r-project.org> ?????:
>The pattern of functions accepting other functions as inputs and
>passing additional ... arguments to them is prevalent throughout
>the R ecosystem. Currently, however, all such functions must one
>way or another tackle the problem of inadvertently passing arguments
>meant to go to
2023 Mar 11
1
Multiple Assignment built into the R Interpreter?
On Sat, 11 Mar 2023 11:11:06 -0500
Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
> That's clear, but your proposal violates a very basic property of the
> language, i.e. that all statements are expressions and have a value.
How about reframing this feature request from multiple assignment
(which does go contrary to "everything has only one value, even if it's
2023 Mar 11
3
Multiple Assignment built into the R Interpreter?
Thanks Duncan and Ivan for the careful thoughts. I'm not sure I can follow
all aspects you raised, but to give my limited take on a few:
> your proposal violates a very basic property of the language, i.e. that all statements are expressions and have a value.
> What's the value of 1 + (A, C = init_matrices()).
I'm not sure I see the point here. I evaluated 1 + (d =
2023 Mar 11
1
Multiple Assignment built into the R Interpreter?
On 11/03/2023 11:57 a.m., Ivan Krylov wrote:
> On Sat, 11 Mar 2023 11:11:06 -0500
> Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
>
>> That's clear, but your proposal violates a very basic property of the
>> language, i.e. that all statements are expressions and have a value.
>
> How about reframing this feature request from multiple assignment
>
2023 Mar 11
2
Multiple Assignment built into the R Interpreter?
FWIW, it's possible to get fairly close to your proposed semantics
using the existing metaprogramming facilities in R. I put together a
prototype package here to demonstrate:
https://github.com/kevinushey/dotty
The package exports an object called `.`, with a special `[<-.dot` S3
method which enables destructuring assignments. This means you can
write code like:
.[nr, nc] <-
2023 Mar 11
1
Multiple Assignment built into the R Interpreter?
On 11/03/2023 4:42 p.m., Sebastian Martin Krantz wrote:
> Thanks Duncan and Ivan for the careful thoughts. I'm not sure I can
> follow all aspects you raised, but to give my limited take on a few:
>
>> your proposal violates a very basic property of the language, i.e. that all statements are expressions and have a value. > What's the value of 1 + (A, C =
2023 Mar 12
2
Multiple Assignment built into the R Interpreter?
Thanks Gabriel and Kevin for your inputs,
regarding your points Gabriel, I think Python and Julia do allow multiple
sub-assignment, but in-line with my earlier suggestion in response to
Duncan to make multiple assignment an environment-level operation (like
collapse::%=% currently works), this would not be possible in R.
Regarding the [a] <- coolest_function() syntax, yeah it would mean do
2023 Mar 11
1
Multiple Assignment built into the R Interpreter?
There are some other considerations too (apologies if these were mentioned
above and I missed them). Also below are initial thoughts, so apologies for
any mistakes or oversights.
For example, if
[a, b] <- my2valuefun()
works the same as
local({
tmp <- my2valuefun()
stopifnot(is.list(tmp) && length(tmp) == 2)
a <<- tmp[[1]]
b <<- tmp[[2]]
})
Do we expect
[a[1], b[3]]
2009 Feb 10
2
plotting the result of a nonlinear regression
Hello,
to plot the result of a singular non linear regression (using nls) I usually use the function plotfit, for example:
r.PTG.V<-nls(PTG.P~ fz1(Portata, a,b), data=dati, start=list(a=10, b=10), nls.control(maxiter=200), algorithm='port',
trace=TRUE, na.action=na.omit, lower=list(a=0, b=10), upper=list(a=100, b=100))
plotfit(r.PTG.V)
I tried to use the function plotfit on the
2013 Dec 12
2
method default for hclust function
I could not figure out what was the default when I ran hclust() without specifying the method.
For example:
I just have a code like:
hclust(dist(data))
Any input would be appreciated:)
[[alternative HTML version deleted]]
2001 May 16
2
Strange formatting
I've never noticed this before, though it's probably not new. In
1.2.3 for Windows, if I print a short vector the formatting is
different than if I print a long one, whether or not they fit on one
line. The short/long split appears to be between 9 and 10 elements:
> 1:9
[1] 1 2 3 4 5 6 7 8 9
> 1:10
[1] 1 2 3 4 5 6 7 8 9 10
> sqrt(1:9)
[1] 1.000000 1.414214