pocmatos
2019-3-12 07:37:10

I will do a PR for this on the reference guide then and see what others think.


mark.warren
2019-3-12 13:47:10

I’ve been jumping around the documentation trying to work out all of the things I need to do to make a ‘proper’ racket project. e.g. rackunit tests, module, contracts etc. Does anyone know if there is a single checklist or simple document that gives a basic project layout?


mark.warren
2019-3-12 14:37:49

Ignore me. Found the raco pkg docs. I think that’s what I need.


marian.petruk
2019-3-12 16:32:24

@marian.petruk has joined the channel


greg
2019-3-12 17:22:33

@mark.warren Although I haven’t used it raco pkg new might be a good head-start. Otherwise, I think I’ve ~cargo-culted~ thoughtfully researched various Racket projects on Git{Hub Lab} for ideas.


soegaard2
2019-3-12 17:24:04

soegaard2
2019-3-12 17:28:49

@mark.warren A little on unit tests: https://beautifulracket.com/explainer/unit-testing.html


chris613
2019-3-12 20:39:02

@notjack i got somewhere in the end :slightly_smiling_face: #lang racket (require racket/list) (require datalog) (define blah (make-theory)) (datalog blah (! (statement sales "are willing to work within a new environment (editor)")) (! (statement managers "get in the way")) (! (validation managers "get in the way")) (! (validation sales "do not want to maintain a database")) (! (:- (learning C X) (statement C X) (validation C X))) (! (:- (statement C X) (statement C X))) ; (! (:- (assumption C X) ; (statement C X) ; (not (validation C X)))) ;(! (validation sales "are willing to work within a new environment (editor)")) ) (define learnings (datalog blah (? (learning C X)))) (define statements (datalog blah (? (statement C X)))) ;assumptions = statements that are not validated ;(remove-duplicates '(a b b a)) (define assumptions (remove* learnings statements))


notjack
2019-3-12 21:19:15

@chris613 nice! Good idea to move the negation logic outside of datalog entirely


chris613
2019-3-12 21:48:23

gone a little futher actually


chris613
2019-3-12 21:48:25

(define (add-assumption-rule hm) (datalog blah (! (assumption (hash-ref hm 'C) (hash-ref hm 'X))))) (map add-assumption-rule (remove* (datalog blah (? (learning C X))) (datalog blah (? (statement C X)))))


chris613
2019-3-12 21:48:54

could probably be cleaned up quite a bit :slightly_smiling_face:


notjack
2019-3-12 21:49:07

I don’t know enough datalog to know what that does exactly :stuck_out_tongue:


chris613
2019-3-12 21:50:50

so really all ive done is implimented the idea of “every statement must be either validated or unvalidated” by reading in the original ruleset, figuring out the missing rules programatically and adding them back in to the logic DB for future use sort of thing


notjack
2019-3-12 21:52:32

ohhh, I see now


notjack
2019-3-12 21:54:46

It’s neat how well a language-oriented-programming approach works here. You’ve cleanly split the logic surrounding the entire rule database from the logic of the individual rules themselves, by using racket code for one and datalog code for the other.


michaelmmacleod
2019-3-13 01:10:55

Does anyone know if there is a way to automatically create nested attributes in syntax patterns? For example, let’s say I have

(define-syntax-class B
  (pattern c))
(define-syntax-class A
  (pattern b:B))

Is there any way to automatically generate nested attributes, so I can do something like this: (syntax-parse #'hello-world [x:A #'x.b.c]) without having to redefine A like this: (define-syntax-class A (pattern the-b:B #:with b.c #'the-b.c))


notjack
2019-3-13 01:33:06

@michaelmmacleod I don’t know of anything that’s completely automatic, but you can use the #:attributes keyword to expose nested attributes without having to use #:with on each one: (define-syntax-class A #:attributes (b b.c) (pattern b:B))


michaelmmacleod
2019-3-13 01:34:02

oh my goodness thank you so much :slightly_smiling_face:. I can’t believe I didn’t see that haha.


michaelmmacleod
2019-3-13 01:34:42

I’ve got at least 50 lines of #:with clauses in my program


notjack
2019-3-13 01:34:43

I didn’t know about it either for like my first several years of using syntax/parse


notjack
2019-3-13 01:35:32

it’s difficult to find out about