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
-module(languages). | |
-export([getLanguageDescription/2]). | |
getLanguageDescription(Languages, Language) -> | |
[FirstResult|_] = [{Description} || {LanguageName, Description} <- Languages, LanguageName == Language ], | |
FirstResult. | |
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
-module(counter). | |
-export([count_to_ten/0]). | |
count_to_ten() -> count_to_ten(1). | |
count_to_ten(10) -> io:fwrite("10" ,[]); | |
count_to_ten(N) -> io:fwrite("~w~n", [N]), count_to_ten(N+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
import collection.mutable.HashSet | |
import dbc.result.Tuple | |
import scala.io._ | |
import scala.actors._ | |
import Actor._ | |
import scala.util.matching.Regex | |
val linkPattern = new Regex("""<a +href=\"([^\"]+)\"[^>]*>""", "link") | |
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
trait Censor { | |
val censoredWords = Map("shoot" -> "pucky", "darn" -> "beans") | |
def censor(text : String) : String = { | |
censoredWords.foldLeft(text)((sum, value) => sum.replaceAll(value._1, value._2)) | |
} | |
} |
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
package info.denoo.slisw.tictactoe | |
/** | |
* A representation of the gameboard. | |
*/ | |
class Board() { | |
val cells = Array.fill(3, 3) { | |
new TicTacToeCell() | |
} |
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
% The valid methods valdiates that every elements (that should be a list) contains only different numbers. | |
% this is copied from the book. | |
valid([]). | |
valid([Head|Tail]) :- | |
fd_all_different(Head), | |
valid(Tail). | |
% Splits a list in to mutliple lists of length N. | |
split_head_tail(_,[],[],[]). |
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
my_sort(List, Result) :- | |
my_sort(List, [], Result). | |
my_sort([], SortedList,SortedList). | |
my_sort([Head|Tail], SortedList, Result) :- | |
insert(Head, SortedList, SubResult), | |
my_sort(Tail, SubResult, Result). | |
insert(ElementToInsert, [], [ElementToInsert]). |
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
| ?- book(What, 'Robert C. Martin'). | |
What = 'Clean code' ? a | |
What = 'The clean coder' | |
no |
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
# The line below sets some DEFAULT, starting with Netatalk 2.1. | |
:DEFAULT: options:upriv,usedots | |
/media/data "Data" cnidscheme:dbd options:usedots,upriv |
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
squareBrackets := method( | |
r := List clone; | |
call message arguments foreach(arg, | |
r append(arg) | |
) | |
) | |
languages := [ | |
"Io", |