Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Reactors - (lambda) as a callback function?
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Reactors - (lambda) as a callback function? (Read 1231 times)
0 Members and 1 Guest are viewing this topic.
Grrr1337
Swamp Rat
Posts: 812
WWW
Reactors - (lambda) as a callback function?
«
on:
March 20, 2017, 08:10:37 AM »
Hi guys, reactor dummy asking:
Is it possible to set
lambda
function as a callback function to a reactor?
I've did some simple test and it failed:
Code - Auto/Visual Lisp:
[Select]
_$
(
vlr-Mouse-reactor
"test"
; include the new reactor
(
list
(
cons
:vlr-beginDoubleClick
(
lambda
(
rtr arg
)
(
alert
(
strcat
"
\n
rtr "
(
vl-prin1-to-string
rtr
)
"
\n
arg "
(
vl-prin1-to-string
arg
)
)
)
)
)
; cons
)
; list
)
; vlr-mouse-reactor
Error: bad argument
type
:
(
or
stringp symbolp
)
: #
<
USUBR @0000005c713bba70
-
lambda
->
_1$
Although:
Code - Auto/Visual Lisp:
[Select]
_$
(
equal
(
type
Dclick:callback
)
(
type
(
lambda
(
rtr arg
)
(
alert
(
strcat
"
\n
rtr "
(
vl-prin1-to-string
rtr
)
"
\n
arg "
(
vl-prin1-to-string
arg
)
)
)
)
)
)
T
_$
But before I fully gave up on this idea, I wanted someone else that perhaps tried this long time ago to comfirm that this is impossible?
«
Last Edit: March 20, 2017, 08:17:33 AM by Grrr1337
»
Logged
(apply ''((a b c)(a b c))
'(
(( f L ) (apply 'strcat (f L)))
(( L ) (if L (cons (chr (car L)) (f (cdr L)))))
(72 101 108 108 111 32 87 111 114 108 100)
)
)
vevo.bg
roy_043
Water Moccasin
Posts: 1895
BricsCAD 18
Re: Reactors - (lambda) as a callback function?
«
Reply #1 on:
March 20, 2017, 10:21:35 AM »
The documentation is pretty clear:
Quote from:
http://docs.autodesk.com/ACD/2011/ENU/filesALR/WS1a9193826455f5ff1a32d8d10ebc6b7ccc-679d.htm
callback_function is a
symbol
representing a function
«
Last Edit: March 20, 2017, 10:29:46 AM by roy_043
»
Logged
Grrr1337
Swamp Rat
Posts: 812
WWW
Re: Reactors - (lambda) as a callback function?
«
Reply #2 on:
March 20, 2017, 10:41:22 AM »
Thanks Roy!
I thought that I could fool this with
lambda
, instead of defining a simple named function.
Logged
(apply ''((a b c)(a b c))
'(
(( f L ) (apply 'strcat (f L)))
(( L ) (if L (cons (chr (car L)) (f (cdr L)))))
(72 101 108 108 111 32 87 111 114 108 100)
)
)
vevo.bg
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Reactors - (lambda) as a callback function?