continuation?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

continuation?

vicnorton
What is the new continuation character? Please don't tell me that no
command or assignment will be allowed to take up more than one line.

Octave 3.6.4
octave> x = [1 2 3 \
> 4 5 6]
x =

   1   2   3   4   5   6

Octave 3.8.0
octave-cli-3.8.0> x = [1 2 3 \
warning: using continuation marker \ outside of double quoted strings is
deprecated and will be removed in a future version of Octave
> 4 5 6]
x =

   1   2   3   4   5   6

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: continuation?

bpabbott
Administrator

> On Feb 12, 2014, at 8:20 AM, Vic Norton <[hidden email]> wrote:
>
> What is the new continuation character? Please don't tell me that no
> command or assignment will be allowed to take up more than one line.
>
> Octave 3.6.4
> octave> x = [1 2 3 \
>> 4 5 6]
> x =
>
>   1   2   3   4   5   6
>
> Octave 3.8.0
> octave-cli-3.8.0> x = [1 2 3 \
> warning: using continuation marker \ outside of double quoted strings is
> deprecated and will be removed in a future version of Octave
>> 4 5 6]
> x =
>
>   1   2   3   4   5   6

x = [1 2 3 ...
4 5 6];

Ben
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: continuation?

José Luis García Pallero
In reply to this post by vicnorton
2014-02-12 14:20 GMT+01:00 Vic Norton <[hidden email]>:

> What is the new continuation character? Please don't tell me that no
> command or assignment will be allowed to take up more than one line.
>
> Octave 3.6.4
> octave> x = [1 2 3 \
>> 4 5 6]
> x =
>
>    1   2   3   4   5   6
>
> Octave 3.8.0
> octave-cli-3.8.0> x = [1 2 3 \
> warning: using continuation marker \ outside of double quoted strings is
> deprecated and will be removed in a future version of Octave
>> 4 5 6]
> x =
>
>    1   2   3   4   5   6

You can use also
x = [1 2 3 ...
4 5 6];

as in Matlab

>
> _______________________________________________
> Help-octave mailing list
> [hidden email]
> https://mailman.cae.wisc.edu/listinfo/help-octave



--
*****************************************
José Luis García Pallero
[hidden email]
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: continuation?

c.-2
In reply to this post by vicnorton

On 12 Feb 2014, at 14:20, Vic Norton <[hidden email]> wrote:

> What is the new continuation character? Please don't tell me that no
> command or assignment will be allowed to take up more than one line.

use '...' (3 dots) instead of the backslash
c.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: continuation?

Jérôme
In reply to this post by vicnorton
What about

> octave> x = [1 2 3 ...
>> 4 5 6]

?

--
Jérôme

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: continuation?

vicnorton
In reply to this post by vicnorton
Ah hah! Thanks guys!
   octave> x = [1 2 3 ...
   > 4 5 6]
looks much better!

I guess I'll just have to go through a lot of my code replacing
backspace continuations.

On Feb 12, 2014, at 8:20 AM, Vic Norton <[hidden email]> wrote:

> What is the new continuation character? Please don't tell me that no
> command or assignment will be allowed to take up more than one line.
>
> Octave 3.6.4
> octave> x = [1 2 3 \
>> 4 5 6]
> x =
>
>   1   2   3   4   5   6
>
> Octave 3.8.0
> octave-cli-3.8.0> x = [1 2 3 \
> warning: using continuation marker \ outside of double quoted strings is
> deprecated and will be removed in a future version of Octave
>> 4 5 6]
> x =
>
>   1   2   3   4   5   6

_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: continuation?

forkandwait
Vic Norton <vic <at> norton.name> writes:

>
> Ah hah! Thanks guys!
>    octave> x = [1 2 3 ...
>    > 4 5 6]
> looks much better!
>
> I guess I'll just have to go through a lot of my code replacing
> backspace continuations.

Deprecating the backslash seems like a bad design choice to me.  The
ellipses from Matlab are cute, but stupid and hard to parse, and the
backslash is better and conforms to many Unix languages.

Same with "#" (good) versus "%" (silly) for comments

I would add a warning when the backslash is encountered, but keep it in the
language indefinitely, just in case any maintainers are listening.






_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: continuation?

Jordi Gutiérrez Hermoso-2
On Wed, 2014-02-12 at 19:21 +0000, fork wrote:
> I would add a warning when the backslash is encountered, but keep it
> in the language indefinitely, just in case any maintainers are
> listening.

The problem is that it's also used as a left division operator. While
the Matlab language doesn't use # for anything, the \ operator as a
continuation marker makes the parser more complicated. Consider,

    x = (5\
         10);

which is a parsing error, but

    x = (10/
         5);

which parses fine.

However, as this example illustrates, you can get by without
continuation markers altogether in many cases, something that is only
allowed in Octave but not in Matlab. If there are open round brackets,
Octave will ignore newlines.

- Jordi G. H.



_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: continuation?

fgnievinski
In reply to this post by vicnorton
<quote author="vicnorton">
Ah hah! Thanks guys!
   octave> x = [1 2 3 ...
   > 4 5 6]
looks much better!

I guess I'll just have to go through a lot of my code replacing
backspace continuations.

On Feb 12, 2014, at 8:20 AM, Vic Norton <[hidden email]> wrote:

> What is the new continuation character? Please don't tell me that no
> command or assignment will be allowed to take up more than one line.
>
> Octave 3.6.4
> octave> x = [1 2 3 \
>> 4 5 6]
> x =
>
>   1   2   3   4   5   6
>
> Octave 3.8.0
> octave-cli-3.8.0> x = [1 2 3 \
> warning: using continuation marker \ outside of double quoted strings is
> deprecated and will be removed in a future version of Octave
>> 4 5 6]
> x =
>
>   1   2   3   4   5   6

You can ignore the warning:

warning('off', 'Octave:deprecated-syntax')