667 search results for ""

Showing 651 - 667
  1. Sets

    Filtering a Set

    The function StringSet.filter of type (string -> bool) -> StringSet.t -> StringSet.t creates a new set by keeping the elements that satisfy a predicate from an existing set.

    Data Structures
  2. Profiling

    .data

    .long writes a word (4 bytes) to the current segment. .byte writes a single byte. .ascii writes a string of bytes (NOT nul-terminated). .space writes the given number of zero bytes. Normall

    Guides
  3. Maps

    Filtering a Map

    To filter a map, use the filter function. It takes a predicate to filter entries and a map. It returns a new map containing the entries satisfying the predicate.

    Data Structures
  4. Preprocessors and PPXs

    PPXs

    PPxs are a different kind of preprocessor—one that does not run on the textual source code, but rather on the parsing result: the Abstract Syntax Tree (AST), which in the OCaml compiler is call

    Advanced Topics
  5. Arrays

    Length of an Array

    The Array.length function returns the size of an array:

    Data Structures
  6. File Manipulation

    Example

    <!-- $MDX dir=examples --> We can compile and run this example: <!-- $MDX file=examples/file_manip.ml -->

    Tutorials
  7. Maps

    Map a Map

    The keys are the same in both maps. For each key, a value in lucky_numbers is converted into a value in lucky_strings using string_of_int . Using StringMap.map , we create a map associatin

    Data Structures
  8. Sets

    Conclusion

    We gave an overview of OCaml's Set module by creating a StringSet module using the Set.Make functor. Further, we looked at how to create sets based on a custom comparison function. For more in

    Data Structures
  9. Sets

    Union of Two Sets

    With the function StringSet.union , we can compute the union of two sets.

    Data Structures
  10. Sets

    Working With Sets

    Let's look at a few functions for working with sets using these two sets.

    Data Structures
  11. Maps

    Conclusion

    For more information, refer to Map in the Standard Library documentation. This was an overview of OCaml's Map module. Maps are reasonably efficient and can be an alternative to the imperativ

    Data Structures
  12. Maps

    Working With Maps

    Throughout the rest of this tutorial, we will use the following map:

    Data Structures
  13. Configuring Your Editor

    Vim

    After installing Merlin above, instructions will be printed on how to link Merlin with your editor. If you do not have them visible, just run this command: For Vim, we won't use the LSP server b

    Tooling
  14. Profiling

    .text

    Text is the Unix way of saying "program code". The text segment simply means the part of the executable where program code is stored. The .text directive switches the assembler so it starts w

    Guides
  15. Operators

    Goals

    Using operators as functions and reciprocally, using functions as operators Assign the right associativity and precedence to a custom operator Use and define custom let binders The learning goals o

    Advanced Topics
  16. First-Class Modules

    Heterogeneous Collections

    Module System
  17. First-Class Modules

    Plugin Registry

    Module System