profile
viewpoint

gliptak/arch 1

ARCH models in Python

gliptak/api 0

Hygieia api layer (pre Spring 5)

gliptak/Applied-Crypto-Hardening 0

Best Current Practices regarding secure online communication and configuration of services using cryptography.

gliptak/aws-config-rdk 0

The AWS Config Rules Development Kit helps developers set up, author and test custom Config rules. It contains scripts to enable AWS Config, create a Config rule and test it with sample ConfigurationItems.

gliptak/aws-config-rdklib 0

Python library to enable you to run custom AWS Config Rules at scale, using Lambda Layer.

gliptak/aws-controllers-k8s 0

AWS Controllers for Kubernetes (ACK) is a project enabling you to manage AWS services from Kubernetes

gliptak/aws-ebs-csi-driver 0

CSI driver for Amazon EBS https://aws.amazon.com/ebs/

gliptak/aws-xray-sdk-go 0

AWS X-Ray SDK for the Go programming language.

gliptak/awsls 0

A list command for AWS resources

issue commentfunctionaljava/functionaljava

Performance: Append operation of List and Array

I think both are useful. Feel free to write Deque as a pair of lists.

morris821028

comment created time in a month

issue commentfunctionaljava/functionaljava

Performance: Append operation of List and Array

@tonymorris Thanks your information. I forgot to study DList in this project.

In java.util, LinkedList implements Deque interface. If we consider real-time deque as DList implementation corresponding to paper REAL-TIME DEQUES, MULTIHEAD TURING MACHINES and PURELY FUNCTIONAL PROGRAMMING, Tyng-Runey Chuang and Benjamin Goldberg, 1993.

  • cons and snoc: O(1)
  • head and tail: O(1)
  • append(List): O(m), which m is the number of appended elements.

I'm interested in the real cases prefer which kind of operation?

morris821028

comment created time in a month

issue commentfunctionaljava/functionaljava

Performance: Append operation of List and Array

A double-linked list has O(1) snoc but does not give better performance. It gives a trade-off. You can obtain O(1) cons and snoc with:

// see fj.data.DList
public class DList<A> {
    private final F<List<A>,List<A>> appendFn;
}

Note that head and tail are O(n). A finger-tree gives different trades again.

morris821028

comment created time in a month

issue commentfunctionaljava/functionaljava

Performance: Append operation of List and Array

@tonymorris Could it be O(log n) for a doubly-linked list? The common interface of List is often implemented by doubly-linked list for better performance.

morris821028

comment created time in a month

issue commentfunctionaljava/functionaljava

Performance: Append operation of List and Array

snoc is O(n) for a single-linked list.

morris821028

comment created time in a month

issue openedfunctionaljava/functionaljava

Performance: Append operation of List and Array

Hi,

When I use immutable collection with Java Stream, performance degradation happened. I found the basic List and Array always copy the whole content in O(n) time, which n is current number of elements. Is it normal for functional programming design?

package persistent.array.fully;

import java.util.Iterator;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import fj.Function;
import fj.Monoid;
import fj.data.Array;
import fj.data.List;
import fj.data.fingertrees.FingerTree;
import fj.data.fingertrees.MakeTree;

public class FunctionalJavaListTest {
	@Test
	public void testListPushBackGet() {
		List<Integer> a = List.list();
		for (int i = 0; i < 32; i++) {
			a = a.append(List.list(i)); // snoc
			for (int j = 0; j <= i; j++) {
				Assertions.assertEquals(j, a.index(j));
			}
		}
		a = List.list();
		for (int i = 0; i < 1000000; i++)
			a = a.append(List.list(i)); // snoc

		int i = 0;
		for (Integer e : a) {
			Assertions.assertEquals(i, e);
			i++;
		}
	}

	@Test
	public void testArrayPushBackGet() {
		Array<Integer> a = Array.empty();
		for (int i = 0; i < 32; i++) {
			a = a.append(Array.array(i));
			for (int j = 0; j <= i; j++) {
				Assertions.assertEquals(j, a.get(j));
			}
		}
		a = Array.empty();
		for (int i = 0; i < 1000000; i++)
			a = a.append(Array.array(i));

		int i = 0;
		for (Integer e : a) {
			Assertions.assertEquals(i, e);
			i++;
		}
	}
}

Because I read the paper and implement partial API for Java Collection, and it could take almost O(1) or O(log n) time for single element append. (See implementation https://github.com/morris821028/immortal-jellyfish)

I found we could use finger tree instead of these and take better performance. Therefore, why not wrap finger tree as List/Array?

	@Test
	public void testFingerPushBackGet() {
		FingerTree<Integer, Integer> a = FingerTree.emptyIntAddition();
		for (int i = 0; i < 32; i++) {
			FingerTree<Integer, Integer> ft = FingerTree.emptyIntAddition();
			List.range(1, 1).foldLeft(ft2 -> t -> ft2.snoc(t), ft);
			a = a.append(ft);
			
			int j = 0;
			for (Integer e : iteratorToIterable(a.toStream().iterator())) {
				Assertions.assertEquals(j, e);
				j++;
			}
		}

		a = FingerTree.emptyIntAddition();
		for (int i = 0; i < 1000000; i++) {
			FingerTree<Integer, Integer> ft = FingerTree.emptyIntAddition();
			List.range(i, 1).foldLeft(ft2 -> t -> ft2.snoc(t), ft);
			a = a.append(ft);

		}

		int j = 0;
		for (Integer e : iteratorToIterable(a.toStream().iterator())) {
			Assertions.assertEquals(j, e);
			j++;
		}
	}

created time in a month

push eventgliptak/gliptak.github.io

gliptak

commit sha 93e8ef5ae9ac978a9bc332ed2e08aeaae8d28d79

deploy: 36867f2af8b4619dd513726910b808e2047862cd

view details

push time in a month

push eventgliptak/gliptak.github.io

gliptak

commit sha ba25ae9d6921daa10c65d0a4b0b4b79009dc3a84

deploy: e0c99a9e893b4dea5fb66567242bcb36dd4a60ea

view details

push time in a month

push eventgliptak/gliptak.github.io

gliptak

commit sha 50c642578c9ddfece1ab01711cb09e15e12cc772

deploy: 3c42ddae577fc8f33a29e3544acd1a26beb5c84a

view details

push time in a month

push eventgliptak/gliptak.github.io

gliptak

commit sha fcfd3fa739890ccc8872b1ab145c9ad6828d00e0

deploy: 9863b23cfa7f2928b9713705f881fb96d2fb6612

view details

push time in a month

push eventgliptak/gliptak.github.io

gliptak

commit sha d52c6177e2f19c3421eec58bf9e2795fb57b0593

deploy: 196e9ca388b6a790cceeb1e7b92c04f96a76b049

view details

push time in a month

push eventfunctionaljava/functionaljava

Drew Taylor

commit sha c427a086d6a06a14074719d2f3c9a011ce7ad14d

Fixes #424. Add fj.data.Stream.sequence*, fj.data.Stream.traverse* functions.

view details

Tony Morris

commit sha c07a58bf2cd35df01f8f4e0045591f44dc631bd9

Merge pull request #425 from drewctaylor/functionaljava-424 Fixes #424. Add fj.data.Stream.sequence*, fj.data.Stream.traverse* functions.

view details

push time in a month

PR opened functionaljava/functionaljava

Fixes #426. Add fj.data.NonEmptyList.sequence*, traverse*, foldLeftN, foldRightN, init, last.

Fixes #426. Add fj.data.NonEmptyList.sequence*, traverse*, foldLeftN, foldRightN, init, last.

+810 -57

0 comment

2 changed files

pr created time in a month

issue openedfunctionaljava/functionaljava

Add fj.data.NonEmptyList.sequence*, traverse*, foldLeftN, foldRightN, init, last.

Add sequence.*

Either<L, NonEmptyList<B>> sequenceEither(NonEmptyList<Either<L, B>>)
Either<NonEmptyList<B>, R> sequenceEitherLeft(NonEmptyList<Either<B, R>>)
Either<L, NonEmptyList<B>> sequenceEitherRight(NonEmptyList<Either<L, B>>)
F<C, NonEmptyList<B>> sequenceF(NonEmptyList<F<C, B>>)
IO<NonEmptyList<B>> sequenceIO(NonEmptyList<IO<B>>)
List<NonEmptyList<B>> sequenceList(NonEmptyList<List<B>>)
NonEmptyList<NonEmptyList<B>> sequenceNonEmptyList(NonEmptyList<NonEmptyList<B>>)
Option<NonEmptyList<B>> sequenceOption(NonEmptyList<Option<B>>)
P1<NonEmptyList<B>> sequenceP1(NonEmptyList<P1<B>>)
Seq<NonEmptyList<B>> sequenceSeq(NonEmptyList<Seq<B>>)
Set<NonEmptyList<B>> sequenceSet(Ord<B>,
Stream<NonEmptyList<B>> sequenceStream(NonEmptyList<Stream<B>>)
Trampoline<NonEmptyList<B>> sequenceTrampoline(NonEmptyList<Trampoline<B>>)
Validation<E, NonEmptyList<B>> sequenceValidation(NonEmptyList<Validation<E, B>>)
Validation<E, NonEmptyList<B>> sequenceValidation(Semigroup<E>, NonEmptyList<Validation<E, B>>)

Add traverse.*

Either<L, NonEmptyList<B>> traverseEither(F<A, Either<L, B>>)
Either<NonEmptyList<B>, R> traverseEitherLeft(F<A, Either<B, R>>)
Either<L, NonEmptyList<B>> traverseEitherRight(F<A, Either<L, B>>)
F<C, NonEmptyList<B>> traverseF(F<A, F<C, B>>)
IO<NonEmptyList<B>> traverseIO(F<A, IO<B>>)
List<NonEmptyList<B>> traverseList(F<A, List<B>>)
Option<NonEmptyList<B>> traverseOption(F<A, Option<B>>)
P1<NonEmptyList<B>> traverseP1(F<A, P1<B>>)
Seq<NonEmptyList<B>> traverseSeq(F<A, Seq<B>>)
Set<NonEmptyList<B>> traverseSet(Ord<B> ord,F<A, Set<B>>)
Stream<NonEmptyList<B>> traverseStream(F<A, Stream<B>>)
Trampoline<NonEmptyList<B>> traverseTrampoline(F<A, Trampoline<B>>)
Validation<E, NonEmptyList<B>> traverseValidation(F<A, Validation<E, B>>)
Validation<E, NonEmptyList<B>> traverseValidation(Semigroup<E> semigroup,F<A, Validation<E, B>>)

Add foldRightN, foldLeftN

B foldRightN(F2<A, B, B>, F<A, B>)
B foldRightN(F<A, F<B, B>>, F<A, B>)
B foldLeftN(F2<B, A, B>, F<A, B>)
B foldLeftN(F<B, F<A, B>>, F<A, B>)

created time in a month

issue openedfunctionaljava/functionaljava

Add fj.data.Stream.sequence*, fj.data.Stream.traverse* functions.

Add fj.data.Stream.sequence*:

Either<L, Stream<B>> sequenceEither(Stream<Either<L, B>>)
Either<Stream<B>, R> sequenceEitherLeft(Stream<Either<B, R>>)
Either<L, Stream<B>> sequenceEitherRight(Stream<Either<L, B>>)
F<C, Stream<B>> sequenceF(Stream<F<C, B>>)
IO<Stream<B>> sequenceIO(Stream<IO<B>>)
List<Stream<B>> sequenceList(Stream<List<B>>)
Option<Stream<B>> sequenceOption(Stream<Option<B>>)
P1<Stream<B>> sequenceP1(Stream<P1<B>>)
Seq<Stream<B>> seequenceSeq(Stream<Seq<B>>)
Set<Stream<B>> sequenceSet(Ord<B>, Stream<Set<B>> seq)
Stream<Stream<B>> sequenceStream(Stream<Stream<B>>)
Trampoline<Stream<B>> sequenceTrampoline(Stream<Trampoline<B>>)
Validation<E, Stream<B>> sequenceValidation(Stream<Validation<E, B>>)
Validation<E, Stream<B>> sequenceValidation(Semigroup<E>, Stream<Validation<E, B>>)

Add fj.data.Stream.traverse*

Either<L, Stream<B>> traverseEither(final F<A, Either<L, B>>)
Either<Stream<B>, R> traverseEitherLeft(final F<A, Either<B, R>>)
Either<L, Stream<B>> traverseEitherRight(final F<A, Either<L, B>>)
F<C, Stream<B>> traverseF(F<A, F<C, B>>)
List<Stream<B>> traverseList(F<A, List<B>>)
P1<Stream<B>> traverseP1(F<A, P1<B>>)
Seq<Stream<B>> traverseSeq(F<A, Seq<B>>)
Set<Stream<B>> traverseSet(Ord<B> ord, F<A, Set<B>>)
Stream<Stream<B>> traverseStream(F<A, Stream<B>>)
Trampoline<Stream<B>> traverseTrampoline(F<A, Trampoline<B>>)
Validation<E, Stream<B>> traverseValidation(F<A, Validation<E, B>>)
Validation<E, Stream<B>> traverseValidation(Semigroup<E>, F<A, Validation<E, B>>)

created time in a month

PR opened functionaljava/functionaljava

Create PollimophismExample

This is the java code for an example of pollimophism in object oriented programming

+32 -0

0 comment

1 changed file

pr created time in a month

PR opened functionaljava/functionaljava

Create GCD of two numbers

Created new file on GCD of two numbers.

+28 -0

0 comment

1 changed file

pr created time in 2 months

pull request commentfunctionaljava/functionaljava

Fixes #416. Release 4.8.2.

I've removed changes that I unintentionally included in this commit; it now includes exclusively the changelog, readme, and build.gradle changes for a 4.8.2 release.

drewctaylor

comment created time in 2 months

push eventgliptak/gliptak.github.io

gliptak

commit sha 5277166d6c1f204e43f14679cdf9a5204a5a6bf8

deploy: 0515d0e87d501beabd870ff69b7fbf7fa19cfa3b

view details

push time in 2 months

pull request commentfunctionaljava/functionaljava

Create binaryToDecimal

Codecov Report

Merging #421 into series/5.x will decrease coverage by 0.05%. The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff                @@
##             series/5.x     #421      +/-   ##
================================================
- Coverage         49.89%   49.84%   -0.06%     
+ Complexity         2341     2337       -4     
================================================
  Files               154      154              
  Lines              9115     9115              
  Branches            490      490              
================================================
- Hits               4548     4543       -5     
- Misses             4421     4424       +3     
- Partials            146      148       +2     
Impacted Files Coverage Δ Complexity Δ
core/src/main/java/fj/Ord.java 44.29% <0.00%> (-3.36%) 34.00% <0.00%> (-4.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2d2efee...7bb4a0c. Read the comment docs.

shivamnishad246

comment created time in 2 months

PR opened functionaljava/functionaljava

Create binaryToDecimal

This is the code for covert binary to decimal.

+21 -0

0 comment

1 changed file

pr created time in 2 months

push eventgliptak/gliptak.github.io

gliptak

commit sha 083a15ac11da15ff2dfa23c95b931216c307474d

deploy: 34a1391dc94c33822c1ee92ebd8a1ac4b16aafb5

view details

push time in 2 months

pull request commentfunctionaljava/functionaljava

Improve Docs

Codecov Report

Merging #420 into series/5.x will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff              @@
##             series/5.x     #420   +/-   ##
=============================================
  Coverage         49.89%   49.89%           
  Complexity         2341     2341           
=============================================
  Files               154      154           
  Lines              9115     9115           
  Branches            490      490           
=============================================
  Hits               4548     4548           
  Misses             4421     4421           
  Partials            146      146           
Impacted Files Coverage Δ Complexity Δ
java-core/src/main/java/fj/java/util/ListUtil.java 0.00% <ø> (ø) 0.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2d2efee...fd9331d. Read the comment docs.

Suresh165

comment created time in 2 months

PR opened functionaljava/functionaljava

Improve Docs

//Sir, these import fj.F; import fj.F2; //are not working intellij

+2 -1

0 comment

1 changed file

pr created time in 2 months

pull request commentfunctionaljava/functionaljava

Fixes #416. Release 4.8.2.

Codecov Report

Merging #419 into series/4.x will decrease coverage by 0.04%. The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff                @@
##             series/4.x     #419      +/-   ##
================================================
- Coverage         52.43%   52.39%   -0.05%     
+ Complexity         2565     2562       -3     
================================================
  Files               153      153              
  Lines              9244     9244              
  Branches            482      482              
================================================
- Hits               4847     4843       -4     
- Misses             4244     4246       +2     
- Partials            153      155       +2     
Impacted Files Coverage Δ Complexity Δ
core/src/main/java/fj/data/fingertrees/Deep.java 66.00% <0.00%> (-0.80%) 109.00% <0.00%> (-1.00%)
core/src/main/java/fj/data/List.java 69.33% <0.00%> (-0.44%) 168.00% <0.00%> (-2.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f0bbae5...b646185. Read the comment docs.

drewctaylor

comment created time in 2 months

PR opened functionaljava/functionaljava

Fixes #416. Release 4.8.2.

Updates the build.gradle, ChangeLog.md, and README.adoc.

+31 -11

0 comment

3 changed files

pr created time in 2 months

issue commentfunctionaljava/functionaljava

Will there be a release 4.8.2 / 4.9?

Press it. I believe in you.

drewctaylor

comment created time in 2 months

more