Re: clojure is supposed to be 'code is data' yet I can't add to the end of a list?

2021-07-19 Thread James Reeves
Don't get be wrong: Clojure can manipulate lists easily. You can append items to a list with (concat xs '(5)) or use syntax quoting `(~@xs 5). You just can't use conj specifically, as that function has a particular use case. The problem with manipulating code is that code is complex. The same

Re: clojure is supposed to be 'code is data' yet I can't add to the end of a list?

2021-07-19 Thread SideStep
18 Jul 2021, at 5:40 PM, SideStep wrote: > > Thanks Tania! The point I'm making is that list (data structure for > evaluatable data/code) is not easily manipulatable with code in clojure. So > much for 'code-is-data'... > Thanks for the suggestion. > In regards to rethinkin

Re: clojure is supposed to be 'code is data' yet I can't add to the end of a list?

2021-07-18 Thread Joe R . Smith
It is a singly linked list, so the natural position at which to add is the front. conj will add to the front of lists and to the end of vectors. Consider using a vector if you want to append to the end. It'd be more semantically correct. More background: If you append to the end of a singly

Re: clojure is supposed to be 'code is data' yet I can't add to the end of a list?

2021-07-18 Thread James Reeves
1, at 5:40 PM, SideStep wrote: > Thanks Tania! The point I'm making is that list (data structure for > evaluatable data/code) is not easily manipulatable with code in clojure. So > much for 'code-is-data'... > Thanks for the suggestion. > In regards to rethinking it: it is suppo

Re: clojure is supposed to be 'code is data' yet I can't add to the end of a list?

2021-07-18 Thread SideStep
Thanks Tania! The point I'm making is that list (data structure for evaluatable data/code) is not easily manipulatable with code in clojure. So much for 'code-is-data'... Thanks for the suggestion. In regards to rethinking it: it is supposed to be commands coming-in that sets parts of the grid

Re: clojure is supposed to be 'code is data' yet I can't add to the end of a list?

2021-07-17 Thread Tanya Moldovan
Hi, conj <https://clojuredocs.org/clojure.core/conj> adds at the end of a vector, but at the beginning of a list. It is how it is implemented. I think this <https://stackoverflow.com/questions/5734435/put-an-element-to-the-tail-of-a-collection> and this <https://medium.com/@greg_

clojure is supposed to be 'code is data' yet I can't add to the end of a list?

2021-07-17 Thread SideStep
<https://stackoverflow.com/posts/68420449/timeline> I have a representation of a matrix in grid.clj file: (-> (grid 10 10) (toggle 2 3 4 5) (off 2 3 4 5) (on 2 3 4 5)) It's a list of functionts, first one initializes a grid, others modify it. Clojures' 'code is data'

Re: First post: how to mimic a Java List with types?

2020-08-16 Thread Jack Park
r evaluable lists, or they can be >> evaluable objects which perform computations >> > > A simple Clojure list/vector can hold any type of data you put into it. So > your record can hold a vector of these things, which can be represented as > Clojure data structure (lists / maps / e

Re: First post: how to mimic a Java List with types?

2020-08-15 Thread Jack Park
). > - failed: vector? at: [:fn-tail :arity-1 :params] spec: > :clojure.core.specs.alpha/param-list > - failed: (or (nil? %) (sequential? %)) at: [:fn-tail :arity-n :bodies] > spec: :clojure.core.specs.alpha/params+body > I wonder what I am missing. Thanks in advance for ideas. -Ja

Re: First post: how to mimic a Java List with types?

2020-08-15 Thread Jack Park
rs in such lists can be either other evaluable lists, or they can be >> evaluable objects which perform computations >> > > A simple Clojure list/vector can hold any type of data you put into it. So > your record can hold a vector of these things, which can be represented as >

Re: First post: how to mimic a Java List with types?

2020-08-15 Thread Brandon R
achieve your desired functionality without records and protocols but what you describe sounds like a fitting case for them. Members in such lists can be either other evaluable lists, or they can be > evaluable objects which perform computations > A simple Clojure list/vector can hold any type o

Re: First post: how to mimic a Java List with types?

2020-08-15 Thread Jack Park
Hi Erik, I think that teasing things apart helps along some dimensions, but the problem I face, still thinking like a Java hacker, is that I need to put things together: I need to construct a *type* (deftype) which honors two different interfaces, a list, and an evaluable object. I need

Re: First post: how to mimic a Java List with types?

2020-08-15 Thread Erik Assum
Why not tease things apart? (defn eval [x] ...) (some eval my-list) ;; or list (every? eval my-list) ;; and list https://clojuredocs.org/clojure.core/some https://clojuredocs.org/clojure.core/every_q Now, you can make the eval function polymorphic in several ways, simplest is to case or cond

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread matthew...@gmail.com
Another option would be to do what Alex is suggesting and define and as a function. Just because it’s a macro in clojure.core doesn’t mean you can’t write your own :) (defn eval' [x] (if (map? x) (apply (:fn x) (:coll x)) x)) (defn and-list [& items] (let [if? (fn [x] (if x

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread Jack Park
Alex, I plan to explore this idea. Many thanks! Jack On Fri, Aug 14, 2020 at 1:38 PM Oleksandr Shulgin < oleksandr.shul...@zalando.de> wrote: > > > > Nevermind transducers: I've just realized that reduced can be used with > the normal reduce. E.g. here's short-circuiting AND-reduction fn: >

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread Jack Park
Wow! I say that because that might be getting closer to what I have in mind but still not there yet. I'm really trying to develop a type which honors two interfaces, one for the list object, and one for the IEvaluable object. As a type, I invoke it, then add objects to it, then place

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread Oleksandr Shulgin
e.g. boolean eval(); (from Java) > Thus far, in a tiny VSCode project, I defined > > (definterface IEvaluable >(^boolean runIt [])) > > and defined a simple object which will return false and one which will > return true. I'll use those to populate a conjunctive and a

RE: First post: how to mimic a Java List with types?

2020-08-14 Thread Sam Hahn
Jack - I'll call you :)  Cheers - Sam Original Message Subject: Re: First post: how to mimic a Java List with types? From: Jack Park <jackp...@topicquests.org> Date: Fri, August 14, 2020 11:34 am To: clojure@googlegroups.com Mapping and transducers seems appropriate,

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread Jack Park
IEvaluable (^boolean runIt [])) and defined a simple object which will return false and one which will return true. I'll use those to populate a conjunctive and a disjunctive list. Now I must define a list object which runs that interface. Still digging and experimenting, but, on the surface

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread Jack Park
Mapping and transducers seems appropriate, though I'm still wrapping my head around how to make this work. >From the "class with functions" mindset, I need an ArrayList into which I can: a) add members to the list from time to time b) run eval() on it; a conjunctive list will exit f

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread Jesús Gómez
and its sibling OrList behave just like a List object, but > also will answer to eval() by running the collection and dealing with what > each element returns when it, too, is eval()'d. > > I'd really love to discover how to pull that off in Clojure. > > Many thanks in adva

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread Oleksandr Shulgin
and return a boolean. >> The idea lies at the heart of an inference engine. >> >> But, I also define a class *AndList* which implements IInferrable and >> extends java.util.ArrayList >> >> So, AndList, and its sibling OrList behave just like a List object, but

Re: First post: how to mimic a Java List with types?

2020-08-14 Thread Oleksandr Shulgin
o matter what it is, will > answer to eval() and return a boolean. > The idea lies at the heart of an inference engine. > > But, I also define a class *AndList* which implements IInferrable and > extends java.util.ArrayList > > So, AndList, and its sibling OrList behave just like

Re: First post: how to mimic a Java List with types?

2020-08-13 Thread Alexandre Almosni
eval() and return a boolean. > The idea lies at the heart of an inference engine. > > But, I also define a class AndList which implements IInferrable and extends > java.util.ArrayList > > So, AndList, and its sibling OrList behave just like a List object, but also >

First post: how to mimic a Java List with types?

2020-08-13 Thread Jack Park
* which implements IInferrable and extends java.util.ArrayList So, AndList, and its sibling OrList behave just like a List object, but also will answer to eval() by running the collection and dealing with what each element returns when it, too, is eval()'d. I'd really love to discover how to pull

Re: Rich Hickey Calls for Book List, Creates Nice Resource as a Side Effect

2018-11-02 Thread Alex Miller
https://clojure.org/community/books is a thing too... And https://clojure.org/community/resources has a lot of good resources as well (PRs on https://github.com/clojure/clojure-site/blob/master/content/community/resources.adoc welcome...) On Friday, November 2, 2018 at 9:18:41 AM UTC-5,

Rich Hickey Calls for Book List, Creates Nice Resource as a Side Effect

2018-11-02 Thread Nathan Smutz
Rich requested that people report in on books they wrote about Clojure and when the book was first published. (He's gathering information for a History of Clojure paper.) Lots of people are also chiming in with mentions of Clojure in books they wrote on other subjects, online learning

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 <de...@yotsov.org <mailto:de...@yotsov.org>> wrote: Hello, I h

Re: Reading file to list as char array

2017-10-03 Thread Peter Hull
On Tuesday, 3 October 2017 12:39:47 UTC+1, Furkan Yıldız wrote: > > I am reading a txt file containing words. I need to add these words to the > list as char. For example > > > > I think you need to split into words first using a regex then seq each word (def words

Reading file to list as char array

2017-10-03 Thread Furkan Yıldız
I am reading a txt file containing words. I need to add these words to the list as char. For example Example txt file: this is a simple test and the result should be the following: '((t h i s) (i s) (a) (s i m p l e) (t e s t) these are the codes I wrote, (def

[ANN] Honeysql mailing list and slack channel

2017-07-17 Thread Michael Blume
I'm opening a Google group and Slack channel for discussion of Honeysql, the Clojure DSL for generating SQL. We have some issues that are likely to result in breaking changes, and I'd like to get more input on that than I'd be likely to get in a PR/Issue discussion. Maling list: https

Re: associative destructuring on a list? (using :keys)

2017-01-09 Thread John Gabriele
emembered seeing an explanation of it somewhere. Turns out I'd forgotten reading about that bit of magic in the "Clojure Programming" book (p.35). -- John On Friday, January 6, 2017 at 7:36:51 PM UTC-5, Francis Avila wrote: > A list/seq (not a vector) which is destructured as a map wil

Re: associative destructuring on a list? (using :keys)

2017-01-06 Thread Francis Avila
A list/seq (not a vector) which is destructured as a map will be first read into a map as by (apply hash-map the-seq) This curiosity exists so the "keyword argument" idiom works: (defn my-options [_ & {:keys [a b] :as options}] options) => #'user/my-options (my-options n

associative destructuring on a list? (using :keys)

2017-01-06 Thread John Gabriele
I've used associative destructing in the usual fashion: some-app.core=> (def m {:a 1 :b 2}) #'some-app.core/m some-app.core=> (let [{:keys [a b]} m] (str a "-" b)) "1-2" but what is going on here: some-app.core=> (def li '(:a 1 :b 2)) #'some-app.core/li ;; Wat?

Re: Elegant way to do lazy infinite list with custom step

2016-12-14 Thread Ghadi Shayban
ime and I was tired. Nice example though. > > On Tue, Dec 13, 2016 at 10:03 PM, Ghadi Shayban <gsha...@gmail.com > > wrote: > >> A common way to do it in Clojure is `iterate`, no macros necessary. As of >> Clojure 1.7 this doesn't allocate a list at all if you redu

Re: Elegant way to do lazy infinite list with custom step

2016-12-13 Thread Timothy Baldridge
this doesn't allocate a list at all if you reduce/fold over it: > (iterate #(+ % 2) 4) > > > On Tuesday, December 13, 2016 at 11:27:28 PM UTC-5, tbc++ wrote: >> >> I'm not aware of such a construct, but it's trivial enough to write >> something like this

Re: Elegant way to do lazy infinite list with custom step

2016-12-13 Thread Ghadi Shayban
A common way to do it in Clojure is `iterate`, no macros necessary. As of Clojure 1.7 this doesn't allocate a list at all if you reduce/fold over it: (iterate #(+ % 2) 4) On Tuesday, December 13, 2016 at 11:27:28 PM UTC-5, tbc++ wrote: > > I'm not aware of such a construct, but it's t

Re: Elegant way to do lazy infinite list with custom step

2016-12-13 Thread Alex Miller
(range 4 Long/MAX_VALUE 2) On Tuesday, December 13, 2016 at 10:14:00 PM UTC-6, bill nom nom wrote: > > In Haskell, I can get an infinite lazy list that is incremented by two by, > starting at 4 > [4,6..] > > which yields the result > [4,6,8,10...] > > the more general

Re: Elegant way to do lazy infinite list with custom step

2016-12-13 Thread Timothy Baldridge
I'm not aware of such a construct, but it's trivial enough to write something like this using `range` or perhaps write a function that will yield a lazy seq: (defn inf-list ([x y] (cons x (cons y (inf-list x y 2 ([x y c] (cons (+ x (* c (- y x))) (lazy-seq (inf-list x y (inc

Elegant way to do lazy infinite list with custom step

2016-12-13 Thread bill nom nom
In Haskell, I can get an infinite lazy list that is incremented by two by, starting at 4 [4,6..] which yields the result [4,6,8,10...] the more general form [x,y..] produces [x, x + (y-x), x + 2 * (y-x), x + 3 * (y-x)...] Is there a way to make a macro of this in clojure, or is there something

Clojars Mirrors mailing list

2016-12-13 Thread Daniel Compton
nal traffic and speed up build times There is a new ultra low traffic mailing list for these communications at https://groups.google.com/forum/#!forum/clojars-mirrors. This mailing list does not publicly display membership, so you can join without revealing you or your companies usage of Cloj

Re: clojure.core/bean throws when passed an empty list

2016-10-04 Thread Gary Trakhman
This is an existing bug: http://dev.clojure.org/jira/browse/CLJ-978?page=com.atlassian.jira.plugin.system.issuetabpanels:changehistory-tabpanel It's relatively easy to write a workaround if needed. On Tue, Oct 4, 2016 at 7:59 AM Divyansh Prakash wrote: > Is this

clojure.core/bean throws when passed an empty list

2016-10-04 Thread Divyansh Prakash
Is this desired behaviour? user=> (bean []) {:class clojure.lang.PersistentVector, :empty true} user=> (bean {}) {:class clojure.lang.PersistentArrayMap, :empty true} user=> (bean ()) IllegalAccessException Class clojure.core$bean$fn__5975$fn__5976 can not access a member of class

Re: Exception : cannot create ISeq from Long when empty list is present.. ?

2016-07-25 Thread Ashish Negi
Thanks James.. I will now add a vector after first.. -- 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 - please be patient with your first

Re: Exception : cannot create ISeq from Long when empty list is present.. ?

2016-07-24 Thread James Reeves
"solve" is a recursive function that expects a collection of mazes to be returned. By adding "first" you change the return type, stripping off a layer each recursive call until you get integers instead of vectors. - James On 24 July 2016 at 08:32, Ashish Negi wrote:

Re: Exception : cannot create ISeq from Long when empty list is present.. ?

2016-07-24 Thread Ashish Negi
the code throwing exceptions is below it : https://github.com/ashishnegi/joy-of-clojure/blob/master/src/joy_of_clojure/chap16_thinking_programs.clj#L76 -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to

Exception : cannot create ISeq from Long when empty list is present.. ?

2016-07-24 Thread Ashish Negi
I am writing a soduku solver.. Everything works but since i am interested in first solution.. when i write `first` after https://github.com/ashishnegi/joy-of-clojure/blob/master/src/joy_of_clojure/chap16_thinking_programs.clj#L58 I get {:type java.lang.IllegalArgumentException ;; :message

Re: Is there any desire or need for a Clojure DataFrame? (X-POST from Numerical Clojure mailing list)

2016-06-07 Thread Daniel Slutsky
Hi. I'm experimenting with Renjin interop - in particular, trying to make a Renjin objects implement core.matrix protocols (as mikera suggested). I hope to be able to share some draft soon. then ask your opinions about it. Hi. I'm experimenting with Renjin interop - in particular, trying

Re: Is there any desire or need for a Clojure DataFrame? (X-POST from Numerical Clojure mailing list)

2016-06-06 Thread arthur . maciejewicz
Chaoya, I haven't been working on this, and I don't really intend to anytime soon, there's other work that I must attend to in the immediate time-frame. - Arthur On Saturday, June 4, 2016 at 11:51:49 PM UTC-4, Chaoya Li wrote: > > Hi I'm interested in Clojure DataFrame implementation. How

Re: Is there any desire or need for a Clojure DataFrame? (X-POST from Numerical Clojure mailing list)

2016-06-04 Thread Chaoya Li
Hi I'm interested in Clojure DataFrame implementation. How is this going now? Are you coding for core.matrix or are you writing a new library from scratch? How can I join in this project? 在 2016年3月10日星期四 UTC+8上午4:57:31,arthur.ma...@gmail.com写道: > > Is there any desire or need for a Clojure

Re: Is there any desire or need for a Clojure DataFrame? (X-POST from Numerical Clojure mailing list)

2016-03-13 Thread Mikera
On Friday, 11 March 2016 09:21:09 UTC+8, arthur.ma...@gmail.com wrote: > > Renjin and Spark's dataframes are not going to be easily removed from > their respective codebases, as far as my brief perusal of the source can > tell. I agree that N-D DataFrames would be a good addition to the >

Re: Is there any desire or need for a Clojure DataFrame? (X-POST from Numerical Clojure mailing list)

2016-03-10 Thread Mikera
On Friday, 11 March 2016 09:09:14 UTC+8, Dragan Djuric wrote: > > This is already working well for the array programming APIs (it's easy to >> mix and match Clojure data structures, Vectorz Java-based arrays, GPU >> backed arrays in computations). >> > > While we could agree to some extent on

Re: Is there any desire or need for a Clojure DataFrame? (X-POST from Numerical Clojure mailing list)

2016-03-10 Thread arthur . maciejewicz
Renjin and Spark's dataframes are not going to be easily removed from their respective codebases, as far as my brief perusal of the source can tell. I agree that N-D DataFrames would be a good addition to the ecosystem, similar to the goals of Python's xarray (xarray.pydata.org). However, it is

Re: Is there any desire or need for a Clojure DataFrame? (X-POST from Numerical Clojure mailing list)

2016-03-10 Thread Dragan Djuric
> > This is already working well for the array programming APIs (it's easy to > mix and match Clojure data structures, Vectorz Java-based arrays, GPU > backed arrays in computations). > While we could agree to some extent on the other parts of your post but the GPU part is *NOT* true: I

Re: Is there any desire or need for a Clojure DataFrame? (X-POST from Numerical Clojure mailing list)

2016-03-10 Thread Mikera
core.matrix maintainer here. I think it would be great to have more work on dataframe-type support. I think the right strategy is as follows: a) Make use of the core.matrix Dataset protocols where possible (or add new ones) b) Create implementation(s) for these protocols for whatever back-end

Re: Is there any desire or need for a Clojure DataFrame? (X-POST from Numerical Clojure mailing list)

2016-03-09 Thread arthur . maciejewicz
Dan, That's a huge amount of stats packages available for use assuming we achieve interop with Renjin's dataframes. I'll look into it as well. My priorities are to first get something working for $DAYJOB, and then to build a more generally useful package, and finally add extras such as

Re: Is there any desire or need for a Clojure DataFrame? (X-POST from Numerical Clojure mailing list)

2016-03-09 Thread Christopher Small
Sounds great; and sure thing, will do :-) The basic idea I had was to implement a bidirectional index mapping names <-> indices. This requires making sure you keep the index up to date any time you change the data, but seemed the easiest way forward. My fork is here:

Re: Is there any desire or need for a Clojure DataFrame? (X-POST from Numerical Clojure mailing list)

2016-03-09 Thread arthur . maciejewicz
Chris, thanks for the reply. It's good to know that I'm not the only one who misses this functionality! My goal is definitely to be compatible with Incanter and core.matrix, as they both seem mature, and I will never have the time to implement that functionality from scratch myself. I'll be

Re: Is there any desire or need for a Clojure DataFrame? (X-POST from Numerical Clojure mailing list)

2016-03-09 Thread Daniel Slutsky
Thank you for raising this question. By the way, one desired feature for a Clojure dataframe abstraction would be good interop with Renjin's dataframes. Renjin is a JVM-based rewrite of (a subset of) R. It offers a large number of JVM-based statistical libraries. Most of them rely on the

Re: Is there any desire or need for a Clojure DataFrame? (X-POST from Numerical Clojure mailing list)

2016-03-09 Thread Christopher Small
If you're going to do any work in this area, I would highly encourage you to do in as part of the core.matrix library. That is what Incanter is or will be using for it's dataset implementation. But it's nice that those abstractions and implementations be separate from Incanter itself, since

Is there any desire or need for a Clojure DataFrame? (X-POST from Numerical Clojure mailing list)

2016-03-09 Thread arthur . maciejewicz
Is there any desire or need for a Clojure DataFrame? By DataFrame, I mean a structure similar to R's data.frame, and Python's pandas.DataFrame. Incanter's DataSet may already be fulfilling this purpose, and if so, I'd like to know if and how people are using it. >From quickly researching, I

[ANN] Clojure/west 2016 speakers list now available!

2016-02-16 Thread Alex Miller
Clojure/west 2016 will be held Apr 15-16 in Seattle, WA. http://clojurewest.org You can now find the full list of speakers at http://clojurewest.org/speakers! We had a fantastic set of proposals (115) this year and an excellent program as a result. I also want to highlight our keynote speaker

Re: macro to unwrap a list

2016-02-15 Thread Gary Verhaegen
On Monday, 15 February 2016, Sonny To <son.c...@gmail.com> wrote: > I am trying to write a macro to unwrap a list: > > here's my naive attempt > > (defmacro unwrap [s] > (-> s pr-str (clojure.string/replace #"[\(\)]" "") read-string)) > >

Re: macro to unwrap a list

2016-02-15 Thread Stuart Sierra
macro to unwrap a list: > > here's my naive attempt > > (defmacro unwrap [s] > (-> s pr-str (clojure.string/replace #"[\(\)]" "") read-string)) > > (unwrap (1 2 3) ) should give 1 2 3 > > any ideas how this can be done? > > thanks, >

Re: macro to unwrap a list

2016-02-15 Thread James Reeves
What do you mean by "unwrap a list"? If you mean something where: (foo (unwrap 1 2 3)) == (foo 1 2 3) Then I'm afraid this can't be done. A macro returns a single data structure. - James On 15 February 2016 at 18:54, Sonny To <son.c...@gmail.com> wrote: > I am tryi

macro to unwrap a list

2016-02-15 Thread Sonny To
I am trying to write a macro to unwrap a list: here's my naive attempt (defmacro unwrap [s] (-> s pr-str (clojure.string/replace #"[\(\)]" "") read-string)) (unwrap (1 2 3) ) should give 1 2 3 any ideas how this can be done? thanks, Sonny -- You received t

The Reading List

2015-10-14 Thread Alan Thompson
Hi, Just saw a good presentation on InfoQ by Jason McCreary ( http://www.infoq.com/presentations/the-reading-list) where he mentions several topics from "The Reading List", which is an informal list of books that are considered by many in the industry to be "required readin

Re: The Reading List

2015-10-14 Thread Dragan Djuric
Is there a living person who read all, or even a majority, of these books? If there is (although I doubt), what he/she thinks about them? I am genuinely interested. In my opinion, there is too much Cool Aid magic in the list, and too little of more tangible stuff. Is not that the books

(= (list {'a 42}) '({'a 42})) => false ???

2015-09-26 Thread Chris Cornelison
"part-of-name-here") Source: (source function-name-here) Javadoc: (javadoc java-object-or-class-here) Exit: Control+D or (exit) or (quit) Results: Stored in vars *1, *2, *3, an exception in *e user=> (list {'a 42}) ({a 42}) user=> '({'a 42}) ({(quote a) 42}) user=> (= (lis

Re: (= (list {'a 42}) '({'a 42})) => false ???

2015-09-26 Thread Lars Andersen
You can see it if you read: user=> (read-string "(= (list {'a 42}) '({'a 42}))") ;;=> (= (list {(quote a) 42}) (quote ({(quote a) 42}))) If you remove it: user=> (= (list {'a 42}) '({a 42})) ;;=> true On Saturday, September 26, 2015 at 3:12:44 PM UTC+2, Chris Cornel

Should `list?` be true for a clojure.lang.PersistentQueue item?

2015-09-02 Thread William Tozier
A confusing cond result sent me to an odd place just now, and apparently list? is true for the result of (clojure.lang.PersistentQueue/EMPTY) queue item. Now technically I see this makes sense, since `list?` "Returns true if x implements IPersistentList", and that's absolutel

Re: who can help me get clojure function list in notepad++? thanks!

2015-09-01 Thread Alex Woods
notepad++ support clojure by lisp, clojure api & autocompletefile & readme of notepad++ https://drive.google.com/file/d/0By5ssgBX1IWaWDMydXdMdHI0Z2s/view?usp=sharing 在 2015年9月1日星期二 UTC+8下午10:30:38,Alex Woods写道: > > >

who can help me get clojure function list in notepad++? thanks!

2015-09-01 Thread Alex Woods
my set is error: ;notepad++\functionList.xml

Re: Given a list of maps, produce a sublist having distinct values for one key

2015-04-06 Thread Andy Fingerhut
the item has been added, and customers who are interested in the parent of that category, and so on recursively to the root of the graph. Now, I can recurse up the graph asking each category in turn for the customers interested in it; and by concatenating the lists, arrive at one list of all

Re: Given a list of maps, produce a sublist having distinct values for one key

2015-04-06 Thread Simon Brooke
on recursively to the root of the graph. Now, I can recurse up the graph asking each category in turn for the customers interested in it; and by concatenating the lists, arrive at one list of all the interested customers. The problem is that if one customer has registered interest in both a category

Re: Given a list of maps, produce a sublist having distinct values for one key

2015-03-24 Thread Ben Wolfson
of the graph. Now, I can recurse up the graph asking each category in turn for the customers interested in it; and by concatenating the lists, arrive at one list of all the interested customers. The problem is that if one customer has registered interest in both a category and its parent, he will appear

Given a list of maps, produce a sublist having distinct values for one key

2015-03-24 Thread Simon Brooke
been added, and customers who are interested in the parent of that category, and so on recursively to the root of the graph. Now, I can recurse up the graph asking each category in turn for the customers interested in it; and by concatenating the lists, arrive at one list of all the interested

Sorting a collection of elements according to a given list of elements

2015-03-19 Thread Henrik Heine
Hi, I want to sort a set/map according to an ordering given by a seq of elements - e.g. (def some-order [:u :a :e :i :o]) (def some-order-fn (order-fn some-order)) (sorted-set-by some-order-fn :a :e :i :o :u) ; -- #{:u :a :e :i :o} This is what I came up with: (defn order-fn [ks] #(-

Re: Sorting a collection of elements according to a given list of elements

2015-03-19 Thread Andy Fingerhut
I don't know if it is a more elegant implementation, but I found something like this for maps in the useful library a while back, called ordering-map: https://github.com/amalloy/useful/blob/master/src/flatland/useful/map.clj#L243-L245 I have been putting a few different varieties of sorted maps

Re: Sorting a collection of elements according to a given list of elements

2015-03-19 Thread Fluid Dynamics
On Thursday, March 19, 2015 at 8:53:37 AM UTC-4, Henrik Heine wrote: Hi, I want to sort a set/map according to an ordering given by a seq of elements - e.g. (def some-order [:u :a :e :i :o]) (def some-order-fn (order-fn some-order)) (sorted-set-by some-order-fn :a :e :i :o :u) ; -- #{:u

`(apply map vector ...)`, and passing `apply` a list vs. a vector

2015-03-18 Thread John Gabriele
:z])) ArityException Wrong number of args (3) passed to: Symbol clojure.lang.AFn.throwArity (AFn.java:429) ~~~ Why does it fail when I pass a list there instead of a vector? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send

Re: `(apply map vector ...)`, and passing `apply` a list vs. a vector

2015-03-18 Thread Ben Wolfson
(AFn.java:429) ~~~ Why does it fail when I pass a list there instead of a vector? -- 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 - please

Re: `(apply map vector ...)`, and passing `apply` a list vs. a vector

2015-03-18 Thread Ambrose Bonnaire-Sergeant
clojure.lang.AFn.throwArity (AFn.java:429) ~~~ Why does it fail when I pass a list there instead of a vector? -- 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

Re: `(apply map vector ...)`, and passing `apply` a list vs. a vector

2015-03-18 Thread John Gabriele
Ah! I was passing `apply` a list who's first element was a symbol, rather than the function itself. Got it. Thanks Ambrose and Ben! On Wednesday, March 18, 2015 at 5:10:45 PM UTC-4, Ambrose Bonnaire-Sergeant wrote: [vector] is a vector with the vector predicate. '(vector) is a vector

Re: Could use a better error message here (using a list in update-in)

2015-03-11 Thread John Gabriele
/display/community/Creating+Tickets –S On Tuesday, March 10, 2015 at 3:13:36 PM UTC, John Gabriele wrote: In Clojure v1.6.0. This one confused me when I'd accidentally passed a list in to `update-in` instead of a vector: -- You received this message because you are subscribed to the Google

Re: Could use a better error message here (using a list in update-in)

2015-03-10 Thread Stuart Sierra
Please file a ticket in JIRA and tag it with errormsg http://dev.clojure.org/display/community/Creating+Tickets –S On Tuesday, March 10, 2015 at 3:13:36 PM UTC, John Gabriele wrote: In Clojure v1.6.0. This one confused me when I'd accidentally passed a list in to `update-in` instead

Could use a better error message here (using a list in update-in)

2015-03-10 Thread John Gabriele
In Clojure v1.6.0. This one confused me when I'd accidentally passed a list in to `update-in` instead of a vector: ~~~ some-app.core= (update-in [:a :b :c] [1] name) [:a b :c] some-app.core= (update-in '(:a :b :c) [1] name) NullPointerException clojure.core/name (core.clj:1518) ~~~ -- You

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Fluid Dynamics
On Tuesday, February 17, 2015 at 10:24:29 PM UTC-5, Udayakumar Rayala wrote: Then probably (apply concat) is better than (mapcat identity) isnt it? What is (cons ::sentinel)? Why do you need it here? It'll drop the wrong elements otherwise: = (- (range 1 22) (partition 5 5 nil)

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Udayakumar Rayala
Ah ok. Got it. On Wed, Feb 18, 2015 at 9:13 AM, Fluid Dynamics a2093...@trbvm.com wrote: On Tuesday, February 17, 2015 at 10:24:29 PM UTC-5, Udayakumar Rayala wrote: Then probably (apply concat) is better than (mapcat identity) isnt it? What is (cons ::sentinel)? Why do you need it here?

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Ben Wolfson
why not (mapcat next)? On Tue, Feb 17, 2015 at 3:45 PM, Fluid Dynamics a2093...@trbvm.com wrote: On Tuesday, February 17, 2015 at 2:21:20 PM UTC-5, Cecil Westerhof wrote: What is the best way to remove all elements which position (counting from 1) is a multiply of five out of a list? So

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Udayakumar Rayala
Then probably (apply concat) is better than (mapcat identity) isnt it? What is (cons ::sentinel)? Why do you need it here? On Wed, Feb 18, 2015 at 5:58 AM, Fluid Dynamics a2093...@trbvm.com wrote: On Tuesday, February 17, 2015 at 6:47:59 PM UTC-5, Ben wrote: why not (mapcat next)? Yeah,

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Fluid Dynamics
On Tuesday, February 17, 2015 at 2:21:20 PM UTC-5, Cecil Westerhof wrote: What is the best way to remove all elements which position (counting from 1) is a multiply of five out of a list? So the list: (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21) ​becomes: (1 2 3 4 6 7 8

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Fluid Dynamics
On Tuesday, February 17, 2015 at 6:47:59 PM UTC-5, Ben wrote: why not (mapcat next)? Yeah, that should work too, though conceptually trimming each part and then reflattening the partition are two separate steps of the computation. :) The correct answer, obviously, is (- s (cons

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Cecil Westerhof
this-list] (keep-indexed (fn [i v] (if (= 0 (mod (inc i) index)) nil v)) this-list)) The first element should not be filtered (counting from 1) and because I will use it more often I created a function.​ On Tue, Feb 17, 2015 at 12:21 PM

Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Cecil Westerhof
What is the best way to remove all elements which position (counting from 1) is a multiply of five out of a list? So the list: (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21) ​becomes: (1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19 21)​ -- Cecil Westerhof -- You received

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Ivan L
this works = (filter #(not= (mod % 5) 0) (range 22)) (1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19 21) On Tuesday, February 17, 2015 at 2:21:20 PM UTC-5, Cecil Westerhof wrote: What is the best way to remove all elements which position (counting from 1) is a multiply of five out of a list? So

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Timothy Baldridge
, 2015 at 2:21:20 PM UTC-5, Cecil Westerhof wrote: What is the best way to remove all elements which position (counting from 1) is a multiply of five out of a list? So the list: (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21) ​becomes: (1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Timothy Baldridge
position (counting from 1) is a multiply of five out of a list? So the list: (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21) ​becomes: (1 2 3 4 6 7 8 9 11 12 13 14 16 17 18 19 21)​ -- Cecil Westerhof -- You received this message because you are subscribed to the Google

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Colin Yates
)) nil v)) (range 30)) ​I made the following: ​ ​(defn indexed-sieve [index this-list] (keep-indexed (fn [i v] (if (= 0 (mod (inc i) index)) nil v)) this-list)) The first element should

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Colin Yates
that runs every snippet posted to this mailing list through kibit (https://github.com/jonase/kibit). On Tue, Feb 17, 2015 at 1:49 PM, Colin Yates colin.ya...@gmail.com wrote: Style police would point out zero? and when-not :). On 17 Feb 2015 20:40, Cecil Westerhof cldwester...@gmail.com wrote

  1   2   3   4   5   6   7   8   9   10   >