{"action":"created","issue":{"url":"https://api.github.com/repos/Shen-Language/shen-sources/issues/59","repository_url":"https://api.github.com/repos/Shen-Language/shen-sources","labels_url":"https://api.github.com/repos/Shen-Language/shen-sources/issues/59/labels{/name}","comments_url":"https://api.github.com/repos/Shen-Language/shen-sources/issues/59/comments","events_url":"https://api.github.com/repos/Shen-Language/shen-sources/issues/59/events","html_url":"https://github.com/Shen-Language/shen-sources/issues/59","id":338424836,"node_id":"MDU6SXNzdWUzMzg0MjQ4MzY=","number":59,"title":"prolog 'call' not working properly","user":{"login":"NHALX","id":5621813,"node_id":"MDQ6VXNlcjU2MjE4MTM=","avatar_url":"https://avatars0.githubusercontent.com/u/5621813?v=4","gravatar_id":"","url":"https://api.github.com/users/NHALX","html_url":"https://github.com/NHALX","followers_url":"https://api.github.com/users/NHALX/followers","following_url":"https://api.github.com/users/NHALX/following{/other_user}","gists_url":"https://api.github.com/users/NHALX/gists{/gist_id}","starred_url":"https://api.github.com/users/NHALX/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NHALX/subscriptions","organizations_url":"https://api.github.com/users/NHALX/orgs","repos_url":"https://api.github.com/users/NHALX/repos","events_url":"https://api.github.com/users/NHALX/events{/privacy}","received_events_url":"https://api.github.com/users/NHALX/received_events","type":"User","site_admin":false},"labels":[{"id":187531090,"node_id":"MDU6TGFiZWwxODc1MzEwOTA=","url":"https://api.github.com/repos/Shen-Language/shen-sources/labels/bug","name":"bug","color":"fc2929","default":true},{"id":985165747,"node_id":"MDU6TGFiZWw5ODUxNjU3NDc=","url":"https://api.github.com/repos/Shen-Language/shen-sources/labels/prolog","name":"prolog","color":"35ce9b","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-05T04:37:51Z","updated_at":"2018-07-08T03:40:38Z","closed_at":null,"author_association":"NONE","body":"Below is the output which fails under OS shen but works under PRO. The code generators for OS and Pro compile to the same code for 'test1'. I haven't looked closely at the code produced by test2, but they seem to be identical walls of text. Maybe lazyderef isn't working right? \r\n\r\nShen/OS\r\n```\r\n(4-)\r\n(prolog? (test3 A B))\r\nZ: (test1 Var2 Var3)\r\nfalse\r\n```\r\n\r\nShen/PRO\r\n```\r\n(4-) (prolog? (test3 A B))\r\nZ: (test1 Var2 Var3)\r\ntestX->3: Var2\r\ntrue\r\n```\r\n\r\nCode\r\n```\r\n(0-) (defprolog test1\r\n  (mode 1 -) 2 <-- (prolog.trace \"test1->2\" 2);\r\n  X 3          <-- (prolog.trace \"testX->3\" X);)\r\ntest1\r\n\r\n(1-)\r\n(defprolog test2\r\n  A B [test1 A B] <--;)\r\ntest2\r\n\r\n(2-)\r\n(defprolog test3\r\n  A B <-- (test2 A B Z)\r\n          (prolog.trace \"Z\" Z)\r\n          (call Z);)\r\ntest3\r\n\r\n(3-) (defprolog prolog.trace\r\n  Msg X <-- (when (do (output \"~A: ~R~%\" Msg X) true)); )\r\nprolog.trace\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/Shen-Language/shen-sources/issues/comments/403259844","html_url":"https://github.com/Shen-Language/shen-sources/issues/59#issuecomment-403259844","issue_url":"https://api.github.com/repos/Shen-Language/shen-sources/issues/59","id":403259844,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzI1OTg0NA==","user":{"login":"tizoc","id":13744,"node_id":"MDQ6VXNlcjEzNzQ0","avatar_url":"https://avatars2.githubusercontent.com/u/13744?v=4","gravatar_id":"","url":"https://api.github.com/users/tizoc","html_url":"https://github.com/tizoc","followers_url":"https://api.github.com/users/tizoc/followers","following_url":"https://api.github.com/users/tizoc/following{/other_user}","gists_url":"https://api.github.com/users/tizoc/gists{/gist_id}","starred_url":"https://api.github.com/users/tizoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tizoc/subscriptions","organizations_url":"https://api.github.com/users/tizoc/orgs","repos_url":"https://api.github.com/users/tizoc/repos","events_url":"https://api.github.com/users/tizoc/events{/privacy}","received_events_url":"https://api.github.com/users/tizoc/received_events","type":"User","site_admin":false},"created_at":"2018-07-08T03:40:38Z","updated_at":"2018-07-08T03:40:38Z","author_association":"MEMBER","body":"Ok, I was playing with this a bit, and something I noticed is that the generated code invokes `call` with the variable as is, without doing a deref on it, example:\r\n\r\n```shen\r\n(defun shen.f1296 (ProcN Cont)\r\n  (let A (shen.newpv ProcN)\r\n    (let B (shen.newpv ProcN)\r\n      (let X (shen.newpv ProcN)\r\n        (do (shen.incinfs)\r\n          (bind X (cons test1 (cons 1 (cons (shen.deref A ProcN) (cons (shen.deref B ProcN) ()))))\r\n                ProcN\r\n                (freeze (call X ProcN Cont))))))))     \\\\ <---- here\r\n```\r\n\r\nbut the definition of `call` looks like this:\r\n\r\n```shen\r\n(define call\r\n  [F | X] ProcessN Continuation\r\n  -> (call-help (function (lazyderef F ProcessN)) X ProcessN Continuation)\r\n  _ _ _ -> false)\r\n```\r\n\r\nThe generated code passes a prolog variable instead of something with the form `[F | X]`, so the catch-all case gets it and returns false.\r\n\r\nCan you tell me thats the generated code for this in SP?\r\n\r\n```shen\r\n(define something -> (prolog? (is X [test 1 A B]) (call X)))\r\n```\r\n\r\nI get this in the OS version:\r\n\r\n```\r\n(25-) (ps something)\r\n[defun something [] [shen.f1296 [shen.start-new-prolog-process] [freeze true]]]\r\n\r\n(26-) (ps shen.f1296)\r\n[defun shen.f1296 [V1299 V1300] [let A [shen.newpv V1299] [let B [shen.newpv V1299] [let X [shen.newpv V1299] [do [shen.incinfs] [bind X [cons test [cons 1 [cons [shen.deref A V1299] [cons [shen.deref B V1299] []]]]] V1299 [freeze [call X V1299 V1300]]]]]]]]\r\n```"}}
{"actor":{"display_login":"tizoc"}}