newLISP Fan Club

Forum => Anything else we might add? => Topic started by: didi on September 14, 2007, 11:26:26 AM

Title: transforming destructive to none-destructive functions ?
Post by: didi on September 14, 2007, 11:26:26 AM
( 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
Title:
Post by: Jeff on September 14, 2007, 11:42:31 AM
Redefine it in a function.  A function will copy the value and return the destroyed (copied) value.
Title:
Post by: cormullion on September 14, 2007, 01:45:37 PM
I use (string):



(set 's "didi")

(replace "i" s "a")

(println s)

;-> "dada"



(set 's "didi")

(replace "i" (string s) "a")

(println s)

;-> ;-> "didi"
Title:
Post by: didi on September 30, 2007, 05:28:19 AM
Thanks !   I use the string-function now .