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-17 Thread James Reeves
On Tue, 17 Jul 2018 at 22:47, Christian Seberino wrote: > When writing software in Clojure, the data structures are often the >> keystone of the codebase. When I write Clojure, I start by mapping out what >> data structures and keywords I need, and from there write functions around >> them. It's

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-17 Thread Philipp Neumann
Macros aren't the right tool for that. If you want to create a function that behaves differently, depending on the input (Vector, seq or something else, like LinkedHashSet) you should look into multimethods. And if you want to do comprehensive data manipulation you should look into

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-17 Thread Robert Levy
I don't entirely buy the official story on this feature, but it is what it is. In my experience, people do a lot of defensive typecasting, much more than we reason about performance. Because the performance just doesn't really matter in the vast majority of cases, and we're more concerned with

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-17 Thread Christian Seberino
> > > When writing software in Clojure, the data structures are often the > keystone of the codebase. When I write Clojure, I start by mapping out what > data structures and keywords I need, and from there write functions around > them. It's for this reason that I don't think prepend and append

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-17 Thread James Reeves
On Tue, 17 Jul 2018 at 21:06, Christian Seberino wrote: > > Clojure, on the other hand, takes great care to ensure that its data can >> always be represented as literals. For data that isn't a standard >> collection type, there are tagged literals. Clojure syntax starts from a >> representation

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-17 Thread Vladimir Bokov
Alex, though I mostly support you and value "understand efficiency from first look" a lot, I'd speak about this: > There is no Clojure operation for "add something to the right side of a list" - instead there is the far simpler (in simple vs easy terms) "add something to a collection" I think

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-17 Thread Christian Seberino
Ah no worries. I think you made a significant point..." Shaping your use of the language's raw materials to build up to your domain/application is very much a Lisp philosophy". Everyone can use Clojure as they need. Amazing really. cs On Tue, Jul 17, 2018 at 3:58 PM, Robert Levy wrote: >

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-17 Thread Robert Levy
Whoa, I think you are reading way too deeply into what I wrote. Let me explain what I meant: Lisp is great, Clojure is great, the community doesn't typically change the core of the language-- the change process is very conservative and largely top-down. The rest of it was a cheap shot at the

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-17 Thread Tomasz Sulej
W dniu wtorek, 17 lipca 2018 22:44:27 UTC+2 użytkownik Christian Seberino napisał: > > > data are functions and vice-versa >> > > What do you mean? e.g. How is the [1 2 3] a "function"? > > user> ([1 2 3] 0) 1 user> ([1 2 3] 2) 3 user> ({:a 1 :b 2} 0) nil user> ({:a 1 :b 2} :a) 1 > cs > --

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-17 Thread Tomasz Sulej
user> ([1 2 3] 0) 1 user> ([1 2 3] 2) 3 user> ({:a 1 :b 2} 0) nil user> ({:a 1 :b 2} :a) 1 On Tue, 17 Jul 2018 at 22:44, Christian Seberino wrote: > > data are functions and vice-versa >> > > What do you mean? e.g. How is the [1 2 3] a "function"? > > cs > > -- > You received this message

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-17 Thread Christian Seberino
> data are functions and vice-versa > What do you mean? e.g. How is the [1 2 3] a "function"? cs -- 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

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-17 Thread Christian Seberino
On Tue, Jul 17, 2018 at 3:13 PM, Robert Levy wrote: > If you want to you can use the prepend and append found in tupelo lib, or > you can write your own training wheels lib for your students. You have > total creative control over your course design. Shaping your use of the > language's raw

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-17 Thread Erik Assum
One data point, me: When I started out with Clojure, I was very worried about conj, not quite knowing wether it would add at the beginning or the end of the data structure. But, having worked with Clojure (in web dev) now for a couple of years, I find myself using conj quite sparingly. And 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-17 Thread Gary Trakhman
Data to most people means tabular or relational data and not complex, compound data, and EDN is a funny case, since it is not the concrete representation. What about print-dup, and print-method? Is that subtlety inherent to the elegance? How often do you really need complex, immutable keys?

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-17 Thread Robert Levy
If you want to you can use the prepend and append found in tupelo lib, or you can write your own training wheels lib for your students. You have total creative control over your course design. Shaping your use of the language's raw materials to build up to your domain/application is very much a

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-17 Thread Gregg Reynolds
On Tue, Jul 17, 2018, 2:49 PM James Reeves wrote: > On Tue, 17 Jul 2018 at 19:52, Christian Seberino > wrote: > >> By the time a Clojure beginner is doing the kind of hardcore concurrent >> applications that Clojure is great at, he/she will know how to use a >> profiler. At the point, they'll

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-17 Thread Christian Seberino
> > > For example, in Python you can write {1, 2} to produce a set, or {1: 2} to > produce a dict. But what does {} produce? Is it an empty set, or an empty > dict? Python chooses the latter, leaving the literal syntax for sets > incomplete. To my mind this is indicative of a design approach that

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-17 Thread James Reeves
On Tue, 17 Jul 2018 at 19:52, Christian Seberino wrote: > By the time a Clojure beginner is doing the kind of hardcore concurrent > applications that Clojure is great at, he/she will know how to use a > profiler. At the point, they'll be ready (and motivated!) to learn about > the nuances of

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-17 Thread Gregg Reynolds
On Tue, Jul 17, 2018, 1:51 PM Christian Seberino wrote: > Actually, even "real" programmers can live for a long time with those > training wheels I was talking about. > As the Python guys have been proclaiming for 20+ years, performance isn't > as important as we think for many (most?)

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-17 Thread Christian Seberino
Actually, even "real" programmers can live for a long time with those training wheels I was talking about. As the Python guys have been proclaiming for 20+ years, performance isn't as important as we think for many (most?) applications. What the Python crowd does, when they're code is slower

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-17 Thread Christian Seberino
Actually, even "real" programmers can live for a long time with those training wheels I was talking about. As the Python guys have been proclaiming for 20+ years, performance isn't as important as we think for many (most?) applications. What the Python crowd does, when they're code is slower than

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-17 Thread Christian Seberino
> > Understanding the difference and why it's important are far more > illuminating than just forcing your prior model (like tupelo's > prepend/append). If your goal is education, then it's doubly important to > take this journey. It may be a few stops longer, but you'll actually learn > a lot

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-17 Thread Gary Trakhman
On Tue, Jul 17, 2018 at 1:35 PM Alex Miller wrote: > You can talk about Clojure operations from a type perspective, but I think > when you do so, you are largely missing the point of Clojure. > > Having used Clojure for a very long while, I will have to respectfully disagree with this one.

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-17 Thread Alex Miller
You can talk about Clojure operations from a type perspective, but I think when you do so, you are largely missing the point of Clojure. There is no Clojure operation for "add something to the right side of a list" - instead there is the far simpler (in simple vs easy terms) "add something to

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-17 Thread Gary Trakhman
I'm just referring to a language design tradeoff, specifically clojure picks ad-hoc polymorphism over making it easy to reason about types. Subtyping, polymorphism, and the ability to do efficient type inference (auto and human) are a real debate outside of clojure. People wanting more specific

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-17 Thread Alex Miller
On Tuesday, July 17, 2018 at 11:06:51 AM UTC-5, Gary Trakhman wrote: > > It's pretty hard in clojure to keep track of a data structure and ensure > some function introduced later in the middle of a data path doesn't seq it > along the way. > I'll again refer to the faq for when stuff like

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-17 Thread Gary Trakhman
It's pretty hard in clojure to keep track of a data structure and ensure some function introduced later in the middle of a data path doesn't seq it along the way. You get some discipline around this, but it adds to the learning curve. I wouldn't say polymorphism is better or easier than being

