[Q] What would be the best approach or design for converting this common lisp code?

110 views
Skip to first unread message

Sungjin Chun

unread,
Dec 18, 2015, 5:07:38 PM12/18/15
to Clojure
Hi,


If you look at the code, the main trading agent is designed using inheritance and the main
operation (consume) function mainly depends upon mutable update of agent's states.

As far as I know Clojure does not permit attribute inheritance and this kind of state update is
not recommended approach. 

What would be the best approach in Clojure?

Thank you in advance and sorry for my poor english.

Stuart Sierra

unread,
Dec 20, 2015, 3:38:59 PM12/20/15
to Clojure
Hi Sungjin,

Although Clojure draws from the long history of Lisps, it is very much its own language. In particular, the emphasis on immutable data by default makes Clojure very different from both Common Lisp and Scheme. Porting code from another Lisp to Clojure will usually require a complete redesign.

Based on looking very briefly at the code you linked to, it looks like it might be some kind of agent-based simulation. Clojure's Agents may be something worth exploring: http://clojure.org/agents

–S

Sungjin Chun

unread,
Dec 20, 2015, 4:47:47 PM12/20/15
to Clojure
Thank you for your response. I thought that the transducer based approach combined with core.async channel could be a solution.

I'll check for the agent thing.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/Io1CyKo9Rlw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages