Git Product home page Git Product logo

phrase-search's Introduction

phrase-search

Purpose

This program takes 2 inputs (phrase, directory path) and outputs a list of files that contain the search phrase in the directory path. Matched files must be output on separate lines.

Scala was selected for this program to satisfy some of the constraints that had been placed on solving this problem. It has given me an opportunity to get some hands on experience developing with this language

Constraints

  • Coded in a statically compiled and type-checked language
  • Runtime casts are forbidden
  • Functional Programming
    • Everything should be representable as a function
    • Immutable: every abstraction should be used in an immutable manner. It is permissible to have mutable code hidden beneath the covers (for an abstraction), but try and avoid it unless there’s real need for it.
  • Type Safety
  • Recursion
    • recursion (open or closed) is the only kind of looping construct permitted. ie.ie, no "for" loops
  • OS/Platform
    • must compile and run on Ubuntu 14.04 LTS (64-bit)

Installation

This project makes use of Scala's Build Tool (SBT). SBT handles the projects dependencies, and will download any of the necessary libraries. The latest package of SBT at the writing of this readme is 0.13.7. To install SBT on Ubuntu 14.04 follow the instructions below.

wget https://dl.bintray.com/sbt/debian/sbt-0.13.7.deb
sudo dpkg -i sbt-0.13.7.deb

Compile, Test, and Run

Now that sbt is installed on your system, you can compile, test, and run the application directly from their console. First start the sbt console by:

sbt

To compile, type the following into the sbt console. Note that upon first run, compile will take a little longer as SBT downloads the projects dependencies.

compile

To test, type the following into the sbt console.

test

To run, type the following into the sbt console, then follow the console prompts from the application.

run

There are some sample files that are included with this application if you don't have a folder set up yet, and still want to try running it. The folder path for those files is 'src/test/resources/files'. The search string can also include regex. For example, if you want to do a case insensitive search, add '(?i)' to the beginning of your search string.

Please enter search string:
(?i)everything

phrase-search's People

Contributors

chewbakartik avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.