From: Seth Burleigh <wburle@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [babel][bug] \ in detangling
Date: Thu, 13 Jan 2011 11:54:55 -0600 [thread overview]
Message-ID: <AANLkTinJp79RL3L4s=6XbKDbJv=fJPW-8b4_n53QdCNN@mail.gmail.com> (raw)
In-Reply-To: <AANLkTikuUv4fqM6Ka2CqdMN46bM1oxeEZeiuVTD0AhS_@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 159 bytes --]
Ive attached the file it fails on. Notice that it fails below the constants
macro, but if you're above it, it will succeed since it wont find the [[name
val]]
[-- Attachment #1.2: Type: text/html, Size: 163 bytes --]
[-- Attachment #2: general.clj --]
[-- Type: application/octet-stream, Size: 4179 bytes --]
;; [[file:~/Dropbox/.rep/clj-forex/clj-forex.org::*General][forex-util-general]]
(ns forex.util.general
(:use utils.general forex.util.spawn forex.util.log)
(:import (org.joda.time DateTime DateTimeZone Instant)))
(deftype AtomHash [val]
Object
(toString [this] (str "<AtomHash " @val ">"))
clojure.lang.IPersistentMap
;;ILookup
(valAt [this key] (get @val key))
(valAt [this key notfound] (get @val key notfound))
;;IPersistentCollection
(count [this] (.count @val))
(empty [this] {})
(cons [this e] (.cons @val e))
(equiv [this gs] (or (identical? this gs)
(when (identical? (class this) (class gs))
(.equiv @val) gs)))
(containsKey [this k] (or (and (get @val k) true) false))
(entryAt [this k] (get @val k))
;;Seqable
(seq [this] (seq @val))
;;Associative
(assoc [this k g] (assoc @val k g))
(assocEx [this k g] (assoc this k g))
(without [this k] (.without @val k))
clojure.lang.IDeref
(deref [this] @val))
(defmethod clojure.core/print-method AtomHash [o w]
(.write w (.toString o)))
(defn atom-hash [val]
(is (map? val))
(AtomHash. (atom val)))
(defn symbolicate
"symbolicate symbols together. ignores things like whitespaces, just drops them!"
[& args]
(symbol (apply str args)))
;;TODO: add support for waiting on multiple objects, including sockets!
(defprotocol PWait
(wait-for [this timeout units] [this timeout]))
;;copied from clojure source, but adding timeout wait-for
(defn beg
"Alpha - subject to change.
Returns a promise object that can be read with deref/@, and set,
once only, with deliver. Calls to deref/@ prior to delivery will
block. All subsequent derefs will return the same delivered value
without blocking."
{:added "1.1"}
[]
(let [d (java.util.concurrent.CountDownLatch. 1)
v (atom nil)]
(reify
clojure.lang.IDeref
(deref [_] (.await d) @v)
PWait
(wait-for [this timeout]
(wait-for this timeout
java.util.concurrent.TimeUnit/MILLISECONDS))
(wait-for [this timeout units]
(if timeout
(.await d timeout units)
(do (.await d) true)))
clojure.lang.IFn
(invoke [this x]
(locking d
(if (pos? (.getCount d))
(do (reset! v x)
(.countDown d)
x)
(throw
(IllegalStateException.
"Multiple deliver calls to a promise"))))))))
(defn give
"Alpha - subject to change.
Delivers the supplied value to the promise, releasing any pending
derefs. A subsequent call to deliver on a promise will throw an exception."
{:added "1.1"}
[promise val]
(promise val))
(defmacro awhen [test & body]
`(when-let [~'it ~test]
~@body))
(defmacro naive-var-local-cache-strategy [var]
`(let [cache# (atom {})]
(reify PCachingStrategy
(retrieve [_ item#] (get @cache# item#))
(cached? [_ item#] (contains? @cache# item#))
(hit [this# _] this#)
(miss [this# item# result#]
(reset! cache# (swap! ~var assoc item# result#))
this#))))
(defmacro constants [& args]
`(do ~@(map (fn [[name val]] `(def ~name ~val)) (group args 2))))
(defmacro spawn-log [func]
`(spawn (fn [] (try (~func) (catch Exception e#
(.printStackTrace e#) (severe e#))))))
(defonce *env* (atom {:timeframe 1440 :symbol "EURUSD"})) ;default +D1+, EURUSD
(defn env [key] (key @*env*))
(defn env! [map]
(swap! *env* #(merge % map))
map)
;;todo: fix private!
;;todo: ignores all nils?
(defmacro wenv [[& args] & body]
`(binding [forex.util.general/*env*
(atom (merge @@~#'*env* (hash-map ~@args)))]
~@body))
(defmacro with-write-lock [l & body]
`(let [obj# ~l]
(try (do (.lock (.writeLock obj#)) ~@body)
(finally (.unlock (.writeLock obj#))))))
(defmacro with-read-lock [l & body]
`(let [obj# ~l]
(try (do (.lock (.readLock obj#)) ~@body)
(finally (.unlock (.readLock obj#))))))
;; forex-util-general ends here
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next prev parent reply other threads:[~2011-01-13 17:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-13 16:27 [babel][bug] \ in detangling Seth Burleigh
2011-01-13 17:01 ` Eric Schulte
2011-01-13 17:16 ` Seth Burleigh
2011-01-13 17:54 ` Seth Burleigh [this message]
2011-01-13 21:09 ` Eric Schulte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='AANLkTinJp79RL3L4s=6XbKDbJv=fJPW-8b4_n53QdCNN@mail.gmail.com' \
--to=wburle@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=schulte.eric@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).