... "dynamic" [ button "add" [ "some code here" ] text "1" field "#FF00C8" text "2" field "#FF00C8" ] ...
@GiuseppeChillemi they are the same (unless I don't know something):
a: [a b] ;== [a ; b ;] aa: [a b] ; == [a b] a = aa ; == true
if you want to add newline (I guess that what you mean by
CR) then you can just add newline in your code (hit enter):
a: [a] ; == [a] append a [ b] ;== [a ; b ;]
However certain operations may delete newlines. You can check and set/clear newlines manually using
arr: [a b c] ; [a b c] arr: next arr ; [b c] new-line? arr ; false new-line arr on ; on = true ; [ ; b c ; ] new-line? arr ; true head arr ; [a ; b c ; ]
foreachwon't work because it gives you element of the series. The element doesn't hold information about new-line markers.
how would you store functions in a block/series and then execute them with foreach. I tried various things along the lines of this:
a: function [x] [x + 1] b: function [x] [x * 2] c: function [x] [x * x] funcs: [:a :b :c] foreach f funcs [ print f 5]
which is printing 'a b c', when I'm trying to get '6 10 25'.
cdis meant for interactive console sessions
@cprinos to add to previous answers, you can as well add functions to the block
append funcs :a.
ps. you may use a
map! (key-value container, e.g.
m: #(a: 42) m/a ; 42).
m: #() m/a: function [x] [x + 1] m/b: function [x] [x + 2] m/c: function [x] [x + 3]
You can run functions by a name:
m/a 1; == 2 or you can get keys (words) of the map and use foreach:
foreach key words-of m [probe m/:key 10] ; 11 ; 12 ; 13