Re: Best Practices for Accessing Data Files That May Be Bundled?

2018-02-06 Thread James Gatannah
At first glance, it seems like you probably 
want http://clojuredocs.org/clojure.core/ns-resolve


On Tuesday, February 6, 2018 at 2:38:06 PM UTC-6, Randy J. Ray wrote:
>
> First, some brief background/context: I've been playing around with 
> Clojure for a while, mostly just doing Project Euler problems. I'm taking 
> the "Algorithms Specialization" from Coursera, and decided to do all the 
> programming assignments in Clojure as a way of tackling some larger, deeper 
> problems. But overall, my understanding of Clojure overall is still fairly 
> mild.
>
> What I want to do, is write some scaffolding around the weekly programming 
> tasks that automates the execution of the user-contributed test-cases. I'd 
> like to be able to add a new form to be tested in a single place (e.g., the 
> project's core.clj file) and have a re-compile be able to find out that the 
> new namespace is now in place, locate the test-files, and execute the form 
> with each test-input.
>
> I'm pretty sure I can handle locating the test files as long as they're on 
> the file system (I'm looking at the fs package for walking around the file 
> system). But is there a way to (semi-)transparently handle the data files 
> being resources within the JAR, as well?
>
> Also, how would I take a pair of strings (namespace and form-name, 
> respectively) and turn that into the callable function? For example, if my 
> set of desired test-forms were a simple nested list:
>
> (("algorithms.class1.week1.karatsuba-mult" "karatsuba-mult")
>  ("algorithms.class1.week2.count-inv" "count-inv")
>  ...)
>
> (Currently, the last ns element is the same as the function-name to call, 
> but some of these will have multiple implementations that I'll want to time 
> for comparison, so this won't always be the case.)
>
> So, for the first "test", I want to turn 
> ("algorithms.class1.week1.karatsuba-mult" 
> "karatsuba-mult") into a binding that will call 
> algorithms.class1.week1.karatsuba-mult/karatsuba-mult when used as a 
> function. I know how to do this in other languages (my strongest is Perl, 
> but don't hold that against me!), just not in Clojure.
>
> The interface of all tests is the same-- they take the name of the input 
> file as a single input, and return a string as a result (I have 
> result-files in the same dirs as the input files, for comparison. I just 
> need to be able to iterate over the forms to test, and the test-cases for 
> each form.
>
> (I say "I just need", but I'll probably be back with more questions after 
> I get these answered...)
>
> Randy
> -- 
> Randy J. Ray - randy...@gmail.com  - twitter.com/rjray
> Silicon Valley Scale Modelers: http://www.svsm.org
> San Jose, CA
>

-- 
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: Help please: New to clojure development

2018-02-06 Thread Aditya Athalye
Welcome to Clojure, Nadeen.

A few friends and I created "Clojure by example" for programmers not 
familiar with Clojure https://github.com/inclojure-org/clojure-by-example

This is intended as a quick-start to a common way of problem-solving with 
Clojure. 

The README explains more, and should help you decide if it's for you.

(Shameless plug, because I think it's going to be useful in your particular 
case.)

Further, in case you have not come across it yet, the official Clojure 
website also links to many resources, under the "Getting Started" page 
https://clojure.org/guides/getting_started

Enjoy!

-- 
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.


Clojure integrates Cesium, Openstreetmap and OpenMap inside Protege

2018-02-06 Thread Alan Moore
Ru,

You’ve done some impressive work on this and previous projects. I especially 
like the level of integration with other tools. Thanks!

Alan

-- 
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.


Best Practices for Accessing Data Files That May Be Bundled?

2018-02-06 Thread Randy J. Ray
First, some brief background/context: I've been playing around with Clojure
for a while, mostly just doing Project Euler problems. I'm taking the
"Algorithms Specialization" from Coursera, and decided to do all the
programming assignments in Clojure as a way of tackling some larger, deeper
problems. But overall, my understanding of Clojure overall is still fairly
mild.

What I want to do, is write some scaffolding around the weekly programming
tasks that automates the execution of the user-contributed test-cases. I'd
like to be able to add a new form to be tested in a single place (e.g., the
project's core.clj file) and have a re-compile be able to find out that the
new namespace is now in place, locate the test-files, and execute the form
with each test-input.

I'm pretty sure I can handle locating the test files as long as they're on
the file system (I'm looking at the fs package for walking around the file
system). But is there a way to (semi-)transparently handle the data files
being resources within the JAR, as well?

Also, how would I take a pair of strings (namespace and form-name,
respectively) and turn that into the callable function? For example, if my
set of desired test-forms were a simple nested list:

(("algorithms.class1.week1.karatsuba-mult" "karatsuba-mult")
 ("algorithms.class1.week2.count-inv" "count-inv")
 ...)

(Currently, the last ns element is the same as the function-name to call,
but some of these will have multiple implementations that I'll want to time
for comparison, so this won't always be the case.)

So, for the first "test", I want to turn
("algorithms.class1.week1.karatsuba-mult"
"karatsuba-mult") into a binding that will call
algorithms.class1.week1.karatsuba-mult/karatsuba-mult when used as a
function. I know how to do this in other languages (my strongest is Perl,
but don't hold that against me!), just not in Clojure.

The interface of all tests is the same-- they take the name of the input
file as a single input, and return a string as a result (I have
result-files in the same dirs as the input files, for comparison. I just
need to be able to iterate over the forms to test, and the test-cases for
each form.

(I say "I just need", but I'll probably be back with more questions after I
get these answered...)

Randy
-- 
Randy J. Ray - randy.j@gmail.com - twitter.com/rjray
Silicon Valley Scale Modelers: http://www.svsm.org
San Jose, CA

-- 
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: Help please: New to clojure development

2018-02-06 Thread Andy Fingerhut
Nadeen:

You are welcome to send questions here, of course.  I wanted to point out
another resource that many people take advantage of: The #beginners channel
on Slack.

https://clojurians.slack.com

Sorry, I don't recall the exact button clicks necessary after you create a
free account on Slack for yourself in order to join particular 'channels',
but hopefully the web page makes that not difficult to figure out.

Andy

On Tue, Feb 6, 2018 at 8:50 AM, Nadeen Kurz  wrote:

> Thanks Simon, I am using the repl and I am sorry, I should have click
> share to make it easier, don't know what I was thinking.
>
> Thanks everyone for your help, really appreciate it.
>
> On Feb 6, 2018 10:32 AM, "Simon Luetzelschwab"  wrote:
>
>> Hi Nadeen,
>>
>> Welcome to Clojure!
>>
>> I'd recommend incorporating Clojure's excellent REPL into your workflow
>> to easily try things out with quick feedback.
>>
>> Here's an online version with your code snippet prepopulated - just hit
>> the run button!
>>
>> https://repl.it/repls/OblongIntrepidAlabamamapturtle
>>
>> This should do what you like -
>>
>> (def input-file [{:st_abbrev "AZ", :firstname "john", :lastname "smith"}
>>   {:st_abbrev "FL", :firstname "roy", :lastname
>> "wills"}
>>{:st_abbrev "OH", :firstname "jay", :lastname
>> "louis"}])
>>
>>  (def state-names
>> {"AZ" "Arizona", "FL" "Florida", "OH" "Ohio"})
>>
>>  (defn state-desc3 [e]
>> (assoc e :state (state-names (:st_abbrev e
>>
>> (map state-desc3 input-file)
>>
>>
>> On Tue, Feb 6, 2018 at 5:27 AM, Nadeen Kurz  wrote:
>>
>>> Thanks for the quick response James. Yes, you hit the nail on the head
>>> with me not understanding map, explanation you provided helps. I like the
>>> second option better. I have tried both options and now I am getting
>>> "illegalargumentexception, key must be an integer"
>>> When I call
>>> (state-desc3 input-file)
>>>
>>> When I do this, it works find of course cause it's only one
>>> (state-desc3 {:st_abbr "AZ", :first name "John", :lastname  "Smith"})
>>>
>>>
>>>  1) maybe an index problem which I don't understand yet and researching
>>>
>>> 2) I need to figure out how to call function for testing
>>>
>>>
>>> On Feb 5, 2018 9:57 PM, "James Reeves"  wrote:
>>>
>>> First:
>>>
>>>   (#(map :st_abbrev input-file))
>>>
>>> Is equivalent to:
>>>
>>>   (map :st_abbrev input-file)
>>>
>>> Because your putting the form in an anonymous function, then immediately
>>> calling it. This is equivalent to just evaluating the form.
>>>
>>> Next, I think you're confused as to how `map` handles multiple
>>> arguments. If you call:
>>>
>>>   (map f [1 2 3] [4 5 6])
>>>
>>> Then it will return:
>>>
>>>   [(f 1 4) (f 2 5) (f 3 6)]
>>>
>>> The two collections are lined up, then passed as arguments to the
>>> function.
>>>
>>> If you want to put this into one function, then you don't need an inner
>>> map. You instead want:
>>>
>>>   (defn state-desc2 [input-file]
>>> (let [desc2 (:st_abbrev input-file)]
>>> (case desc2
>>>  "AZ" (assoc input-file :state "Arizona")
>>>  "FL" (assoc input-file :state "Florida")
>>>  "OH" (assoc input-file :state "Ohio")
>>>  "default")))
>>>
>>> You could also write it as:
>>>
>>>   (def state-names
>>> {"AZ" "Arizona", "FL" "Florida", "OH" "Ohio"})
>>>
>>>   (defn state-desc3 [input-file]
>>> (assoc input-file :state (state-names (:st_abbrev input-file
>>>
>>>
>>>
>>> On 6 February 2018 at 01:22, Nadeen Kurz  wrote:
>>>
 Can someone help me with the following please: I am new to clojure and
 i haven't developed in 4 years, previous was mainframe. See questions in
 blue

 ; Task is to add full state name based on st_abbr


 (def input-file [{:st_abbrev "AZ", :firstname "john", :lastname "smith"}
   {:st_abbrev "FL", :firstname "roy", :lastname
 "wills"}
{:st_abbrev "OH", :firstname "jay", :lastname
 "louis"}])

 *Question 1: How do I make these between the lines into one Defn?*
 ---
 (def get-state
   (#(map :st_abbrev input-file)))

 #'user/get-state
 ("AZ" "FL" "OH")

 (defn state-desc [get-state input-file]
   (let [desc get-state]
   (case desc
"AZ" (assoc input-file :state "Arizona")
"FL" (assoc input-file :state "Florida")
"OH" (assoc input-file :state "Ohio")
"default"
)))

 (map state-desc get-state input-file)

 #'user/state-desc
  ({:st_abbrev "AZ", :firstname "john", :lastname "smith", :state
 "Arizona"}
   {:st_abbrev "FL", :firstname "roy", :lastname "wills", :state
 "Florida"}
   {:st_abbrev "OH", :firstname "ja  y", :lastname "louis", :state

Re: [JOB] Clojure Developer for smart lighting IoT platform

2018-02-06 Thread Kevin
Note that this is position is located in San Jose, CA.

-- 
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: Help please: New to clojure development

2018-02-06 Thread Nadeen Kurz
Thanks Simon, I am using the repl and I am sorry, I should have click share
to make it easier, don't know what I was thinking.

Thanks everyone for your help, really appreciate it.

On Feb 6, 2018 10:32 AM, "Simon Luetzelschwab"  wrote:

> Hi Nadeen,
>
> Welcome to Clojure!
>
> I'd recommend incorporating Clojure's excellent REPL into your workflow to
> easily try things out with quick feedback.
>
> Here's an online version with your code snippet prepopulated - just hit
> the run button!
>
> https://repl.it/repls/OblongIntrepidAlabamamapturtle
>
> This should do what you like -
>
> (def input-file [{:st_abbrev "AZ", :firstname "john", :lastname "smith"}
>   {:st_abbrev "FL", :firstname "roy", :lastname
> "wills"}
>{:st_abbrev "OH", :firstname "jay", :lastname
> "louis"}])
>
>  (def state-names
> {"AZ" "Arizona", "FL" "Florida", "OH" "Ohio"})
>
>  (defn state-desc3 [e]
> (assoc e :state (state-names (:st_abbrev e
>
> (map state-desc3 input-file)
>
>
> On Tue, Feb 6, 2018 at 5:27 AM, Nadeen Kurz  wrote:
>
>> Thanks for the quick response James. Yes, you hit the nail on the head
>> with me not understanding map, explanation you provided helps. I like the
>> second option better. I have tried both options and now I am getting
>> "illegalargumentexception, key must be an integer"
>> When I call
>> (state-desc3 input-file)
>>
>> When I do this, it works find of course cause it's only one
>> (state-desc3 {:st_abbr "AZ", :first name "John", :lastname  "Smith"})
>>
>>
>>  1) maybe an index problem which I don't understand yet and researching
>>
>> 2) I need to figure out how to call function for testing
>>
>>
>> On Feb 5, 2018 9:57 PM, "James Reeves"  wrote:
>>
>> First:
>>
>>   (#(map :st_abbrev input-file))
>>
>> Is equivalent to:
>>
>>   (map :st_abbrev input-file)
>>
>> Because your putting the form in an anonymous function, then immediately
>> calling it. This is equivalent to just evaluating the form.
>>
>> Next, I think you're confused as to how `map` handles multiple arguments.
>> If you call:
>>
>>   (map f [1 2 3] [4 5 6])
>>
>> Then it will return:
>>
>>   [(f 1 4) (f 2 5) (f 3 6)]
>>
>> The two collections are lined up, then passed as arguments to the
>> function.
>>
>> If you want to put this into one function, then you don't need an inner
>> map. You instead want:
>>
>>   (defn state-desc2 [input-file]
>> (let [desc2 (:st_abbrev input-file)]
>> (case desc2
>>  "AZ" (assoc input-file :state "Arizona")
>>  "FL" (assoc input-file :state "Florida")
>>  "OH" (assoc input-file :state "Ohio")
>>  "default")))
>>
>> You could also write it as:
>>
>>   (def state-names
>> {"AZ" "Arizona", "FL" "Florida", "OH" "Ohio"})
>>
>>   (defn state-desc3 [input-file]
>> (assoc input-file :state (state-names (:st_abbrev input-file
>>
>>
>>
>> On 6 February 2018 at 01:22, Nadeen Kurz  wrote:
>>
>>> Can someone help me with the following please: I am new to clojure and i
>>> haven't developed in 4 years, previous was mainframe. See questions in blue
>>>
>>> ; Task is to add full state name based on st_abbr
>>>
>>>
>>> (def input-file [{:st_abbrev "AZ", :firstname "john", :lastname "smith"}
>>>   {:st_abbrev "FL", :firstname "roy", :lastname
>>> "wills"}
>>>{:st_abbrev "OH", :firstname "jay", :lastname
>>> "louis"}])
>>>
>>> *Question 1: How do I make these between the lines into one Defn?*
>>> ---
>>> (def get-state
>>>   (#(map :st_abbrev input-file)))
>>>
>>> #'user/get-state
>>> ("AZ" "FL" "OH")
>>>
>>> (defn state-desc [get-state input-file]
>>>   (let [desc get-state]
>>>   (case desc
>>>"AZ" (assoc input-file :state "Arizona")
>>>"FL" (assoc input-file :state "Florida")
>>>"OH" (assoc input-file :state "Ohio")
>>>"default"
>>>)))
>>>
>>> (map state-desc get-state input-file)
>>>
>>> #'user/state-desc
>>>  ({:st_abbrev "AZ", :firstname "john", :lastname "smith", :state
>>> "Arizona"}
>>>   {:st_abbrev "FL", :firstname "roy", :lastname "wills", :state
>>> "Florida"}
>>>   {:st_abbrev "OH", :firstname "ja  y", :lastname "louis", :state
>>> "Ohio"})
>>> 
>>> ---
>>>
>>> Question 2: I tried to combine in one defn, but it's not working, any
>>> help would be appreciated
>>>
>>> (defn state-desc2 [input-file]
>>>   (let [desc2 (#(map :st_abbrev input-file))]
>>>   (case desc2
>>>"AZ" (assoc input-file :state "Arizona")
>>>"FL" (assoc input-file :state "Florida")
>>>"OH" (assoc input-file :state "Ohio")
>>>"default"
>>>)))
>>>
>>> (map state-desc2 input-file)
>>>
>>> #'user/state-desc2
>>> ("default" "default" "default")
>>>
>>> --
>>> You received this message 

Re: Help please: New to clojure development

2018-02-06 Thread Simon Luetzelschwab
Hi Nadeen,

Welcome to Clojure!

I'd recommend incorporating Clojure's excellent REPL into your workflow to
easily try things out with quick feedback.

Here's an online version with your code snippet prepopulated - just hit the
run button!

https://repl.it/repls/OblongIntrepidAlabamamapturtle

This should do what you like -

(def input-file [{:st_abbrev "AZ", :firstname "john", :lastname "smith"}
  {:st_abbrev "FL", :firstname "roy", :lastname "wills"}
   {:st_abbrev "OH", :firstname "jay", :lastname
"louis"}])

 (def state-names
{"AZ" "Arizona", "FL" "Florida", "OH" "Ohio"})

 (defn state-desc3 [e]
(assoc e :state (state-names (:st_abbrev e

(map state-desc3 input-file)


On Tue, Feb 6, 2018 at 5:27 AM, Nadeen Kurz  wrote:

> Thanks for the quick response James. Yes, you hit the nail on the head
> with me not understanding map, explanation you provided helps. I like the
> second option better. I have tried both options and now I am getting
> "illegalargumentexception, key must be an integer"
> When I call
> (state-desc3 input-file)
>
> When I do this, it works find of course cause it's only one
> (state-desc3 {:st_abbr "AZ", :first name "John", :lastname  "Smith"})
>
>
>  1) maybe an index problem which I don't understand yet and researching
>
> 2) I need to figure out how to call function for testing
>
>
> On Feb 5, 2018 9:57 PM, "James Reeves"  wrote:
>
> First:
>
>   (#(map :st_abbrev input-file))
>
> Is equivalent to:
>
>   (map :st_abbrev input-file)
>
> Because your putting the form in an anonymous function, then immediately
> calling it. This is equivalent to just evaluating the form.
>
> Next, I think you're confused as to how `map` handles multiple arguments.
> If you call:
>
>   (map f [1 2 3] [4 5 6])
>
> Then it will return:
>
>   [(f 1 4) (f 2 5) (f 3 6)]
>
> The two collections are lined up, then passed as arguments to the function.
>
> If you want to put this into one function, then you don't need an inner
> map. You instead want:
>
>   (defn state-desc2 [input-file]
> (let [desc2 (:st_abbrev input-file)]
> (case desc2
>  "AZ" (assoc input-file :state "Arizona")
>  "FL" (assoc input-file :state "Florida")
>  "OH" (assoc input-file :state "Ohio")
>  "default")))
>
> You could also write it as:
>
>   (def state-names
> {"AZ" "Arizona", "FL" "Florida", "OH" "Ohio"})
>
>   (defn state-desc3 [input-file]
> (assoc input-file :state (state-names (:st_abbrev input-file
>
>
>
> On 6 February 2018 at 01:22, Nadeen Kurz  wrote:
>
>> Can someone help me with the following please: I am new to clojure and i
>> haven't developed in 4 years, previous was mainframe. See questions in blue
>>
>> ; Task is to add full state name based on st_abbr
>>
>>
>> (def input-file [{:st_abbrev "AZ", :firstname "john", :lastname "smith"}
>>   {:st_abbrev "FL", :firstname "roy", :lastname
>> "wills"}
>>{:st_abbrev "OH", :firstname "jay", :lastname
>> "louis"}])
>>
>> *Question 1: How do I make these between the lines into one Defn?*
>> ---
>> (def get-state
>>   (#(map :st_abbrev input-file)))
>>
>> #'user/get-state
>> ("AZ" "FL" "OH")
>>
>> (defn state-desc [get-state input-file]
>>   (let [desc get-state]
>>   (case desc
>>"AZ" (assoc input-file :state "Arizona")
>>"FL" (assoc input-file :state "Florida")
>>"OH" (assoc input-file :state "Ohio")
>>"default"
>>)))
>>
>> (map state-desc get-state input-file)
>>
>> #'user/state-desc
>>  ({:st_abbrev "AZ", :firstname "john", :lastname "smith", :state
>> "Arizona"}
>>   {:st_abbrev "FL", :firstname "roy", :lastname "wills", :state
>> "Florida"}
>>   {:st_abbrev "OH", :firstname "ja  y", :lastname "louis", :state "Ohio"})
>> 
>> ---
>>
>> Question 2: I tried to combine in one defn, but it's not working, any
>> help would be appreciated
>>
>> (defn state-desc2 [input-file]
>>   (let [desc2 (#(map :st_abbrev input-file))]
>>   (case desc2
>>"AZ" (assoc input-file :state "Arizona")
>>"FL" (assoc input-file :state "Florida")
>>"OH" (assoc input-file :state "Ohio")
>>"default"
>>)))
>>
>> (map state-desc2 input-file)
>>
>> #'user/state-desc2
>> ("default" "default" "default")
>>
>> --
>> 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 

Reminder - State of Clojure 2018

2018-02-06 Thread Alex Miller
Just a reminder that the Clojure survey closes on Friday - please take a 
few minutes to complete it...

https://www.surveymonkey.com/r/clojure2018

Thanks!

-- 
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: Help please: New to clojure development

2018-02-06 Thread Nadeen Kurz
Thanks for the quick response James. Yes, you hit the nail on the head with
me not understanding map, explanation you provided helps. I like the second
option better. I have tried both options and now I am getting
"illegalargumentexception, key must be an integer"
When I call
(state-desc3 input-file)

When I do this, it works find of course cause it's only one
(state-desc3 {:st_abbr "AZ", :first name "John", :lastname  "Smith"})


 1) maybe an index problem which I don't understand yet and researching

2) I need to figure out how to call function for testing


On Feb 5, 2018 9:57 PM, "James Reeves"  wrote:

First:

  (#(map :st_abbrev input-file))

Is equivalent to:

  (map :st_abbrev input-file)

Because your putting the form in an anonymous function, then immediately
calling it. This is equivalent to just evaluating the form.

Next, I think you're confused as to how `map` handles multiple arguments.
If you call:

  (map f [1 2 3] [4 5 6])

Then it will return:

  [(f 1 4) (f 2 5) (f 3 6)]

The two collections are lined up, then passed as arguments to the function.

If you want to put this into one function, then you don't need an inner
map. You instead want:

  (defn state-desc2 [input-file]
(let [desc2 (:st_abbrev input-file)]
(case desc2
 "AZ" (assoc input-file :state "Arizona")
 "FL" (assoc input-file :state "Florida")
 "OH" (assoc input-file :state "Ohio")
 "default")))

You could also write it as:

  (def state-names
{"AZ" "Arizona", "FL" "Florida", "OH" "Ohio"})

  (defn state-desc3 [input-file]
(assoc input-file :state (state-names (:st_abbrev input-file



On 6 February 2018 at 01:22, Nadeen Kurz  wrote:

> Can someone help me with the following please: I am new to clojure and i
> haven't developed in 4 years, previous was mainframe. See questions in blue
>
> ; Task is to add full state name based on st_abbr
>
>
> (def input-file [{:st_abbrev "AZ", :firstname "john", :lastname "smith"}
>   {:st_abbrev "FL", :firstname "roy", :lastname
> "wills"}
>{:st_abbrev "OH", :firstname "jay", :lastname
> "louis"}])
>
> *Question 1: How do I make these between the lines into one Defn?*
> ---
> (def get-state
>   (#(map :st_abbrev input-file)))
>
> #'user/get-state
> ("AZ" "FL" "OH")
>
> (defn state-desc [get-state input-file]
>   (let [desc get-state]
>   (case desc
>"AZ" (assoc input-file :state "Arizona")
>"FL" (assoc input-file :state "Florida")
>"OH" (assoc input-file :state "Ohio")
>"default"
>)))
>
> (map state-desc get-state input-file)
>
> #'user/state-desc
>  ({:st_abbrev "AZ", :firstname "john", :lastname "smith", :state
> "Arizona"}
>   {:st_abbrev "FL", :firstname "roy", :lastname "wills", :state "Florida"}
>   {:st_abbrev "OH", :firstname "ja  y", :lastname "louis", :state "Ohio"})
> 
> ---
>
> Question 2: I tried to combine in one defn, but it's not working, any help
> would be appreciated
>
> (defn state-desc2 [input-file]
>   (let [desc2 (#(map :st_abbrev input-file))]
>   (case desc2
>"AZ" (assoc input-file :state "Arizona")
>"FL" (assoc input-file :state "Florida")
>"OH" (assoc input-file :state "Ohio")
>"default"
>)))
>
> (map state-desc2 input-file)
>
> #'user/state-desc2
> ("default" "default" "default")
>
> --
> 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.
>



-- 
James Reeves
booleanknot.com

-- 
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 

Clojure integrates Cesium, Openstreetmap and OpenMap inside Protege

2018-02-06 Thread ru
Hi,

Clojure integrates Cesium, Openstreetmap and OpenMap inside Protege to 
simulate train movement.

Project page: *https://github.com/rururu/simpro-scene 
*

*Screencast 1: https://www.youtube.com/watch?v=cT5h79w3wR4=youtu.be 
*

*Screencast 2: https://www.youtube.com/watch?v=WEx2-rMCJag=youtu.be 
*

*Sincerely,*
*   Ru*

-- 
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.