[parenscript-devel] js closures in ps?
Greetings. I'm new to parenscript. I'm currently playing with converting a lisp program that generates js "the hard way". I have some code that looks like this (excerpted from a format string): function addPlace(lat, lon, label, icon) { var point = new GLatLng(lat, lon); var marker = new GMarker(point, { icon : icon }); GEvent.addListener(marker,\"click\", function() { map.openInfoWindowHtml(point, label); }); map.addOverlay(marker); } I can find nothing in the ps docs that tell me how to deal with the function() { ... }. Did I just miss it? Kevin
It was probably too obvious, anonymous functions are called lambda: (*g-event.add-listener marker "click" (lambda () (map.open-info-window-html point label)) /Henrik Hjelte On 10/13/07, Kevin Layer <layer@known.net> wrote:
Greetings. I'm new to parenscript. I'm currently playing with converting a lisp program that generates js "the hard way". I have some code that looks like this (excerpted from a format string):
function addPlace(lat, lon, label, icon) { var point = new GLatLng(lat, lon); var marker = new GMarker(point, { icon : icon }); GEvent.addListener(marker,\"click\", function() { map.openInfoWindowHtml(point, label); }); map.addOverlay(marker); }
I can find nothing in the ps docs that tell me how to deal with the function() { ... }. Did I just miss it?
Kevin _______________________________________________ parenscript-devel mailing list parenscript-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
participants (2)
-
Henrik Hjelte
-
Kevin Layer