• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Kof2008 Itll
 

Kof2008 Itll

on

  • 2,096 views

“Introduction to Lazy lists”

“Introduction to Lazy lists”
How to use and construct lazy lists on Programming Langage Ruby.

Statistics

Views

Total Views
2,096
Views on SlideShare
2,094
Embed Views
2

Actions

Likes
1
Downloads
4
Comments
0

1 Embed 2

http://www.slideshare.net 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Kof2008 Itll Kof2008 Itll Presentation Transcript

    • Introduction to Lazy Lists 2008 UJIHISA, Tatsuhiro
    • UJIHISA Tatsuhiro • Osaka University • Ruby, Vim, Haskell and Math • http://ujihisa.nowa.jp • http://twitter.com/ujm • To the US!
    • Targets • • Array, Enumerable, IO (File) Haskell
    • Lazy lists
    • • Ruby Haskell (Lazy list) Live coding Vim
    • Lazy Lists • Lazy lists (or streams) • List (= Array in Ruby) • Only needed parts are calculated. • Haskell supports lazy lists by default. • Ruby can support it.
    • List (=Array) in Ruby • Array class • [0, 1, 2, 3], Array.new(4) {|i| i } • a #=> [0, 1, 2, 3] a.map {|i| i * 2 } #=> [0, 2, 4, 6]
    • List • Data structure • Insert, Delete, Access sequentially
    • c.f. Array • Data structure • Insert, Delete, Access randomly, Size
    • (List again) • Data structure • Insert, Delete, Access sequentially
    • Lazy List • Data structure • Insert, Delete, Access sequentially
    • Types of lazy lists • Boundless length lists ( ) • Undefined length lists ( ) • Defined length lists ( )
    • How to construct lazy lists?
    • Notations • array = 1000+ length array heavy = lambda { heavy procedure } • array.take(2).map(&heavy) • array.map(&heavy).take(2)
    • Common case • truncation (break) • filtering (if, unless; select, reject) • mapping (=, map) • processing (???, each) folding (<<, inject)