Re: Key must be integer error

2018-04-29 Thread Axel Katerbau
Hi Renata,

> How can I update the atom accounts in the field of operations?
> 
> (def accounts (atom [{:id "7512a15b-0770-4a9b-a74b-389374b46461", :balance 
> 0.0, :operations nil, :blocked false} 
>   {:id "7446cfe6-882c-4f25-bad1-5ed8c9aea994", :balance 0.0, :operations nil, 
> :blocked false} 
>   {:id "3136860d-ab7f-4814-8f3b-2d18048db9b9", :balance 0.0, :operations nil, 
> :blocked false} 
>   {:id "2dc20615-f1f7-4637-9602-ae9494689166", :balance 0.0, :operations nil, 
> :blocked false}
>   {:id "c6dccf4a-535c-4eba-8cfc-0554408de8bd", :balance 0.0, :operations nil, 
> :blocked false}]))
> 
> I tried this:
> 
> (swap! accounts (fn [x] (update-in x [:operations]  #(if (= (:id %) 
> account-id) new-value
> 
> and returns "key must be integer" because of [:operations]

the atom hold and array of accounts. In swap! you are trying to access one (!) 
value in a key-path [:operations] but access to elements of an array is not 
valid via a key-path but by using indexes.

What you are seemingly trying to do is to map over the contents of the array in 
the atom which is not what you coded here.

- Axel

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Clojure for Cocoa

2012-01-24 Thread Axel Katerbau, Objectpark
Hi David,

On 23 Jan., 04:00, David Nolen  wrote:

> This would be cool. I think just comes down to how ambitious you are.
>
> ClojureScript is effectively Clojure-in-Clojure. Given that we can target
> JavaScript communicating with Objective-C is not that difficult, i.e.
> JSCocoa.
>
> Having a version of Clojure that integrates with OS X as well as Clojure
> integrates with the JVM will be a much more ambitious task but it would be
> really, really cool.
>
> Projects that seem relevant, at least to me:
>
> * F-Script
> * JSCocoa
> * Clozure CL
> * MacRuby

I think the JSCocoa/Clojurescript would work somehow but the latter is
more what I'd love to have.
Thanks for the pointers.

Clojure in Clojure would be a nice start to have e.g. a LLVM frontend.
But it's really quiet as far as CiC goes, right?

- Axel

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure for Cocoa

2012-01-24 Thread Axel Katerbau, Objectpark
Hi Konrad,

On 23 Jan., 05:13, Konrad Hinsen 
wrote:
> David Nolen writes:
>
>  > Having a version of Clojure that integrates with OS X as well as Clojure
>  > integrates with the JVM will be a much more ambitious task but it would be
>  > really, really cool.
>
> As this would imply integrating with the C/C++/Objective universe in
> general, it would also be very useful outside of the OS X platform.
> It just looks like a lot of work.

sure. But integrating with the Objective-C runtime would be necessary
to fully embrace the Cocoa frameworks which is IMHO crucial for "real"
Mac/iOS programming with Clojure.

- Axel

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Clojure for Cocoa

2012-01-22 Thread Axel Katerbau, Objectpark
Hi all,

I'm pondering the idea of having Clojure for "regular" Mac OS/iOS
programming with the Objective-C libraries like Cocoa and the like.

Having a Clojure variant that embraces the Objective-C runtime would
be the goal.

But what would be the best way of achieving this? Building a LLVM
frontend? Using Clojure-In-Clojure (how far is this by the way?),
crafting some core libraries in Objective-C?

What do you think would be the best approach?

- Axel

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en