Changeset 27259 in project


Ignore:
Timestamp:
08/18/12 14:48:02 (9 years ago)
Author:
Moritz Heidkamp
Message:

clojurian: Document version 0.0.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/clojurian

    r26734 r27259  
    88=== Overview
    99
    10 Currently the only module provided by this egg is {{clojurian-syntax}}.
     10Currently this egg provides two modules: {{clojurian-syntax}} and
     11{{clojurian-atom}}.
    1112
    1213=== Modules
     
    9495
    9596
     97<syntax>(if-let (var val) then else)</syntax>
     98
     99Equivalent to {{(let ((var val)) (if var then else))}}.
     100
     101
     102<syntax>(if-let* ((x1 y1) (x2 y2) ...) then else)</syntax>
     103
     104Equivalent to {{(or (and-let* ((x1 y1) (x2 y2) ...) then) else)}}.
     105
     106
     107==== clojurian-atom (experimental)
     108
     109This module provides an implementation of
     110[[http://clojure.org/atoms|Clojure's atom reference type]]. It is in
     111an experimental state right now and only provides the very basic
     112functionality, e.g. validators and watches are still missing. Note
     113that atoms only work with immutable data structures so they can't be
     114used to coordinate updates of record slots, for example.
     115
     116
     117<procedure>(atom value)</procedure>
     118
     119Returns and atom with the given initial {{value}}.
     120
     121
     122<procedure>(atom? x)</procedure>
     123
     124Checks whether {{x}} is an atom.
     125
     126
     127<procedure>(atom-value atom)</procedure>
     128
     129Returns the current value of {{atom}}.
     130
     131
     132<procedure>(compare-and-set! atom old new)</procedure>
     133
     134Atomically sets the value of {{atom}} to {{new}} if its current value
     135is {{eq?}} to the given {{old}} value. Returns {{#t}} if the update
     136was successful and {{#f}} if not.
     137
     138
     139<procedure>(swap! atom proc . args)</procedure>
     140
     141Atomically swaps the value of {{atom}} to be {{(apply proc (atom-value
     142atom) args)}}. Because {{proc}} may be called multiple times it must
     143be free of side-effects. Returns the new value of {{atom}}.
     144
     145
     146<procedure>(reset! atom value)</procedure>
     147
     148Sets the value of {{atom}} to {{value}}. Returns {{value}}.
     149
     150
    96151=== About this egg
    97152
     
    110165==== Version history
    111166
     167; 0.0.2 : Add {{if-let}}, {{if-let*}} and {{clojurian-atom}}
    112168; 0.0.1 : Initial release
    113169
Note: See TracChangeset for help on using the changeset viewer.