Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with working examples in Un-course #2

Open
arey0pushpa opened this issue Jun 5, 2016 · 5 comments
Open

Problem with working examples in Un-course #2

arey0pushpa opened this issue Jun 5, 2016 · 5 comments

Comments

@arey0pushpa
Copy link

arey0pushpa commented Jun 5, 2016

I'm using Dr.Racket with https://github.com/miniKanren/Racket-miniKanren/wiki/How-to-Install-as-a-Package-from-Dr.-Racket
But it does't support few constructs , For example evalo .. And few others . So i'm now trying to use scheme instead . Can you specify the what should i use to get the examples shown working. I'm using mit-scheme then when i clone this repo and load "mk.sm" i get this. With Other repo too i'm getting similar problem. Can you help ?

1 ]=> (load "mk.scm")

;Loading "mk.scm"...
;Unbound variable: list-sort
;To continue, call RESTART with an option number:
; (RESTART 3) => Specify a value to use instead of list-sort.
; (RESTART 2) => Define list-sort to a given value.
; (RESTART 1) => Return to read-eval-print level 1.

With https://github.com/miniKanren/miniKanren
1 ]=> (load "mk.scm")

;Loading "mk.scm"...
;lambda list has duplicate parameter: #[uninterned-symbol 11 a] in (#[uninterned-symbol 11 a] #[uninterned-symbol 11 a])
;To continue, call RESTART with an option number:
; (RESTART 1) => Return to read-eval-print level 1.

@webyrd
Copy link
Owner

webyrd commented Jun 5, 2016

Hi!

I'd recommend using this version of miniKanren:

https://github.com/webyrd/faster-miniKanren

