Skip to content

Instantly share code, notes, and snippets.

Advanced Functional Programming with Scala - Notes

Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@Samehadar
Samehadar / Tree.scala
Created February 2, 2018 14:34 — forked from dholbrook/Tree.scala
Scala binary tree
/**
* D Holbrook
*
* Code Club: PO1
*
* (*) Define a binary tree data structure and related fundamental operations.
*
* Use whichever language features are the best fit (this will depend on the language you have selected). The following operations should be supported:
*
* Constructors
@Samehadar
Samehadar / advices.txt
Created April 27, 2018 14:28 — forked from rponte/advices.txt
some ways to show sql generated by hibernate
Setting the hibernate.show_sql to true tells hibernate to Write all SQL statements to console. This is an alternative to setting the log category org.hibernate.SQL to debug.
So even if you set this property to false, make sure that you don't have the following category defined (or configured to use a console appender):
log4j.logger.org.hibernate.SQL=DEBUG
Also, make sure that you don't set the hibernate.show_sql programmatically to true when instancing your Configuration object. Hunt something like this:
Configuration cfg = new Configuration().configure().
.setProperty("hibernate.show_sql", "true");
Note that the setProperty(String propertyName, String value) takes as first parameter the full name of a configuration property i.e. hibernate.show_sql, not just show_sql.
@Samehadar
Samehadar / sbt_with_private_artifactory.md
Created October 24, 2018 16:22 — forked from FlakM/sbt_with_private_artifactory.md
sbt with private artifactory

Setting up sbt with private repo

The solve was suggested here: sbt/sbt#2817

Steps for read access

  1. in ~/.sbt/repositories put:
package xxx;
import java.util.AbstractQueue;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Condition;
package xxx;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.*;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Consumer;