Keyword namespacing best practices
I'm looking for some feedback on keyword namespacing. Say you're writing an API to be used by external clients that works something like this: (fetch url :timeout 10) => {:status 200, :body "..."} Would you namespace the :status and :body keywords in the response? What about the :timeout kwarg in the function call? Why or why not? -- 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: Keyword namespacing best practices
I would not use keyword namespaces in this situation. Users of the "fetch" function will likely type :timeout, :status, and :body when using this function. Keyword namespaces would just force users to type longer names for these. On Sunday, September 30, 2018 at 9:45:56 PM UTC-4, Michael Gardner wrote: > > I'm looking for some feedback on keyword namespacing. Say you're writing > an API to be used by external clients that works something like this: > > (fetch url :timeout 10) > => {:status 200, :body "..."} > > Would you namespace the :status and :body keywords in the response? What > about the :timeout kwarg in the function call? Why or why not? -- 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: Keyword namespacing best practices
> On Sep 30, 2018, at 18:54, Eric Lavigne wrote: > > I would not use keyword namespaces in this situation. Users of the "fetch" > function will likely type :timeout, :status, and :body when using this > function. Keyword namespaces would just force users to type longer names for > these. Thanks for the response, Eric. Leaving :timeout aside for the moment, the issue I'm wrestling with is that you never know what your clients will do with the response. That makes it hard to anticipate the likelihood of keyword collisions, especially for a more complex compound response. There are also some fringe benefits, like greater synergy with clojure.spec and a kind of self-description effect (again, more relevant for larger APIs). I've also heard some library developers say they've adopted namespaced keywords almost everywhere, so I guess I'm just wondering about where to draw that line. -- 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
can anyone provide me a way how to solve this pproblem. i have to map these items based on thier input type . the output will be .clj file i have attached. -- 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. Concept HOSPICE_ENC HOSPICE_ENV HOSPICE_FACILITY_ENV ACUTE_INPATIENT_ENC ACUTE_INPATIENT_ENV HIGH_RISK_CONDITION_CLIN OUTPATIENT_ENV OUTPATIENT_ENC SSI_SURGICAL_PROCEDURE_PROC SSI_SURGICAL_SITE_INFECTION_CLIN PROPHYLACTIC_ANTIMICROBIAL_PROC ORDER_FOR_ANTIMICROBIAL_PROPHYLAXIS_PROC ORDER_FOR_ANTIMICROBIAL_PROPHYLAXIS_PROC MEDICAL_REASON_PROPHYLACTIC_ANTIMICROBIAL_NOT_ORDERED_PROC VTE_PROC VTE_PROPHYLAXIS_ORDERED_OR_GIVEN_PROC VTE_PROPHYLAXIS_ORDERED_OR_GIVEN_PROC CVC_PROC MAXIMAL_STERILE_BARRIER_TECHNIQUE_PROC MAXIMAL_STERILE_BARRIER_TECHNIQUE_PROC MSSA_INPATIENT_ENC SEPSIS_DUE_TO_MSSA_CLIN SEPSIS_DUE_TO_MSSA_CLIN BETA_LACTAM_ANTIBIOTIC_NOT_PRESCRIBED_MEDICAL_REASON_PROC ISCHEMIC_STROKE_CLIN INPATIENT_STAY_ENV COMFORT_CARE_PROC CLINICAL_TRIAL_PARTICIPANT_CLIN CAROTID_INTERVENTION_PROC LEFT_AMA_DCDIS ACUTE_INPATIENT_ENC NONACUTE_INPATIENT_ENC ANTIPLATELET_THERAPY_MED ANTICOAGULANT_MED MEDICAL_REASON_CLIN CARDIAC_STRESS_IMAGING_PROC CARDIAC_STRESS_IMAGING_LOW_RISK_SURGERY_PATIENT_PROC ED_ENC ED_ENV MINOR_BLUNT_HEAD_TRAUMA_CLIN GLASGOW_COMA_SCORE_OBSTYPE ADULT_HEAD_CT_FOR_TRAUMA_PROC CT_LESS_THAN_24_HOURS_AFTER_MINOR_HEAD_TRAUMA_ADULT_PROC MINOR_BLUNT_HEAD_TRAUMA_EXCLUSION_INDICATIONS_ADULT_CLIN Null SEVERE_HEADACHE_CLIN VOMITING_CLIN PHYSICAL_FINDINGS_OF_A_BASILAR_SKULL_FRACTURE_CLIN FOCAL_NEUROLOGICAL_DEFICIT_CLIN COAGULOPATHY_CLIN THROMBOCYTOPENIA_CLIN DANGEROUS_MECHANISM_OF_INJURY_CLIN ANTICOAGULANT_MED LOSS_OF_CONSCIOUSNESS_CLIN POST_TRAUMATIC_AMNESIA_CLIN DRUG_ALCOHOL_INTOXICATION_CLIN HEADACHE_CLIN SHORT_TERM_MEMORY_LOSS_CLIN HEAD_OR_NECK_TRAUMA_CLIN POST_TRAUMATIC_SEIZURE_CLIN PEDS_HEAD_CT_FOR_TRAUMA_PROC CT_LESS_THAN_24_HOURS_AFTER_MINOR_HEAD_TRAUMA_PEDS_PROC MINOR_BLUNT_HEAD_TRAUMA_EXCLUSION_INDICATIONS_PEDS_CLIN ALTERED_MENTAL_STATUS_CLIN PHYSICAL_FINDINGS_OF_A_BASILAR_SKULL_FRACTURE_CLIN LOSS_OF_CONSCIOUSNESS_CLIN VOMITING_CLIN DANGEROUS_MECHANISM_OF_INJURY_CLINY SEVERE_HEADACHE_CLIN SURGICAL_PROCEDURE_PROC UNPLANNED_SURGICAL_PROCEDURE_PROC OPIOID_MED CANCER_CLIN BENZODIAZEPINE_MED output.clj Description: Binary data
Re: clojure
The code is incorrect, if you want something like this : (onto/defconcept BENZODIAZEPINE_MED) (onto/defconcept HOSPICE_ENC) this has the same premise as your previous question in this post https://groups.google.com/forum/#!topic/clojure/nrAeWCLC-Vc I think you should consider learning clojure https://braveclojure.com/ On Monday, 1 October 2018 09:58:59 UTC+5:30, venkata sai wrote: > > can anyone provide me a way how to solve this pproblem. i have to map > these items based on thier input type . the output will be .clj file i have > attached. > -- 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
this is different one. you want to map thier respective type and put it in a set of maps On Monday, October 1, 2018 at 10:16:11 AM UTC+5:30, Pankaj Doharey wrote: > > The code is incorrect, if you want something like this : > > (onto/defconcept > BENZODIAZEPINE_MED) > > (onto/defconcept >HOSPICE_ENC) > > this has the same premise as your previous question in this post > https://groups.google.com/forum/#!topic/clojure/nrAeWCLC-Vc > > I think you should consider learning clojure https://braveclojure.com/ > > On Monday, 1 October 2018 09:58:59 UTC+5:30, venkata sai wrote: >> >> can anyone provide me a way how to solve this pproblem. i have to map >> these items based on thier input type . the output will be .clj file i have >> attached. >> > -- 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
Aah, a map in clojure looks like : {:a 1 :b 2 :c 3} Which of those symbols in the *.csv* file are keys and values? On Monday, 1 October 2018 10:18:22 UTC+5:30, venkata sai wrote: > > this is different one. you want to map thier respective type and put it in > a set of maps > > On Monday, October 1, 2018 at 10:16:11 AM UTC+5:30, Pankaj Doharey wrote: >> >> The code is incorrect, if you want something like this : >> >> (onto/defconcept >> BENZODIAZEPINE_MED) >> >> (onto/defconcept >>HOSPICE_ENC) >> >> this has the same premise as your previous question in this post >> https://groups.google.com/forum/#!topic/clojure/nrAeWCLC-Vc >> >> I think you should consider learning clojure https://braveclojure.com/ >> >> On Monday, 1 October 2018 09:58:59 UTC+5:30, venkata sai wrote: >>> >>> can anyone provide me a way how to solve this pproblem. i have to map >>> these items based on thier input type . the output will be .clj file i have >>> attached. >>> >> -- 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
i mean this is set of maps you have to map them under one particluar category On Monday, October 1, 2018 at 10:22:41 AM UTC+5:30, Pankaj Doharey wrote: > > Aah, a map in clojure looks like : > {:a 1 :b 2 :c 3} > > Which of those symbols in the *.csv* file are keys and values? > > > On Monday, 1 October 2018 10:18:22 UTC+5:30, venkata sai wrote: >> >> this is different one. you want to map thier respective type and put it >> in a set of maps >> >> On Monday, October 1, 2018 at 10:16:11 AM UTC+5:30, Pankaj Doharey wrote: >>> >>> The code is incorrect, if you want something like this : >>> >>> (onto/defconcept >>> BENZODIAZEPINE_MED) >>> >>> (onto/defconcept >>>HOSPICE_ENC) >>> >>> this has the same premise as your previous question in this post >>> https://groups.google.com/forum/#!topic/clojure/nrAeWCLC-Vc >>> >>> I think you should consider learning clojure https://braveclojure.com/ >>> >>> On Monday, 1 October 2018 09:58:59 UTC+5:30, venkata sai wrote: can anyone provide me a way how to solve this pproblem. i have to map these items based on thier input type . the output will be .clj file i have attached. >>> -- 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: Keyword namespacing best practices
It is easy to overdo it when trying to predict future needs. I always (now) do the minimal solution, with the expectation that it *may* evolve in the future. Since the parts that do need change (say 5% ?) are usually not the ones I would have predicted, I am usually very glad I didn't over-engineer the API in advance. Alan PS: YAGNI rules - and it's easier/less painful to fix the 5% where it's wrong than the 95% where it's right PPS: YMMV (but not much!) On Sun, Sep 30, 2018 at 7:12 PM Michael Gardner wrote: > > > On Sep 30, 2018, at 18:54, Eric Lavigne wrote: > > > > I would not use keyword namespaces in this situation. Users of the > "fetch" function will likely type :timeout, :status, and :body when using > this function. Keyword namespaces would just force users to type longer > names for these. > > Thanks for the response, Eric. Leaving :timeout aside for the moment, the > issue I'm wrestling with is that you never know what your clients will do > with the response. That makes it hard to anticipate the likelihood of > keyword collisions, especially for a more complex compound response. There > are also some fringe benefits, like greater synergy with clojure.spec and a > kind of self-description effect (again, more relevant for larger APIs). > > I've also heard some library developers say they've adopted namespaced > keywords almost everywhere, so I guess I'm just wondering about where to > draw that line. > > -- > 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. > -- 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.