Some commands

409 views
Skip to first unread message

Leo Barichello

unread,
Nov 18, 2011, 1:32:59 PM11/18/11
to kdeedu-...@googlegroups.com
Hi,

i miss some comands in kturtle:

- floor: given a integer number, it returns the biggest integer less than that number
Is is usefull to generate integer random number e for some specific numeric rotines

- arc: given radius and angle measurement, it draws a circle's arc with the specified radius eith the openning equals to angle given

- array: at least unidimensional array. Once you advance a lçittle in a disciplne about programming, it is impossible to live without them

Am i missing something that already exist?

It is possible to build them from the existing commands, but since they seem (at least to me) really basic, it would be nice to include in the "core commands".

Is it possible to implement them?
How could i help with it?

Bye

--
Sócio-diretor da Mais educacional - www.mais.mat.br
Professor do Colégio Villa Lobos e PUC-Campinas


Niels Slot

unread,
Nov 20, 2011, 5:51:01 PM11/20/11
to kdeedu-...@googlegroups.com
Hi Leo,

For floor I can think of the following code:

learn floor $value {

$rounded = round $value

$diff = $value - $rounded

if $diff >= 0 {

return $rounded

}else{

return $rounded - 1

}

}


This implementation is of course far from optimal. Maybe I'll consider adding it as a core command together with 'ceil'.


I don't fully understand what your proposed arc command should do. But things like drawing circles can already be done (using simple forward and turnleft/turnright commands). So I think that, given enough calculations, any arc can be drawn.


Array functionality has been discussed a couple of times among the developers. It would involve quite a bit of work to make the current KTurtle interpreter work with arrays and I believe the discussion concluded that we think arrays are too advanced to fit in KTurtle. Maybe this will change in the future, but for now (and the near future) you won't see arrays in KTurtle.


Regards,


Niels


2011/11/18 Leo Barichello <baric...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "KTurtle; an educational programming environment" group.
To post to this group, send email to kdeedu-...@googlegroups.com.
To unsubscribe from this group, send email to kdeedu-kturtl...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/kdeedu-kturtle?hl=en.

Leo Barichello

unread,
Nov 21, 2011, 11:32:44 AM11/21/11
to kdeedu-...@googlegroups.com
Hi Neils,

Exactly! The function ceil is quite similar. Another equivalent option is implement the function "remain of a division", maybe this last one is even more useful and versatile to include in the core.

About the arc command, I know that is easy to build a "generic" circle using forwards and turns, but it is not trivial to do it for a known radius if you considere young students that dont know trigonometry. The above code is my sugestion:

learn arc $radius, $angle {

$angle_i = arccos 1/$radius

$angle_e = 90 - $angle_i

$n = round $angle/(2*$angle_e)

turnright 90

repeat $n {

turnleft 2*$angle_e

forward 2

}

}


Since circumference is a pretty basic geometric form normally drawn using the radius measurement and it is not so simple to implement it, i think it would be really nice do have the function in core.

What do you think?


About the array, OK. I can imagine it is not so simple to implement it.


Regards,

Leo



2011/11/20 Niels Slot <niel...@gmail.com>

Niels Slot

unread,
Nov 22, 2011, 1:23:56 PM11/22/11
to kdeedu-...@googlegroups.com
2011/11/21 Leo Barichello <baric...@gmail.com>

Hi Neils,

Exactly! The function ceil is quite similar. Another equivalent option is implement the function "remain of a division", maybe this last one is even more useful and versatile to include in the core.

Remainder of a division will be in KTurtle that ships with KDE SC 4.8 (should be in February of the end of January). I added that a few weeks back. The command will be call 'mod', as in modulo.
 

About the arc command, I know that is easy to build a "generic" circle using forwards and turns, but it is not trivial to do it for a known radius if you considere young students that dont know trigonometry. The above code is my sugestion:

learn arc $radius, $angle {

$angle_i = arccos 1/$radius

$angle_e = 90 - $angle_i

$n = round $angle/(2*$angle_e)

turnright 90

repeat $n {

turnleft 2*$angle_e

forward 2

}

}


Since circumference is a pretty basic geometric form normally drawn using the radius measurement and it is not so simple to implement it, i think it would be really nice do have the function in core.

What do you think?


I think the list of commands in KTurtle should be a minimal set. Part of the fun of logo it that you have to implement your own triangle and rectangle functions. If something can be implemented trivially using the basic commands, then I see no reason to add the functionality as a basic command.

Maybe we can start some sort of KTurtle standard library? Like a bunch of functions implemented in KTurtle script that might be usable for others as well. I'm not sure how we make it available to users (maybe as scripts on kde-apps.org, maybe something different), but I would prefer that over implementing more functions as KTurtle  core functions.

Regards

Niels
 

Leo Barichello

unread,
Nov 22, 2011, 1:35:49 PM11/22/11
to kdeedu-...@googlegroups.com
Hi, Neils

About the remainder: great news! It will solve some limitations for me.

About the arc function, i can see you point, but I really think circunference deserves a core function because it is a really basic geometric shape. In fact, the function i wrote is quite simple but not for students from primary school.
However, the ideia of "standard library" that can be "imported" or even selected from a menu (we can think of a aritmethic library, geometric, trigonometric, etc) is pretty interesting. Count on me to implement something in this way.

Regards,
Leo

2011/11/22 Niels Slot <niel...@gmail.com>

tom arnall

unread,
May 27, 2014, 4:01:12 PM5/27/14
to kdeedu-...@googlegroups.com
"I think the list of commands in KTurtle should be a minimal set. Part of the fun of logo it that you have to implement your own triangle and rectangle functions. If something can be implemented trivially using the basic commands, then I see no reason to add the functionality as a basic command.

"Maybe we can start some sort of KTurtle standard library? Like a bunch of functions implemented in KTurtle script that might be usable for others as well. I'm not sure how we make it available to users (maybe as scripts on kde-apps.org, maybe something different), but I would prefer that over implementing more functions as KTurtle  core functions."


agreed for my purposes. i teach programming to people who have trouble grasping the fundamentals. kturtle serves my purpose very well. i want people to re-invent the wheel ;o) i do think as well that the library is a great idea. it wd provide us with the best of both worlds to some extent. also, it gives the beginner the chance to study good code once he or she gets the basic ideas of the language.
 

tom arnall

unread,
May 27, 2014, 4:10:06 PM5/27/14
to kdeedu-...@googlegroups.com
kturtle is a subset of logo, which is a very sophisticated language. the inventors of logo had hoped it wd become a much-employed application language. i think ucblogo is the original version of it. details at: http://www.cs.berkeley.edu/~bh/logo.html

Leo Barichello

unread,
May 27, 2014, 4:18:16 PM5/27/14
to kdeedu-...@googlegroups.com
Hello,

What could be the "something different" mentioned by Niels?

I dont think kde-files.org is a good choice for extra functions, because you open the files as a new script, over the one you are working on.

My ideia is something like a new menu with some libraries available (like "Arithmetic", "Geometry"). Once the user activate it, they open as a non-editable new tab on the "Editor". Then, the user can look at the codes and functions available on each library.
What do you think?

Best wishes,
Leo


--
You received this message because you are subscribed to the Google Groups "KTurtle; an educational programming environment" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kdeedu-kturtl...@googlegroups.com.

To post to this group, send email to kdeedu-...@googlegroups.com.



--
Professor de Matemática do Colégio Villa Lobos e Anglo Bragança Paulista

tom arnall

unread,
May 27, 2014, 4:33:00 PM5/27/14
to kdeedu-...@googlegroups.com
Leo!

I'm so glad to get your reply on the kturtle forum.

Please send me some information on yr work with kturtle.

I am working in Mexico. A colleague and I are designing an internet
course on programming. Right now, most of our work is her learning
kturtle and me helping her do it. So far, we've had five sessions. I'm
very excited about this because she has a master's in e-learning and
is already teaching people using the internet. She came to Ensenada to
do research for her doctorate. This is where we met. She went back to
her home in Veracruz two weeks ago, so now we have no choice but to
learn well how to use the kinds of tools we will need for the
programming course.

Regards,

Tom
>> agreed for my purposes. I teach programming to people who have trouble
>> grasping the fundamentals. Kturtle serves my purpose very well. I want
>> people to re-invent the wheel ;o) I do think as well that the library is
>> a
>> great idea. It would provide us with the best of both worlds to some extent.
>> also, it gives the beginner the chance to study good code once he or she
>> gets the basic ideas of the language.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "KTurtle; an educational programming environment" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to kdeedu-kturtleunsubscribegooglegroups.com.
>>
>> To post to this group, send email to kdeedu-kturtlegooglegroups.com.
>> Visit this group at http://groups.google.com/group/kdeedu-kturtle.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Professor de Matemtica do Colgio Villa Lobos e Anglo Bragana Paulista
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "KTurtle; an educational programming environment" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/kdeedu-kturtle/IAhqXvPICI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> kdeedu-kturtleunsubscribegooglegroups.com.
> To post to this group, send email to kdeedu-kturtlegooglegroups.com.

Leo Barichello

unread,
May 27, 2014, 4:39:14 PM5/27/14
to kdeedu-...@googlegroups.com
Tom,

I utilized Kturtle a lot 2 years ago with high school students. After that, I developed 2 workshops about Kturtle applied to probability problems and arithmetical procedures. See something at http://www.mais.mat.br/wiki/Kturtle (in portuguese).

I am teacher and researcher in Mathematics Education. So, we may have some common interests!

Since 2013 I started to use Scratch instead of Kturtle to teach basic programming to middle and high school students, but I am still interested on Kturtle.

Leo



To unsubscribe from this group and stop receiving emails from it, send an email to kdeedu-kturtl...@googlegroups.com.
To post to this group, send email to kdeedu-...@googlegroups.com.



--
Reply all
Reply to author
Forward
0 new messages