eholk/harlan

Exception in lookup: Variable not found with irritants

rHermes opened this issue · 1 comments

When I try to compile this program:

(module
  (define (main)
        (println (map (lambda (x) (+ 2 x)) ))
        0))

I get this error:

Exception in lookup: Variable not found with irritants (map ((close_outfile fn (...) -> void) (command-line fn () -> (...)) (flush-stdout fn () -> void) (get-environment-variable fn (...) -> str) (nanotime fn () -> u64) (open_outfile fn (...) -> (...)) ...))

What am I doing wrong here?

eholk commented

Hi, sorry for taking so long to respond!

There are two issues here. First, you didn't give an argument for map. You probably want to do something like this:

(module
  (define (main)
    (println (map (lambda (x) (+ 2 x)) (vector 1 2 3 4)))
    0))

Next, Harlan doesn't actually support map yet (although I'm testing a change that adds it as I type). To do the same thing without map, you'd do something like this:

(module
  (define (main)
    (println (kernel ((x (vector 1 2 3 4))) (+ 2 x)))
    0))

Let me know if this helps!