You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to program...@googlegroups.com
Hey,
I noticed that flat_map on a bloom collection will cause it to cycle through the collection twice (demonstrated in pasted code below).
Is this intentional?
CODE:
class B
include Bud
state do
scratch :t, [:a, :d]
scratch :b, [:a, :dp]
end
bloom :test do
b <= t.flat_map do |p|
puts p.inspect
p.d.map {|g| [p.a, g]}
end
end
end
b = B.new
b.t <+ [[1, [["a", "a"], ["b", "b"]]]]
b.tick
OUTPUT:
[1, [["a", "a"], ["b", "b"]]]
[1, [["a", "a"], ["b", "b"]]]
--
Yoriyasu Yano
University of California, Berkeley
BA Cognitive Science and Computer Science
Joseph Hellerstein
unread,
Nov 27, 2011, 2:14:02 AM11/27/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to program...@googlegroups.com
In general, rule bodies may be eval'ed many times per tick, so side-effects in rule bodies are not a good idea!
Note that BudCollections have set semantics, so eval'ing the rhs multiple times per tick shouldn't affect the lhs (unless you do side-effecting stuff in bodies!)
In future versions of Bud, side-effects in the body will be forbidden...