You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Made most Cowry methods public
would throw an exception at Runtime. I had done something that in retrospect is obviously dumb.
- Documented Cowry (Copy-On Write aRraY) better.
These are type-safe utility methods for dealing with arrays.
This project still aims to keep you from needing to deal with arrays, but sometimes you do, and it's handy to have copy-on-write routines for doing it.
More of these methods could be made public if they are needed.
- [Nate Austin](https://github.com/navision)'s memory-efficient iteration of just keys or just values from maps. Thank you Nate!
- Fixed split() to handle splitIndex = 0 and splitIndex = size() thanks to a bug report from [Jonathan Cornaz](https://github.com/jcornaz) (curator of [collekt](https://github.com/jcornaz/collekt))
- Added Transformable.toImRrbt() and .toMutableRrbt() to make it convenient to transform things into RRB-Trees.
- Fixed bugs found using FindBugs - thanks to @cprice404. There are still some reported bugs, but
I think they are rare corner cases that lack clear solutions. This was the low-hanging fruit.
- Option.NONE is removed to avoid possible circular instantiation. Use None.NONE instead.
- Moved Indented to new indent package.
- Moved static methods from the Indented interface to a new IndentedUtils class.
- STRINGS array constant from Indented interface is now private to the IndentedUtils class.
- UnmodMap.UnEntry.EntryToUnEntryIter.next() now returns a Tuple2 instead of some other one-off class.
Copy file name to clipboardexpand all lines: CHANGE_LOG.md
+19
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,25 @@ releases on the way from an old version to a new one. Fix any deprecation warni
5
5
release before upgrading to the next one. The documentation next to each Deprecated annotation
6
6
tells you what to use instead. Once we delete the deprecated methods, that documentation goes too.
7
7
8
+
## Release 3.5.2: Fixes from Master
9
+
- Made most Cowry methods public
10
+
- Fixed a bug (reported by [fcurts](https://github.com/fcurts) - with unit test!) where Heterogeneous RrbTrees of more than 32 items
11
+
would throw an exception at Runtime. I had done something that in retrospect is obviously dumb.
12
+
- Documented Cowry (Copy-On Write aRraY) better.
13
+
These are type-safe utility methods for dealing with arrays.
14
+
This project still aims to keep you from needing to deal with arrays, but sometimes you do, and it's handy to have copy-on-write routines for doing it.
15
+
More of these methods could be made public if they are needed.
16
+
-[Nate Austin](https://github.com/navision)'s memory-efficient iteration of just keys or just values from maps. Thank you Nate!
17
+
- Fixed split() to handle splitIndex = 0 and splitIndex = size() thanks to a bug report from [Jonathan Cornaz](https://github.com/jcornaz) (curator of [collekt](https://github.com/jcornaz/collekt))
18
+
- Added Transformable.toImRrbt() and .toMutableRrbt() to make it convenient to transform things into RRB-Trees.
19
+
- Fixed bugs found using FindBugs - thanks to @cprice404. There are still some reported bugs, but
20
+
I think they are rare corner cases that lack clear solutions. This was the low-hanging fruit.
21
+
- Option.NONE is removed to avoid possible circular instantiation. Use None.NONE instead.
22
+
- Moved Indented to new indent package.
23
+
- Moved static methods from the Indented interface to a new IndentedUtils class.
24
+
- STRINGS array constant from Indented interface is now private to the IndentedUtils class.
25
+
- UnmodMap.UnEntry.EntryToUnEntryIter.next() now returns a Tuple2 instead of some other one-off class.
26
+
8
27
### Release 3.5.1: Kotlin compatibility
9
28
- Renamed artifact to Paguro-KF for "Kotlin-Friendly"
10
29
- This was originally 3.1.1, but the master branch ended up using that number, so now this branch is 3.5.x
Copy file name to clipboardexpand all lines: README.md
+78-48
Original file line number
Diff line number
Diff line change
@@ -10,44 +10,42 @@ Photo by [Rushen](https://www.flickr.com/photos/rushen/12171498934/in/photostrea
10
10
# Overview
11
11
Paguro is short for the Latin "Paguroidea" - the name of the Hermit Crab superfamily in Biology.
12
12
These collections grow by adding a new shell, leaving the insides the same, much the way [Hermit Crabs trade up to a new shell when they grow](https://www.youtube.com/watch?v=f1dnocPQXDQ).
13
-
This project used to be called UncleJim.
14
13
15
-
# News
16
-
### RRB Tree Released!
17
-
An [RRB Tree](https://glenkpeterson.github.io/Paguro/apidocs/index.html?org/organicdesign/fp/collections/RrbTree.html) is an immutable List (like Clojure's PersistentVector) that also supports random inserts, deletes, and can be split and joined back together in logarithmic time.
18
-
There's been one for Scala for a while (Bagwell/Rompf who wrote the paper were Scala people), and a native Clojure one, but neither is super helpful for Java programmers.
19
-
This is an entirely new Apache 2.0 Java implementation.
14
+
[](https://gitter.im/GlenKPeterson/Paguro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Available from the [Maven Repository](http://mvnrepository.com/artifact/org.organicdesign/Paguro) as:
19
+
```xml
20
+
<!--
21
+
If you're using Kotlin and Java, you want the 3.5 version in the KotlinFootWetting branch.
22
+
Java-only users want 3.x from the main branch.
23
+
-->
24
+
<dependency>
25
+
<groupId>org.organicdesign</groupId>
26
+
<artifactId>Paguro</artifactId>
27
+
<version>3.5.2</version>
28
+
</dependency>
33
29
```
34
30
35
-
### How to update
36
-
An upgrade script is in the [Change Log](CHANGE_LOG.md#30-upgrade) along with a description of the 3.0 changes (there were may!).
31
+
The Maven artifact is the easiest way to use Paguro, but you can [build from source](#build-from-source) if you want to.
32
+
33
+
# News
34
+
### RRB Tree Released!
37
35
38
-
### Other new features
39
-
[Union types](https://glenkpeterson.github.io/Paguro/apidocs/index.html?org/organicdesign/fp/oneOf/package-summary.html) for Java! Well, an approximation of them anyway.
36
+
An [RRB Tree](https://glenkpeterson.github.io/Paguro/apidocs/index.html?org/organicdesign/fp/collections/RrbTree.html) is an immutable List (like Clojure's PersistentVector) that also supports random inserts, deletes, and can be split and joined back together in logarithmic time. Details: https://github.com/GlenKPeterson/Paguro/releases/tag/3.0.16
40
37
41
38
### Next Major Release will be Paguro 4.0, "Kotlin Compatibility"
42
39
43
-
Some things will have to be renamed in order to fit better with the Kotlin standard library.
44
-
Notably MutableList, MutableMap, and MutableSet conflict with the same-named classes in Kotlin.
40
+
This announcement is making some people nervous even as it makes others happy. The primary curator (Glen) will still continue using Paguro in both Java and Kotlin for at least a year, maybe forever. Kotlin is nearly 100% backward-compatible with Java 8. I've met several people who know Paguro but not Kotlin, but I have yet to meet the person who knows both and likes Paguro but not Kotlin.
45
41
46
-
The primary programmer on this project is now writing more Kotlin than Java.
47
-
If you like Paguro, you'll probably prefer Kotlin too.
48
-
Kotlin seems nearly 100% compatible with Java, meaning when you call Kotlin from Java, you could think you're calling native Java.
49
-
So even if this becomes an all Kotlin project, Java programmers should have no trouble using it.
50
-
If Java-only programmers object for some reason, we can make a Java-only branch.
42
+
You are probably interested in Paguro because you like Immutability, Functional Programming (maybe as pure as Haskell, maybe not), and Types. Kotlin is a briefer Java that assumes immutability, makes Functional Programming easier, and plugs 3/4 of the quirks in Java's generic type system. If you're concerned about the future of Paguro, I think the best way to put your worries to rest is to try Kotlin. It's pretty great!
43
+
44
+
If a rewrite in Kotlin sounds good to you, consider voting for [this issue](https://youtrack.jetbrains.com/issue/KT-4779) because without it, I'll have to maintain separate Java and Kotlin code.
45
+
46
+
Check back for more details as the 4.x release progresses.
47
+
48
+
Check the [Change Log](CHANGE_LOG.md) for details of recent changes.
51
49
52
50
# Features
53
51
@@ -60,31 +58,14 @@ If Java-only programmers object for some reason, we can make a Java-only branch.
60
58
*`map(tup(1, "single"), tup(2, "double"), tup(3, "triple"))` - an immutable map that uses integers to look up appropriate strings.
61
59
***Extensible, immutable tuples**[api](https://glenkpeterson.github.io/Paguro/apidocs/index.html?org/organicdesign/fp/tuple/package-summary.html)/[src](src/main/java/org/organicdesign/fp/tuple) - use them for rapid prototyping, then later extend them to make your own lightweight, immutable Java classes with correct `equals()`, `hashCode()`, and `toString()` implementations.
62
60
***Lazy initialization**[api](https://glenkpeterson.github.io/Paguro/apidocs/index.html?org/organicdesign/fp/function/LazyRef.html)/[src](src/main/java/org/organicdesign/fp/function/LazyRef.java) - LazyRef thread-safely performs initialization and frees initialization resources on first use. Subsequent uses get the now-constant initialized value. Use this instead of static initializers to avoid initialization loops. Cache results of expensive operations for reuse.
61
+
***Union types**[api](https://glenkpeterson.github.io/Paguro/apidocs/index.html?org/organicdesign/fp/oneOf/package-summary.html)/[src](src/main/java/org/organicdesign/fp/oneOf) - Not as nice as being built into the language, but they extend type safety outside the object hierarchy.
63
62
***Memoization**[api](https://glenkpeterson.github.io/Paguro/apidocs/org/organicdesign/fp/function/Fn3.html#memoize-org.organicdesign.fp.function.Fn3-)/[src](src/main/java/org/organicdesign/fp/function/Fn3.java#L42) - Turns function calls into hashtable lookups to speed up slow functions over a limited range of inputs.
64
63
***Tiny** with no dependencies - The entire project fits in a 270K jar file that is compiled in the compact1 profile.
Paguro takes advantage of Java's type inferencing. It eschews void return types, arrays, primatives, and checked exceptions in lambdas. It can decrease the amount of code you need to write by a factor of at 2x-3x. Using functional transfomrations instead of loops focuses you on choosing the right collections which leads to more readable code AND better Big O complexity/scalability.
[](https://gitter.im/GlenKPeterson/Paguro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
74
-
75
-
Available from the [Maven Repository](http://mvnrepository.com/artifact/org.organicdesign/Paguro) as:
76
-
```xml
77
-
<!--
78
-
If you're new to Paguro, consider starting with the streamlined
79
-
3.0 Alpha version instead (on the 2016-05-22_RRB-Tree branch)
80
-
-->
81
-
<dependency>
82
-
<groupId>org.organicdesign</groupId>
83
-
<artifactId>Paguro-KF</artifactId>
84
-
<version>3.5.1</version>
85
-
</dependency>
86
-
```
87
-
88
69
# Details
89
70
90
71
```java
@@ -152,7 +133,7 @@ It started with a Software Engineering Stack Exchange question: [Why doesn't Jav
152
133
153
134
### Q: Why Java instead of another/better JVM language?
That said, this could become a Kotlin-based project.
157
138
158
139
# Future Development Ideas (as of 2017-09-10)
@@ -180,5 +161,54 @@ Unless otherwise stated, the rest of this work is licensed under the Apache 2.0
180
161
New contributions should be made under the Apache 2.0 license whenever practical.
181
162
I believe it is more popular, clearer, and has been better tested in courts of law.
182
163
164
+
# Build from Source
165
+
166
+
The [pre-built maven artifact](#maven-artifact) is the easiest way to use Paguro.
167
+
Mose users do not need to build Paguro from source.
168
+
169
+
#### Prerequisites
170
+
Paguro should build on Ubuntu 16.04 and later with `openjdk-8-jdk`, `git`, and `maven` installed from the official repositories. A compiler bug in javac 1.8.0_31 prevents building Paguro, but OpenJDK 1.8.0.91 and later (or Oracle) should work on Windows or Mac.
171
+
172
+
##### Environment Variables
173
+
Depending on how you installed Java and Maven, you may need to set some of the following in your `~/.profile` file and reboot (or source that file like `. ~/.profile` from the command line you will use for the build). Or do whatever Windows does. If your tools are installed in different directories, you will have to fix the following:
174
+
```bash
175
+
export JDK_HOME=/usr/lib/jvm/java-8-openjdk-amd64
176
+
export JAVA_HOME=$JDK_HOME/jre
177
+
export M2_HOME=$TOOLS/apache-maven-3.3.9/
178
+
export M2="$M2_HOME"bin
179
+
export PATH=$PATH:$M2
180
+
```
181
+
182
+
##### Build
183
+
```bash
184
+
# Start in an appropriate directory
185
+
186
+
# You need TestUtils for Paguro's equality testing.
187
+
# The first time you build, get a local copy of that and Paguro
0 commit comments