Skip to content

Instantly share code, notes, and snippets.

@fare
Created February 17, 2018 01:57
Show Gist options
  • Save fare/7e5720bd3c156452bfe790c83a810e79 to your computer and use it in GitHub Desktop.
Save fare/7e5720bd3c156452bfe790c83a810e79 to your computer and use it in GitHub Desktop.
case-lambda works in the interpreter, only accepts the base case in the compiler
;; works with Gerbil v0.12-DEV-1315-g5902327 on Gambit v4.8.8-434-g490f0a7d on nixpkgs 867d3f9 (gcc 7.2.0)
;; fails with Gerbil v0.12-DEV-1404-g0a266db on Gambit v4.8.8-435-gd1991ba7 on nixpkgs dafdaa9 (gcc 7.3.0)
package: bug
(export #t)
(import :clan/utils/assert)
(def foo (case-lambda (() 0) ((x) 1) ((x y) 2) ((x y z . t) (+ 3 (length t)))))
(def (test-foo)
(assert-equal! (foo) 0)
(assert-equal! (foo 0) 1)
(assert-equal! (foo 0 1) 2)
(assert-equal! (foo 0 1 2) 3)
(assert-equal! (foo 0 1 2 3) 4))
@fare
Copy link
Author

fare commented Feb 17, 2018

Solution to the issue: two different versions of gcc 6.4.0 were used, because my $NIX_PATH and my $nixpkgs didn't agree with each other, so gerbil-nix-env.sh was getting the wrong path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment