> I'm a fortran/COBOL/C programmer trying to teach his daughter Logo.
> I understand pointers and indirection.
> 1. I do not understand why variable names must be preceeded by a double
> quote in the make command, and then by a colon in the print command. Is
> there someplace (either the online documentation or Jim's book) that
> explains (from a programmer's perspective) how to create and manipulate
The reason why it's different (definition and use) is because you WANT
it to be different. It's similar to the reason why Pascal
for assignment rather than =. After kids just got threw learning
a != a + 1
Programming comes along (Like C/FORTRAN) and does this
a = a + 1
This can be confusing for young programmers. So the idea is to make
it clear that it's not an equation but an assignment.
make "a :a + 1
That is, DEFINE a new variable A by using the current VALUE of A plus 1.
> 2. Given the following sequence:
> make "a 255
> setpc [:a 0 0]
> why do I get the message:
> setpc doesnt like [:a 0 0] as input
> More to the point, how do I create continuously varying colors?
Your second problem is extremely common.
In C lingo you did this.
sprintf(foo, ":a 0 0");
But what you want is
sprintf(foo, "%d 0 0", :a);
To do this you need to build a new list with :a resolved
setpc (list :a 0 0)
Yes, parens are done differently also :-)
For someone that has never used Logo, Lisp or Scheme it's baffling
and it takes quite some time to appreciate. For someone that's never
programmed it's more intuitive (rules are more consistent and generally
My most Native language is C++ but I still LOVE to play in Logo.
Brian's books will give more technical information about Logo, apply
more of the advanced features of the language and is designed for older
students. Jim's books are more by example and geared towards younger
students and covers some of the unique features of MSWLogo.
Both are excellent with very different goals see URL's on MSWLogo's web page.
> 3. In a nested "repeat" loop, is it correct to assume that "repcount"
> refers to the inner value in the inner loop and the outer value in the
> outer loop? If I want to reference the outer value in the inner loop I
> assume I must capture it into a variable before the inner "repeat" (e.g.):
> make "outer repcount
Yes, you are correct.
> Is there any syntax that will let me reference the outer repcount from the
> inner loop?
Yes, see Help on FOR. Although FOR, WHILE etc. are not technically
standard Logo they are mighty handy.
To get help on FOR enter
You sound like a C programmer for sure, getting his loop control understood.
Also study recursion for solving problems also.
See bottom of MSWLogo page on how to join and learn powerful
recursive techniques that even young programmers can grasp.
> 4. Why can I "print repcount", but must "print :a"? What is the
> difference between those two variables that the "a" requires the colon?
repcount is a function that output the internal counter vs :a is a variable.
C uses ()'s to indicate a function, logo uses a bare name.
The www page contains some very powerful educational software.
Our single most important investment is our kids.