Open zilti opened 11 years ago
Hi! Looks like remp isn't built into Guile.
(remp even? '(1 2 3 4 5)) => (1 3 5)
If you add this defn, do you get any other errors?
(define remp (lambda (p ls) (cond ((null? ls) '()) ((p (car ls)) (remp p (cdr ls))) (else (cons (car ls) (remp p (cdr ls)))))))
Thanks.
--Will
Hi! It seems that guile2.0 lacks remp, exists and call-with-string-output-port, and sort takes arguments in opposite order -- appending the following [re]definitions to mk should do the job:
(define (remp p ls) (cond ((null? ls) '()) ((p (car ls)) (remp p (cdr ls))) (else (cons (car ls) (remp p (cdr ls))))))
(define (exists p ls) (cond ((null? ls) #f) ((p (car ls)) #t) (else (exists p (cdr ls)))))
(define sorter (lambda (ls) (sort ls lex<=?)))
(define datum->string (lambda (x) (with-output-to-string (lambda () (display x)))))
Cheers, d.
This is still broken in chicken scheme.
The fix provided works as long as you delete the original sorter (which uses those args backwards).
Hmm. The version of Vicare Scheme I'm using doesn't even define 'sort', although the code works if 'sort' is defined to be 'list-sort'.
I wonder if implementation-specific preludes are a better way to handle these incompatibilities, as was done with earlier versions of full Kanren. Any thoughts?
+1 for preludes if they can reliably adapt miniKanren to specific implementations … so many fun things to do with guile!
better yet: can miniKanren somehow generate the translations needed to implement it for a given scheme engine, provided abstract definitions of the external functions it requires? for example, "i need a procedure remp
such that (equal? (remp 'b '(a b c)) '(a c))
Output from REPL: