some small example using s-expressions

David House dhouse at janestreet.com
Wed Nov 21 09:45:39 GMT 2012


Sure.

On Wed, Nov 21, 2012 at 9:38 AM, Malcolm Matalka <mmatalka at gmail.com> wrote:
> Is that for Async? What if I'm in the synchronous world?  I've been
> using Sexp.of_string and Sexp.to_string_hum, is that correct?
>
> /M
>
> David House <dhouse at janestreet.com> writes:
>
>> I'm not sure about the build side, but the usage is very simple. You
>> do indeed just say "with sexp" on every type you want to be sexpable,
>> in both the .ml and .mli.
>>
>> You will then have two new functions:
>>
>> t_of_sexp : Sexp.t -> t
>> sexp_of_t : t -> Sexp.t
>>
>> (Replace "t" with the name of your type throughout.)
>>
>> You can use these with, e.g., Writer.write_sexp(s), Reader.load_sexp(s).
>>
>> On Wed, Nov 21, 2012 at 8:31 AM, Malcolm Matalka <mmatalka at gmail.com> wrote:
>>> https://github.com/avsm/ocaml-tutorial/tree/master/examples/broker
>>>
>>> Francois Berenger <francois.berenger.working at gmail.com> writes:
>>>
>>>> Hello,
>>>>
>>>> I am looking for some introduction to using s-expressions.
>>>>
>>>> A small and simple example would be enough
>>>> for me to get started:
>>>>
>>>> I'd like to know:
>>>> - what to change in my code to enable them (just add ' with sexp' after
>>>> some type declaration?)
>>>> - what to change in my build system to enable them (I use oasis)
>>>>
>>>> Thanks a lot,
>>>> Francois.



More information about the core mailing list