You can run this version of miniKanren in Racket by loading 'mk.rkt'. The
implementation also works in Chez Scheme (
https://github.com/cisco/ChezScheme) or Vicare Scheme (
https://github.com/marcomaggi/vicare), if you load 'mk-vicare.scm' and then
'mk.scm'.

'evalo' isn't actually part of miniKanren. Rather, it is a miniKanren goal
(which is just a function) defined using the miniKanren primitives. Once
you have loaded miniKanren in Racket or Scheme you can load 'evalo' by
loading either simple-interp.scm or full-interp.scm. simple-interp.scm
is closer in spirit to the simpler interpreters in the miniKanren
uncourse. full-interp.scm contains a much more sophisticated interpreter
that supports variadic functions, letrec, a pattern matcher, etc.

Here's a transcript from running the full interpreter in Chez Scheme:


Chez Scheme Version 9.4.1
Copyright 1984-2016 Cisco Systems, Inc.

(load "mk-vicare.scm")
(load "mk.scm")
(load "full-interp.scm")
(run 1 (q) (evalo '(lambda (x) x) q))
((closure
(lambda (x) x)
((list val closure (lambda x x) ()) (not val prim . not) (equal? val
prim . equal?)
(symbol? val prim . symbol?) (cons val prim . cons)
(null? val prim . null?) (car val prim . car)
(cdr val prim . cdr))))
(run 1 (q) (evalo q 'foo))
('foo)
(run 2 (q) (evalo q 'foo))
('foo (((lambda .0 'foo)) (=/= ((.0 quote))) (sym .0)))
(run 1 (q) (evalo q q))
((
.0 (num .0)))
(run 3 (q) (evalo q q))
((
.0 (num .0)) #t #f)
(run 4 (q) (evalo q q))
((
.0 (num .0))
#t
#f
(((lambda (
.0) (list .0 (list 'quote .0)))
'(lambda (
.0) (list .0 (list 'quote .0))))
(=/= ((
.0 closure))
((
.0 list))
((
.0 prim))
((_.0 quote)))
(sym _.0)))


Let me know if you have any problems or questions!

Cheers,

--Will

On Sun, Jun 5, 2016 at 3:14 AM, I Hate Tears [email protected]
wrote:

I'm using Dr.Racket with
https://github.com/miniKanren/Racket-miniKanren/wiki/How-to-Install-as-a-Package-from-Dr.-Racket
But it does't support few constructs , For example evalo .. And few others
. So i'm now trying to use scheme instead . Can you specify the what should
i use to get the examples shown working. I'm using mit-scheme then when i
clone this repo and load "mk.sm" i get this. With Other repo too i'm
getting similar problem. Can you help ?

1 ]=> (load "mk.scm")

;Loading "mk.scm"...
;Unbound variable: list-sort
;To continue, call RESTART with an option number:
; (RESTART 3) => Specify a value to use instead of list-sort.
; (RESTART 2) => Define list-sort to a given value.
; (RESTART 1) => Return to read-eval-print level 1.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#2, or mute the
thread
https://github.com/notifications/unsubscribe/ABHThO01jOiY1qKbvuyKx_UVXMvh3i8Lks5qIpNhgaJpZM4IuUL5
.

@arey0pushpa
Copy link
Author

Worked like a charm in Chez Scheme. But one question where the scheme looks to load the files for ex: "mk.scm" ? Is that in Home directory (i put minikanren in every possible directory that i think of where scheme might have searched) or can i tell scheme where to look.
One more thing with Dr.racket its still not working

#lang racket
(load "mk.scm")

mk.scm:8:0: #%top-interaction: unbound identifier;
also, no #%app syntax transformer is bound in: #%top-interaction

hard to even debug.

Thanks. really helpful.

@webyrd
Copy link
Owner

webyrd commented Jun 7, 2016

On Mon, Jun 6, 2016 at 11:19 AM, I Hate Tears [email protected]
wrote:

Worked like a charm in Chez Scheme. But one question where the scheme
looks to load the files for ex: "mk.scm" ? Is that in Home directory (i put
minikanren in every possible directory that i think of where scheme might
have searched) or can i tell scheme where to look.

When running miniKanren in Chez from the command line, I usually open a
terminal window, 'cd' to the directory containing 'mk.scm', then start Chez
from that directory by typing 'scheme' in the terminal.

One more thing with Dr.racket its still not working

#lang racket
(load "mk.scm")

mk.scm:8:0: #%top-interaction: unbound identifier;
also, no #%app syntax transformer is bound in: #%top-interaction

hard to even debug.

Did you try loading 'mk.rkt' rather than 'mk.scm'?

Thanks. really helpful.

Glad to help! :)


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#2 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABHThEWSlOp7_H_CVqRYfv64XD1hEkUdks5qJFaYgaJpZM4IuUL5
.

@arey0pushpa
Copy link
Author

arey0pushpa commented Jun 7, 2016

When running miniKanren in Chez from the command line, I usually open a
terminal window, 'cd' to the directory containing 'mk.scm', then start Chez
from that directory by typing 'scheme' in the terminal.

Yes , I initially thought of that and that's how i was loading it. Cheers! Thanks.

Did you try loading 'mk.rkt' rather than 'mk.scm'?

Yes Did that itself. And Dr.Racket searches in Home directory so i'm putting it in right place .

#lang racket
(load "mk.rkt")

mk.rkt:1:0: #%top-interaction: unbound identifier;
also, no #%app syntax transformer is bound in: #%top-interaction

Thank you so much. Completed first two un-courses. Very helpful. Thank you. Minikanren Rocks !

@webyrd
Copy link
Owner

webyrd commented Jun 7, 2016

Happy to help!

BTW, you might find this new miniKanren-powered project interesting:

https://github.com/webyrd/Barliman

On Tue, Jun 7, 2016 at 4:03 AM, I Hate Tears [email protected]
wrote:

When running miniKanren in Chez from the command line, I usually open a
terminal window, 'cd' to the directory containing 'mk.scm', then start Chez
from that directory by typing 'scheme' in the terminal.

Yes , I initially thought of that and that's how i was loading it. Cheers!
Thanks.

Did you try loading 'mk.rkt' rather than 'mk.scm'?
Yes Did that itself. And Dr.Racket searches in Home directory so i'm
putting it in right place .

#lang racket
(load "mk.rkt")

mk.rkt:1:0: #%top-interaction: unbound identifier;
also, no #%app syntax transformer is bound in: #%top-interaction

Thank you so much. Completed first two un-courses. Very helpful. Thank
you. Minikanren Rocks !


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#2 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABHThH6BIC4pgvOGr1RNA-X_to6kCEoHks5qJUIKgaJpZM4IuUL5
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants