Skip to content

Commit e83468a

Browse files
committed
Updated readme: added links to Habrahabr, reformatted sample code.
1 parent 152c156 commit e83468a

File tree

2 files changed

+32
-15
lines changed

2 files changed

+32
-15
lines changed

license.txt renamed to license.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
TL;DR: Simplified BSD License
1+
**Simplified BSD License**
22

3-
Copyright (c) 2012, Alexander Prokhorov
3+
Copyright © 2012–2014, Alexander Prokhorov
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without
77
modification, are permitted provided that the following conditions are met:
88

9-
* Redistributions of source code must retain the above copyright
10-
notice, this list of conditions and the following disclaimer.
9+
* Redistributions of source code must retain the above copyright
10+
notice, this list of conditions and the following disclaimer.
1111

12-
* Redistributions in binary form must reproduce the above copyright
13-
notice, this list of conditions and the following disclaimer in the
14-
documentation and/or other materials provided with the distribution.
12+
* Redistributions in binary form must reproduce the above copyright
13+
notice, this list of conditions and the following disclaimer in the
14+
documentation and/or other materials provided with the distribution.
1515

1616
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1717
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED

readme.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,21 @@ $categories = array(
5454
array('name' => 'Operating systems', 'id' => 'os'),
5555
);
5656

57-
// Put products with non-zero quantity into matching categories; sort products by quantity descending, then by name
57+
// Put products with non-zero quantity into matching categories;
58+
// sort categories by name;
59+
// sort products within categories by quantity descending, then by name.
5860
$result = from($categories)
5961
->orderBy('$cat ==> $cat["name"]')
6062
->groupJoin(
6163
from($products)
6264
->where('$prod ==> $prod["quantity"] > 0')
6365
->orderByDescending('$prod ==> $prod["quantity"]')
6466
->thenBy('$prod ==> $prod["name"]'),
65-
'$cat ==> $cat["id"]',
66-
'$prod ==> $prod["catId"]',
67-
'($cat, $prods) ==> array("name" => $cat["name"], "products" => $prods)'
67+
'$cat ==> $cat["id"]', '$prod ==> $prod["catId"]',
68+
'($cat, $prods) ==> array(
69+
"name" => $cat["name"],
70+
"products" => $prods
71+
)'
6872
);
6973

7074
// Alternative shorter syntax using default variable names
@@ -75,7 +79,11 @@ $result2 = from($categories)
7579
->where('$v["quantity"] > 0')
7680
->orderByDescending('$v["quantity"]')
7781
->thenBy('$v["name"]'),
78-
'$v["id"]', '$v["catId"]', 'array("name" => $v["name"], "products" => $e)'
82+
'$v["id"]', '$v["catId"]',
83+
'array(
84+
"name" => $v["name"],
85+
"products" => $e
86+
)'
7987
);
8088

8189
// Closure syntax, maximum support in IDEs, but verbose and hard to read
@@ -88,7 +96,12 @@ $result3 = from($categories)
8896
->thenBy(function ($prod) { return $prod["name"]; }),
8997
function ($cat) { return $cat["id"]; },
9098
function ($prod) { return $prod["catId"]; },
91-
function ($cat, $prods) { return array("name" => $cat["name"], "products" => $prods); }
99+
function ($cat, $prods) {
100+
return array(
101+
"name" => $cat["name"],
102+
"products" => $prods
103+
);
104+
}
92105
);
93106

94107
print_r($result->toArrayDeep());
@@ -178,9 +191,9 @@ PHP
178191

179192
License
180193
=======
181-
**TL;DR: Simplified BSD License**
194+
**Simplified BSD License**
182195

183-
Copyright (c) 2012, Alexander Prokhorov
196+
Copyright © 2012–2014, Alexander Prokhorov
184197
All rights reserved.
185198

186199
Redistribution and use in source and binary forms, with or without
@@ -207,6 +220,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
207220
Links
208221
=====
209222

223+
##### YaLinqo
224+
* **Habrahabr** articles *(Russian)*: [comparison of LINQ libraries](http://habrahabr.ru/post/147612/), [YaLinqo 1.0 with updated comparison](http://habrahabr.ru/post/147848/), [YaLinqo 2.0](http://habrahabr.ru/post/229763/).
225+
226+
##### LINQ ported to other languages:
210227
* [**linq.js**](http://linqjs.codeplex.com/) - LINQ for JavaScript. The one and only complete port of .NET 4 LINQ to JavaScript.
211228
* [**Underscore.js**](http://documentcloud.github.com/underscore/) - library for functional programming in JavaScript. Similar to LINQ, but different method names and no lazy evaluation.
212229
* [**Underscore.php**](http://brianhaveri.github.com/Underscore.php/) - port of Underscore.js to PHP. Identical functionality.

0 commit comments

Comments
 (0)