Giter Site home page Giter Site logo

core's Introduction

Core

Scheme's commonly used small functions

(core alist)

(ref association-list key)

=> value or #f

(val association-list value)

=> key or #f

(alter association-list key value)

=> new association-list which has been modified by key

(drop association-list key)

=> new association-list with drop the key's pair

(push association-list key value)

=> new association-list which add a new pair by right

(pop association-list)

=> procedure call by rightest pair et new association-list which drop the rightest pair

(insert association-list key value)

=> new association-list which add a new pair by left

(eject association-list)

=> procedure call by leftest pair et new association-list which drop the leftest pair

(alter! association-list key value)

=> #t for success #f for fails, the old association-list will be modified by key

(drop! association-list key)

=> #t for success #f for fails, the old association-list will be modified: the key's pair is dropped

(push! association-list key value)

=> #t for success, the old association-list will be modified: add a key value pair by right

(pop! association-list)

=> pair, take the rightest pair, and delete it in the old association-list

(insert! association-list key value)

=> #t for success, the old association-list will be modified: add a key value pair by left

(eject! association-list)

=> pair, take the leftest pair, and delete it in the old association-list

(alist->vector association-list)

((0 . value1)(1 . value2)(2 . value3) ...) => #(value1 value2 value3 ...)

(vector->alist vector)

#(value1 value2 value3 ...) => ((0 . value1)(1 . value2)(2 . value3) ...)

(core string)

(split string char)

=> list

(core exception)

(try procedure (catch procedure))

(core loop)

(for variable in collection do-something ...)

(for/sum variable in collection do-something ...)

=> sum of (begin do-something ...)s

(for/list variable in collection do-something ...)

=> list of (begin do-something ...)s

(for/vector variable in collection do-something ...)

=> vector of (begin do-something ...)s

(for/min variable in collection do-something ...)

=> min number of (begin do-something ...)s

(for/max variable in collection do-something ...)

=> max number of (begin do-something ...)s

(core string)

(split str char)

=> list of substrings of str that are separated by char

(split* str char)

=> list of substrings of str that are separated by char, but ignore emputy string

(string-split str sep)

=> list of substrings of str that are separated by string sep

(string-prefix? str pref)

=> if pref is the prefix of str,return true,otherwise false.

(string-find str to-find)

=> list of pairs (positions of to-find in the string str)

(string-replace str <from:string or listof string> <to:string or listof string>)

=> string that froms are replaced by to

core's People

Contributors

guenchi avatar syntacticlosure avatar

Watchers

 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.