transforming destructive to none-destructive functions ?

For the Compleat Fan
Locked
didi
Posts: 166
Joined: Fri May 04, 2007 8:24 pm
Location: Germany

transforming destructive to none-destructive functions ?

Post 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

Jeff
Posts: 604
Joined: Sat Apr 07, 2007 2:23 pm
Location: Ohio
Contact:

Post by Jeff »

Redefine it in a function. A function will copy the value and return the destroyed (copied) value.
Jeff
=====
Old programmers don't die. They just parse on...

Artful code

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post 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"

didi
Posts: 166
Joined: Fri May 04, 2007 8:24 pm
Location: Germany

Post by didi »

Thanks ! I use the string-function now .

Locked