This sort of pattern is used quite a lot in clojure (even in core): (let [data (if (string? data) (read-string data) data) data (if (string? (first data)) (first data) (next data)) data (if (string? (first data)) (first data) (next data))] data)
Throwing exceptions on overridden variable names would not only break Clojure code, but also is very "non-lispy". Timothy On Tue, Feb 12, 2013 at 6:31 AM, AtKaaZ <atk...@gmail.com> wrote: > it makes sense to not throw now that I think about it, when using "_" > instead of "a" > I'm also thinking of cases like: > => (let [a 1] > (let [b 2 a 3] > (println a b))) > 3 2 > nil > > is there something that would let me know I'm overwriting "a" ? I figure > if something like this would slip by would be tough to track down > > > On Tue, Feb 12, 2013 at 1:46 PM, Michael Wood <esiot...@gmail.com> wrote: > >> On 12 February 2013 12:28, AtKaaZ <atk...@gmail.com> wrote: >> > what would this do: >> > >> > (let [a 1, a 2] a) >> > becomes: >> > (let [a 1, a123 2] a) >> > or >> > (let [a 1, a123 2] a123) >> > or >> > exception[I prefer] >> >> It would be the second option, i.e.: >> >> (let [a 1, a123 2] a123) >> >> The original code is valid, so it would not throw an exception. >> >> > On Tue, Feb 12, 2013 at 7:10 AM, Ambrose Bonnaire-Sergeant >> > <abonnaireserge...@gmail.com> wrote: >> >> >> >> Processing a hygienic AST relieves the burden of worrying about >> shadowing >> >> of locals. >> >> >> >> Wherever a binding would normally be shadowed, it is instead renamed >> to a >> >> local binding currently not in scope. >> >> >> >> eg. (let [a 1, a a] a) >> >> >> >> becomes >> >> >> >> (let [a 1, a123 a] a123) >> >> >> >> It can be useful for those processing Clojure's analysis results. >> >> >> >> Thanks, >> >> Ambrose >> >> >> >> >> >> On Tue, Feb 12, 2013 at 1:54 AM, kovas boguta <kovas.bog...@gmail.com> >> >> wrote: >> >>> >> >>> What is a hygienic AST? >> >>> >> >>> Thanks >> >>> k >> >>> >> >>> >> >>> On Sun, Feb 10, 2013 at 10:45 PM, Ambrose Bonnaire-Sergeant >> >>> <abonnaireserge...@gmail.com> wrote: >> >>> > Hi everyone, >> >>> > >> >>> > Happy to release analyze 0.3.0 with new hygienic code transformation >> >>> > capabilities. >> >>> > >> >>> > [analyze "0.3.0"] >> >>> > >> >>> > In a line: >> >>> > >> >>> > analyze.hygienic=> (-> (ast (let [a 1 a a b a a a] a)) ast-hy >> emit-hy) >> >>> > ((fn* ([] (let* [a 1 a2921 a b a2921 a2922 a2921] a2922)))) >> >>> > >> >>> > Hygienic AST's have enabled large performance boosts in core.typed. >> I'm >> >>> > excited to see how it could >> >>> > be as useful to others. >> >>> > >> >>> > Note: "hygienic" AST's (those transformed with >> >>> > `analyze.hygienic/ast-hy` can >> >>> > be printed normally with `analyze.emit-form/emit-form`, and >> >>> > hygienically >> >>> > with `analyze.hygienic/emit-hy`. >> >>> > >> >>> > https://github.com/frenchy64/analyze >> >>> > >> >>> > Thanks, >> >>> > Ambrose >> >>> > >> >>> > -- >> >>> > -- >> >>> > 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/groups/opt_out. >> >>> > >> >>> > >> >>> >> >>> -- >> >>> -- >> >>> 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/groups/opt_out. >> >>> >> >>> >> >> >> >> -- >> >> -- >> >> 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/groups/opt_out. >> >> >> >> >> > >> > >> > >> > >> > -- >> > Please correct me if I'm wrong or incomplete, >> > even if you think I'll subconsciously hate it. >> > >> > -- >> > -- >> > 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/groups/opt_out. >> > >> > >> >> >> >> -- >> Michael Wood <esiot...@gmail.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 https://groups.google.com/groups/opt_out. >> >> >> > > > -- > Please correct me if I'm wrong or incomplete, > even if you think I'll subconsciously hate it. > > -- > -- > 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/groups/opt_out. > > > -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- -- 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/groups/opt_out.