Tutorial by Examples: pre

Predicates that reason about instantiations are called meta-logical. Examples are: var/1 ground/1 integer/1 These predicates are outside the realm of pure monotonic logic programs, because they break properties like commutativity of conjunction. Other predicates that are meta-logical includ...
Predicates that reason about all solutions are extra-logical. These are for example: setof/3 findall/3 bagof/3
XML pre-defines five general entities that can be used without declaring them: & " ' < > They are associated with the names amp, quot, apos, lt and gt. <?xml version="1.0"?> <entities> & is an ampersand. " is a quote. ' is...
Any predicate function can be used as a spec. Here's a simple example: (clojure.spec/valid? odd? 1) ;;=> true (clojure.spec/valid? odd? 2) ;;=> false the valid? function will take a spec and a value and return true if the value conforms to the spec and false otherwise. One other inte...
# Extract strings with a specific regex df= df['col_name'].str.extract[r'[Aa-Zz]'] # Replace strings within a regex df['col_name'].str.replace('Replace this', 'With this') For information on how to match strings using regex, see Getting started with Regular Expressions.
var request = new XMLHttpRequest(); request.onreadystatechange = (e) => { if (request.readyState !== 4) { return; } if (request.status === 200) { console.log('success', request.responseText); } else { console.warn('error'); } }; request.open('GET', 'https://my...
string outsidetext = "I am outside of bracket"; string.Format("{{I am in brackets!}} {0}", outsidetext); //Outputs "{I am in brackets!} I am outside of bracket"
Angular supports three types of expressions in the ng-class directive. 1. String <span ng-class="MyClass">Sample Text</span> Specifying an expression that evaluates to a string tells Angular to treat it as a $scope variable. Angular will check the $scope and look for a va...
var a:Number=0.123456789; trace(a); // 0.123456789 trace(a.toPrecision(4)); // 0.1235 trace(a.toFixed(4)); // 0.1235 trace(a.toExponential(4)); // 1.2345e-1 trace(a.toString(16)); // 0 - works for integer part only var b:Number=12345678.9876543; // a bigg...
Python 2.x2.3 x = 'hello world!' vowels = [x for x in 'AEIOU'] print (vowels) # Out: ['A', 'E', 'I', 'O', 'U'] print(x) # Out: 'U' Python 3.x3.0 x = 'hello world!' vowels = [x for x in 'AEIOU'] print (vowels) # Out: ['A', 'E', 'I', 'O', 'U'] print(x) # Out: 'hello world!' ...
The call/N family of predicates can call arbitrary Prolog goals at run time: ?- G=true, call(G). true. ?- G=(true,false), call(G). false.
Predicates that impede or prohibit a declarative reading of Prolog programs are extra-logical. Examples of such predicates are: !/0 (->)/2 and if-then-else (\+)/1 These predicates can only be understood procedurally, by taking into account the actual control flow of the interpreter, and a...
A list of recognised color keyword names can be found in the W3C Recommendation for SVG. <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <circle r="30" cx="100" cy="100" fill="red" stroke=&qu...
To get the value of the last result from your last expression in the console, use an underscore _. >>> 2 + 2 4 >>> _ 4 >>> _ + 6 10 This magic underscore value is only updated when using a python expression that results in a value. Defining functions or for loops ...
Postfix increment X++ will add 1 to x var x = 42; x++; Console.WriteLine(x); // 43 Postfix decrement X-- will subtract one var x = 42 x--; Console.WriteLine(x); // 41 ++x is called prefix increment it increments the value of x and then returns x while x++ returns the value of x and the...
Predefined operators according to ISO/IEC 13211-1 and 13211-2: PriorityTypeOperator(s)Use1200xfx:- -->1200fx:- ?-Directive, query1100xfy;1050xfy->1000xfy','900fy\+700xfx= \\=Term unification700xfx== \\== @< @=< @> @>=Term comparison700xfx=..700xfxis =:= =\= < > =<...
It is possible to find the first element of a Stream that matches a condition. For this example, we will find the first Integer whose square is over 50000. IntStream.iterate(1, i -> i + 1) // Generate an infinite stream 1,2,3,4... .filter(i -> (i*i) > 50000) // Filter to find element...
Preface You'll need node >= 4 and express 4 for this project. You can get the latest node distribution from their download page. Before this tutorial, you should initialize your node project by running $ npm init from the command line and filling in the information you want. Note that you c...
PREPARE prepares a statement for execution EXECUTE executes a prepared statement DEALLOCATE PREPARE releases a prepared statement SET @s = 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse'; PREPARE stmt2 FROM @s; SET @a = 6; SET @b = 8; EXECUTE stmt2 USING @a, @b; Result: +------------+ |...
Following is most basic expression tree that is created by lambda. Expression<Func<int, bool>> lambda = num => num == 42; To create expression trees 'by hand', one should use Expression class. Expression above would be equivalent to: ParameterExpression parameter = Expression.Pa...

Page 8 of 34