Re: Bug in the front end's parser ( lst[[ ;; , 1 ]] syntax)
- To: mathgroup at smc.vnet.net
- Subject: [mg88258] Re: Bug in the front end's parser ( lst[[ ;; , 1 ]] syntax)
- From: Albert Retey <awnl at arcor.net>
- Date: Wed, 30 Apr 2008 04:22:29 -0400 (EDT)
- References: <fv6umg$roe$1@smc.vnet.net>
Szabolcs Horv=C3=A1t wrote:
> Suppose that we want to take the third element of every sublist from th=
e
> following list:
>
> lst = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}
>
> One way to do this is to use lst[[All, 3]]
>
> Another way would be to use the new Span-syntax:
>
> lst[[ ;; , 3]]
>
> Unfortunately this does not work when evaluated in the front end. It
> does work when the kernel was started on the command line.
>
> (Both of lst[[1;; , 3]] and lst[[;;-1 , 3]] work from the front end.)
>
>
This looks like a bug to me. Note that the following works as expected:
Cell[BoxData[
RowBox[{"lst", "[[",
RowBox[{";;", ",", "2"}], "]]"}]], "Input"]
while the frontend creates this when typing in the expression:
Cell[BoxData[
RowBox[{"lst", "[[",
RowBox[{";;",
RowBox[{",", "2"}]}], "]]"}]], "Input"]
which produces the syntax error...
hth,
albert