Scheme's commonly used small functions
Clone or download
Latest commit 493b208 Jan 15, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test clean up Nov 16, 2018
.gitattributes Create .gitattributes Aug 30, 2018
.gitignore update readme Oct 24, 2018
LICENSE update Jan 11, 2019
README.md add core async and core io Nov 16, 2018
alist.sc update Jan 11, 2019
async.sc clean up Nov 16, 2018
condition.sc update Jan 11, 2019
configuration.sc serveral updates Jan 7, 2019
data.sc add set support Jan 15, 2019
exception.sc update Jan 11, 2019
generic.sc update Jan 11, 2019
io.sc serveral updates Jan 7, 2019
loop.sc Merge pull request #16 from Syntacticlosure/master Jan 15, 2019
package.sc Update package.sc Oct 27, 2018
parser.sc serveral improvements Dec 7, 2018
string.sc update Jan 11, 2019
syntax.sc great improvement of for : more optimizations , support in-stream Nov 10, 2018

README.md

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