Code Monkey home page Code Monkey logo

custom_lib's Introduction

custom_lib

by Derek Huang

last updated on: 11-23-2018
file created on: 08-29-2018

This directory will contain C source and header files that implement useful functions and data structures that are not part of the standard core C library. Credit is attributed as appropriate.

It is quite tedious to implement things from scratch over and over again. These also serve as a fun programming exercise for a beginner like me.

A minor annoyance with markdown: line breaks are created by putting two spaces after a line of text. So it's very difficult to tell visually where the line break is...

Function/struct declarations

d_array.c, d_array.h:
struct d_array {
    void *a;
    size_t e_siz, siz, max_siz;
    char *(*__tostr_el)(const void *);
    char *t__;
    char sep, pr_c, ps_c;
};
typedef struct d_array d_array;

char *d_array__tostr(d_array *da, size_t si, size_t ei);
d_array *d_array__new(size_t n, size_t e, char *(*__tef)(const void *), const char *__t,
		      char __sep, char __pr_c, char __ps_c);
void d_array__insert(d_array *da, void *e, size_t i);
void d_array__append(d_array *da, void *e);
void d_array__remove(d_array *da, size_t i);
void *d_array__get(d_array *da, size_t i);
void d_array__getcpy(void *p, d_array *da, size_t i);
void d_array__set(d_array *da, size_t i, void *p);
void d_array__free(d_array *da);
stats.c, stats.h:
double normalcdf(double x, double mu, double s);
double normalpdf(double x, double mu, double s);
strh_table.c, strh_table.h:
struct ht_node {
    char *str;
    struct ht_node *next;
};
typedef struct ht_node ht_node;

struct h_table {
    ht_node **table;
    int siz;
}
typedef struct h_table h_table;

h_table *new_h_table(int s);
int hfunc(char *s, int siz);
void h_table_insert(h_table *ht, char *s);
int h_table_nsearch(h_table *ht, char *s);
void free_h_table(h_table *ht);

Todo: implement LCG, xorshift+ (128plus?)

custom_lib's People

Contributors

phetdam avatar

Watchers

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.