Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Yeti newcomer and a question
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Tommy McGuire  
View profile  
 More options Jul 5 2011, 1:28 pm
From: Tommy McGuire <mcgu...@crsr.net>
Date: Tue, 5 Jul 2011 10:28:23 -0700 (PDT)
Local: Tues, Jul 5 2011 1:28 pm
Subject: Yeti newcomer and a question
I spent the weekend playing with Yeti, and I'm very impressed. It is a
*nice* language.

To have something to work on, I cloned the snake game from Learning
Clojure, which went almost perfectly. I do have one question, though.
I probably missed it in the documentation, but how do you access a
method of a class' superclass?

Specifically, I created a subclass of JPanel whose implementation of
paintComponent needs to call the superclass' paintComponent. If you
want to check out my code, it's at http://www.crsr.net/files/snake.yeti.
I also wrote some comments about it at http://maniagnosis.crsr.net/2011/07/snakes-on-yeti.html.
I would welcome any suggestions or corrections.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Madis  
View profile  
 More options Jul 6 2011, 6:30 am
From: Madis <ma...@cyber.ee>
Date: Wed, 6 Jul 2011 13:30:38 +0300 (EEST)
Local: Wed, Jul 6 2011 6:30 am
Subject: Re: [yeti] Yeti newcomer and a question

On Tue, 5 Jul 2011, Tommy McGuire wrote:
> I spent the weekend playing with Yeti, and I'm very impressed. It is a
> *nice* language.

> To have something to work on, I cloned the snake game from Learning
> Clojure, which went almost perfectly. I do have one question, though.
> I probably missed it in the documentation, but how do you access a
> method of a class' superclass?

> Specifically, I created a subclass of JPanel whose implementation of
> paintComponent needs to call the superclass' paintComponent. If you
> want to check out my code, it's at http://www.crsr.net/files/snake.yeti.
> I also wrote some comments about it at http://maniagnosis.crsr.net/2011/07/snakes-on-yeti.html.
> I would welcome any suggestions or corrections.

It wasn't implemented, but I implemented it now. ;)

Just use super#fobar(...) in some method.

https://github.com/mth/yeti/commit/0a7b745cf9da839fcac0c03b9065518263...

The http://linux.ee/~mzz/yeti/yeti.jar has been updated, too.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Madis  
View profile  
 More options Jul 6 2011, 9:31 am
From: Madis <ma...@cyber.ee>
Date: Wed, 6 Jul 2011 16:31:28 +0300 (EEST)
Local: Wed, Jul 6 2011 9:31 am
Subject: Re: [yeti] Yeti newcomer and a question

On Tue, 5 Jul 2011, Tommy McGuire wrote:
> If you want to check out my code, it's at http://www.crsr.net/files/snake.yeti.
> I also wrote some comments about it at http://maniagnosis.crsr.net/2011/07/snakes-on-yeti.html.
> I would welcome any suggestions or corrections.

Looked at the comments now, member? is contains in the library (and yes,
it would've been better named contains?).

The list destructuring pattern matching is there, but you must use case of to do it.

butLast lst =
     case lst of
     [_]: [];
     h :: t: h :: butLast t;
     _: [];
     esac;

There is a short-hand for creating new structures from existing ones:

turn snake newdir =
   { dir = newdir,
     body = snake.body,
     color = snake.color };

Could be written as:

turn snake dir =
     snake with {dir};

The {dir} there is equivalent to {dir = dir}, and this can be used
everywhere, so:

{ x = x, y = y, w = w, h = h } = pointToScreenRec pt;

can be written as

{ x, y, w, h } = pointToScreenRec pt;

Hoping this helps ;)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tommy McGuire  
View profile  
 More options Jul 6 2011, 5:00 pm
From: Tommy McGuire <mcgu...@crsr.net>
Date: Wed, 6 Jul 2011 14:00:47 -0700 (PDT)
Local: Wed, Jul 6 2011 5:00 pm
Subject: Re: Yeti newcomer and a question
On Jul 6, 8:31 am, Madis <ma...@cyber.ee> wrote:

