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 (program) | |
| (util) | |
| (printing) | |
| (node-constructors) | |
| (_srfi :1)) | |
| ;; A sample output: | |
| '(elem (url "stairs_a_0Shape1") | |
| (tr 0 0 0 0 -11 0 0 -1 0 0 0 0 17 0 0 0 |
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
| % Notes for | |
| % K. Matsuda et al. "A Grammar-based Approach to Invertible Programs" | |
| % The program from the paper: | |
| % h r = add Z r | |
| % add x r = case x of | |
| % Z -> r | |
| % S y -> add y r | |
| % Our query: r such that h r == S Z |
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
| (elem | |
| (url "#stairs_a_0Shape1") | |
| (tr ("0 0 1 17113.65 0 1 0 0 -1 0 0 -10567.28 0 0 0 1") | |
| (elem (url "#connect_double_a_0Shape1") | |
| (tr ("-1 0 0 1323.87 0 1 0 788.0534 0 0 -1 -21667.02 0 0 0 1") | |
| (elem | |
| (url "#stairs_a_0Shape1") | |
| (tr ("-1 0 0 11256.4 0 1 0 -788.0534 0 0 -1 -18749.07 0 0 0 1") | |
| (elem | |
| (url "#tower_a_01") |
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 | |
| (_srfi :1) | |
| (_srfi :69) | |
| (printing) | |
| (util) | |
| (chart-parsing) | |
| (program) | |
| (named-search-trees) | |
| (program-likelihood) | |
| (hash-cons)) |
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_module(library(assoc)). | |
| :- dynamic dag/2. | |
| find_at_least_one(X, Y, Z) :- findall(X, Y, Z), length(Z, N), N > 0. | |
| add_if_not_present(Term, ID) :- (dag(ID, Term)) -> (true) ; (gensym(subtree, ID), assertz(dag(ID, Term))). | |
| write_dags :- listing(dag). | |
| test_data_Start_dag(Data) :- retractall(dag), pred_Start_dag(Data, Result), write(Result), write_dags, nl. |
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 (hash-cons) | |
| (printing)) | |
| ;; A highly ambiguous grammar | |
| ;; S -> e | (e e) | (e (S)) | (e (e (S))) | |
| ;; A chart for the tree (e (e (e))) | |
| ;; The format: |
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
| % P(Data | Prog) as SCFG parsing | |
| find_at_least_one(X, Y, Z) :- findall(X, Y, Z), length(Z, N), N > 0. | |
| % the example grammar: | |
| % S -> NT(C1, node(C1)) | |
| % C1 -> C2 | C3 | p(C4, C4) | |
| % C2 -> 0 | 1 | |
| % C3 -> 1 | 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
| -- Analytic inductive programming, according to survey paper: | |
| -- Kitzelmann, Emanuel. Inductive Programming: A Survey of Program Synthesis Techniques | |
| -- Other related work: | |
| -- D.R. Smith. The synthesis of LISP programs from examples: A survey. | |
| -- P.D. Summers. A Methodology for LISP program construction from examples. | |
| -- Author: Lingfeng Yang |
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
| # An interpreter that fails early given an evidence query | |
| unDE_evidence = lambda evidence: mapd(lambda (k, v): (evalDExpr(k), v), evidence) | |
| def check_evidence(v, val, evidence): | |
| unwrapped = unDE_evidence(evidence) | |
| if unwrapped.has_key(v): | |
| if isfunction(unwrapped[v]): | |
| return unwrapped[v](val) | |
| else: | |
| return val == unwrapped[v] |
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 genericsboundstest; | |
| import java.util.*; | |
| public class Main { | |
| public static <T> T addAll_1(List<T> src, List<T> dest) | |
| { | |
| T last = null; | |
| for (T o : src) { |
NewerOlder