How does one create an array of points?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How does one create an array of points?

Michael Rice
I've been trying to create an array of points (in Squeak 5) but am failing badly. See below: first part => what I get when I exec "print it" on the first part. Guidance please.

#(1@1 2@2) => #(1 #@ 1 2 #@ 2)

#((Point x: 1 y: 1) (Point x: 2 y: 2)) =>  #(#(#Point #x: 1 #y: 1) #(#Point #x: 2 #y: 2))

#(12 'b' $c) => #(12 'b' $c)

#(12 'b' $c 1@1) => #(12 'b' $c 1 #@ 1)

#(12 'b' $c (1@1)) => #(12 'b' $c #(1 #@ 1))

#(12 'b' $c (Point x: 1 y: 1)) => #(12 'b' $c #(#Point #x: 1 #y: 1))

Point x:1 y: 1 =>  1@1

(Point x:1 y: 1) => 1@1

#((Point x: 1 y: 1)) => #(#(#Point #x: 1 #y: 1))

#(1@1) => #(1 #@ 1)


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

RE: How does one create an array of points?

Ron Teitelbaum

Hi Michael,

 

Good question!

 

{Point x:1 y:1. Point x:2 y:2.}

 

It’s not obvious!  Notice the periods after the end of each element.

 

All the best,

 

Ron Teitelbaum

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Rice
Sent: Monday, June 20, 2016 11:21 AM
To: SqueakList
Subject: [Newbies] How does one create an array of points?

 

I've been trying to create an array of points (in Squeak 5) but am failing badly. See below: first part => what I get when I exec "print it" on the first part. Guidance please.

 

#(1@1 2@2) => #(1 #@ 1 2 #@ 2)

 

#((Point x: 1 y: 1) (Point x: 2 y: 2)) =>  #(#(#Point #x: 1 #y: 1) #(#Point #x: 2 #y: 2))

 

#(12 'b' $c) => #(12 'b' $c)

 

#(12 'b' $c 1@1) => #(12 'b' $c 1 #@ 1)

 

#(12 'b' $c (1@1)) => #(12 'b' $c #(1 #@ 1))

 

#(12 'b' $c (Point x: 1 y: 1)) => #(12 'b' $c #(#Point #x: 1 #y: 1))

 

Point x:1 y: 1 =>  1@1

 

(Point x:1 y: 1) => 1@1

 

#((Point x: 1 y: 1)) => #(#(#Point #x: 1 #y: 1))

 

#(1@1) => #(1 #@ 1)

 


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: How does one create an array of points?

Joseph Alotta
In reply to this post by Michael Rice

a := Array new: 2.
a at: 1 put: (Point x: 1 y: 1).
a at: 2 put: (Point x: 2 y: 2).

a =>  {1@1 . 2@2}



> On Jun 20, 2016, at 9:41 AM, Michael Rice [via Smalltalk] <[hidden email]> wrote:
>
> I've been trying to create an array of points (in Squeak 5) but am failing badly. See below: first part => what I get when I exec "print it" on the first part. Guidance please.
>
> #(1@1 2@2) => #(1 #@ 1 2 #@ 2)
>
> #((Point x: 1 y: 1) (Point x: 2 y: 2)) =>  #(#(#Point #x: 1 #y: 1) #(#Point #x: 2 #y: 2))
>
> #(12 'b' $c) => #(12 'b' $c)
>
> #(12 'b' $c 1@1) => #(12 'b' $c 1 #@ 1)
>
> #(12 'b' $c (1@1)) => #(12 'b' $c #(1 #@ 1))
>
> #(12 'b' $c (Point x: 1 y: 1)) => #(12 'b' $c #(#Point #x: 1 #y: 1))
>
> Point x:1 y: 1 =>  1@1
>
> (Point x:1 y: 1) => 1@1
>
> #((Point x: 1 y: 1)) => #(#(#Point #x: 1 #y: 1))
>
> #(1@1) => #(1 #@ 1)
>
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
> If you reply to this email, your message will be added to the discussion below:
> http://forum.world.st/How-does-one-create-an-array-of-points-tp4901909.html
> To start a new topic under Squeak - Beginners, email [hidden email]
> To unsubscribe from Squeak - Beginners, click here.
> NAML

Reply | Threaded
Open this post in threaded view
|

Re: How does one create an array of points?

Michael Rice
In reply to this post by Ron Teitelbaum
Weird, but what do I know.

I see that this (a period separating each from the next) also works:

{1@1. 2@2. 3@3} => {1@1 . 2@2 . 3@3}

Thanks, all.



On Mon, Jun 20, 2016 at 11:29 AM, Ron Teitelbaum <[hidden email]> wrote:

Hi Michael,

 

Good question!

 

{Point x:1 y:1. Point x:2 y:2.}

 

It’s not obvious!  Notice the periods after the end of each element.

 

All the best,

 

Ron Teitelbaum

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Rice
Sent: Monday, June 20, 2016 11:21 AM
To: SqueakList
Subject: [Newbies] How does one create an array of points?

 

I've been trying to create an array of points (in Squeak 5) but am failing badly. See below: first part => what I get when I exec "print it" on the first part. Guidance please.

 

#(1@1 2@2) => #(1 #@ 1 2 #@ 2)

 

#((Point x: 1 y: 1) (Point x: 2 y: 2)) =>  #(#(#Point #x: 1 #y: 1) #(#Point #x: 2 #y: 2))

 

#(12 'b' $c) => #(12 'b' $c)

 

#(12 'b' $c 1@1) => #(12 'b' $c 1 #@ 1)

 

#(12 'b' $c (1@1)) => #(12 'b' $c #(1 #@ 1))

 

#(12 'b' $c (Point x: 1 y: 1)) => #(12 'b' $c #(#Point #x: 1 #y: 1))

 

Point x:1 y: 1 =>  1@1

 

(Point x:1 y: 1) => 1@1

 

#((Point x: 1 y: 1)) => #(#(#Point #x: 1 #y: 1))

 

#(1@1) => #(1 #@ 1)

 


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

RE: How does one create an array of points?

Ron Teitelbaum

 

From: Michael Rice
Sent: Monday, June 20, 2016 11:44 AM

 

Weird, but what do I know.

 

I see that this (a period separating each from the next) also works:

 

{1@1. 2@2. 3@3} => {1@1 . 2@2 . 3@3}

 

[Ron Teitelbaum] Ahh Yes.  Even better.

 

Thanks, all.

 

 

 

On Mon, Jun 20, 2016 at 11:29 AM, Ron Teitelbaum <[hidden email]> wrote:

Hi Michael,

 

Good question!

 

{Point x:1 y:1. Point x:2 y:2.}

 

It’s not obvious!  Notice the periods after the end of each element.

 

All the best,

 

Ron Teitelbaum

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Rice
Sent: Monday, June 20, 2016 11:21 AM
To: SqueakList
Subject: [Newbies] How does one create an array of points?

 

I've been trying to create an array of points (in Squeak 5) but am failing badly. See below: first part => what I get when I exec "print it" on the first part. Guidance please.

 

#(1@1 2@2) => #(1 #@ 1 2 #@ 2)

 

#((Point x: 1 y: 1) (Point x: 2 y: 2)) =>  #(#(#Point #x: 1 #y: 1) #(#Point #x: 2 #y: 2))

 

#(12 'b' $c) => #(12 'b' $c)

 

#(12 'b' $c 1@1) => #(12 'b' $c 1 #@ 1)

 

#(12 'b' $c (1@1)) => #(12 'b' $c #(1 #@ 1))

 

#(12 'b' $c (Point x: 1 y: 1)) => #(12 'b' $c #(#Point #x: 1 #y: 1))

 

Point x:1 y: 1 =>  1@1

 

(Point x:1 y: 1) => 1@1

 

#((Point x: 1 y: 1)) => #(#(#Point #x: 1 #y: 1))

 

#(1@1) => #(1 #@ 1)

 


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

 


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners