Killing a primitive
A Logo programming environment for Microsoft Windows
Brought to you by:
david_costanzo
Look at the following action:
I open FMSLogo and type in the following procedure from the command line and its editor:
to circle :radius
show (word "|You will never get a circle with radius | :radius)
end
After entering this I receive
circle defined
Now I want to draw a circle and write
circle 50
When I press "EXECUTE" the result is
You will never get a circle with radius 50
This should never had happened. Instead when trying to enter my procedure circle, I should have received
circle is already defined
because from the manual I knew that circle is a primitive and a reserved procedure name.
But circle comes from logolib and is not known before it is used for the first time.
Hence I can write my own circle-procedure and use it to kill the primitive circle.
The name circle should be a reserved name, always.
Diff:
This is by design and is useful. For example SLOWDRAW works by replacing the definition of FORWARD. In another ticket, you had replaced EDALL with an improved procedure picker. Being able to redefine CIRCLE has nothing to do with whether you've run CIRCLE or not. You can redefine it at any time.
The word "primitive" has a specific meaning in FMSLogo. It does not mean "comes with FMSLogo" as you are using it. It means "written in C" (compiled into fmslogo.exe). Even primitives can also be re-defined but you have to set REDEFP to TRUE before doing so.
CIRCLE is a library function and so is not a primitive:
If you don't want to change the definition of CIRCLE, don't do it. I don't see why you fault FMSLogo for doing what you told it to do. Because CIRCLE is a library procedure, if you want to restore the original definition, you can run
ERASE "CIRCLEto erase your bad definition. The next time CIRCLE is run, FMSLogo will load it from the logolib directory (see the attached screenshot).I wonder if there is a way to know whether FMSLogo will be able to load a definition from the library or not.
Or even a way to preemptively load library definitions so that when a student tries to create a new procedure FMSLogo responds with:
circle is already definedI've read that some Logos specifically do not offer a circle primitive or library command because they want to give students the chance to come up with a definition for themselves.
Papert, in one of his books, talks about an instance where a student needed a circle and with a little body syntonic guidance ...
https://runestone.academy/ns/books/published//TeacherCSP/CSPNameTurtles/bodySyntonic.html
the student was able to come up with a procedure. Great learning opportunity lost if circle is already defined.
If teachers are able to modify what library procedures are available to students, then when student needs some new command (circle, sin, cos, arc, summation, iseq, memberp) they can have the opportunity to actually program something useful for themselves.
Then when the intro course ends and the advance course begins, the teacher can then enable the professional quality definitions of those procedures and make then known to the students. Who, then, can start using them as scaffolding for higher level stuff.
Last edit: DanielAjoy 2022-01-27
Daniel Ajoy writes:
FMSLogo loads the library procedures from the "logolib" directory. If a procedure has already been defined, then FMSLogo will not try to load it from logolib.
To know if something a library procedure, you can look in your logolib directory. This can be done through Windows Explorer or programmatically. It's safe to assume that FMSLogo can load any of the files in there and that doing so will load a definition for a procedure of the same name.
A way that that's not as good is to do something like this
The problem with this approach is that it'll output "TRUE for user-defined procedures.
Daniel Ajoy writes:
Running
DEFINED? "CIRCLEloads it. This will stopTOfrom defining it from the commander, but there's no way to stop a programmer from using EDIT to change the definition.Daniel Ajoy writes:
A teacher with administrative rights can add or delete procedure definitions from logolib or use
REDEFPandERASEin startup.logoscript to remove a primitive. A teacher is legally permitted to re-distribute this "derived work" if they wanted to give this learning-enhanced FMSLogo to students. Of course, a teacher is also legally permitted to modify the source code to customize FMSLogo to meet their educational goals.Sorry for not keeping in contact for some weeks - but this will end soon.
I think this discussion here is really interesting. If you need a headline for it, I'd propose:
Opening Pandora's box.