On 29/03/18 14:12, oldk1331 wrote:> You see, without explicity a "return
void()$Void", some
other value may be returned, but again, there's nothing
interesting to do with a value of Void type.
That's not my point. You have changed the code to this:
every?(leaf?, c) =>
s : String := concat [value c1 for c1 in c]
sayHt s
if value(t) ~= "" then sayHt concat["</",tagName,">"]
return void()$Void
It seems to me that the point of => is to return from a block but it
will never return from the block because it reaches the return first.
So although the code works fine it is potentially confusing for people
reading the code.
You are just using => as an if-then so I would prefer that the code used
if-then explicitly like this:
if every?(leaf?, c) then
s : String := concat [value c1 for c1 in c]
sayHt s
if value(t) ~= "" then sayHt concat["</",tagName,">"]
return void()$Void
either that or allow the code to exit from the block like this:
every?(leaf?, c) =>
s : String := concat [value c1 for c1 in c]
sayHt s
if value(t) ~= "" then sayHt concat["</",tagName,">"]
void()$Void
but not both.
It does not really matter but I would rather optimise for
understandability rather than minimising code or insignificant speed
changes.
Martin
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.