kandi background
Explore Kits

litil | The Litil programming language | Functional Programming library

 by   jawher Java Version: Current License: MIT

 by   jawher Java Version: Current License: MIT

Download this library from

kandi X-RAY | litil Summary

litil is a Java library typically used in Programming Style, Functional Programming applications. litil has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has low support. You can download it from GitHub.
This is the first post of a series where I’ll talk about the different techniques I’ve used to create a parser and un evaluator for the Litil™ programming language in Java. However, please keep the following in mind:. This is still work in progress, this a a bare-bones languages: no REPL, no tools, no language spec, nothing but code, and even that isn’t that pretty to look at not particularly clean or organized. Here’s a quick overview of the Litil language.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • litil has a low active ecosystem.
  • It has 19 star(s) with 1 fork(s). There are 2 watchers for this library.
  • It had no major release in the last 12 months.
  • litil has no issues reported. There are 1 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of litil is current.
litil Support
Best in #Functional Programming
Average in #Functional Programming
litil Support
Best in #Functional Programming
Average in #Functional Programming

quality kandi Quality

  • litil has 0 bugs and 0 code smells.
litil Quality
Best in #Functional Programming
Average in #Functional Programming
litil Quality
Best in #Functional Programming
Average in #Functional Programming

securitySecurity

  • litil has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • litil code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
litil Security
Best in #Functional Programming
Average in #Functional Programming
litil Security
Best in #Functional Programming
Average in #Functional Programming

license License

  • litil is licensed under the MIT License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
litil License
Best in #Functional Programming
Average in #Functional Programming
litil License
Best in #Functional Programming
Average in #Functional Programming

buildReuse

  • litil releases are not available. You will need to build from source code and install.
  • Build file is available. You can build the component from source.
  • Installation instructions are not available. Examples and code snippets are available.
litil Reuse
Best in #Functional Programming
Average in #Functional Programming
litil Reuse
Best in #Functional Programming
Average in #Functional Programming
Top functions reviewed by kandi - BETA

