Re: OK idea to replace conj and cons with "prepend" and "append" macros that have consistent behavior and return same types as args?

2018-07-20 Thread Matching Socks
To return to OP's question -- Good idea? Answer: At first, I saw the standard library as a mud puddle, an inkblot with just chaos, no airplane or number 42 in it. Then I got this book: Clojure Programming - Practical Lisp for the Java World - by Chas Emerick, Brian Carper, Christophe Gra

Re: OK idea to replace conj and cons with "prepend" and "append" macros that have consistent behavior and return same types as args?

2018-07-20 Thread Justin Smith
another false example above fixed: user=> (into '(1) '(2 3)) (3 2 1) On Fri, Jul 20, 2018 at 9:13 AM Christian Seberino wrote: > Wow thanks. That was pretty thorough. > > cs > > > On Friday, July 20, 2018 at 10:51:48 AM UTC-5, Gary Johnson wrote: >> >> Hi Christian, >> >> You are looking for

Re: How define alias for .indexOf? (def somealias .indexOf) does not work.

2018-07-20 Thread Gary Trakhman
Ah, this came in with 1.5: https://dev.clojure.org/jira/browse/CLJ-910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel On Fri, Jul 20, 2018 at 12:38 PM Gary Trakhman wrote: > > The memfn docstring says it can be type hinted to avoid reflection. Any > reason why it would still b

Re: How define alias for .indexOf? (def somealias .indexOf) does not work.

2018-07-20 Thread Gary Trakhman
> The memfn docstring says it can be type hinted to avoid reflection. Any reason why it would still be slower then wrapping it in a type hinted function? Neat, I didn't know that! Since each memfn creates a new function, it's the same thing as writing it out manually, unlike say 'partial', which i

Re: OK idea to replace conj and cons with "prepend" and "append" macros that have consistent behavior and return same types as args?

2018-07-20 Thread Christian Seberino
Wow thanks. That was pretty thorough. cs On Friday, July 20, 2018 at 10:51:48 AM UTC-5, Gary Johnson wrote: > > Hi Christian, > > You are looking for "into", which is already part of the Clojure standard > library. > > Appending: > > (into '(1 2) '(3)) ;=> (1 2 3) > (into [1 2] [3])

Re: Complete Web Development Setup Using Clojure CLI Tools

2018-07-20 Thread Gary Johnson
Thanks for the link! -- 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 post. To unsubscribe from this group

Re: OK idea to replace conj and cons with "prepend" and "append" macros that have consistent behavior and return same types as args?

2018-07-20 Thread Gary Trakhman
@Gary Johnson, your post is otherwise great, but I think a little confusing for this point: > , I would advise you to use the "into" function that I demonstrated at the beginning of this email if you wish to teach a unified API for appending and prepending to each of Clojure's four main data struct

Re: OK idea to replace conj and cons with "prepend" and "append" macros that have consistent behavior and return same types as args?

2018-07-20 Thread Gary Johnson
Hi Christian, You are looking for "into", which is already part of the Clojure standard library. Appending: (into '(1 2) '(3)) ;=> (1 2 3) (into [1 2] [3]) ;=> [1 2 3] (into {:a 1 :b 2} {:c 3}) ;=> {:a 1, :b 2, :c 3} (into #{:a :b} #{:c}) ;=> #{:c :b :a} Prepending: