eholk / harlan

A language for GPU computing.
Other
1.19k stars 82 forks source link

Exception in lookup: Variable not found with irritants #152

Closed rHermes closed 4 years ago

rHermes commented 9 years ago

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 9 years ago

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!