### Dart: Map Over List Source: https://gitlab.com/upstash/context7test/-/blob/main/docs/api.md Dart example mapping over a list and printing the result. ```dart void main() { final nums = [1,2,3,4,5]; final tripled = nums.map((n) => n * 3).toList(); print(tripled); } ``` -------------------------------- ### TypeScript: Typed User Model and Formatting Source: https://gitlab.com/upstash/context7test/-/blob/main/docs/guide.md Demonstrates TypeScript's type safety with a user interface and a function to format user information. Use this for examples of strong typing in TypeScript. ```typescript interface User { id: number; name: string; active: boolean } function formatUser(u: User): string { return `${u.id}:${u.name}:${u.active}` } console.log(formatUser({ id: 1, name: 'Ada', active: true })); ``` -------------------------------- ### Go: Minimal HTTP Server Source: https://gitlab.com/upstash/context7test/-/blob/main/docs/guide.md A basic HTTP server in Go that responds with a greeting. It illustrates the usage of the net/http package for creating simple web services. ```go package main import ( "fmt" "net/http" ) func main(){ http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request){ fmt.Fprintln(w, "Hello from Go!") }) http.ListenAndServe(":8080", nil) } ``` -------------------------------- ### Julia: Generate Cubes using List Comprehension Source: https://gitlab.com/upstash/context7test/-/blob/main/README.md Generates a list of cubes for numbers in a given range using Julia's list comprehension syntax. Prints the resulting list. ```julia nums = 1:5 cubes = [n^3 for n in nums] println(cubes) ``` -------------------------------- ### C#: LINQ Query for Filtering and Projection Source: https://gitlab.com/upstash/context7test/-/blob/main/docs/guide.md Filters and projects a sequence of numbers using C# LINQ to demonstrate expressive collection manipulation. This is useful for showcasing LINQ's capabilities. ```csharp using System; using System.Linq; class Program { static void Main(){ var nums = new[]{1,2,3,4,5}; var squares = nums.Where(n=>n%2==1).Select(n=>n*n); Console.WriteLine(string.Join(",", squares)); } } ``` -------------------------------- ### Bash: Count Files in Current Directory Source: https://gitlab.com/upstash/context7test/-/blob/main/README.md Counts the number of files in the current directory using `ls` and `wc -l`. Outputs the count prefixed with 'Files: '. ```bash FILES=$(ls | wc -l) echo "Files: $FILES" ``` -------------------------------- ### PHP: JSON Response Source: https://gitlab.com/upstash/context7test/-/blob/main/docs/api.md Outputs a JSON response in PHP for a simple API endpoint. Illustrates header setting and encoding. ```php 'ok', 'time' => time()]); ``` -------------------------------- ### Haskell: Filter Odd Numbers and Square Them Source: https://gitlab.com/upstash/context7test/-/blob/main/README.md Filters a list of numbers to keep only odd ones, then squares each of them. Prints the resulting list. ```haskell main :: IO () main = print $ map (^2) $ filter odd [1..10] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.