Giter VIP home page Giter VIP logo

kdlcl's Introduction

kdlcl

KDL reader/writer for Common Lisp.

Interface

Reading a document

(in-package :kdl-user)
(read-document stream) ; dispatches to `from-stream'
(read-document string) ; dispatches to `from-string'
(read-document filespec) ; dispatches to `from-file'

Working with the document

These getters all have setf forms too.

(in-package :kdl-user)

;; Get the value from a value cons cell
(value value)

;; Get the type from a value cons cell
(value-type value)

;; Get the name of a property
(property-name property)

;; Get the value from a property
(property-value property)

;; Get the value-type from a property
(property-type property)

;; Get the name of a node
(node-name node)

;; Get the properties from a node
(node-properties node)

;; Get the children from a node
(node-children node)

;; get the second child
(node-child node 1)

;; Get the type of a node
(node-type node)

Writing the document

(in-package :kdl-user)
(to-stream kdl-document)
(to-string kdl-document)
(to-file kdl-document)

Quirks

This implementation of KDL is spec-compliant, but the test-cases differ from the official test-cases is a few ways:

Properties

Like kdl-rs, multiple properties with the same name are allowed and all duplicated will be preserved.

Really large numbers

Very big floats max out at *most-positive-double-float*. For example:

Input
chubby-number 1e1000
Output
chubby-number 1.7976931348623157e308

Exponent representation

  • Exponents use lowercase e
    official tests
    1.1E-100
    :kdl/t
    1.1e-100
  • Positive exponents have no plus
    official tests
    1.1E+100
    :kdl/t
    1.1e100
  • Non-integer numbers always have a decimal point:
    official tests
    1E+100
    :kdl/t
    1.0e100

Lisp implementation differences

The tests for the exponent formats are based on the output from SBCL. The library works on at least GNU CLISP and ECL, but the floating point number output is in a different format. For instance, ECL prints the floats in this cute fashion: 1.e10.

I haven’t been able to test on any other implementations yet because I can’t get them running on my computer :o(

MIT-0

kdlcl's People

Contributors

chee avatar

Stargazers

 avatar  avatar

Watchers

 avatar

kdlcl's Issues

Unlicense?

You seem a bit undecided about the license. I had never heard of MIT-0 before...

I strongly recommend the Unlicense, which I have been using for all my open-source projects (except one) for more than a decade. One advantage is that the Unlicense is much more popular than MIT-0. (Fun fact: the Unlicense is listed as a choice in the shortlist of recommended licenses when you create a new repo on GitHub!)

For your consideration. :)

KDL 2.0 compliance

KDL 2.0.0-draft.3 is now generally available (kdl-org/kdl#286), and with it, we've decided to encourage existing implementations to start working towards 2.0 support and send feedback and suggestions for anything you might run into, so I'm making this tracking issue. :)

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.