Hi all,
I have a pieces of code below:
(defun bio-graph-gui ()
(with-ltk ()
(let* ((sc (make-instance 'scrolled-canvas))
(c (canvas sc))
(i))
((loop for i in '(10 20 30) do
(create-line c (list 10 10 100 i)))
(text (create-text c 260 250 "Canvas test"))
(pack sc :expand 1 :fill :both)
(scrollregion c 0 0 800 800)))))
I compile in SBCL, there is always an error at:
(loop for i in '(10 20 30) do
(create-line c (list 10 10 100 i)))
with the message: illegal function call. I don't understand why? Help
me please
Best regards,
Elvis Nguyen wrote:
> Hi all,
>
> I have a pieces of code below:
> (defun bio-graph-gui ()
> (with-ltk ()
> (let* ((sc (make-instance 'scrolled-canvas))
> (c (canvas sc))
> (i))
>
> ((loop for i in '(10 20 30) do
> (create-line c (list 10 10 100 i)))
> (text (create-text c 260 250 "Canvas test"))
> (pack sc :expand 1 :fill :both)
> (scrollregion c 0 0 800 800)))))
>
> I compile in SBCL, there is always an error at:
> (loop for i in '(10 20 30) do
> (create-line c (list 10 10 100 i)))
> with the message: illegal function call. I don't understand why? Help
> me please
There is one pair of parentheses too many: Instead of ((loop ...)), just
say (loop ...).
Why did you add the extra parentheses?
Pascal
--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
On Jul 12, 5:48 pm, Pascal Costanza <····@p-cos.net> wrote:
> Elvis Nguyen wrote:
> > Hi all,
>
> > I have a pieces of code below:
> > (defun bio-graph-gui ()
> > (with-ltk ()
> > (let* ((sc (make-instance 'scrolled-canvas))
> > (c (canvas sc))
> > (i))
>
> > ((loop for i in '(10 20 30) do
> > (create-line c (list 10 10 100 i)))
> > (text (create-text c 260 250 "Canvas test"))
> > (pack sc :expand 1 :fill :both)
> > (scrollregion c 0 0 800 800)))))
>
> > I compile in SBCL, there is always an error at:
> > (loop for i in '(10 20 30) do
> > (create-line c (list 10 10 100 i)))
> > with the message: illegal function call. I don't understand why? Help
> > me please
>
> There is one pair of parentheses too many: Instead of ((loop ...)), just
> say (loop ...).
>
> Why did you add the extra parentheses?
>
> Pascal
>
> --
> My website:http://p-cos.net
> Common Lisp Document Repository:http://cdr.eurolisp.org
> Closer to MOP & ContextL:http://common-lisp.net/project/closer/
Because, I want to draw some lines in the canvas. Is there any way to
draw some lines using loops.
Step 1: Create a canvas (let * ((....)), called c
Step 2: Draw some lines using Loop
Step 3: Pack these lines into the canvas c.
But it doesn't run.
On Jul 12, 7:11 pm, Elvis Nguyen <·······@gmail.com> wrote:
> On Jul 12, 5:48 pm, Pascal Costanza <····@p-cos.net> wrote:
>
>
>
> > Elvis Nguyen wrote:
> > > Hi all,
>
> > > I have a pieces of code below:
> > > (defun bio-graph-gui ()
> > > (with-ltk ()
> > > (let* ((sc (make-instance 'scrolled-canvas))
> > > (c (canvas sc))
> > > (i))
>
> > > ((loop for i in '(10 20 30) do
> > > (create-line c (list 10 10 100 i)))
> > > (text (create-text c 260 250 "Canvas test"))
> > > (pack sc :expand 1 :fill :both)
> > > (scrollregion c 0 0 800 800)))))
>
> > > I compile in SBCL, there is always an error at:
> > > (loop for i in '(10 20 30) do
> > > (create-line c (list 10 10 100 i)))
> > > with the message: illegal function call. I don't understand why? Help
> > > me please
>
> > There is one pair of parentheses too many: Instead of ((loop ...)), just
> > say (loop ...).
>
> > Why did you add the extra parentheses?
>
> > Pascal
>
> > --
> > My website:http://p-cos.net
> > Common Lisp Document Repository:http://cdr.eurolisp.org
> > Closer to MOP & ContextL:http://common-lisp.net/project/closer/
>
> Because, I want to draw some lines in the canvas. Is there any way to
> draw some lines using loops.
> Step 1: Create a canvas (let * ((....)), called c
> Step 2: Draw some lines using Loop
> Step 3: Pack these lines into the canvas c.
>
> But it doesn't run.
===========================================
This is code:
;;; Using ltk for making GUIs
(defun bio-graph-gui ()
(with-ltk ()
(let* ((sc (make-instance 'scrolled-canvas))
(c (canvas sc))
(loop for i from 1 to 3 do (create-line c (list 10 10 100
(* i 100))))
(text (create-text c 260 250 "Canvas test")))
(pack sc :expand 1 :fill :both)
(scrollregion c 0 0 800 800))))
The error is:
The LET* binding spec(loop for i from 1 to 3 do (create-line c (list
10 10 100 (* i 100)))) is malformed.
On Jul 12, 7:20 pm, Elvis Nguyen <·······@gmail.com> wrote:
> On Jul 12, 7:11 pm, Elvis Nguyen <·······@gmail.com> wrote:
>
> > On Jul 12, 5:48 pm, Pascal Costanza <····@p-cos.net> wrote:
>
> > > Elvis Nguyen wrote:
> > > > Hi all,
>
> > > > I have a pieces of code below:
> > > > (defun bio-graph-gui ()
> > > > (with-ltk ()
> > > > (let* ((sc (make-instance 'scrolled-canvas))
> > > > (c (canvas sc))
> > > > (i))
>
> > > > ((loop for i in '(10 20 30) do
> > > > (create-line c (list 10 10 100 i)))
> > > > (text (create-text c 260 250 "Canvas test"))
> > > > (pack sc :expand 1 :fill :both)
> > > > (scrollregion c 0 0 800 800)))))
>
> > > > I compile in SBCL, there is always an error at:
> > > > (loop for i in '(10 20 30) do
> > > > (create-line c (list 10 10 100 i)))
> > > > with the message: illegal function call. I don't understand why? Help
> > > > me please
>
> > > There is one pair of parentheses too many: Instead of ((loop ...)), just
> > > say (loop ...).
>
> > > Why did you add the extra parentheses?
>
> > > Pascal
>
> > > --
> > > My website:http://p-cos.net
> > > Common Lisp Document Repository:http://cdr.eurolisp.org
> > > Closer to MOP & ContextL:http://common-lisp.net/project/closer/
>
> > Because, I want to draw some lines in the canvas. Is there any way to
> > draw some lines using loops.
> > Step 1: Create a canvas (let * ((....)), called c
> > Step 2: Draw some lines using Loop
> > Step 3: Pack these lines into the canvas c.
>
> > But it doesn't run.
>
> ===========================================
> This is code:
> ;;; Using ltk for making GUIs
> (defun bio-graph-gui ()
> (with-ltk ()
> (let* ((sc (make-instance 'scrolled-canvas))
> (c (canvas sc))
>
> (loop for i from 1 to 3 do (create-line c (list 10 10 100
> (* i 100))))
> (text (create-text c 260 250 "Canvas test")))
>
> (pack sc :expand 1 :fill :both)
> (scrollregion c 0 0 800 800))))
>
> The error is:
> The LET* binding spec(loop for i from 1 to 3 do (create-line c (list
> 10 10 100 (* i 100)))) is malformed.
Ok, thanks a lot. It works well.
"Elvis Nguyen" <·······@gmail.com> wrote in message
·········································@33g2000vbe.googlegroups.com...
On Jul 12, 7:11 pm, Elvis Nguyen <·······@gmail.com> wrote:
> On Jul 12, 5:48 pm, Pascal Costanza <····@p-cos.net> wrote:
> But it doesn't run.
===========================================
This is code:
;;; Using ltk for making GUIs
(defun bio-graph-gui ()
(with-ltk ()
(let* ((sc (make-instance 'scrolled-canvas))
(c (canvas sc))
(loop for i from 1 to 3 do (create-line c (list 10 10 100
(* i 100))))
(text (create-text c 260 250 "Canvas test")))
(pack sc :expand 1 :fill :both)
(scrollregion c 0 0 800 800))))
Close the list of variables being bound via the LET with a right paren,
i.e. ...(c (canvas sc))) and then check to make sure all the parens in
the code balance properly.
You are attempting to treat LOOP itself as a variable in the LET list.
You want a structure like this:
(let ((a x)
(b y))
(loop for i .........)))
A LOOP in LET means the LOOP must be within the scope of the LET not in
its list of variables.
Carl Taylor
Elvis Nguyen <·······@gmail.com> writes:
> This is code:
> ;;; Using ltk for making GUIs
> (defun bio-graph-gui ()
> (with-ltk ()
> (let* ((sc (make-instance 'scrolled-canvas))
> (c (canvas sc))
>
> (loop for i from 1 to 3 do (create-line c (list 10 10 100
> (* i 100))))
> (text (create-text c 260 250 "Canvas test")))
>
> (pack sc :expand 1 :fill :both)
> (scrollregion c 0 0 800 800))))
>
> The error is:
> The LET* binding spec(loop for i from 1 to 3 do (create-line c (list
> 10 10 100 (* i 100)))) is malformed.
Even stranger. Why do you want to define variables named LOOP and
TEST?
The syntax to define a variable is
(let* (
(variable expression)
...
)
body-expressions...)
so why are you putting several expressions in the variable LOOP
definition clause?
You could write:
(let* ((sc (make-instance 'scrolled-canvas))
(c (canvas sc))
(loop 3)
(text (create-text c 260 250 "Canvas test")))
(dotimes (i loop)
(create-line c (list 10 10 100 (* i 100))))
(pack sc :expand 1 :fill :both)
(scroll-region c 0 800 800))
--
__Pascal Bourguignon__
Elvis Nguyen <·······@gmail.com> writes:
> On Jul 12, 5:48�pm, Pascal Costanza <····@p-cos.net> wrote:
>> Elvis Nguyen wrote:
>> > Hi all,
>>
>> > I have a pieces of code below:
>> > (defun bio-graph-gui ()
>> > � (with-ltk ()
>> > � � (let* ((sc (make-instance 'scrolled-canvas))
>> > � � � � � �(c (canvas sc))
>> > � � � � � �(i))
>>
>> > � � � ((loop for i in '(10 20 30) do
>> > � � � � � � (create-line c (list 10 10 100 i)))
>> > � � � �(text (create-text c 260 250 "Canvas test"))
>> > � � � �(pack sc :expand 1 :fill :both)
>> > � � � �(scrollregion c 0 0 800 800)))))
>>
>> > I compile in SBCL, there is always an error at:
>> > (loop for i in '(10 20 30) do
>> > � � � � � � (create-line c (list 10 10 100 i)))
>> > with the message: illegal function call. I don't understand why? Help
>> > me please
>>
>> There is one pair of parentheses too many: Instead of ((loop ...)), just
>> say (loop ...).
>>
>> Why did you add the extra parentheses?
>
> Because, I want to draw some lines in the canvas. Is there any way to
> draw some lines using loops.
> Step 1: Create a canvas (let * ((....)), called c
> Step 2: Draw some lines using Loop
> Step 3: Pack these lines into the canvas c.
>
> But it doesn't run.
No, Pascal asked why you wrote:
((loop for i in '(10 20 30) do
(create-line c (list 10 10 100 i)))
(text (create-text c 260 250 "Canvas test"))
(pack sc :expand 1 :fill :both)
(scrollregion c 0 0 800 800)))))
instead of:
(loop for i in '(10 20 30) do
(create-line c (list 10 10 100 i)))
(text (create-text c 260 250 "Canvas test"))
(pack sc :expand 1 :fill :both)
(scrollregion c 0 0 800 800))))
What made you put these forms inside a list?
--
__Pascal Bourguignon__