<aside> 💡 Owner: @Marcin Hagmajer
</aside>
<aside> 💡 AskQL Environment Queries run in the environment that the server made available to the AskVM at runtime. Each environment shares certain resources that you can query in AskQL.
</aside>
<aside>
💡 Braces
Braces open up a new computation block formed by a list of another computations. The ask {
block is a function block where computations are run sequentially and the last one is returned. In query {
they all run simultaneously and the accumulated result structure is returned.
</aside>
Let's query the name of the environment.
ask {
query {
name
description
}
}
{
name: "AskQL environment"
description: "The prototype of an AskQL environment"
}
<aside> ✅ Green colour marks the successful execution of our query. Examples in this documentation consist of two parts - a query in blue and a simplified representation of a JSON response that came back from the server.
</aside>
<aside> 📘 You can find out more about the standard library of resources in the AskQL Environment Library.
</aside>
<aside> ⚡ AskQL simultaneously fetches all your queried resources at the same time.
</aside>
Ask makes it easier for you to write long expression using syntax sugar. Both programs below give the same result.
ask {
query {
firstName :upperCase
}
}
ask {
query {
firstName :upperCase(firstName)
}
}
<aside>
#️⃣ : colon symbol
The colon symbol :
causes the value identified on the left side to be passed as the first argument to the function expression on the right as the first argument if it takes it. Which then can be chained further to perform data conversions.
</aside>
<aside> 🗺️ It's very easy to add localised aliases for the names of function provided by the standard library make it easy for non-English speaking programmers to use it too.
</aside>
// AskScript uses UTF-8 file encoding
const dużeLitery = upperCase
ask {
query {
name :dużeLitery
}
}
// Next versions of AskQL:
ask(language: 'pl') {
query {
imię :dużeLitery
}
}