In [1]:
1+1
Out[1]:
In [2]:
{{1,2,3}}
Out[2]:
In [3]:
f[1,2,g[3],4,5] //. f[l1__,l2__,g[x_],r__] :> h[r,x,l2,l1]
Out[3]:
In [4]:
f[g[a1,b,c1],h[a2,b,c2]] //. f[g[___,x_,___],h[___,y_,___]] /; x===y :> {x}
Out[4]:
In [5]:
(* the bubble sort rule *)
sortRule := {x___,y_,z_,k___}/;(y>z) :> {x,z,y,k}
In [6]:
{64, 44, 71, 48, 96, 47, 59, 71, 73, 51, 67, 50, 26, 49, 49}//.sortRule
Out[6]:
In [7]:
res1 = SatSolve[a&&b && (!a || c||d) && !d];
res1
Out[7]:
In [8]:
(* extract the true atoms using a comprehension *)
{x :: Sat[{m___}]<-res1,(x_->True)<<-m}
Out[8]:
In [9]:
SatSolve[a&&b&&(!a||!b)]
Out[9]:
In [10]:
Doc[SatSolve]
In [11]:
Let[Sat[m_]<-SatSolve[a&&b], a&&b//. m]
Out[11]:
In [ ]: