Skip to content

if-then-else lines pasted together without whitespace, causes parser failure #16

@robert-dodier

Description

@robert-dodier

Looks like successive lines of a conditional expression are pasted together without whitespace and sent to Maxima, and then the Maxima parser reports an error. E.g. this example causes an error:

$ cat baz.Rmd 
## If-then-else test

```{maxima}
x: 1234;
y: 2345;
```
```{maxima}
if x > y
  then x
  else y;
```

The error is:

Quitting from lines 8-11 (baz1.Rmd) 
Error in maxima.env$mx$get(code[i]) : 
incorrect syntax: y is not an infix operator
(x > y)then xelse y;
                  ^

I can work around the problem by placing parenthesis:

$ cat baz1.Rmd 
## If-then-else test

```{maxima}
x: 1234;
y: 2345;
```
```{maxima}
if (x > y)
  then (x)
  else (y);
```

and then the output seems to show the pasting-together behavior:

$ cat baz1.knit.md 
## If-then-else test


```maxima
(%i5) x: 1234;
```

$$1234$$

```maxima
(%i6) y: 2345;
```

$$2345$$

```maxima
(%i7) if (x > y)then (x)else (y);
```

$$2345$$

Not sure what to do. One possibility is to send the lines without pasting them together; I don't know if that interferes with other things.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions