# 4.7 Lists.pdf - GBbib GBbib h?2 HBbi Bb  7mM/K2MiH/i...

• No School
• AA 1
• 14

This preview shows page 1 - 6 out of 14 pages.

GBbib
GBbib h?2 HBbi Bb < 7mM/<K2Mi<H /<i< bi`m+im`2 BM 7mM+iBQM<H T`Q;`<KKBM;X = HBbi ?<pBM; x 1 , ..., x n <b 2H2K2Mib Bb r`Bii2M List( x 1 , ..., x n ) 1t<KTH2 val fruit = List( ŏapplesŏ , ŏorangesŏ , ŏpearsŏ ) val nums = List(1, 2, 3, 4) val diag3 = List(List(1, 0, 0), List(0, 1, 0), List(0, 0, 1)) val empty = List() h?2`2 <`2 irQ BKTQ`i<Mi /Bz2`2M+2b #2ir22M HBbib <M/ <``<vbX GBbib <`2 BKKmi<#H2 ě i?2 2H2K2Mib Q7 < HBbi +<MMQi #2 +?<M;2/X GBbib <`2 `2+m`bBp2- r?BH2 <``<vb <`2 ~<iX
GBbib val fruit = List( ŏapplesŏ , ŏorangesŏ , ŏpearsŏ ) val diag3 = List(List(1, 0, 0), List(0, 1, 0), List(0, 0, 1))
h?2 GBbi hvT2 GBF2 <``<vb- HBbib <`2 ?QKQ;2M2Qmb , i?2 2H2K2Mib Q7 < HBbi Kmbi <HH ?<p2 i?2 b<K2 ivT2X h?2 ivT2 Q7 < HBbi rBi? 2H2K2Mib Q7 ivT2 T Bb r`Bii2M scala.List[T] Q` b?Q`i2` Dmbi List[T] 1t<KTH2 val fruit : List [ String ] = List( ŏapplesŏ , ŏorangesŏ , ŏpearsŏ ) val nums : List [ Int ] = List(1, 2, 3, 4) val diag3 : List [ List [ Int ]] = List(List(1, 0, 0), List(0, 1, 0), List(0, 0, 1)) val empty : List [ Nothing ] = List()
*QMbi`m+iQ`b Q7 GBbib ;HH HBbib <`2 +QMbi`m+i2/ 7`QK, i?2 2KTiv HBbi Nil - <M/ i?2 +QMbi`m+iBQM QT2`<iBQM :: UT`QMQmM+2/ +QMb V, x :: xs =Bp2b < M2r HBbi rBi? i?2 }`bi 2H2K2Mi

#### You've reached the end of your free preview.

Want to read all 14 pages?

• Fall '19

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern