sorting a list based on the order of its items in another list

2017-12-12 Thread Deyan Yotsov
Hello, I have one list of potentially up to 2 million strings: big-list. Then I have another list, small-list, the elements of which are a subset of the elements of big-list. I want to sort the elements in small-list so that they become sorted in the same way in which they are sorted in big-

Re: sorting a list based on the order of its items in another list

2017-12-12 Thread Deyan Yotsov
PS: I just realized that the code, as I wrote it, will not work, as nesting of # is forbidden. My actual code is: (defn is-element-in-list [e l]   (some #{e} l)) (filter #(is-element-in-list % small-list) big-list) Sorry about that. Deyan On 12/12/2017 02:24 PM, Deyan Yotsov wrote: Hello,

Re: sorting a list based on the order of its items in another list

2017-12-12 Thread Gary Trakhman
How about (filter (set small-list) big-list) ? On Dec 12, 2017 8:25 AM, "Deyan Yotsov" wrote: > Hello, > > I have one list of potentially up to 2 million strings: big-list. > > Then I have another list, small-list, the elements of which are a subset > of the elements of big-list. > > I want to s

Re: sorting a list based on the order of its items in another list

2017-12-12 Thread Ray Miller
Very similar to your solution: (filter (set small-list) big-list) On 12 December 2017 at 13:24, Deyan Yotsov wrote: > Hello, > > I have one list of potentially up to 2 million strings: big-list. > > Then I have another list, small-list, the elements of which are a subset > of the elements of big

Re: sorting a list based on the order of its items in another list

2017-12-12 Thread Deyan Yotsov
Thank you very much, Ray Miller and Gary Trakhman! On 12/12/2017 02:32 PM, Ray Miller wrote: Very similar to your solution: (filter (set small-list) big-list) On 12 December 2017 at 13:24, Deyan Yotsov > wrote: Hello, I have one list of potentially up to 2 m

Loading deps.edn Dynamically in Clojure 1.9

2017-12-12 Thread Asim Jalis
Is it possible to load deps.edn dynamically without restarting the REPL in Clojure 1.9? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - plea

Re: functional implementation of core.async primitives

2017-12-12 Thread Divyansh Prakash
Hi, @halgari! The JS port actually does have this, just haven't found the time to port it back. But basically we can define something like: (defn goloop* > [f initial-state] > (letfn [(recur+ [state] > (goloop* f state))] > (go > (f recur+ initial-state > > > (defmac

Re: functional implementation of core.async primitives

2017-12-12 Thread Divyansh Prakash
In fact, the JS implementation is much ahead of the Clojure version as of right now - with a better parking algorithm and `goconsume` for creating actors that park on read from a channel in an implicit loop. -- You received this message because you are subscribed to the Google Groups "Clojure"

Re: functional implementation of core.async primitives

2017-12-12 Thread Divyansh Prakash
Just remembered that I did give an example in the README, a port of braveclojure's hotdog machine. (defn hot-dog-machine > [in out hot-dogs-left] > (when (> hot-dogs-left 0) > (go (if (= 3 input) > (go>! [out "hot dog"] > (hot-dog-machine in out (dec hot-dogs-left)

Loading deps.edn Dynamically in Clojure 1.9

2017-12-12 Thread Alex Miller
No, although there are a couple external projects along these lines ... https://github.com/RutledgePaulV/clj-embed And also people are poking on things like this in boot pods. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, se

Re: functional implementation of core.async primitives

2017-12-12 Thread Divyansh Prakash
I just added `goloop` and `goconsume` to the Clojure implementation, with version of `recur` called `gorecur`. *Example:* > repl> > (def ch (chan)) > #'functional-core-async.core/ch > > repl> > (goconsume [v ch] > (if (= :ok v) > (gorecur) > (println "done"))) > #object[java.util.conc

RE: Loading deps.edn Dynamically in Clojure 1.9

2017-12-12 Thread Sean Corfield
Yes, if you use Boot. Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN An Architect's View -- http://corfield.org/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood From: Asim Jalis Sent: Tuesday, December 12, 2017 4:39 PM To: clojure@goo