> On Tue, 5 Jul 2011, Tommy McGuire wrote:
> > If you want to check out my code, it's athttp://www.crsr.net/files/snake.yeti.
> > I also wrote some comments about it athttp://maniagnosis.crsr.net/2011/07/snakes-on-yeti.html.
> > I would welcome any suggestions or corrections.

> Looked at the comments now, member? is contains in the library (and yes,
> it would've been better named contains?).
> ...

Thanks for your comments! I was updating my code and had a little
problem with the super#paintComponent(g) call and the new yeti.jar.

snake.yeti:142:14: Non-public method
javax.swing.JComponent#paintComponent cannot be accessed from
different package ()

It looks like the paintComponent method in javax.swing.JComponent (the
superclass of JPanel) is protected. It should be accessible from my
subclass of JPanel, right?

Also, I am wondering about the definition of butLast:

butLast lst =
     case lst of
     [_]: [];
     h :: t: h :: butLast t;
     _: [];
     esac;

If I change it to be:

butLast lst =
    case lst of
    [] : [];
    [_] : [];
    h :: t : h :: butLast t;
    esac;

I get an error: "1:10: Partial match: []".

I can see where your version is guaranteed to match, because the last
case is a default. However, I think mine is exhaustive. What is wrong
with it?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Madis  
View profile  
 More options Jul 6 2011, 6:54 pm
From: Madis <ma...@cyber.ee>
Date: Thu, 7 Jul 2011 01:54:33 +0300 (EEST)
Local: Wed, Jul 6 2011 6:54 pm
Subject: Re: [yeti] Re: Yeti newcomer and a question

I'll look into it.

Yes, your match is exhaustive, but the pattern analyzer isn't currently
smart enough and errs on the safe side (requiring a match-all pattern on
list matches). In practice it's usually possible to organize the pattern
that way.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Madis  
View profile  
 More options Jul 6 2011, 7:04 pm
From: Madis <ma...@cyber.ee>
Date: Thu, 7 Jul 2011 02:04:52 +0300 (EEST)
Local: Wed, Jul 6 2011 7:04 pm
Subject: Re: [yeti] Re: Yeti newcomer and a question

On Thu, 7 Jul 2011, Madis wrote:
> On Wed, 6 Jul 2011, Tommy McGuire wrote:

>> Thanks for your comments! I was updating my code and had a little
>> problem with the super#paintComponent(g) call and the new yeti.jar.

>> snake.yeti:142:14: Non-public method
>> javax.swing.JComponent#paintComponent cannot be accessed from
>> different package ()

>> It looks like the paintComponent method in javax.swing.JComponent (the
>> superclass of JPanel) is protected. It should be accessible from my
>> subclass of JPanel, right?

> I'll look into it.

Should be fixed now.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tommy McGuire  
View profile  
 More options Jul 7 2011, 5:52 pm
From: Tommy McGuire <mcgu...@crsr.net>
Date: Thu, 7 Jul 2011 14:52:20 -0700 (PDT)
Local: Thurs, Jul 7 2011 5:52 pm
Subject: Re: Yeti newcomer and a question
On Jul 6, 6:04 pm, Madis <ma...@cyber.ee> wrote:

> >> It looks like the paintComponent method in javax.swing.JComponent (the
> >> superclass of JPanel) is protected. It should be accessible from my
> >> subclass of JPanel, right?

> > I'll look into it.

> Should be fixed now.

Yep, works perfectly. Thanks!

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tommy McGuire  
View profile  
 More options Jul 6 2011, 2:55 pm
From: Tommy McGuire <mcgu...@crsr.net>
Date: Wed, 6 Jul 2011 11:55:12 -0700 (PDT)
Local: Wed, Jul 6 2011 2:55 pm
Subject: Re: Yeti newcomer and a question
On Jul 6, 5:30 am, Madis <ma...@cyber.ee> wrote:

> On Tue, 5 Jul 2011, Tommy McGuire wrote:
> > Specifically, I created a subclass of JPanel whose implementation of
> > paintComponent needs to call the superclass' paintComponent.

> It wasn't implemented, but I implemented it now. ;)

> Just use super#fobar(...) in some method.

> https://github.com/mth/yeti/commit/0a7b745cf9da839fcac0c03b9065518263...

> Thehttp://linux.ee/~mzz/yeti/yeti.jarhas been updated, too.

That was fast! Thanks!

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »