reversing [toggle] output

Nov 7, 2011 at 7:04pm

reversing [toggle] output

hello!

is there a more elegant way to reverse my [toggle] output? my attempt does the job using [if $i1 > 0 then 0 else 1]. so, what else is there? :)

cheers,

jonas

– Pasted Max Patch, click to expand. –
#59864
Nov 7, 2011 at 7:11pm
– Pasted Max Patch, click to expand. –
#215489
Nov 7, 2011 at 7:14pm

that I like.

thanks!

#215490
Nov 7, 2011 at 8:06pm

shorter: [if $i1 then 1 else 0].

or just [== 0].

or why not [!= 1]?

[expr ($f1+1)%1] should also work. :)

#215491
Nov 7, 2011 at 8:16pm

:)

do like the equal/not equal alternative. and thanks for pointing out that my [if] can be further reduced…

#215492
Nov 7, 2011 at 10:44pm

I agree [== 0] is the way to go. the most readable one.
Two others ways, just for fun : [expr $i1^1] [expr !$i1]

#215493
Nov 7, 2011 at 11:31pm

The old classic [expr int($i1*pow(2,3)/ln(9)*-1/3+1)] is the best! ;)

#215494
Nov 7, 2011 at 11:59pm

laugh my f ass right OFF

#215495
Nov 8, 2011 at 12:08am

Only because getting Euler’s identity into the [expr] object looked like a bit of a challenge!

#215496
Nov 8, 2011 at 12:32am

transcendental…….

#215497
Nov 8, 2011 at 12:53am

I’m all about the [!- 1]

#215498
Nov 8, 2011 at 8:44am

@Roman
you meant [if $i1 then 0 else 1]

[!- 1], yeah :) can’t get any slimmer.

also thanks for the insight into [expr]. endless potential, the fella…

#215499
Nov 8, 2011 at 11:18am

[!- 1] or [== 0] ?

I think it just depends whether you consider 0 1 as numbers or booleans.

#215500
Nov 8, 2011 at 7:39pm

[!- 1] is branchless. Wins every time.

#215501

You must be logged in to reply to this topic.