Ruby for Highschoolers?

ilan berci wrote:

Finally OO IS REAL LIFE,

Really? OO is a gross simplification of real life, handy for code organization under various (but not all) circumstances.

Luckily, software is not real life.

···

--
James Britt

"Take eloquence and wring its neck."
  - Paul Verlaine

why the lucky stiff <ruby-talk@whytheluckystiff.net> writes:

DO NOT TRY TO WRITE A GAME.

I'm a bit curious about why you suggested this since writing a game
seems to be precisely the way many beginning programmers learn. (Or at
least it was in the days when practically every computer had QBasic.)
Is it because you'll get sidetracked by graphics concepts (which don't
really have much to do with the fundamentals of programming) or is
there another reason?

It seems if it's done right, writing a game can be a very engaging way
to learn. Perhaps it would be better if the incidentals (like
graphics) were abstracted away--perhaps handled by a program written
by the instructor on one machine hooked up to a projector, while
students only communicated with it over DRb, and thus wouldn't have to
think about things like rendering.

-Phil Hagelberg

http://technomancy.us

This has slightly confused me, but I'll admit that it's been a while since I've dealt with this sort of thing, so jump in with corrections as required.

   - A language has first-class functions when a function can be assigned to variable, passed to or returned from another function, and so on. In Ruby, a = lambda { |x| x + 1 } for example.

   - The distinction between Lisp-1 and Lisp-2 that the latter has a separate namespace for functions, in Ruby, for example, def a(x) x + 1; end can exist alongside a = lambda { |x| x + 1 } (and there's a corresponding hoop to jump through to call the lambda).

What I don't understand is how it follows that being in a different namespace implies that Lisp-2 doesn't have true first-class functions. The only reason I can think of is the circular one that "only Lisp-1 has true first-class functions", which gives it the distinct flavour of an age-old Lisp holy war (if that's the case, consider me uninterested).

matthew smillie.

···

On Jun 12, 2006, at 18:06, Christian Neukirchen wrote:

it's important to recognize that Scheme has
true first-class functions (being a Lisp-1), whereas there is a
fundamental difference between Blocks/Procs/lambdas and methods (being
a Lisp-2).

why the lucky stiff wrote:

It's just like a chemistry teacher having fun with liquid nitrogen and a banana.
You want to find dramatic, compelling exercises that you enjoy performing and
that the students totally lap up.

Ahhh, now we're talking. Watch as I dip my Ruby code
into liquid nitrogen and then use it to drive a nail...

Hal

why the lucky stiff wrote:

It's just like a chemistry teacher having fun with liquid nitrogen and a banana.
You want to find dramatic, compelling exercises that you enjoy performing and
that the students totally lap up.

Aye, that's something I agree with. Thermite paste is a bit more dramatic that /anything/ nitrogen can do, though.

For Ruby, the equivalent of the liquid nitrogen experiment is the social
projector demo. You set up a projector connected to a server. And you give
each student a REPL (irb) which acts as the client. Then you give students
commands which will affect the screen. In the past, I've used DRb[2] and students
are given an object and they run methods. I have a number of variations of this:

* Each student gets a section of the screen which can be altered in color and
   shape. Or a screen full of emoticons or avatars.

* Students vote on topics and the screen charts their response.

* You show a picture on screen and ask students to "tag" the picture. Words
   appear on screen with size corresponding to the popularity. Use ambiguous
   imagery that solicits interesting responses.

The idea here is that students watch the screen fill and feel the reward as a
group. High school students crave group acceptance anyway, so this feeds that
craving.

That's actually a really nifty idea for introducting people to Ruby.

Good luck, intrepid Nicholas. DO NOT TRY TO WRITE A GAME.

Thanks!

I'm also guessing that you're saying don't write a game because people will be discouraged by the fact that they can't create Unreal 2010 with four lines of code, MS Paint, and a lot of luck?

Again, thank you all!

Regards,
Nick Evans

In a Lisp-2 you have to use special syntax (funcall, apply, #call) to call a function-value. I believe that was the distinction he was making.

···

On Jun 12, 2006, at 2:58 PM, Matthew Smillie wrote:

On Jun 12, 2006, at 18:06, Christian Neukirchen wrote:

it's important to recognize that Scheme has
true first-class functions (being a Lisp-1), whereas there is a
fundamental difference between Blocks/Procs/lambdas and methods (being
a Lisp-2).

This has slightly confused me, but I'll admit that it's been a while since I've dealt with this sort of thing, so jump in with corrections as required.

  - A language has first-class functions when a function can be assigned to variable, passed to or returned from another function, and so on. In Ruby, a = lambda { |x| x + 1 } for example.

  - The distinction between Lisp-1 and Lisp-2 that the latter has a separate namespace for functions, in Ruby, for example, def a(x) x + 1; end can exist alongside a = lambda { |x| x + 1 } (and there's a corresponding hoop to jump through to call the lambda).

What I don't understand is how it follows that being in a different namespace implies that Lisp-2 doesn't have true first-class functions. The only reason I can think of is the circular one that "only Lisp-1 has true first-class functions", which gives it the distinct flavour of an age-old Lisp holy war (if that's the case, consider me uninterested).

matthew smillie.

ilan berci wrote:

Finally OO IS REAL LIFE,

Really? OO is a gross simplification of real life, handy for code organization under various (but not all) circumstances.

People tend to abuse this point of object-oriented languages; they treat classes/objects like modules, and quite frankly, it's sometimes really annoying to read.

Luckily, software is not real life.

Phew!

···

On 12-Jun-06, at 12:08 PM, James Britt wrote:

James Britt

--
Jeremy Tregunna
jtregunna@blurgle.ca

"One serious obstacle to the adoption of good programming languages is the notion that everything has to be sacrificed for speed. In computer languages as in life, speed kills." -- Mike Vanier

Jeremy Tregunna wrote:

ilan berci wrote:

Finally OO IS REAL LIFE,

Really? OO is a gross simplification of real life, handy for code organization under various (but not all) circumstances.

People tend to abuse this point of object-oriented languages; they treat classes/objects like modules, and quite frankly, it's sometimes really annoying to read.

Oh, absolutly. But, by the same token, not every line of code needs to be part of some object scheme.

···

On 12-Jun-06, at 12:08 PM, James Britt wrote:

--
James Britt

"Take eloquence and wring its neck."
  - Paul Verlaine

Logan Capaldo <logancapaldo@gmail.com> writes:

it's important to recognize that Scheme has
true first-class functions (being a Lisp-1), whereas there is a
fundamental difference between Blocks/Procs/lambdas and methods
(being
a Lisp-2).

This has slightly confused me, but I'll admit that it's been a
while since I've dealt with this sort of thing, so jump in with
corrections as required.

  - A language has first-class functions when a function can be
assigned to variable, passed to or returned from another function,
and so on. In Ruby, a = lambda { |x| x + 1 } for example.

  - The distinction between Lisp-1 and Lisp-2 that the latter has a
separate namespace for functions, in Ruby, for example, def a(x) x
+ 1; end can exist alongside a = lambda { |x| x + 1 } (and there's
a corresponding hoop to jump through to call the lambda).

What I don't understand is how it follows that being in a different
namespace implies that Lisp-2 doesn't have true first-class
functions. The only reason I can think of is the circular one that
"only Lisp-1 has true first-class functions", which gives it the
distinct flavour of an age-old Lisp holy war (if that's the case,
consider me uninterested).

matthew smillie.

In a Lisp-2 you have to use special syntax (funcall, apply, #call) to
call a function-value. I believe that was the distinction he was
making.

Exactly. If there are two different syntaxes for a) method calling,
and b) calling of "first-class" code objects ("functions"), these
functions are a) either are not really first-class or b) not functions
in the usual meaning of the term.

I could also say: Ruby has first-class lambdas (which *wrap* a block
or a method), but not first-class methods (or blocks, for that
matter). In Scheme, all executable code objects are first-class.

In real life, it's probably not that important; but from the language
aspect, it's rather characterizing. (E.g. python has first-class
functions and first-class methods (which are functions, too)).

···

On Jun 12, 2006, at 2:58 PM, Matthew Smillie wrote:

On Jun 12, 2006, at 18:06, Christian Neukirchen wrote:

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org