Is Variable Interpolation Possible?

24 views
Skip to first unread message

Don

unread,
Mar 13, 2013, 7:06:18 PM3/13/13
to f-sc...@googlegroups.com
I've got an object "oppsExtras" with properties "extra", "extra2", "extra3", etc. Rather than act on those fields individually...

(({oppExtras extra1} intersection:roleNames) count > 0) ifTrue: [
...
].
(({oppExtras extra2} intersection:roleNames) count > 0) ifTrue: [
...
].

...is it possible to loop through these 12 properties with some sort of interpolation? Like:

(({oppExtras extra|i|} intersection:roleNames) count > 0) ifTrue: [

where |i| is a counter? (Forgive me for my misuse of terms anywhere in my posts. I'm new here.)

Ken Ferry

unread,
Mar 13, 2013, 7:43:05 PM3/13/13
to f-sc...@googlegroups.com
You're probably looking for the asBlock method.

> oppsExtras
#{ 'extra1' -> {2, 3, 4},
   'extra2' -> {1, 3},
   'extra3' -> {2, 3},
   'extra0' -> {1, 2, 3}
}

> compactBlockStrings := ('#extra' ++ @ (4 iota @ description))

> compactBlockStrings
{'#extra0', '#extra1', '#extra2', '#extra3'}

> compactBlocks := compactBlockStrings asBlock

> compactBlocks
{#extra0, #extra1, #extra2, #extra3}

> compactBlocks @ value:oppsExtras
{{1, 2, 3}, {2, 3, 4}, {1, 3}, {2, 3}}

-ken


--
You received this message because you are subscribed to the Google Groups "F-Script" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f-script+u...@googlegroups.com.
To post to this group, send email to f-sc...@googlegroups.com.
Visit this group at http://groups.google.com/group/f-script?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Don

unread,
Mar 14, 2013, 12:05:11 AM3/14/13
to f-sc...@googlegroups.com
Ooooh! Let me play around with that a bit and see what I can come up with. Thanks!
Reply all
Reply to author
Forward
0 new messages