[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> Pascal, Numbers or Words?



Reply-To: tlbelding@htcomp.net (Tony Belding) 
and "Olga Tuzova" <olgatu@ort.spb.ru>

There are two periods in man's life:
First, when he can do everything, but is allowed to do nothing, 
and second, when he is allowed to do everything, but already can't do anything.

(Sorry for a poor translation from Polish writer Witkacy).

I think, that sentence applies to programming languages as well. Some of
them are full of restrictions making programmer do work in ascetic way like
a slave; other offers creative freedom, support programmer with plenty of
"inventions" and allow to do ... any mistake you can only imagine (or - more
often - beyond anyone's imagination).

After some years of earning for life with programming, I'm not sure which
are better. Those "liberal" ones seems to bo more productive. On the other
hand, Pascal has something like an "european soul" in opposition to C which
is 100% american. For this reason, I think, Pascal was a favourite way to
deal with computers for me for many years. It has a clear form and helps to
keep a "good habit" in programming. And after all, it is far from strait
utilitarianism.
Tony may call it "fascist", but I would leave this adjective for use to
those, who really had faced fasism - as long, as they live among us.

I would agree, Pascal is scholastic and has a little use outside college.
And this is a point of discussion. Professional programmers need an
efficient tool. They are willing to say, that programming is rather an art
then a discipline. 
On the other hand, we can introduce some computer languages as a way of
thinking, or a way of dealing abstract problems. This is only a helpful
coincidence, that it is a machine, which can obey a program. In fact -
creating a program is a goal in education, I think. Obeying it should give
an extra fun - not a prove. Only some of youngsters will act as programers.
All of them should train their mental possibilities.

It is obvious that speed of computing is less important here. Tony wrote:
> With the fast processors of Pentium and PowerPC class becoming
available, it seems like even interpreted Logo can do pretty good
speed.  I tested an old MS-DOS release of Berkeley Logo (3.0.1) on my
Pentium 90MHz system the other day.  It was amazing -- and rather
embarrassing -- to see how it smoked my Amiga 4000/040.  Considering
the likelyhood of Pentium II and PowerPC processors clocked over
200MHz, I don't see much advantage to be gained from further speeding
up the Logo language engine.  I feel like what we really need are more
primitives to make wider use of the system resources.  So we can do
things like raster graphics, simple GUI dialog boxes, load images, play
sounds samples, etc.

and I agree completely.

Now, about words and numbers. 
Some time ago we found (with some of my colleagues) that a computer is an
excellent tool as long as it doesn't deal with numbers. After that there are
round-up errors, finite representation of integers or fraction parts etc. 
Of course, there are programs and systems which make an error free
calculations, but we can't get some of that systems and put it into our
favourite Logo.
However a number IS a word as long, as we use a computer to manipulate with
it. So let's get use of word/number dualism in Logo and let's try for
example this:

to suma :a :b
; this is a SUM of :a :b of any length
 output dodaj :a :b 0
end

to dodaj :a :b :c
 if and emptyp :a emptyp :b [ifelse :c=1 [output "1][output " ]]
 if emptyp :a [output dodaj :b :c "0]
 if emptyp :b [output dodaj :a :c "0]
 ifelse(sum last :a last :b :c)>9~
  [output word dodaj bl :a bl :b "1 last (sum last :a last :b :c) ]~
  [output word dodaj bl :a bl :b "0 last (sum last :a last :b :c) ]
end

to razy :a :b
; this is a PRODUCT of :a :b of any length
 if emptyp bl :b [output razy1cyf :a last :b]
 output suma word razy :a bl :b "0 razy1cyf :a last :b
end

to razy1cyf :liczba :cyfra
; this is a PRODUCT of :liczba of any length and :cyfra of length 1
 if :cyfra=0 [output "0]
 if :cyfra=1 [output :liczba]
 output suma :liczba razy1cyf :liczba :cyfra-1
end

to factorial :k 
 if :k=0 [output 1]
 if :k=1 [output 1]
 output razy :k factorial :k-1
end

(There are some polish words used as names above. I hope this wouldn't
bother you)

After 760 seconds my home-made PC with a cheap Amd processor discovered,
that factorial of 100 has 158 digits, starts with 933262... and ends with 24
zeros. 
UCBLogo need about 28 min to do so.

---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home