This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Queens { | |
def main(args: Array[String]): Unit = { | |
println(queens(9)) | |
} | |
def queens(n: Int): List[List[Int]] = { | |
def expandSol(currentSol: List[List[Int]], size: Int): List[List[Int]] = { | |
if (size == n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
firewall :: IPClassifier(dst tcp port ssh,-); | |
in :: FromDevice(dev0) -> cl :: Classifier(12/0800,-); | |
cl[0] -> stripper :: Strip(14) -> checker :: CheckIPHeader -> firewall; | |
cl[1] -> discarder :: Discard; | |
firewall[0] -> out :: ToDevice(dev1); | |
firewall[1] -> discarder; | |
-- Elements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
firewall :: IPClassifier(dst tcp port ssh,-); | |
in :: FromDevice(dev0) -> cl :: Classifier(12/0800,-); | |
cl[0] -> counter :: AverageCounter(2) -> stripper :: Strip(14) -> checker :: CheckIPHeader -> firewall; | |
cl[1] -> discarder :: Discard; | |
firewall[0] -> out :: ToDevice(dev1); | |
firewall[1] -> discarder; | |
goes to: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.LinkedList; | |
public class Main { | |
public static void main(String[] args) { | |
MyStack s = new MyStack(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Boxed types and specialization in Scala |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- 1. write an ADT which encodes arithmetic expressions containing +, * or parentheses -} | |
data Expr a = | |
{-- 2. display an expression nicely --} | |
instance Show a => Show (Expr a) where | |
{- 3. write a function which evaluates an expression. Also, write it's type -} | |
{- 4. Write a function which eliminates parentheses from an expression. | |
e * (3) = e * 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; delay construct | |
(define doi (delay (+ 1 1))) | |
; force a delay to compute its result | |
(force doi) | |
; cons for streams | |
(define-syntax conss | |
(syntax-rules () | |
((conss x y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ctors return an object | |
anonymous objects | |
returning by const | |
uses of const: | |
1. immutability of param | |
2. immutability of returned object | |
3. immutability of 'this' | |
return consts from getters ! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% ---------------------------------------- | |
%% ---------------------------------------- | |
%% Atenție la antetele predicatelor și la prefixul parametrilor | |
%% p(+Arg1, -Arg2, ?Arg3) | |
%% * Arg1 va fi instanțiat atunci când se va încerca satisfacerea p/3 | |
%% * Arg2 se va instanția odată cu satisfacerea p/3 | |
%% * Arg3 va putea fi instanțiat sau nu atunci când se va satisface p/3: | |
%% | |
%% Interogați Prolog cu "checkXX." pentru a verifica rezolvarea exercițiului XX. | |
%% Pentru a vedea progresul general, trimiteți scopul "check_all". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Click can be found @ http://www.read.cs.ucla.edu/click/ | |
Click paper @ https://pdos.csail.mit.edu/papers/click:tocs00/paper.pdf | |
====================================================================== | |
sudo apt-get update | |
sudo apt-get install git build-essential | |
git clone https://github.com/kohler/click.git | |
cd clikc |
OlderNewer