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
gera_nac(casa(_, N, _, _, _), [N], []) :- !. | |
gera_nac(casa(_, N, _, _, _), Nacs, Resto) :- select(N, Nacs, Resto). | |
gera_beb(casa(_, _, B, _, _), [B], []) :- !. | |
gera_beb(casa(_, _, B, _, _), Bebs, Resto) :- select(B, Bebs, Resto). | |
gera_cig(casa(_, _, _, C, _), [C], []) :- !. | |
gera_cig(casa(_, _, _, C, _), Cigs, Resto) :- select(C, Cigs, Resto). | |
gera_ani(casa(_, _, _, _, A), [A], []) :- !. |
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
gera_casa(C, atr(Cs, Ns, Bs, Cigs, As), atr(Cs2, Ns2, Bs2, Cigs2, As2)) :- | |
gera_cor(C, Cs, Cs2), gera_nac(C, Ns, Ns2), | |
gera_beb(C, Bs, Bs2), gera_cig(C, Cigs, Cigs2), gera_ani(C, As, As2). | |
gera_casas([], _) :- !. | |
gera_casas([C|Cs], Atribs) :- | |
gera_casa(C, Atribs, Atribs2), gera_casas(Cs, Atribs2). | |
gera_sol([C1, C2, C3, C4, C5]) :- | |
Cores = [amarela,azul,branca,verde,vermelha], |
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
vizinho_esq(C1, C2, [C1,C2|_]). | |
vizinho_esq(C1, C2, [C3|T]) :- vizinho_esq(C1, C2, T). | |
vizinho_dir(C1, C2, [C2,C1|_]). | |
vizinho_dir(C1, C2, [C3|T]) :- vizinho_dir(C1, C2, T). | |
vizinho(C1, C2, S) :- vizinho_esq(C1, C2, S). | |
vizinho(C1, C2, S) :- vizinho_dir(C1, C2, S). |
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
solucao(S):- | |
C1=casa(_,noruegues,_,_,_), | |
C3=casa(_,_,leite,_,_), | |
S=[C1,C2,C3,C4,C5], !, | |
vizinho_esq(casa(verde,_,_,_,_),casa(branca,_,_,_,_), S), | |
vizinho(casa(_,noruegues,_,_,_), casa(azul,_,_,_,_), S), | |
vizinho(casa(_,_,_,blends,_),casa(_,_,_,_,gato), S), | |
vizinho(casa(_,_,_,_,cavalo),casa(_,_,_,dunhill,_), S), | |
vizinho(casa(_,_,_,blends,_),casa(_,_,agua,_,_), S), | |
member(casa(vermelha,ingles,_,_,_), S), |
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
gera_cor(casa(C, _, _, _, _), [C], []) :- !. | |
gera_cor(casa(C, _, _, _, _), Cores, Resto) :- select(C, Cores, Resto). | |
gera_nac(casa(_, N, _, _, _), [N], []) :- !. | |
gera_nac(casa(_, N, _, _, _), Nacs, Resto) :- select(N, Nacs, Resto). | |
gera_beb(casa(_, _, B, _, _), [B], []) :- !. | |
gera_beb(casa(_, _, B, _, _), Bebs, Resto) :- select(B, Bebs, Resto). |
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
/* | |
read_word_list(Words) | |
Le uma lista de palavras da entrada e coloca o resultado como atomos na | |
lista Words. A string lida da entrada deve terminar com um caractere de | |
ponto final '.'. | |
Baseado em exemplo do livro "The Art of Prolog" de Leon Sterling e Ehud Shapiro. | |
*/ | |
read_word_list(Words) :- get_char(FirstChar), read_words(FirstChar, Words). |
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
# Em resposta a | |
# http://blog.concretesolutions.com.br/2011/12/testinho-numero-2/ | |
### Dados (na ordem: Marguerita, 4 queijos, escarola, portuguesa, frango+catupiry, napolitana) | |
renato <- list(nome='renato', notas=c(4, 5, 4, 5, 4, 3)) | |
marcelo <- list(nome='marcelo', notas=c(2, 2, 1, 3, 5, 2)) | |
lenon <- list(nome='lenon', notas=c(4, 5, 2, 1, 1, 3)) | |
renata <- list(nome='renata', notas=c(4, 5, 1, 1, 3, 4)) | |
washington <- list(nome='washington', notas=c(1, 1, 2, 3, 4, 3)) | |
tino <- list(nome='tino', notas=c(1, 5, 1, 4, 3, 2)) |
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
/* | |
* drivertest.cpp | |
* Vector addition (host code) | |
* | |
* Andrei de A. Formiga, 2012-06-04 | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> |
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
diff --git a/src/builtin_proto.h b/src/builtin_proto.h | |
index 96040ec..54e8d3b 100644 | |
--- a/src/builtin_proto.h | |
+++ b/src/builtin_proto.h | |
@@ -12,6 +12,7 @@ JL_CALLABLE(jl_f_typeof); | |
JL_CALLABLE(jl_f_subtype); | |
JL_CALLABLE(jl_f_isa); | |
JL_CALLABLE(jl_f_typeassert); | |
+JL_CALLABLE(jl_f_llvm_dump); | |
JL_CALLABLE(jl_f_apply); |
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
function find_bin(x::Float64, limits::Vector{Float64}) | |
bin = length(limits) + 1 | |
for i in 1:length(limits) | |
if x < limits[i] | |
bin = i | |
break | |
end | |
end | |
bin | |
end |