kandi has reviewed litil and discovered the below as its top functions. This is intended to give you an instant insight into litil implemented functionality, and help decide if they suit your requirements.

  • Root scope .
    • Dumps this class as byte array .
      • Test if input matches pattern
        • Dumps the class as byte array .
          • unify two types
            • Consumes a token and returns it .
              • Given a list of combins returns a list of strings that are missing .
                • Parses nd .
                  • Get the parameterized type .
                    • Reads a data declaration .

                      Get all kandi verified functions for this library.

                      Get all kandi verified functions for this library.

                      litil Key Features

                      A functional language heavily inspired by ML, (O)Caml, Haskell and [Roy](http://roy.brianmckenna.org/)

                      Full [Hindley Milner](http://en.wikipedia.org/wiki/Hindley-Milner_type_inference) type inference

                      [Python like use of indentation to define blocs](http://en.wikipedia.org/wiki/Off-side_rule)

                      Supported types: numerics, strings, characters and boolean, [tuples](http://en.wikipedia.org/wiki/Tuple), [records](http://en.wikipedia.org/wiki/Record_\(computer_science\)) and [ADTs](http://en.wikipedia.org/wiki/Algebraic_data_type)

                      [pattern matching](http://en.wikipedia.org/wiki/Pattern_matching)

                      [curried functions](http://en.wikipedia.org/wiki/Currying) by default

                      [closures](http://en.wikipedia.org/wiki/Closure_\(computer_science\))

                      exceptions (try/catch/throw)

                      assignment, expressions & functions

                      copy iconCopydownload iconDownload
                      let fact n =
                        if n <= 2 then
                          2
                        else
                          n * fact (n-1)
                      
                      let f5 = fact 5

                      tuples & records

                      copy iconCopydownload iconDownload
                      let x = (5, "a")
                      let person = {name: "lpe", age: 12}

                      destructuring

                      copy iconCopydownload iconDownload
                      let (a, b) = (4, "d")
                      
                      let d = ((4, true), ("test", 'c', a))
                      
                      let ((_, bool), (_, _, _)) = d

                      algebraic data types

                      copy iconCopydownload iconDownload
                      data Option a = Some a | None
                      
                      let o = Some "thing"
                      
                      data List a = Cons a (List a) | Nil
                      
                      let l = Cons 5 (Cons 6 Nil)
                      
                      data Tree a = Null | Leaf a | Node (Tree a) a (Tree a)
                      
                      let t = Node (Leaf 5) 4 (Leaf 3)

                      pattern matching

                      copy iconCopydownload iconDownload
                      let len l =
                        match l
                          []     => 0
                          _ :: t => 1 + len t
                      
                      len [1, 2, 3]

                      partial application

                      copy iconCopydownload iconDownload
                      let add x y = x + y
                      
                      let inc = add 1
                      
                      let three = inc 2

                      closures & higher-order functions

                      copy iconCopydownload iconDownload
                      let map f xs =
                        match xs
                          []     => Nil
                          h :: t => (f h) :: (map f t)
                      
                      let l = [1, 2]
                      
                      let double x = 2 * x
                      
                      -- pass a function by name
                      let l2 = map double l
                      
                      -- or simply a lambda
                      let l2 = map (\x => 2 * x) l
                      
                      let a = 4
                      let f = \x => a * x -- f captures the lexical value of a, i.e. 4
                      let a = 5
                      f 5

                      Community Discussions

                      Trending Discussions on Functional Programming
                      • How do purely functional languages handle index-based algorithms?
                      • Haskell comparing two lists' lengths but one of them is infinite?
                      • Why is `forever` in Haskell implemented this way?
                      • Memoize multi-dimensional recursive solutions in haskell
                      • Why is my Haskell function argument required to be of type Bool?
                      • Vector of functions in APL
                      • What's the theoretical loophole that allows F# (or any functional language) to apply a function mulitple times on the same input
                      • Is Control.Monad.Reader.withReader actually Data.Functor.Contravariant.contramap?
                      • Confused about evaluation of lazy sequences
                      • What is the relation between syntax sugar, laziness and list elements accessed by index in Haskell?
                      Trending Discussions on Functional Programming

                      QUESTION

                      How do purely functional languages handle index-based algorithms?

                      Asked 2022-Apr-05 at 12:51

                      I have been trying to learn about functional programming, but I still struggle with thinking like a functional programmer. One such hangup is how one would implement index-heavy operations which rely strongly on loops/order-of-execution.

                      For example, consider the following Java code:

                      public class Main {
                          public static void main(String[] args) {
                              List<Integer> nums = Arrays.asList(1,2,3,4,5,6,7,8,9);
                              System.out.println("Nums:\t"+ nums);
                              System.out.println("Prefix:\t"+prefixList(nums));
                          }
                        
                          private static List<Integer> prefixList(List<Integer> nums){
                            List<Integer> prefix = new ArrayList<>(nums);
                            for(int i = 1; i < prefix.size(); ++i)
                              prefix.set(i, prefix.get(i) + prefix.get(i-1));
                            return prefix;
                          }
                      }
                      /*
                      System.out: 
                      Nums:   [1, 2, 3, 4, 5, 6, 7, 8, 9]
                      Prefix: [1, 3, 6, 10, 15, 21, 28, 36, 45]
                      */
                      

                      Here, in the prefixList function, the nums list is first cloned, but then there is the iterative operation performed on it, where the value on index i relies on index i-1 (i.e. order of execution is required). Then this value is returned.

                      What would this look like in a functional language (Haskell, Lisp, etc.)? I have been learning about monads and think they may be relevant here, but my understanding is still not great.

                      ANSWER

                      Answered 2022-Mar-07 at 21:17

                      This is not an index-heavy operation, in fact you can do this with a one-liner with scanl1 :: (a -> a -> a) -> [a] -> [a]:

                      prefixList = scanl1 (+)
                      

                      indeed, for the list of Nums, we get:

                      Prelude> prefixList [1 .. 9]
                      [1,3,6,10,15,21,28,36,45]
                      

                      scanl1 takes the first item of the original list as initial value for the accumulator, and yields that. Then each time it takes the accumulator and the next item of the given list, and sums these up as new accumulator, and yields the new accumulator value.

                      Often one does not need indexing, but enumerating over the list is sufficient. Imperative programming languages often work with for loops with indexes, but in many cases these can be replaced by foreach loops that thus do not take the index into account. In Haskell this also often helps to make algorithms more lazy.

                      If you really need random access lookups, you can work with data structures such as defined in the array and vector packages.

                      Source https://stackoverflow.com/questions/71387267

                      Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                      Vulnerabilities

                      No vulnerabilities reported

                      Install litil

                      You can download it from GitHub.
                      You can use litil like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the litil component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

                      Support

                      For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

                      DOWNLOAD this Library from

                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                      over 430 million Knowledge Items
                      Find more libraries
                      Reuse Solution Kits and Libraries Curated by Popular Use Cases
                      Explore Kits

                      Save this library and start creating your kit

                      Share this Page

                      share link
                      Consider Popular Functional Programming Libraries
                      Try Top Libraries by jawher
                      Compare Functional Programming Libraries with Highest Support
                      Compare Functional Programming Libraries with Highest Quality
                      Compare Functional Programming Libraries with Highest Security
                      Compare Functional Programming Libraries with Permissive License
                      Compare Functional Programming Libraries with Highest Reuse
                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                      over 430 million Knowledge Items
                      Find more libraries
                      Reuse Solution Kits and Libraries Curated by Popular Use Cases
                      Explore Kits

                      Save this library and start creating your kit

                      • © 2022 Open Weaver Inc.