Page 1 of 1

transforming destructive to none-destructive functions ?

Posted: Fri Sep 14, 2007 6:26 pm
by didi
( replace "X" (eval button-cmd-string) xname )

This is what worked, but i guess there is a better way to eg. create a non-destructive replace .


; <><><><><><><><><><><><><><><><><><><>

PS: long time no see - while having only little time for hacking , i'm trying to simplify the gui-programming for me . This works already :

( mgs:gui-intro )
( mgs:make-frame "my-app" 5 5 90 45 ) ; the size in % of screen can be left
( mgs:tool-bar )
( mgs:add-button "Run" "Stop" )
( mgs:gui-start )

... probably the rest will take some weeks more ;-) .. but i'll stay tuned to newLISP fanclub

Posted: Fri Sep 14, 2007 6:42 pm
by Jeff
Redefine it in a function. A function will copy the value and return the destroyed (copied) value.

Posted: Fri Sep 14, 2007 8:45 pm
by cormullion
I use (string):

(set 's "didi")
(replace "i" s "a")
(println s)
;-> "dada"

(set 's "didi")
(replace "i" (string s) "a")
(println s)
;-> ;-> "didi"

Posted: Sun Sep 30, 2007 12:28 pm
by didi
Thanks ! I use the string-function now .