if function when processing sound

I have a nyquist script that changes a sound by feeding it through an equation. I need to treat the sound differently depending on it’s sign.

This is my code:

(s-if (= *track* 0) 

    *track*

    (s-if (< *track* 0)

        (s-sqrt
            (diff 1
                (mul 
                    (diff 1 *track*)
                    (diff 1 *track*)
                )
            )
        )

        (s-sqrt
            (diff 1
                (mul
                    (diff *track* 1)
                    (diff *track* 1)
                )
            )
        )
    )
)
[code]

it does not work, since s-if is not a real nyquist function.
How can I modify this script so that it does different things to the sound based off of the sign?

You can do it like this:

;version 4

(defun process1(sig)
  ...some signal processing code...)

(defun process2(sig)
  ...different processing code...)

(defun polarity-split(sig)
  (let ((positive (s-max sig 0))
        (negative (s-min sig 0)))
    (sum (process1 positive)
         (process2 negative))))

(polarity-split *track*)

A simple working example:

(defun process1(sig)
  (mult sig sig))

(defun process2(sig)
  (mult sig 0.5))

(defun polarity-split(sig)
  (let ((positive (s-max sig 0))
        (negative (s-min sig 0)))
    (sum (process1 positive)
         (process2 negative))))

(polarity-split *track*)

brilliant solution, thanks!