was: 3D drawing in aUCBLogo
Actually Elica does not differ that much from any other traditional
Logo.
The syntax is almost the same -- generally there are only two major
diferences -- "." is used to mark variable within another variable, and
parentheses touching identifiers are used as indices.
Maybe you are confused by many unknown library functions, not used in
other Logos. For example, in this statement:
make local "a custom point :x :y :z (set "myparam "myvalue)
only MAKE and LOCAL are primitives (reserved words). All the rest,
namely
CUSTOM, POINT, and SET are user-defined functions and their Logo sources
can be found in files LOGO.ELI and GRAPHIX.ELI
The above statement is functionally equivalent to these 3 lines:
local "a
make "a point :x :y :z
make "a.myparam "myvalue
Here is why: (those who are not interested in the details, may skip the
rest of the mail)
[1] LOCAL in Elica can be used as a function that creates a local
variable and returns its name, that's why MAKE LOCAL "X 1 is treated
as
MAKE (LOCAL "X) 1. In other Logos there is a special dedicated reserved
word MAKELOCAL -- in Elica you don't need it
[2] POINT is a user function (defined in GRAPHIX.ELI) to create a point
(a geometrical object). It takes 3 parameters -- coordinates of the
point
in 3D. So in the statement above you may think that POINT is used in
this
way: (POINT :X :Y :Z)
[3] SET is a user function (defined in LOGO.ELI) to create a list of
values. In our example it creates a set of two elements: the word
MYPARAM
and the word MYVALUE. The difference between a set and a list is that
set's elements can be any object, while list's elements can be only
numbers, words and lists. Another difference is that list is a data type
embedded in the core, while set is a user-defined type
[4] CUSTOM is a user function (defined in GRAPHIX.ELI) that customizes
a
variable (in our case this is the point) by adding or modifying its
properties. So, the first input of CUSTOM is the object (POINT :X :Y
:Z).
The second input is the set (SET ...)
Generally I use CUSTOM when I prefer to create an object and define all
its properties at once. For example:
make "myobj custom (sphere :center :radius) (set
"mode 2
"color rgb 0 0 0
"light "true
"focus vector 0 1 1)
is much clearer (to me) compared to:
make "myobj sphere :center :Radius
make "myobj.mode 2
make "myobj.color rgb 0 0 0
make "myobj.light "true
make "myobj.focus vector 0 1 1
LogoForum messages are archived at:
http://groups.yahoo.com/group/LogoForum
|