>
>
> For instance, which one of these to you consider to be the best
> representation of a event to set the expiry time:
>
>[:cache/expire #inst "2015-09-08T12:00:00Z"]
>
>{:type :cache/expire, :value #inst "2015-09-08T12:00:00Z"}
>
>#cache.Expire [#inst "2015-09-08T12:00:00Z"]
>
>
On 8 September 2015 at 11:38, Thomas Heller wrote:
>
> If you look at these implementations
>
> (def OneOff [(s/one s/Str 'name) (s/one s/Str 'email)])
>
> (s/defrecord OneOff
> [name :- s/Str
> email :- s/Str])
>
> (defrecord OneOff [name email])
>
> All of them do more or less the same
I don't use schema/core.typed much in my actual projects, while I have done
many attempts it just never worked out. I like the idea and should
definitely use them more but it is just too much of a moving system and not
stable enough yet (eg. didn't even know s/either is deprecated).
If you look at
Thanks for your benchmark.
I will upgrade all the dependencies and release 0.2.0
We are using defun with instparse in a DSL implementation, the performance
is acceptable, but the code is much more readable.
2015-09-06 4:33 GMT+08:00 Rob Lally :
> Out of interest, I ran the benchmarks as is,
>> I probably wouldn't use protocols since I doubt there is a function
signature that is exactly identical for all branches. Each branch probably
needs access to different parts of your system (eg. database) and always
passing everything to everything is not ideal.
>> Multi-Method is great if y
On 7 September 2015 at 15:49, Timothy Baldridge
wrote:
>
> Types are good even in dynamic languages, we should use the more. As
> mentioned by Thomas, records are the idiomatic way to store typed
> information in Clojure.
>
I don't think that's true. Or rather, I think it depends on what you mean
>
>
> (def Recipient
>> (s/either PlaceHolder
>> Existing
>> OneOff))
>>
>
> This looks interesting. Where would I actually use this? I mean, if I have
> created three records, I may as well implement multi methods or protocols,
> right? Even if I don't do those, I will
>> Should be expressed as:
>> (swap! :atom a, :function inc)
One of Rich's talks on simplicity actually addresses that. He states that
the above method (with keyword arguments) is actually simpler, but that
this isn't exactly easy to program.
And yes, I would take this same position about positio
>
> Looking at the "(defn register [...])" example. Where is the problem with
> the first solution? It doesn't have the bugs the other implementations have
> and is extremely simple to reason about? The other two solutions do the
> exact same thing just slower with absolutely no gain. If you ne
On 7 September 2015 at 13:59, James Reeves wrote:
> On 6 September 2015 at 15:38, Timothy Baldridge
> wrote:
>>
>> As far as performance goes, this is normally the sort of thing that gets
>> baked into an app at a pretty low level, that's why I suggest it should be
>> as fast as possible. If you
On 6 September 2015 at 09:57, Amith George wrote:
>
> Could you elaborate on what you mean by variants being like a key value
> pair?
>
I mean that tags are usually used to describe what the data *is*, whereas
keys are usually used to describe what the data is for. For instance, one
might have a
On 6 September 2015 at 15:38, Timothy Baldridge
wrote:
> >> I'm not sure why you think that it "complicates the code, and makes it
> harder to understand".
>
> Alright, I'll use the phrase: using vectors as variants complects order
> with data. If you hand me a vector that says [:name "tim"] I ha
FWIW before I came to Clojure I did a lot of Erlang and in the beginning I
was at the exact same spot wanting to use pattern matching everywhere
because it is so damn cool. Same goes for tagged literals.
After a little while I realized that it is just not the way to do it in
Clojure and forcing
In a possible messaging system, a user could denote a recipient using one
of three ways - 1) select an existing user id, 2) enter a new name and
email, 3) pick a placeholder "all my team mates".
Possible F# (might not compipe!!)
Recipient = | Placeholder of string
| Existi
>> I'm not sure why you think that it "complicates the code, and makes it
harder to understand".
Alright, I'll use the phrase: using vectors as variants complects order
with data. If you hand me a vector that says [:name "tim"] I have to know
that "the first thing in this vector is the name of the
On 6 September 2015 at 14:41, Timothy Baldridge
wrote:
> >> "Variants fulfil the same purpose as key/value pairs in a map. The key
> denotes a context-sensitive purpose for the data, rather than its type."
>
> Then use a key/value type. That's my problem with this approach, it
> abuses a collecti
>> "Variants fulfil the same purpose as key/value pairs in a map. The key
denotes a context-sensitive purpose for the data, rather than its type."
Then use a key/value type. That's my problem with this approach, it abuses
a collection type and therefore creates confusion as to the type of data is
TIL that "tagged literals" have an existing meaning in clojure. In my mind,
the terms "tagged vector" and "tagged literal" were interchangeable. From a
quick Google search there doesn't seem to be an existing meaning for
"tagged vector". I think we can agree that it a representation of variants
On 6 September 2015 at 02:31, Timothy Baldridge
wrote:
> >> Thanks, it helps to know using a tagged vector is a real pattern :)
>
> I don't know that it's a "real pattern". If I saw code like this in
> production I would probably raise quite a stink about it during code
> reviews. It's a cute hac
defun, core.match, tagged vectors - seems like I can emulate Elixir
function pattern match behaviour. I took some simple code I found online
(https://twitter.com/Xzilend/status/640282621042233344) and rewrote it to
1) use only tagged vectors (not quite) and 2) use defun and tagged vectors.
I am
In Elixir, tuples are used where in the first element is the tag. A similar
thing can be done in Clojure using vectors. That much was clear. What
bothered me and prompted me to start this thread was I wasn't sure "what"
it is I was doing by creating that vector. Was it purely a convention
thing
>> Thanks, it helps to know using a tagged vector is a real pattern :)
I don't know that it's a "real pattern". If I saw code like this in
production I would probably raise quite a stink about it during code
reviews. It's a cute hack, but it is also an abuse of a data structure. Now
when I see [:f
>
> * Elixir and the BEAM VM are awesome at many things, but I suspect (from
> experience not evidence) that the defun version is still faster than the
> elixir version.
In Clojure, the defun version is not the default or idiomatic way to write
functions. I kind of expected it to be slower. M
Thanks, it helps to know using a tagged vector is a real pattern :) Gives
the confidence to explore this further for my own code.
On Saturday, 5 September 2015 22:37:33 UTC+5:30, Gary Verhaegen wrote:
>
> It won't really help for the library/ecosystem problem, but for your own
> code I'd recomm
Out of interest, I ran the benchmarks as is, and got more or less the same
results - 15x. Then I tried upgrading the defun dependencies - clojure,
core.match and tools.macro - all of which have newer versions, and then running
the benchmarks without leiningen’s jvm-opts and in a trampolined repl
It won't really help for the library/ecosystem problem, but for your own
code I'd recommend watching Jeanine Atkinson's Conj talk from last year:
http://m.youtube.com/watch?v=ZQkIWWTygio
On Saturday, 5 September 2015, Amith George wrote:
> Nice. Hadn't heard of it before. It looks interesting.
Nice. Hadn't heard of it before. It looks interesting. The criterium
benchmark is kinda disappointing though. The pattern matched function took
nearly 15x the time of the normal function.
Performance aside, in Elixir, there seems to be an established convention
for creating the function argumen
You might want to take a look at defun: https://github.com/killme2008/defun
- James
On 5 September 2015 at 09:24, Amith George wrote:
> Hi,
>
> I just read a blog post [1] talking about Elixir pattern matching. I was
> thoroughly impressed with the way its handled in Elixir. I am posting this
>
Hi,
I just read a blog post [1] talking about Elixir pattern matching. I was
thoroughly impressed with the way its handled in Elixir. I am posting this
here cuz I got rather excited and wanted to discuss this with you all.
My experience with pattern matching is limited to the basics of F# and
29 matches
Mail list logo