This file contains hidden or 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
| (ns clj-sudoku.core | |
| (:gen-class)) | |
| ;;; Records | |
| (defrecord Square [pos x y num hints sure unit]) | |
| ;;; Grids | |
| (def easy-grid ".931.564.7.......55.12.93.72.......3.369.752.9.......13.24.81.96.......4.473.285.") |
This file contains hidden or 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
| (ns clj-maze.core | |
| (:use [clojure.test]) | |
| (:gen-class)) | |
| (def north 2r0001) | |
| (def east 2r0010) | |
| (def south 2r0100) | |
| (def west 2r1000) | |
| (defn dir-open? [square dir] |
This file contains hidden or 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
| ; http://groups.google.com/group/clojure/browse_thread/thread/974e2c7f89e27231/5f4bff3e58dfa36f | |
| ; output images http://i.imgur.com/gSASS.png (square maze) | |
| ; http://i.imgur.com/uEqaq.png (hex maze) | |
| ;; generic Wilson's algorithm implementation | |
| (defn maze | |
| "Returns a random maze carved out of walls; walls is a set of | |
| 2-item sets #{a b} where a and b are locations. | |
| The returned maze is a set of the remaining walls." | |
| [walls] |
This file contains hidden or 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
| (ns clj-maze.core | |
| (:use [clojure.test] | |
| [clojure.java.io :only (as-file)]) | |
| (:gen-class)) | |
| ;;; Records | |
| (defrecord Cell [corridors visited]) | |
| ;;; Methods |
This file contains hidden or 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
| (use tcp6 regex) | |
| (define server "irc.freenode.net") | |
| (define port 6667) | |
| (define nick "SchemeBot") | |
| (define chan "#web") | |
| (define nick "scm-bot") | |
| (define chan "#clojure") |
This file contains hidden or 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
| ; Scrivere un programma che chiede all’utente un numero intero n positivo e poi visualizza tutte le combinazioni ; di lunghezza n costituite da sequenze di simboli ’+’ e ’-’. L’ordine delle combinazioni `e a piacere. | |
| ; Esempio : input 3 | |
| ; output: +++ ++- +-- +-+ -++ --+ --- -+- | |
| (define (permutation data) | |
| (define (neg el) | |
| (cond | |
| ((string=? el "+") "-") | |
| ((string=? el "-") "+"))) |
This file contains hidden or 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 Data.List | |
| main = do | |
| let ra = [3, 7, 4, 9, 5, 2, 6, 1] | |
| let sa = selectionSort ra | |
| print sa | |
| -- Insertion sort | |
| insert' :: (Ord a) => a -> [a] -> [a] |
This file contains hidden or 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
| public class Player { | |
| public int points; | |
| public int ping; | |
| public String nickname; | |
| public Player(String ping, String points, String nickname) { | |
| this.ping = Integer.parseInt(ping); | |
| this.points = Integer.parseInt(points); | |
| this.nickname = nickname.substring(1, nickname.length()-1); |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <string.h> | |
| #include <stdlib.h> | |
| #define N 15 | |
| typedef struct { | |
| int hours; | |
| int minutes; | |
| } Time; |
This file contains hidden or 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
| (ns clj-vodafone-sms.core | |
| (:require [clj-http.client :as client]) | |
| (:gen-class)) | |
| (def home-url "http://www.vodafone.it/190/trilogy/jsp/home.do") | |
| (def dispatcher-url "http://www.vodafone.it/190/trilogy/jsp/dispatcher.do?ty_key=fdt_invia_sms&tk=9616") | |
| (def dispatcher-url2 "http://www.areaprivati.vodafone.it/190/trilogy/jsp/dispatcher.do?ty_key=fsms_hp&ipage=next") | |
| (def prepare-url "http://www.areaprivati.vodafone.it/190/fsms/prepare.do") | |
| (def captcha-url "http://www.areaprivati.vodafone.it/190/fsms/generateimg.do") | |
| (def send-url "http://www.areaprivati.vodafone.it/190/fsms/send.do") |