Re: Complete Web Development Setup Using Clojure CLI Tools

2018-07-17 Thread Gary Johnson
Thanks, Chad. I have built quite a few toy and production full-stack Clojure web apps over the past 6 years or so using leiningen and boot. While both of these are great tools with a lot of programmer hours invested in them, I realized recently that neither of them are particularly easy to

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-17 Thread Alex Miller
I think you're no longer teaching Clojure then. The values embedded in this design choice are important and erasing them does a disservice to learners. I think by fighting this, you're actually making Clojure harder than it is. On Tuesday, July 17, 2018 at 9:49:33 AM UTC-5, Christian Seberino

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-17 Thread Christian Seberino
Alex Thanks for all the replies. It is clear there are 2 values in language design...*simplicity* and *efficiency*. Sometimes they conflict unfortunately. Clojure sacrificed a tiny amount of simplicity for a huge gain in efficiency with the design of conj and friends. Imagine someone wanted

Re: [ANN] scope-capture 0.3.0

2018-07-17 Thread Jason Felice
This looks very useful! Thanks! On Tue, Jul 17, 2018 at 9:19 AM Val Waeselynck wrote: > Just released *scope-capture > * 0.3.0, with some new > goodies: > > - spyqt / brkqt >

[ANN] scope-capture 0.3.0

2018-07-17 Thread Val Waeselynck
Just released *scope-capture * 0.3.0, with some new goodies: - spyqt / brkqt (SPY QuieTly), useful for preventing large

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-17 Thread Vladimir Bokov
Another link to "why so": https://gist.github.com/reborg/dc8b0c96c397a56668905e2767fd697f#why-clojure-doesnt-have-a-generic-insert-lookup-append-that-works-the-same-on-all-collections If you still, need this, take a look: