Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Update README.md

  • Loading branch information...
commit 2510b224890c17874d06927d026ff935a5c72061 1 parent 60cbed5
Dan Kogai authored March 31, 2013

Showing 1 changed file with 12 additions and 12 deletions. Show diff stats Hide diff stats

  1. 24  README.md
24  README.md
Source Rendered
@@ -9,11 +9,11 @@ USAGE
9 9
 -----
10 10
 
11 11
 ### In Browser
12  
-````
  12
+````html
13 13
 <script src="list-lazy.js"></script>
14 14
 ````
15 15
 ### node.js
16  
-````
  16
+````javascript
17 17
 var List = require('./list-lazy.js').List;
18 18
 ````
19 19
 
@@ -23,7 +23,7 @@ SIMPLE EXAMPLE
23 23
 By default `List.Lazy` returns an infinite list
24 24
 Note `List.Integers` is exported for convenience.
25 25
 
26  
-````
  26
+````javascript
27 27
 var ll = List.Lazy(function(i){return i}) // infinite integer;
28 28
 ll.length;      // Infinity
29 29
 ll.get(1e6);    // 1000000
@@ -42,7 +42,7 @@ Note `List.xrange` is defined that way:
42 42
 
43 43
 If the length is finite, you can apply `.toArray()`.
44 44
 
45  
-````
  45
+````javascript
46 46
 var ll = List.Lazy({
47 47
     get:function(i){return i},
48 48
     length:1e3
@@ -60,11 +60,11 @@ FOR CONVENIENCE
60 60
 
61 61
 Is an infinite list of integers which is just defined as:
62 62
 
63  
-````
  63
+````javascript
64 64
 List.Integers = List.Lazy(function(i){return i});
65 65
 ````
66 66
 
67  
-````
  67
+````javascript
68 68
 List.Integers.take(10); // [0,1,2,3,4,5,6,7,8,9]; 
69 69
 ````
70 70
 
@@ -74,7 +74,7 @@ Same as `xrange()` of Python.
74 74
 
75 75
 http://docs.python.org/2/library/functions.html#xrange
76 76
 
77  
-````
  77
+````javascript
78 78
 List.xrange(10).length      // 10
79 79
 List.xrange(10).toArray();  // [0,1,2,3,4,5,6,7,8,9];
80 80
 List.xrange(1e6).take(10);  // [0,1,2,3,4,5,6,7,8,9];
@@ -84,7 +84,7 @@ List.xrange(1e6).take(10);  // [0,1,2,3,4,5,6,7,8,9];
84 84
 
85 85
 Same as `range()` of Python which is just defined as:
86 86
 
87  
-````
  87
+````javascript
88 88
 xrange.apply(null, slice.call(arguments)).toArray();
89 89
 ````
90 90
 
@@ -93,7 +93,7 @@ MORE SOPHISTICATED EXAMPLE
93 93
 
94 94
 You can use `this` to memoize like this:
95 95
 
96  
-````
  96
+````javascript
97 97
 var fib = {
98 98
     0:0,
99 99
     1:1,
@@ -176,7 +176,7 @@ CAVEAT
176 176
 
177 177
 This one works fine.
178 178
 
179  
-````
  179
+````javascript
180 180
 List.Integers
181 181
     .map(function(x){ return x*x })
182 182
     .filter(function(x){ return x % 2 === 1 })
@@ -186,7 +186,7 @@ List.Integers
186 186
 
187 187
 While this one DOES NOT.
188 188
 
189  
-````
  189
+````javascript
190 190
 List.Integers
191 191
     .map(function(x){ return x*x })
192 192
     .filter(function(x){ return x % 2 === 1 })
@@ -198,6 +198,6 @@ List.Integers
198 198
 
199 199
 The same thing happens if you try the following in Ruby 2.0:
200 200
 
201  
-````
  201
+````ruby
202 202
 (1..Float::INFINITY).lazy.select{|x| x < 5}.take(10).force
203 203
 ````

0 notes on commit 2510b22

Please sign in to comment.
Something went wrong with that request. Please try again.