Mixing Tcl and Io

  • 4 Replies
  • 58 Views
*

Zero

  • Trusty Member
  • *******
  • Starship Trooper
  • *
  • 435
  • Fictional character
    • SYN CON DEV LOG
Mixing Tcl and Io
« on: November 23, 2017, 01:51:47 pm »


As you know, I like programming languages. Here I do a little thought experiment: mixing John Ousterhout's language Tcl and Steve Dekorte's language Io.

An interesting feature of Tcl is that function evaluation isn't automatic. You have to put code inside square brackets if you want it to be executed. The square brackets and their content will be "replaced by" the output of the code inside them.

set x 24
set y 18
set z "$x + $y is [expr $x + $y]"
puts $z


Io is modern and minimalist. An object is a list of slots, where each slot may contain data/code. You'd call an object's method by naming the corresponding object's slot.

Account := Object clone
Account balance := 0
Account deposit := method(amount,
    balance = balance + amount
)

account := Account clone
account deposit(10.00)
account balance println




Mixing them would give something like this:

set Dog [Object clone];

Dog set greet [
   fun {
      print "Hello, [arg]. I'm [name].";
   };
];

set my-dog [Dog clone];

my-dog
   set name "Maxy the dog",
   greet John;
   
-> Hello, John. I'm Maxy the dog.


"set" means "create a slot in yourself, with this name and this value".

In the first line, we're talking to the Environment, saying: create a slot named "Dog". The value of this slot will be the result of the code in square brackets [Object clone].

With "Object clone", we're talking to the object "Object", asking it to return a clone of itself.

The general form of a command is
command ::= <subject> <verb> <arguments> { "," <verb> <arguments> } ";"

Example:
obj part3 subPartB doThis like that, doThat like this;
where
"obj part3 subPartB" is the subject
"doThis" is a function with arguments "like" and "that"
"doThat" is a function with arguments "like" and "this"

I choose not to use named function arguments. Arguments are accessible through "arg", which contains the list of every argument the function was called with.

This would blend perfectly with the pub/sub semantics of Birdy.


*

Thierry

  • Bumblebee
  • **
  • 43
  • God is a sphere. Press 9 to enter.
Re: Mixing Tcl and Io
« Reply #1 on: November 23, 2017, 02:07:57 pm »
What those languages can do that python cannot ? (Compared to guys like you I really consider myself as beginner in programming !  :))

*

Zero

  • Trusty Member
  • *******
  • Starship Trooper
  • *
  • 435
  • Fictional character
    • SYN CON DEV LOG
Re: Mixing Tcl and Io
« Reply #2 on: November 23, 2017, 02:40:44 pm »
Nothing, really. All general purpose mainstream programming language are (pseudo) Turing-complete, which means they can compute everything, if they have enough space-time.

Differences are rather:
- some things are easier in one language, other things are easier in another
- porting to specific platforms can be easy/hard
- the ecosystems are different (ecosystem = libraries made by communities)
- communities have different "style" and size...

You code in Python? Python is good for AI. Good choice!

*

Thierry

  • Bumblebee
  • **
  • 43
  • God is a sphere. Press 9 to enter.
Re: Mixing Tcl and Io
« Reply #3 on: November 23, 2017, 09:56:08 pm »
Nothing, really. All general purpose mainstream programming language are (pseudo) Turing-complete, which means they can compute everything, if they have enough space-time.

Differences are rather:
- some things are easier in one language, other things are easier in another
- porting to specific platforms can be easy/hard
- the ecosystems are different (ecosystem = libraries made by communities)
- communities have different "style" and size...

You code in Python? Python is good for AI. Good choice!

ok I get it.
Yes Python is the only language I know. I went to it because I saw roboticists in many forums going to it and being quite satisfied.  I love it as well. Thanks to it I saw very fast that I could do almost everything with a machine. I don't say I don't want to go further with other languages but at least for what I need now this is enough.

Are you into Python as well ?

*

Thierry

  • Bumblebee
  • **
  • 43
  • God is a sphere. Press 9 to enter.
Re: Mixing Tcl and Io
« Reply #4 on: November 23, 2017, 10:23:28 pm »
By the way ... IO dictionaries  are weird ! They look more like "set" than "dict". There s no item:value... ???

http://iolanguage.org/tutorial.html


 


Kilopower
by keghn (General AI Discussion)
November 23, 2017, 11:57:32 pm
Mixing Tcl and Io
by Thierry (General Project Discussion)
November 23, 2017, 10:23:28 pm
Programming language designed specifically for AGI
by ivan.moony (General AI Discussion)
November 23, 2017, 10:20:52 pm
Theory of Everything
by Thierry (General AI Discussion)
November 23, 2017, 09:29:11 pm
When VR meets reality – how live concerts could be enhanced...
by Freddy (Virtual Reality)
November 23, 2017, 09:27:15 pm
What defines Human?
by infurl (General Chat)
November 23, 2017, 07:25:32 pm
Brain vs computer
by unreality (General AI Discussion)
November 23, 2017, 04:43:24 pm
A system for Machine Behaviour
by Thierry (General Project Discussion)
November 23, 2017, 02:28:25 pm
Chasing complexity
by infurl (Robotics News)
November 23, 2017, 07:58:53 pm
The most sensational news ever!
by 8pla.net (AI News )
November 23, 2017, 02:30:27 pm
When Good Drones go Bad
by Thierry (AI News )
November 18, 2017, 09:08:13 pm

Users Online

25 Guests, 1 User
Users active in past 15 minutes:
keghn
[Trusty Member]

Most Online Today: 35. Most Online Ever: 208 (August 27, 2008, 09:36:30 am)

Articles