{"action":"opened","issue":{"number":7,"created_at":"2011-10-19T20:27:35Z","pull_request":{"diff_url":null,"patch_url":null,"html_url":null},"body":"Pattern matching in the head of a named function works fine both in compiled and interpreted mode. However, it doesn't work for lambdas (compiled and interpreted).\r\n\r\nThis one works fine:\r\n\r\n```lisp\r\n(defmodule foo (export (a_and_c 1)))\r\n(defun a_and_c ([(tuple a b c)] (tuple a c)))\r\n```\r\n\r\n```lisp\r\n(a_and_c (tuple 'a 'b 'c)) ; returns #(a c)\r\n```\r\n\r\nBut that one does not work at all:\r\n\r\n```lisp\r\n(defmodule bar (export (a_and_b 1)))\r\n(defun a_and_b (t)\r\n  (let ((issue_7 (lambda ([(tuple a b c)] (tuple a b)))))\r\n    (funcall issue_7 t)))\r\n```\r\n\r\nWhen slurping the function, everything looks alright, but when it is invoked, a badarity error occurs:\r\n\r\n```lisp\r\n(a_and_b (tuple 'a 'b 'c)) ; should return `#(a b)`, but does not\r\n```\r\n\r\n```\r\nexception error: #(badarity #(#Fun<lfe_eval.15.56600010> (#(a b c))))\r\n```\r\n\r\nInstead of the correct arity of one (like it applies to the named function), the lambda function has an incorrect arity of 2:\r\n\r\n```lisp\r\n(: lists keyfind 'arity 1 (: erlang fun_info (fun a_and_b 1))))) ; returns #(arity 2)\r\n```\r\n\r\nCompiling it does not work, too:\r\n\r\n```lisp\r\n(: lfe_comp file '\"/tmp/bar.lfe\")\r\n```\r\n\r\n```\r\n/tmp/bar.lfe:2: bad form: lambda\r\nerror\r\n```","comments":0,"title":"pattern matching in function head doesn't work for lambdas","updated_at":"2011-10-19T20:27:35Z","url":"https://api.github.com/repos/rvirding/lfe/issues/7","id":1998134,"assignee":null,"milestone":null,"closed_at":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/6ed1a9b7f7d696817c0e716162f26abd?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"6ed1a9b7f7d696817c0e716162f26abd","url":"https://api.github.com/users/KlausTrainer","id":230061,"login":"KlausTrainer"},"html_url":"https://github.com/rvirding/lfe/issues/7","labels":[],"state":"open"},"legacy":{"number":7,"action":"opened","issue":1998134}}