Programming Wireless Sensor Networks (WSNs) is a complex task for which existing approaches adopt rigid architectures that are only suitable for specific application fields. In previous papers we introduced a programming methodology and a lightweight middleware based on high-level programming and executable code exchange for distributed processing on WSNs. In this paper, we show how high-level programming can be effectively used on WSNs to implement symbolic reasoning. In order to prove the feasibility of our approach, we present a Fuzzy Logic system where the value updates and the rule evaluations are performed in a distributed way. Through the proposed methodology, we discuss the development of an Ambient Intelligence application. In particular, we describe how the nodes of a WSN may compute an estimation of the user thermal comfort by exchanging symbolic rather than numerical data, and control an HVAC (Heating, Ventilation and Air Conditioning) system accordingly.( destination-node --) tell: code :tell Code between tell: and :tell keywords is sent to the destination node whose address is expected on the top of