Re: [ANN] New blog post on Perfumed Nightmare

2024-05-01 Thread Gary Johnson
Daniel Szmulewicz  writes:

> Greetings fellow Clojurians,
>
> I am excited to announce the publication of my latest in-depth blog
> post on the topic of HTTP and web application development. Since I am
> currently looking for work, I had the opportunity to dedicate my
> mornings - when I’m at peak mental clarity - to creating this content
> over the course of a week.

Hi Daniel,

  Thanks for sharing your post on building a dependency-free, minimal
HTTP server. In the same vein, I thought you (and perhaps some others
on this mailing list) might be interested in seeing my
dependency-free, minimal Gemini server, Space-Age. I built it several
years ago when the Gemini protocol was just firming up, and I've had
great fun in using it to run both my personal site and the software
team wiki at my workplace.

Since it is also written in Clojure without any dependencies on third
party libraries, its socket management code looks quite a lot like
yours but also includes features for encryption and authentication
over SSL/TLS with X.509 certificates. Here's the link if anyone is
interested:

https://gitlab.com/lambdatronic/space-age

The smallnet/smolnet is a real breath of fresh air after being
inundated by the every increasing corporatization of the web over the
last few decades. And from a learning perspective, working with much
simpler, alternative communication protocols greatly increases
accessibility for both users and developers and may even encourage you
to whip up your own Gemini server or client as a weekend project.

Have fun and happy hacking!
  Gary

-- 
GPG Key ID: 7BC158ED
Use `gpg --search-keys lambdatro...@gmail.com' to find me
Protect yourself from surveillance: https://emailselfdefense.fsf.org
===
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

Why is HTML email a security nightmare? See https://useplaintext.email/

Please avoid sending me MS-Office attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/87y18ty2zz.fsf%40gmail.com.


Re: [ANN] New blog post on Perfumed Nightmare

2024-04-28 Thread Daniel Szmulewicz
Apologies for the jumbled paragraph which should read: 

This whirlwind tour sheds light on the design of web frameworks that 
emerged in all language communities (Servlets, WSGI or Rack), reflecting 
the need to standardize around a portable interface abstracting HTTP.
On Sunday, April 28, 2024 at 3:22:36 PM UTC+8 Daniel Szmulewicz wrote:

> Greetings fellow Clojurians,
>
> I am excited to announce the publication of my latest in-depth blog post 
> on the topic of HTTP and web application development. Since I am currently 
> looking for work, I had the opportunity to dedicate my mornings - when I’m 
> at peak mental clarity - to creating this content over the course of a week.
>
> We start with a minimalist web server that soon enough honors the 
> semantics of HTTP/1.1 GET requests. Then, we write a Ring adapter for our 
> server, decoupling the nitty-gritty from application logic.
>
> This whirlwind tour sheds light on the design of web frameworks that 
> emerged in all language communities (Servlets, WSGI or Rack), reflecting 
> the need to standardize around a portable interface abstractinThe anatomy 
> of a HTTP server g HTTP.
>
> At the same time, I went to great length documenting the experience of 
> living and breathing at the REPL. Throughout the post, I explain each 
> decision point and experimentation that ultimately led me to the final 
> design. I know beginners often struggle with that and I hope this can help 
> them in their journey to REPL-oriented development.
>
> For advanced users, feel free to skip the introductory sections and jump 
> to the final code 
> . I 
> welcome contributions from the community that keep the spirit of the 
> exercise: no external dependencies, single namespace, brevity and 
> simplicity of code.
>
> You will find the The Anatomy of a HTTP server 
>  on my blog 
>  dedicated to Lisp programming.
>
> As always, feedback is most welcome! Thank you!
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/2111488c-3455-4a8d-bce8-95afa120f06an%40googlegroups.com.


Re: Sierra's Component

2024-04-06 Thread Paul Stadig
You can do either. If you pass the config as a dependency, then you have to
access it in the `start` method after dependency injection has occurred.

Sometimes it is useful to write a constructor function to initialize the
component. If that constructor needs access to the config it must be passed
to the function, not provided as a dependency.

On Sat, Apr 6, 2024, 1:00 AM dieter.v...@gmail.com <
dieter.van.ees...@gmail.com> wrote:

> Hello,  I'm playing a bit with the 'Component' library. The system has
> some initial configuration (port numbers, uri's, usernames,...) in code.
>
> I'm doubting to eighter pass configuration when constructing the system:
> (C/system-map
>  :mycomponent  (map->MyComponent {:conf ...})
>
> OR to pass configuration itself as a component
> (defrecord Config ...)
> (C/system-map
> :config ...
> :mycomponent
>(C/using (map->MyComponent ...) [:config])
>
> Is there any reason why to prefer one way over the  other or is it just
> personal preference?
>
> kind regards,
> Dieter
>
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/2abcf943-e885-4e17-9856-0247959115dcn%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CADQBrAT3fcv10bbwESWf8AHJouzx_nKrTZbO9BZ04%3DoKMrH19g%40mail.gmail.com.


Re: what is the best forum for keeping up with Clojure?

2024-01-10 Thread Laws
Thank you much.

On Wednesday, January 10, 2024 at 1:26:16 AM UTC-5 Sean Corfield wrote:

> The Clojurians Slack is probably the largest and most activity community 
> these days – http://clojurians.net to self-signup and 
> https://clojurians.slack.com for the content – but there's also 
> https://clojureverse.org if you prefer a "forum" over "chat". And there's 
> r/Clojure on Reddit – which also has a handy list of active Clojure 
> communities online in the right hand column.
>
> Also check out this list of resources on the official website: Clojure - 
> Community Resources 
>
> Sean A Corfield -- (510) 862-3370
> An Architect's View -- https://corfield.org/
> World Singles Networks, LLC. -- https://worldsinglesnetworks.com/ 
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
>
> --
> *From:* clo...@googlegroups.com  on behalf of 
> Laws 
> *Sent:* Tuesday, January 9, 2024 2:46 PM
> *To:* Clojure 
> *Subject:* what is the best forum for keeping up with Clojure? 
>  
> Hi everyone, 
>
> I did a lot with Clojure back 2012-2019, but I've been away from it for 
> several years. Now I'm beginning a big new project in Clojure. I'm curious, 
> where would I go to learn about the newest libraries and projects? There 
> was a time 5 years ago when I knew all of the best and most interesting 
> projects, but nowadays I know very little about the scene. is there any 
> forum where people talk about Clojure and all that is new? 
>
>
> Lawrence Krubner
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/clojure/04ea0a28-e263-4af9-93f9-a50295fc1bd0n%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/d935fc6e-3c75-4ef1-ba28-cb0a031fa45en%40googlegroups.com.


Re: what is the best forum for keeping up with Clojure?

2024-01-09 Thread Sean Corfield
The Clojurians Slack is probably the largest and most activity community these 
days – http://clojurians.net to self-signup and https://clojurians.slack.com 
for the content – but there's also https://clojureverse.org if you prefer a 
"forum" over "chat". And there's r/Clojure on Reddit – which also has a handy 
list of active Clojure communities online in the right hand column.

Also check out this list of resources on the official website: Clojure - 
Community Resources

Sean A Corfield -- (510) 862-3370
An Architect's View -- https://corfield.org/
World Singles Networks, LLC. -- https://worldsinglesnetworks.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)


From: clojure@googlegroups.com  on behalf of Laws 

Sent: Tuesday, January 9, 2024 2:46 PM
To: Clojure 
Subject: what is the best forum for keeping up with Clojure?

Hi everyone,

I did a lot with Clojure back 2012-2019, but I've been away from it for several 
years. Now I'm beginning a big new project in Clojure. I'm curious, where would 
I go to learn about the newest libraries and projects? There was a time 5 years 
ago when I knew all of the best and most interesting projects, but nowadays I 
know very little about the scene. is there any forum where people talk about 
Clojure and all that is new?


Lawrence Krubner

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/04ea0a28-e263-4af9-93f9-a50295fc1bd0n%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/IA1PR11MB619378F23198CAD2F5BCEC70F4692%40IA1PR11MB6193.namprd11.prod.outlook.com.


Re: Can't start figweel.main on other Linux-machine

2023-12-07 Thread ru
Thank you, Gary! Sorry, my inadvertency.

среда, 29 ноября 2023 г. в 02:37:23 UTC+3, Gary Johnson: 

> ru  writes:
>
> > I moved a working project from one Linux-machine to other.
> > And that's what I got:
> >
> > ru@ru-sitrol:~$ cd clojure/pro-figweel/
> > ru@ru-sitrol:~/clojure/pro-figweel$ clojure -m figweel.main -b dev -r
>
> 8<-->8
>
> Downloading from clojars and error messages elided
>
> 8<-->8
>
> > "Could not locate figweel/main__init.class, figweel/main.clj or
> > figweel/main.cljc on classpath."}}
> >
> >
> > What can be reason of this?
> > Any help would be greatly appreciated.
> >
> > Sincerely,
> > Ru
>
> Hi Ru,
>
> You are the victim of a typo, I'm afraid. You forgot the "h" in
> "figwheel". The correct command should be:
>
> ```
> ru@ru-sitrol:~/clojure/pro-figweel$ clojure -m figwheel.main -b dev -r
> ```
>
> Have fun and happy hacking!
> Gary
>
> -- 
> GPG Key ID: 7BC158ED
> Use `gpg --search-keys lambda...@gmail.com' to find me
> Protect yourself from surveillance: https://emailselfdefense.fsf.org
> ===
> () ascii ribbon campaign - against html e-mail
> /\ www.asciiribbon.org - against proprietary attachments
>
> Why is HTML email a security nightmare? See https://useplaintext.email/
>
> Please avoid sending me MS-Office attachments.
> See http://www.gnu.org/philosophy/no-word-attachments.html
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/e9174146-49ed-4f7b-bdf8-26461828f096n%40googlegroups.com.


Re: Can't start figweel.main on other Linux-machine

2023-11-28 Thread Gary Johnson
ru  writes:

> I moved a working project from one Linux-machine to other.
> And that's what I got:
>
> ru@ru-sitrol:~$ cd clojure/pro-figweel/
> ru@ru-sitrol:~/clojure/pro-figweel$ clojure -m figweel.main -b dev -r

8<-->8

  Downloading from clojars and error messages elided

8<-->8

> "Could not locate figweel/main__init.class, figweel/main.clj or
> figweel/main.cljc on classpath."}}
>
>
> What can be reason of this?
> Any help would be greatly appreciated.
>
> Sincerely,
>   Ru

Hi Ru,

  You are the victim of a typo, I'm afraid. You forgot the "h" in
"figwheel". The correct command should be:

```
ru@ru-sitrol:~/clojure/pro-figweel$ clojure -m figwheel.main -b dev -r
```

Have fun and happy hacking!
  Gary

-- 
GPG Key ID: 7BC158ED
Use `gpg --search-keys lambdatro...@gmail.com' to find me
Protect yourself from surveillance: https://emailselfdefense.fsf.org
===
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

Why is HTML email a security nightmare? See https://useplaintext.email/

Please avoid sending me MS-Office attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/87y1ehcuvx.fsf%40gmail.com.


Re: 2nd Call for Contributions: BOB 2024 [March 15, Deadline Nov 17]

2023-11-14 Thread Michael Sperber
The deadline is looming - it'd be great to have Clojure material, 
specifically tutorials are very welcome!

On Friday, November 3, 2023 at 10:48:24 AM UTC+1 Michael Sperber wrote:

> We could definitely use some more Clojure material at BOB!
>
>
> 
>  BOB Conference 2024
>  "What happens when we use what's best for a change?"
>   https://bobkonf.de/2024/cfc.html
>  Berlin, Mar 17
> Call for Contributions
>  Deadline: November 17, 2023
>
> 
>
> You are actively engaged in advanced software engineering methods,
> solve ambitious problem with software and are open to cutting-edge
> innovation? Attend this conference, meet people that share your goals,
> and get to know the best software tools and technologies available
> today. We strive to offer a day full of new experiences and
> impressions that you can use to immediately improve your daily life as
> a software developer.
>
> If you share our vision and want to contribute, submit a proposal for
> a talk or tutorial!
>
> NOTE: The conference fee will be waived for presenters. Travel
> expenses will not be covered (for exceptions see "Speaker Grants").
>
> Shepherding
> ---
>
> The program committee offers shepherding to all speakers. Shepherding
> provides speakers assistance with preparing their
> sessions. Specifically:
>
> - advice on structure and presentation
> - review of talk slides
>
> Speaker Grants
> --
>
> BOB has Speaker Grants available to support speakers from groups
> under-represented in technology. We specifically seek women speakers,
> speakers of color, and speakers who are not able to attend the
> conference for financial reasons.
>
> Topics
> --
>
> We are looking for talks about best-of-breed software technology, e.g.:
>
> - functional programming
> - persistent data structures and databases
> - event-based modelling and architecture
> - "fancy types" (dependent types, gradual typing, linear types, ...)
> - formal methods for correctness and robustness
> - abstractions for concurrency and parallelism
> - metaprogramming
> - probabilistic programming
> - math and programming
> - controlled side effects
> - program synthesis
> - next-generation IDEs
> - effective abstractions for data analytics
> - … everything really that isn’t mainstream, but you think should be
> - … includeing rough ideas worth discussing.
>
> Presenters should provide the audience with information that is
> practically useful for software developers.
>
> Challenges
> --
>
> Furthermore, we seek contributions on successful approaches for
> solving hard problems, for example:
>
> - bias in machine-learning systems
> - digital transformation in difficult settings
> - accessibiltity
> - systems with critical reliability requirements
> - ecologically sustainable software development
>
> We're especially interested in experience reports.
> Other topics are also relevant, e.g.:
>
> - introductory talks on technical background
> - overviews of a given field
> - demos and how-tos
>
> Requirements
> 
>
> We accept proposals for presentations of 45 minutes (40 minutes talk +
> 5 minutes questions), as well as 90 minute tutorials for
> beginners. The language of presentation should be either English or
> German.
>
> Your proposal should include (in your presentation language of choice):
>
> - An abstract of max. 1500 characters.
> - A short bio/cv
> - Contact information (including at least email address)
> - A list of 3-5 concrete ideas of how your work can be applied in a 
> developer's daily life
> - additional material (websites, blogs, slides, videos of past 
> presentations, …)
>
> Organisation
> 
>
> - Direct questions to konferenz at bobkonf dot de
> - Proposal deadline: November 17, 2023
> - Notification: December 5, 2023
> - Program: December 12, 2023
>
> Submit here:
>
> https://pretalx.com/bob-2024/submit/
>
> Program Committee
> -
>
> (more information here: https://bobkonf.de/2024/programmkomitee.html)
>
> - Matthias Fischmann, Wire
> - Matthias Neubauer, SICK AG
> - Nicole Rauch, Softwareentwicklung und Entwicklungscoaching
> - Michael Sperber, Active Group
> - Stefan Wehr, Hochschule Offenburg
>
> Scientific Advisory Board
>
> - Annette Bieniusa, TU Kaiserslautern
> - Torsten Grust, Uni Tübingen
> - Peter Thiemann, Uni Freiburg
>

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

Re: Suspended var swaps in core.logic.nominal

2023-11-11 Thread Moe Aboulkheir
According to the wiki:




*In core.logic.nominal, we implement suspensions as constraints. During
swapping of a and b, whenever we encounter a variable x, we replace it with
a fresh variable x' and add the suspension constraint swap [a b] x' x. This
swap constraint is executed under one of two conditions:x and x' both
become bound -- the swapping can resumex and x' become equal -- we enforce
a#x' and b#x' and drop the swap constraint*

I do not see how either of these conditions obtains in the quoted example —
*x * and *y* are unbound.

Best,
Moe

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CACZF%3DBG2cLMVc3Wn_v0%3DQTUZLJtDuGNoUXFdSAZ9DqzcrKYfZw%40mail.gmail.com.


Re: Clojure Golf, episode 1

2023-07-08 Thread Fiverr Me
The code snippet you provided is written in Clojure, a dialect of Lisp. The 
function filter-collecting takes a predicate function, a collector 
function, and multiple lists as arguments. It filters the lists based on 
the predicate function and collects the values from the corresponding 
positions in the lists using the collector function. Copied 
from https://fiverrme.com/

(filter-collecting
  (fn [x y] (< x y))  ; predicate function: checks if x < y
  (fn [x y] (+ x y))  ; collector function: adds x and y
  '(1 7 3 9)  ; first list
  '(5 5 5 5)) ; second list

The first list is (1 7 3 9) and the second list is (5 5 5 5). The function 
checks if each corresponding pair of elements from the two lists satisfies 
the predicate function (x < y). In this case, the pairs (1 5) and (3 5) 
satisfy the predicate because 1 is less than 5 and 3 is less than 5.

For the pairs that satisfy the predicate, the collector function (+) is 
applied to the corresponding elements. The sum of (1 5) is 6, and the sum 
of (3 5) is 8.

Therefore, the result of (filter-collecting (fn [x y] (< x y)) (fn [x y] (+ 
x y)) '(1 7 3 9) '(5 5 5 5)) is (6 8).
On Friday, 14 August 2009 at 18:42:39 UTC-7 Fogus wrote:

> > (defn filter-collecting [predicate collector & lists]
> >   (for [v (apply map vector lists) :when (apply predicate v)] (apply
> > collector v)))
>
> This is very nice. It's short, sweet, and actually describes the
> functionality.
>
> -m
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/b4463e90-de8c-43a9-91fb-b8317af10ec3n%40googlegroups.com.


Re: Switch devops environments via namespaces

2023-05-18 Thread aditya....@gmail.com
So from an ops point of view, I like your first approach; viz. pass the 
environment parameter explicitly.

I prefer being explicit about every single invocation of any ops task.

The namespace solution, while being "legal", causes the configuration to 
become implicit, one has to look at the REPL prompt to "know", rather than 
be confident that we told the function exactly where to call.

>From a Clojure sensibilities point of view, what was stateless (explicit 
param) becomes stateful (implicit global state with def server). This can 
cause all manner of subtle issues, e.g. accidentally referring to the var 
instead of the resolved var in some service function.

Personally, I would go with your original approach, because it forces me to 
slow down a little and pay attention, while I'm typing, every single time. 
This is in service of human error mitigation. I would say the explicit 
workflow is close to the "pointing and calling" method 
https://en.wikipedia.org/wiki/Pointing_and_calling

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/b6713010-47cc-4bd6-8073-d9d5d681d62cn%40googlegroups.com.


Re: Switch devops environments via namespaces

2023-05-18 Thread Joe R . Smith
I mean, it works, it’s clever, … is it more or less “safe” is my question. 


On May 18, 2023, at 12:02 PM, Felix Dorner  wrote:


Clojure noob here, I might be totally off the track or committing crimes, so 
please advise.

For ops, I have to often call rest services in different environments, say prod 
and nonprod. My coworkers use postman and clicky clicky stuff, well, not my 
style, I want to use emacs and cider. I've thus written a set of functions that 
call these services, taking the prod/nonprod server as an argument:

(ns services)
(defn rest [server arg1 arg2] ...)

I'm thinking how it would feel to get rid of the server parameter, and resolve 
it inside the function, depending on the current namespace. I can then just 
leave my cider open, use Cider shortcuts to switch to the prod/nonprod 
namespaces quickly and run my stuff. Also, I would be constantly aware of which 
environment I'm in by looking at the repl prompt. Sounds neat somehow. But I 
feel I am venturing off the track somehow, but this seems to work:

(ns prod
  (:require
   [services :refer :all]))

(def server "http://prod-server.com;)

(ns nonprod
  (:require
   [services :refer :all]))

(def server "http://nonprod-server.com;)

(ns services)
;; no more server arg...
(defn call-a [arg1 arg2]
  (let [server @(resolve 'server)]
     ;; ... do stuff with server))

What do I miss? Complete nonsense? Better solutions?
Thanks again for comments,
Felix




-- 
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 
 .
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/f16c7ac6-107c-48fd-a6af-c9e91687fe18n%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/0100018830153cf6-3c4a1729-13a9-472b-aad0-86f85350e7d1-00%40email.amazonses.com.


Re: Clojure is a good choice for Big Data? Which clojure/Hadoop work to use?

2023-05-03 Thread Edward McBride


Storage migration transfers data from one storage device to another. This 
involves moving blocks of storage and files from storage systems, whether 
they're on disk, tape or in the cloud. During migration is also an optimal 
time for organizations to perform data validation and reduction by 
identifying obsolete or corrupt data.

Database migration moves database files to a new device. This is done when 
an organization changes database vendors, upgrades the database software or 
moves a database to the cloud. Databases must be backed up before migrating.

понедельник, 8 июля 2019 г. в 08:49:35 UTC+3, orazio: 

> Many thanks for your clarifications.
> I don't have a team of engineers. Just myself, that I think with much 
> modesty is not little.
> I'm not familiar with clojure, i know java programming language.
> The lambda's architecture pipeline i want to build will not be made 
> entirely with clojure. As described above I will use existing tools that I 
> don't need to develop (NiFi, Kafka, MongoDB, Hadoop, Hbase)
> Let's focus only on the batch layer of the lambda architecture.
> My doubt is that i did not find an optimal tool, recognized by the Big 
> Data community as the best, for distributed data processing (map reduce) of 
> historical data on HDFS.
> Map reduce algorithms that I have to implement concern Word Count 
> Algorithm of social data message (twitter,facebook,telegram) and iot data 
> analisys and aggregation (such as average values each 30 minutes, each 
> hour, each day).
> Reading Nathan Marz big data book, Principles and best practices of 
> scalable realtime data systems, he suggests clojure/Cascalog for 
> distributed data processing on HDFS Hadoop.
> I'm asking you if clojure/cascalog could be a good choice to do dataset 
> processing (map reduce) and to store the resulting data aggregation to 
> Hbase, or if you suggest other work.
> Otherwise, if you know an existing, well documented, well googleable 
> framework in java language to do distributed data processing and to store 
> resulting data aggregation on Hbase,  it would be appreciated your advise 
> about it.
>
> Thanks again.
> Orazio
>
> Il giorno venerdì 5 luglio 2019 19:43:16 UTC+2, ri...@chartbeat.com ha 
> scritto:
>
>> As much as I would love to convert a new data engineer to the ways of 
>> clojure, in my opinion, choosing a language to solve a problem is rarely a 
>> wise move. Do you have a team of engineers ready and willing to learn 
>> clojure or are you doing this yourself? We do a lot of work with all of the 
>> tools you mention (in clojure) but we built a lot of the frameworks 
>> ourselves or wrote wrappers around java tools. Not for the newbie... if 
>> your goal is to build this pipeline for your boss and you have any sort of 
>> deadline do yourself a favor and pick an existing, well documented, well 
>> googleable framework in a language that your team is familiar with. There 
>> are a ton of hurdles with everything you mentioned without even getting to 
>> clojure. You’re jumping in the deep end of the pool with no life jacket and 
>> you don’t know how to swim.
>>
>> That said, if you ignore my advice you will learn a lot and we will be 
>> here to help, just be warned 
>>
>> On Jul 4, 2019, at 2:09 PM, Thad Guidry  wrote:
>>
>> Christian writes really good tools.  Sparkling is no exception.
>> I have yet to use it in production myself however, since I haven't had 
>> the need to use Clojure directly to solve any "data aggregation" problems.  
>> Spark and other tools do that well enough, naturally.
>>
>> As far as using a tool/programming language to solve "data integration" 
>> problems in large enterprise environments, I will ALWAYS use Open Source 
>> tools for that purpose.  Clojure is no exception.  But I do tend to choose 
>> open source hammers to drive nails.  Sometimes Clojure is missing the 
>> handle on its hammer, as we have all experienced, but that's on us since WE 
>> have the power to make Clojure better.  But often TIME is what we lack to 
>> build better API's, libraries, tools for Clojure expansion.
>>
>> The Apache ecosystem offers many tools & libraries for "big data" and 
>> "data integration"  which I often turn to first because I lack TIME for 
>> building (long tail), but have enough TIME for learning new things (shorter 
>> tail that helps the long tail).
>> https://projects.apache.org/projects.html?category 
>>
>> Thad
>> https://www.linkedin.com/in/thadguidry/
>>
>>
>> On Thu, Jul 4, 2019 at 12:37 PM Chris Nuernberger  
>> wrote:
>>
>> Thad,
>>>
>>> You approach seems very promising to me for a lot of jobs.  Spark runs 
>>> on top of many things.
>>>
>>> As far as a clojure layer on top, what do you think about sparkling 
>>> ?
>>>
>>> On Thu, Jul 4, 2019 at 8:43 AM Thad Guidry  wrote:
>>>
>> "Batch" - doing things in chunks
 "Processing" - THE WORLD :-)  because it means so many different things 
 to so many folks 

Re: Intercepting emacs nrepl input within cider

2023-03-07 Thread Benjamin Schwerdtner
Here is a suggestion in the space of what you are asking:
Assuming my-dsl-eval is a macro:

```
(defun my-cider-dsl-eval-last-sexp ()
  (interactive)
  (cider-nrepl-sync-request:eval
   (format "(my-dsl-eval %s)" (cider-last-sexp
```


On Mon, Mar 6, 2023 at 4:28 AM Conrad  wrote:

> Hi everyone, I'm not super familiar with the internals of cider/nrepl/etc,
> but I have a clojure project with a domain-specific language, and would
> like to be able to type DSL commands into the nrepl, and have custom
> clojure code that checks if it's a DSL command first, before forwarding it
> to the usual cider/clojure reader/evaluator.
>
> I'd appreciate any quick pointers for how I would best go about doing
> this, if any of you folks understand these tools a bit better.
>
> Thanks in advance for any tips!
>
> Conrad Barski
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/f30bd8e5-015b-4965-8150-f3800db984f0n%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CAOiYe4a4VzA-zHEztGw4Zha23MKhAV7yQ%2BWZBnX0GbEusDNguQ%40mail.gmail.com.


Re: Override deps

2023-02-17 Thread 'Tête à-tête' via Clojure
It really was that stoopid but, it needed a 2nd pair of eyes!

Thanks.

On Tuesday, 14 February 2023 at 01:04:13 UTC Alex Miller wrote:

> There may be other things wrong, but hard to tell without more context of 
> your deps.edn.
>
> On Mon, Feb 13, 2023 at 7:02 PM Alex Miller  wrote:
>
>> It looks like you misspelled ":override-deps" (two r's) ?
>>
>> On Mon, Feb 13, 2023 at 5:50 PM 'Tête à-tête' via Clojure <
>> clo...@googlegroups.com> wrote:
>>
>>> :overide-deps
>>> {edu.stanford.nlp/stanford-corenlp {:mvn/version "4.5.2"}}
>>>
>>> I've tried preventing corenlp 4.4.0 and, here, I'm insisting on 4.5.2!  
>>>
>>> A framework that I use relies on corenlp but, I want deps to resolve to 
>>> the latest version only, so not backfill the m2 repo.
>>>
>>>
>>> On Monday, 13 February 2023 at 23:27:38 UTC Alex Miller wrote:
>>>
 Can you share an example deps.edn or some more information?  Also, what 
 Clojure CLI version are you using `clj --version`.

 Alex

 On Monday, February 13, 2023 at 7:14:20 AM UTC-6 
 deliver...@googlemail.com wrote:

> My laptop is struggling for space and, I would like to override a 
> dependency, so that earlier versions aren't pulled to m2 repo.
>
> If it's :override-deps, I'm just doing it wrong!
>
> Whenever I boot a repl, it won't boot, unless it starts pulling a 
> half-gig of I-don't-want-this- old-version!
>
>
> -- 
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@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+u...@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 a topic in the 
>>> Google Groups "Clojure" group.
>>> To unsubscribe from this topic, visit 
>>> https://groups.google.com/d/topic/clojure/g-Gy3Q7jHfk/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> clojure+u...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/clojure/22215b6b-73ec-4f5d-ba4f-c24a3010b32fn%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/5c0ea998-d19f-469d-a0dc-c62f53f2c665n%40googlegroups.com.


Re: Override deps

2023-02-13 Thread 'Alex Miller' via Clojure
There may be other things wrong, but hard to tell without more context of
your deps.edn.

On Mon, Feb 13, 2023 at 7:02 PM Alex Miller  wrote:

> It looks like you misspelled ":override-deps" (two r's) ?
>
> On Mon, Feb 13, 2023 at 5:50 PM 'Tête à-tête' via Clojure <
> clojure@googlegroups.com> wrote:
>
>> :overide-deps
>> {edu.stanford.nlp/stanford-corenlp {:mvn/version "4.5.2"}}
>>
>> I've tried preventing corenlp 4.4.0 and, here, I'm insisting on 4.5.2!
>>
>> A framework that I use relies on corenlp but, I want deps to resolve to
>> the latest version only, so not backfill the m2 repo.
>>
>>
>> On Monday, 13 February 2023 at 23:27:38 UTC Alex Miller wrote:
>>
>>> Can you share an example deps.edn or some more information?  Also, what
>>> Clojure CLI version are you using `clj --version`.
>>>
>>> Alex
>>>
>>> On Monday, February 13, 2023 at 7:14:20 AM UTC-6
>>> deliver...@googlemail.com wrote:
>>>
 My laptop is struggling for space and, I would like to override a
 dependency, so that earlier versions aren't pulled to m2 repo.

 If it's :override-deps, I'm just doing it wrong!

 Whenever I boot a repl, it won't boot, unless it starts pulling a
 half-gig of I-don't-want-this- old-version!


 --
>> 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 a topic in the
>> Google Groups "Clojure" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/clojure/g-Gy3Q7jHfk/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> clojure+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/clojure/22215b6b-73ec-4f5d-ba4f-c24a3010b32fn%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CAOdgdgxWS8kfBQUCHd7FvdZu9Unr%2BLjW_mDatxOUhxpSStu-DQ%40mail.gmail.com.


Re: Override deps

2023-02-13 Thread 'Alex Miller' via Clojure
It looks like you misspelled ":override-deps" (two r's) ?

On Mon, Feb 13, 2023 at 5:50 PM 'Tête à-tête' via Clojure <
clojure@googlegroups.com> wrote:

> :overide-deps
> {edu.stanford.nlp/stanford-corenlp {:mvn/version "4.5.2"}}
>
> I've tried preventing corenlp 4.4.0 and, here, I'm insisting on 4.5.2!
>
> A framework that I use relies on corenlp but, I want deps to resolve to
> the latest version only, so not backfill the m2 repo.
>
>
> On Monday, 13 February 2023 at 23:27:38 UTC Alex Miller wrote:
>
>> Can you share an example deps.edn or some more information?  Also, what
>> Clojure CLI version are you using `clj --version`.
>>
>> Alex
>>
>> On Monday, February 13, 2023 at 7:14:20 AM UTC-6
>> deliver...@googlemail.com wrote:
>>
>>> My laptop is struggling for space and, I would like to override a
>>> dependency, so that earlier versions aren't pulled to m2 repo.
>>>
>>> If it's :override-deps, I'm just doing it wrong!
>>>
>>> Whenever I boot a repl, it won't boot, unless it starts pulling a
>>> half-gig of I-don't-want-this- old-version!
>>>
>>>
>>> --
> 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 a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/g-Gy3Q7jHfk/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/22215b6b-73ec-4f5d-ba4f-c24a3010b32fn%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CAOdgdgyDiR1DGfOG9a-ACnMg1fw3jdxzCe0ceh6tCMFA31KisA%40mail.gmail.com.


Re: Override deps

2023-02-13 Thread 'Tête à-tête' via Clojure
:overide-deps
{edu.stanford.nlp/stanford-corenlp {:mvn/version "4.5.2"}}

I've tried preventing corenlp 4.4.0 and, here, I'm insisting on 4.5.2!  

A framework that I use relies on corenlp but, I want deps to resolve to the 
latest version only, so not backfill the m2 repo.


On Monday, 13 February 2023 at 23:27:38 UTC Alex Miller wrote:

> Can you share an example deps.edn or some more information?  Also, what 
> Clojure CLI version are you using `clj --version`.
>
> Alex
>
> On Monday, February 13, 2023 at 7:14:20 AM UTC-6 deliver...@googlemail.com 
> wrote:
>
>> My laptop is struggling for space and, I would like to override a 
>> dependency, so that earlier versions aren't pulled to m2 repo.
>>
>> If it's :override-deps, I'm just doing it wrong!
>>
>> Whenever I boot a repl, it won't boot, unless it starts pulling a 
>> half-gig of I-don't-want-this- old-version!
>>
>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/22215b6b-73ec-4f5d-ba4f-c24a3010b32fn%40googlegroups.com.


Re: Override deps

2023-02-13 Thread 'Alex Miller' via Clojure
Can you share an example deps.edn or some more information?  Also, what 
Clojure CLI version are you using `clj --version`.

Alex

On Monday, February 13, 2023 at 7:14:20 AM UTC-6 deliver...@googlemail.com 
wrote:

> My laptop is struggling for space and, I would like to override a 
> dependency, so that earlier versions aren't pulled to m2 repo.
>
> If it's :override-deps, I'm just doing it wrong!
>
> Whenever I boot a repl, it won't boot, unless it starts pulling a half-gig 
> of I-don't-want-this- old-version!
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/db025048-e990-4ccb-8340-1ed6e42d70cdn%40googlegroups.com.


Re: ? stateful-map ?

2022-12-09 Thread Steve Miner
See also https://github.com/cgrand/xforms for a transducer version of 
reductions.  The argument f must have a nullary arity.  (You could probably 
create your own variant if you want an explicit init value.)  I think something 
like this should work:

(require '[net.cgrand.xforms :as x])

(defn xscan-left
  ([f coll] (sequence (xscan-left f) coll))
  ([f] (comp (x/reductions f) (drop 1

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/28761DAD-5FB9-4561-ACD1-BCDE3D64BEEB%40gmail.com.


Re: ANN: just-maven-clojure-archetype 0.3-RELEASE

2022-11-29 Thread Jon Seltzer
Thanks m...@talios.com.

a...@puredanger.com - many thanks for all you do. We all benefit from your 
hard work.

I wanted:

- to show Clojure developers know that Maven is already fully featured.
- to demonstrate that Maven archetypes are a great way to provided starter 
projects in an enterprise.
- to help Clojure enthusiasts sneak Clojure into Java shops without anyone 
noticing.
- to encourage teams to create their own by showing they can plug in easily 
and use Clojure anywhere in the Maven lifecycle.
- possibly start a trend where starter projects (archetypes) are shared in 
the community making easier to introduce Clojure into the Java ecosystem.

On Sunday, November 20, 2022 at 3:56:12 PM UTC-8 al...@puredanger.com wrote:

> It still builds all the Clojure contrib projects. :)
>
> On Saturday, November 19, 2022 at 10:54:18 PM UTC-6 ma...@talios.com 
> wrote:
>
>> Nice,
>>
>> Almost surprised to not see my clojure-maven-plugin pop in there - it’s 
>> always a surprise finding folk still using it.
>>
>> -- 
>> "Great artists are extremely selfish and arrogant things" — Steven 
>> Wilson, Porcupine Tree
>>
>>
>> On 20/11/2022 at 1:43:52 PM, Jon Seltzer  wrote:
>>
>>> Bumped version, some small changes - see details here 
>>> .
>>>
>>> Let's you do Clojure development in a Java shop without demanding the 
>>> adoption of a new build stack - it's just Maven.
>>>
>>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/060ae70e-ed6a-4c52-b355-ea3f5b39dd7fn%40googlegroups.com.


Re: ? stateful-map ?

2022-11-28 Thread Jules
Very nearly a direct hit :-)

'reductions' definitely gives me what I want when dealing with eager and 
lazy sequences ... but... it seems to have escaped the transducer makeover 
:-(

core> (reductions + 0 [1 2 3 4 5])
(0 1 3 6 10 15)
core> (take 6 (reductions + (range)))
(0 1 3 6 10 15)
core> (reductions + 0)
Error printing return value (IllegalArgumentException) at 
clojure.lang.RT/seqFrom (RT.java:557).
Don't know how to create ISeq from: java.lang.Long
core> (reductions +)
Execution error (ArityException) at theremin.core/eval351732 
(form-init6069347464735150015.clj:60).
Wrong number of args (1) passed to: clojure.core/reductions
core> 

at least I now know what to call what I am looking for.

Thanks for your help - much appreciated,


Jules

On Sunday, 27 November 2022 at 23:47:22 UTC sritc...@gmail.com wrote:

> Pretty sure what you’re looking for is either 
> https://clojuredocs.org/clojure.core/reductions or something close. This 
> idea is called a “scanLeft” in some functional languages, so that should 
> give you another search term to use. Good luck!
>
> On Sun, Nov 27, 2022, at 12:00 PM, Jules wrote:
>
> Guys,
>
> I've found myself needing a function that I am sure cannot be an original 
> but I'm not aware of it existing anywhere...
>
> It is a cross between 'map', 'reduce' and 'iterate'...
>
> Given a function 'f' and a sequence 's' it would return you  a sequence of 
> :
> ```
> [(f s[0]) (f (f s[0]) s[1]) (f (f (f s[0]) s[1]) s[2]) ...]
> ```
>
> or, more concretely, e.g.:
> ```
> util-test> (stateful-map + [0 1 2 3 4 5])
> [0 1 3 6 10 15]
> util-test> 
> ```
>
> I have a couple of approaches to it - one using reduce:
>
> ```
> (defn stateful-map-1 [f [h & t]]
>   (reduce
>(fn [acc v]
>  (conj acc (f (last acc) v)))
>[h]
>t))
> ```
>
> and another, mapping using a stateful function:
>
> ```
> (let [secret (Object.)]
>   (defn stateful-mapper [f]
> (let [state (volatile! secret)] (fn [v] (vswap! state (fn [old new] 
> (if (= secret old) (f new) (f old new))) v)
>
> (defn stateful-map-2 [f s]
>   (mapv (stateful-mapper f) s))
> ```
>
> The former feels more idiomatic whereas the latter (although uglier) is 
> more efficient and has the added benefit of being able to be used for 
> general map-ing which is important as I want to use this approach to 
> transduce a clojure.async.channel.
>
> It could, of course, be expressed directly as a transducer but it feels 
> like something simpler that should only be lifted to a transducer as and 
> when needed (see test below) ...
>
> Here is my working testsuite:
>
> ```
> (deftest stateful-map-test
>   (testing "reduction"
> (is
>  (=
>   [0 1 3 6 10 15]
>   (stateful-map-1 + [0 1 2 3 4 5]
>   (testing "mapping stateful function"
> (is
>  (=
>   [0 1 3 6 10 15]
>   (stateful-map-2 + [0 1 2 3 4 5]
>   (testing "transduction"
> (is
>  (=
>   [0 1 3 6 10 15]
>   (sequence (map (stateful-mapper +)) [0 1 2 3 4 5])
> ```
>
> Am I missing a standard way of doing this in Clojure ? Or is a stateful 
> function the best answer ?
>
> Interested in your thoughts,
>
>
> Jules
>
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/clojure/f1ada73f-8249-431a-9f4d-580aea12bdefn%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/4c2bf7c2-2703-4d4a-9cc0-00cc830d2705n%40googlegroups.com.


Re: ? stateful-map ?

2022-11-27 Thread Sam Ritchie
Pretty sure what you’re looking for is either 
https://clojuredocs.org/clojure.core/reductions or something close. This idea 
is called a “scanLeft” in some functional languages, so that should give you 
another search term to use. Good luck!

On Sun, Nov 27, 2022, at 12:00 PM, Jules wrote:
> Guys,
> 
> I've found myself needing a function that I am sure cannot be an original but 
> I'm not aware of it existing anywhere...
> 
> It is a cross between 'map', 'reduce' and 'iterate'...
> 
> Given a function 'f' and a sequence 's' it would return you  a sequence of :
> ```
> [(f s[0]) (f (f s[0]) s[1]) (f (f (f s[0]) s[1]) s[2]) ...]
> ```
> 
> or, more concretely, e.g.:
> ```
> util-test> (stateful-map + [0 1 2 3 4 5])
> [0 1 3 6 10 15]
> util-test> 
> ```
> 
> I have a couple of approaches to it - one using reduce:
> 
> ```
> (defn stateful-map-1 [f [h & t]]
>   (reduce
>(fn [acc v]
>  (conj acc (f (last acc) v)))
>[h]
>t))
> ```
> 
> and another, mapping using a stateful function:
> 
> ```
> (let [secret (Object.)]
>   (defn stateful-mapper [f]
> (let [state (volatile! secret)] (fn [v] (vswap! state (fn [old new] (if 
> (= secret old) (f new) (f old new))) v)
> 
> (defn stateful-map-2 [f s]
>   (mapv (stateful-mapper f) s))
> ```
> 
> The former feels more idiomatic whereas the latter (although uglier) is more 
> efficient and has the added benefit of being able to be used for general 
> map-ing which is important as I want to use this approach to transduce a 
> clojure.async.channel.
> 
> It could, of course, be expressed directly as a transducer but it feels like 
> something simpler that should only be lifted to a transducer as and when 
> needed (see test below) ...
> 
> Here is my working testsuite:
> 
> ```
> (deftest stateful-map-test
>   (testing "reduction"
> (is
>  (=
>   [0 1 3 6 10 15]
>   (stateful-map-1 + [0 1 2 3 4 5]
>   (testing "mapping stateful function"
> (is
>  (=
>   [0 1 3 6 10 15]
>   (stateful-map-2 + [0 1 2 3 4 5]
>   (testing "transduction"
> (is
>  (=
>   [0 1 3 6 10 15]
>   (sequence (map (stateful-mapper +)) [0 1 2 3 4 5])
> ```
> 
> Am I missing a standard way of doing this in Clojure ? Or is a stateful 
> function the best answer ?
> 
> Interested in your thoughts,
> 
> 
> Jules
> 
> 
> 
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/clojure/f1ada73f-8249-431a-9f4d-580aea12bdefn%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/798d8cc2-b3b0-4036-b3a2-5cbf43751c98%40app.fastmail.com.


Re: ? stateful-map ?

2022-11-27 Thread Jules
I thought I should have a look at clojure.core.reducers in case there was 
an answer there - but this all still looks eager whereas I need something 
like a lazy reduction which applies a given function to its accumulator and 
each input to give it's new accumulator, which is output on each step...

Jules


On Sunday, 27 November 2022 at 19:00:48 UTC Jules wrote:

> Guys,
>
> I've found myself needing a function that I am sure cannot be an original 
> but I'm not aware of it existing anywhere...
>
> It is a cross between 'map', 'reduce' and 'iterate'...
>
> Given a function 'f' and a sequence 's' it would return you  a sequence of 
> :
> ```
> [(f s[0]) (f (f s[0]) s[1]) (f (f (f s[0]) s[1]) s[2]) ...]
> ```
>
> or, more concretely, e.g.:
> ```
> util-test> (stateful-map + [0 1 2 3 4 5])
> [0 1 3 6 10 15]
> util-test> 
> ```
>
> I have a couple of approaches to it - one using reduce:
>
> ```
> (defn stateful-map-1 [f [h & t]]
>   (reduce
>(fn [acc v]
>  (conj acc (f (last acc) v)))
>[h]
>t))
> ```
>
> and another, mapping using a stateful function:
>
> ```
> (let [secret (Object.)]
>   (defn stateful-mapper [f]
> (let [state (volatile! secret)] (fn [v] (vswap! state (fn [old new] 
> (if (= secret old) (f new) (f old new))) v)
>
> (defn stateful-map-2 [f s]
>   (mapv (stateful-mapper f) s))
> ```
>
> The former feels more idiomatic whereas the latter (although uglier) is 
> more efficient and has the added benefit of being able to be used for 
> general map-ing which is important as I want to use this approach to 
> transduce a clojure.async.channel.
>
> It could, of course, be expressed directly as a transducer but it feels 
> like something simpler that should only be lifted to a transducer as and 
> when needed (see test below) ...
>
> Here is my working testsuite:
>
> ```
> (deftest stateful-map-test
>   (testing "reduction"
> (is
>  (=
>   [0 1 3 6 10 15]
>   (stateful-map-1 + [0 1 2 3 4 5]
>   (testing "mapping stateful function"
> (is
>  (=
>   [0 1 3 6 10 15]
>   (stateful-map-2 + [0 1 2 3 4 5]
>   (testing "transduction"
> (is
>  (=
>   [0 1 3 6 10 15]
>   (sequence (map (stateful-mapper +)) [0 1 2 3 4 5])
> ```
>
> Am I missing a standard way of doing this in Clojure ? Or is a stateful 
> function the best answer ?
>
> Interested in your thoughts,
>
>
> Jules
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/fd2a6541-6d54-427c-a603-f451cd4728f3n%40googlegroups.com.


Re: ANN: just-maven-clojure-archetype 0.3-RELEASE

2022-11-20 Thread 'Alex Miller' via Clojure
It still builds all the Clojure contrib projects. :)

On Saturday, November 19, 2022 at 10:54:18 PM UTC-6 ma...@talios.com wrote:

> Nice,
>
> Almost surprised to not see my clojure-maven-plugin pop in there - it’s 
> always a surprise finding folk still using it.
>
> -- 
> "Great artists are extremely selfish and arrogant things" — Steven Wilson, 
> Porcupine Tree
>
>
> On 20/11/2022 at 1:43:52 PM, Jon Seltzer  wrote:
>
>> Bumped version, some small changes - see details here 
>> .
>>
>> Let's you do Clojure development in a Java shop without demanding the 
>> adoption of a new build stack - it's just Maven.
>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/c97a2983-7e1e-45d1-ad09-958824c525aen%40googlegroups.com.


Re: ANN: just-maven-clojure-archetype 0.3-RELEASE

2022-11-19 Thread Mark Derricutt
Nice,

Almost surprised to not see my clojure-maven-plugin pop in there - it’s
always a surprise finding folk still using it.

-- 
"Great artists are extremely selfish and arrogant things" — Steven Wilson,
Porcupine Tree


On 20/11/2022 at 1:43:52 PM, Jon Seltzer  wrote:

> Bumped version, some small changes - see details here
> .
>
> Let's you do Clojure development in a Java shop without demanding the
> adoption of a new build stack - it's just Maven.
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CALYGm1zHeze%2Bs%2B9o_BsKKCQFgaWmg63TAKWJuZGxpLdriak%3DxQ%40mail.gmail.com.


Re: Announcing The Little Learner: A Straight Line to Deep Learning

2022-09-08 Thread Anurag Mendhekar
Lol! Craig ... wait till you see the rest of the book!

A. 

On Thursday, September 8, 2022 at 6:55:02 AM UTC-7 Craig Brozefsky wrote:

> I'm deeply concerned that a paragon of the lisp community has a "Pointer 
> Sisters" reference as the basis for one of their illustrations.
>
> This is normalizing abusive, and dangerous direct memory management, and 
> is not something our young learners should be exposed to.
>
> Or, maybe I'm just upset because I recognized the image and pun and feel 
> really old now.
>
> OMG, squeee! 
>
> On Wed, Sep 7, 2022 at 6:50 PM Anurag Mendhekar  
> wrote:
>
>> Daniel P. Friedman (Of The Little Lisper and The Little Schemer fame) and 
>> I (Anurag Mendhekar) are pleased to announce that our upcoming book *The 
>> Little Learner: A Straight Line to Deep Learning* just got its release 
>> date, complete with a Preorder Sale (Barnes and Noble, 25%) 
>>  The book comes out 
>> on 2/21/2023.
>>
>> "The Little Learner" covers all the concepts necessary to develop an 
>> intuitive understanding of the workings of deep neural networks: tensors, 
>> extended operators, gradient descent algorithms, artificial neurons, dense 
>> networks, convolutional networks, residual networks and automatic 
>> differentiation.
>>
>> The authors aim to explain the workings of Deep Learning to readers who 
>> may not have the mathematical sophistication necessary to read the existing 
>> literature on the subject. Unlike other books in the field, this book makes 
>> very few assumptions about background knowledge (high-school mathematics 
>> and familiarity with programming). The authors use a layered approach to 
>> construct advanced concepts from first principles using really small 
>> (“little”) programs that build on one another. This is one of the things 
>> that makes this book unique.
>>
>> The other is that it introduces these ideas using a conversational style 
>> in Question/Answer format that is characteristic of the other books in the 
>> Little series. The conversational style puts the reader at ease and enables 
>> the introduction of ideas in frame-by-frame manner as opposed to being hit 
>> with a wall of text.
>>
>> It is (of course!) written using elementary Scheme that should be easily 
>> convertible to Clojure. We had a discussion about this book at the 
>> reClojure conference in 2020 and a number of attendees had expressed an 
>> interest in knowing when it would be out. .[image: TLLPresale.jpg]
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/clojure/7428e818-4729-462d-90e7-5c9f7cb03cc3n%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/873dcf72-32a2-4421-b810-d7f896b4801en%40googlegroups.com.


Re: Manifold questions: Creating sinks/sources

2022-08-10 Thread Jason Zwolak
I don't think you need two streams at all. Unless there's more code in 
between the two streams that you're not showing.

Would the following work:
(def -private-stream- (s/stream ...))
(def my-sink (s/sink-only -private-stream-)) 
(def my-source (s/source-only -private-stream-))

Or if you really want `-private-stream-` to be out of scope, then a fn to 
create the source and sink could be used. Something like

(defn create-sink-and-source []
  (let [private-stream (s/stream ...)]
{:sink (s/sink-only private-stream)
 :source (s/source-only private-stream}))

(def sink-and-source (create-sink-and-source))
(def my-sink (:sink sink-and-source))
(def my-source (:source sink-and-source))

Since a stream is both a sink and a source, you can mask it with 
`sink-only` and `source-only` to get the appearance of having just a sink 
_and_ just a source. I would like to point out that having two streams does 
nothing different than having one other than the overhead and complexity of 
moving data between two streams. Unless, as I said earlier, you're doing 
something in between the two streams.
On Thursday, August 27, 2015 at 4:18:33 PM UTC-4 atamert...@gmail.com wrote:

>
>
> On Thu, Aug 27, 2015 at 10:51 PM, Zach Tellman  wrote:
>
>> Hi Atamert,
>>
>>
> Hi Zach,
>  
>
>> For future reference, posting these questions to 
>> https://groups.google.com/forum/#!forum/aleph-lib will ensure I'll see 
>> them sooner.  
>>
>
> I've subscribed. Thanks.
>
>  
>
>>
>> The `source-only` method is just a way to make sure that the chance for 
>> confusion is minimized, it doesn't prevent the underlying object from being 
>> used normally.  As for your scenario, I'm not sure I completely 
>> understand.  In a standard stream, the flow of data is:
>>
>> [ sink -> source ]
>>
>> So if you `put!` something into the sink, you can `take!` it from the 
>> source.  If you use `source-only` and connect that to some other sink, then 
>> the flow of data will be
>>
>> [ sink -> source ] -> sink
>>
>> So the source is only connected to one sink, not two.  Maybe I'm 
>> misunderstanding you, though.
>>
>
> I have initially written it right. I was looking through the docs and the 
> source at the same time and I got confused. Then I replaced source with 
> sink and vice versa. So if you are misunderstanding, you are understanding. 
> :)
>
> Let me try again. If we have:
>
> (def my-sink (s/sink-only (s/stream ...))) 
> (def my-source (s/source-only (s/stream ...)))
> (s/connect my-source my-sink)   ;; BTW this got me confused, I thought 
> flow was like my-source -> my-sink
>
> After I have written the comment above, and playing with this code in the 
> REPL, I have realized the flow IS from source to sink.
>
> I think I am un-confused now, and it all makes sense. I have a producer 
> side and a consumer side. Instead of repeating a function call, I want to 
> connect these two components using a stream. I thought I'd need half a 
> stream here and half a stream there. But now I realize I need two whole 
> streams, connect them, put! on one side, take! on the other. I hope it 
> makes sense. Sorry for the noise.
>
>
>  
>
>>
>> Zach
>>
>> On Thursday, August 27, 2015 at 4:13:35 AM UTC-7, Atamert Ölçgen wrote:
>>>
>>> Hi,
>>>
>>> AFAIK the only way to create (just) a source (or sink) is:
>>>
>>> (def my-source (s/source-only (s/stream ...)))
>>>
>>> This results in creating a stream and then wrapping it with a 
>>> SourceProxy. We don't keep a reference to the stream and 
>>> the SourceProxy doesn't allow taking.
>>>
>>> But if I'm not missing something since SourceProxy keeps a reference of 
>>> the original stream, there is a sink nobody is using there.
>>>
>>> If I create a sink separately and connect my-source to it, now 
>>> my-source would be connected to two sinks.
>>>
>>> My questions are:
>>>
>>> 1. Is there another method for creating only sinks or sources?
>>> 2. Should the extra/unused source/sink I mentioned above cause concern?
>>>
>>> PS: I'm not talking about a scenario where we're creating thousands 
>>> streams and connecting them all like there's no tomorrow.
>>>
>>>
>>> -- 
>>> Kind Regards,
>>> Atamert Ölçgen
>>>
>>> ◻◼◻
>>> ◻◻◼
>>> ◼◼◼
>>>
>>> www.muhuk.com
>>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Kind Regards,
> Atamert 

Re: variable name duplicate

2022-07-30 Thread vinurs
but, in this situation i cant write code like this?
(let [user-id 1 user_id 2] (log/info user-id user_id))

在2022年7月30日星期六 UTC+8 21:06:48 写道:

> I'm pretty sure what is happening is the Clojure compiler is munging "x-" 
> into "x_" but since you already have an "x_" you get an exception.
>
> On Sat, Jul 30, 2022, 5:23 AM vinurs  wrote:
>
>> hello,
>> i have the following code:
>> ```
>> (let [x- 1 x_ 2] (fn [] [x- x_])) ; => Throws: Duplicate field name "x_" 
>> with signature "J" in class file [...]
>> ```
>> i tested from clojure 1.0.0 to the latest, all throw the exception
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/clojure/72a4df10-b0a7-4886-b1aa-79e15f1f9c79n%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/c1d9b47e-806c-4894-b2ac-e6217ff1d597n%40googlegroups.com.


Re: variable name duplicate

2022-07-30 Thread Paul Stadig
I'm pretty sure what is happening is the Clojure compiler is munging "x-"
into "x_" but since you already have an "x_" you get an exception.

On Sat, Jul 30, 2022, 5:23 AM vinurs  wrote:

> hello,
> i have the following code:
> ```
> (let [x- 1 x_ 2] (fn [] [x- x_])) ; => Throws: Duplicate field name "x_"
> with signature "J" in class file [...]
> ```
> i tested from clojure 1.0.0 to the latest, all throw the exception
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/72a4df10-b0a7-4886-b1aa-79e15f1f9c79n%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CADQBrAQJK09mdp%3DLSTkUyEXFzNmQ78P-vU%3DbfjfgfVNjtKDZKA%40mail.gmail.com.


openjdk:8 & openjdk:11 clojure images being deprecated too (was Re: Clojure Docker images breaking change)

2022-07-25 Thread Wes Morgan
Unfortunately the original plan of leaving openjdk:8 and openjdk:11-based 
images alone isn't going to work. Upstream has recently announced that even 
the old openjdk:8 and openjdk:11 images are being deprecated and will no 
longer receive updates (security and otherwise).

So that means we need to release new clojure images even for those older 
JDK versions, and it is strongly recommended that you move to them.

Similar to what we previously did for the Java 17+ images, we'll be moving 
the Java 8 & 11 images to the eclipse-temurin upstream. The biggest change 
there will be the switch from Debian to Ubuntu inside the images. Some of 
your images will still just work, but many will break. All need to be 
tested.

You can control the timing of when you make the transition by ensuring you 
specify the distro in your Docker tags. For example: 
clojure:openjdk-11-tools-deps-slim-bullseye or 
clojure:openjdk-8-lein-2.9.8-buster. slim-bullseye has been the default for 
awhile now, so if you currently aren't specifying a distro, that's the one 
you want to ensure nothing actually changes in your images while you test 
the new ones (unless you haven't built the image in many months).

Once you make sure you have the "bullseye", "slim-bullseye", "buster", or 
"slim-buster" distro specifier in your existing tags, start testing your 
images with "temurin" in place of "openjdk" and "jammy" (latest LTS Ubuntu 
release) or "focal" (previous LTS Ubuntu release) in place of whatever 
distro you were specifying before. So the two previous examples would 
become clojure:temurin-11-tools-deps-jammy and 
clojure:temurin-8-lein-2.9.8-focal (assuming you need to stay on the older 
release; move to jammy if possible), respectively.

We will be making jammy-based images available for all Java versions as 
well. Up until now we were only providing focal-based images.

This change will take effect in the next few days.

Let me know if you have any questions about this, and I apologize for the 
inconvenience.

On Friday, April 29, 2022 at 3:56:03 PM UTC-6 Wes Morgan wrote:

> Heads up, there are some breaking changes coming very soon for some of the 
> Clojure Docker images.
>
> Specifically the Java 17+ images will be migrating from the old upstream 
> "openjdk" images to the "eclipse-temurin" (the successor to AdoptOpenJDK) 
> upstream images. This change is being forced on us because the Docker 
> Official Image maintainers are being forced to remove the openjdk:17 images 
> due to Oracle no longer producing the "vanilla" builds these were based on 
> for any version past 17.0.2 (and 17.0.3 is already out w/ some important 
> security fixes). You can read more about that here: 
> https://github.com/docker-library/openjdk/pull/495
>
> Probably the biggest change you'll notice is that the new upstream images 
> are based on Ubuntu instead of Debian. There is also an Alpine-based image 
> available upstream, so we will be releasing alpine variants for Java 17+ 
> too. But be aware that those are currently linux/amd64 only (whereas the 
> Ubuntu-based images are available for linux/amd64, linux/arm64, & 
> linux/arm).
>
> So what do you need to do? It depends. :)
>
> Are you using Java 8 or 11 images (e.g. Docker tags containing 
> "openjdk-8-" or "openjdk-11-")?
>
>
>-  You don't need to do anything for now. In the interest of 
>minimizing breakage, we're staying on the still-supported openjdk:8 and 
>openjdk:11 upstream images for the time being.
>
>
> Are you using Java 17 (the current LTS release) or higher images (e.g. 
> Docker tags containing "openjdk-17-" or without any jdk specifier)?
>
>
>- If you're using Docker tags with "openjdk" in them, you'll need to 
>change that to "temurin".
>- If you're using Docker tags without any jdk specifier in them, be 
>aware that you'll get temurin instead of openjdk in a pull in the near 
>future. As always we recommend specifying this so you can opt-in to the 
>shift once you're ready to start testing the change.
>- If you're using Docker tags with a Debian release name in them, 
>you'll need to change those to the Ubuntu release name "focal" (e.g. 
>"bullseye" -> "focal"). Or you could switch to "alpine" but that would 
>potentially require more significant changes in your Docker image(s).
>- Note that there is no "slim-focal". If you're using "slim-buster" or 
>"slim-bullseye" then you'll either need to accept the larger "focal" image 
>or adopt the "alpine" variant if you can (e.g. if you're running only on 
>linux/amd64). The eclipse-temurin focal images are of a similar size as 
> the 
>old openjdk buster & bullseye images (~230MB for Java 17 on linux/amd64). 
>The slim variants shaved ~20-30 MB off of that. If you'd like a slimmer 
>Ubuntu-based image, you'll need to politely ask the eclipse-temurin image 
>maintainers to publish one. If you succeed we'll start building on it!
>
> As usual 

Re: [ANN] Discontinuing 4clojure.com

2022-06-03 Thread C. Tas
I currently own 4clojure.org which is still linked to on many 
Clojure-specific sites. If anyone is interested in buying it, I'd be happy 
to chat.

Peter Strömberg schrieb am Samstag, 17. Juli 2021 um 21:22:16 UTC+2:

> Thanks, thanks, thanks, for creating and caring about 4clojure for this 
> long, Alan! I can't tell how instrumental it has been on my Clojure 
> journey. Not only for learning the language, also for keeping it fun there 
> in the beginning when I doubted I could learn enough of it to get 
> productive. I'm not sure I would have been a Clojurian today if it wasn't 
> for 4clojure.
>
> Best regards,
> /Peter
>
> Den sön 11 juli 2021 kl 23:38 skrev Alan Malloy :
>
>> I've also exported the problem data: 
>> https://drive.google.com/file/d/1hHrygxAs5Do8FpHC9kphYnmyTwZvISnb/view?usp=sharing
>> . 
>>
>> On Sunday, July 11, 2021 at 2:22:33 PM UTC-7 Alan Malloy wrote:
>>
>>> I'm happy to see this project, and I think exporting some data is a 
>>> reasonable compromise. Rather than re-learn how to do any fancy mongodb 
>>> stuff to make it into "pretty" json, I've just done a raw JSON export of 
>>> the solutions collection, which is world-readable at 
>>> https://drive.google.com/file/d/1UQHznThT_eVTBjmLGz3yME8L3teGygUs/view?usp=sharing.
>>>  
>>> I'm contemplating doing a partial export of the users collection too: I 
>>> could connect usernames to IDs without including the email addresses or 
>>> passwords, which would let you rebuild most of the user information. But 
>>> I'm not totally sure this is a good idea: some people may not want their 
>>> usernames shared, or associated with their solutions. Does anyone in this 
>>> thread have an opinion?
>>>
>>> On Tuesday, July 6, 2021 at 9:58:29 AM UTC-7 oxa...@gmail.com wrote:
>>>
>>>> Thank you Alan for all your contributions :)
>>>>
>>>> Hosting things and maintaing them is really hard. We, the LambdaIsland 
>>>> team, are already maintaining clojurians-log and clojureverse and it's 
>>>> definitely not easy!
>>>>
>>>> With a wonderful idea from @borkdude and his `sci` library, I built 
>>>> "4ever-clojure": a completely static version of 4clojure which runs using 
>>>> cljs + sci. It interprets the code in the browser itself. 
>>>>
>>>> It's live at: 4clojure.oxal.org  (Source code at: 
>>>> https://github.com/oxalorg/4ever-clojure  I'm planning to move it 
>>>> under the clojureverse github org)
>>>>
>>>> I have 2 asks from you if it is feasible:
>>>> 1. An export of all solutions (only solutions, no user data needed) - 
>>>> the community is already coming up with some amazing ideas of hooking up 
>>>> user solutions to automatically commit to a Github repo 
>>>> 2. Possibility of transfering *4clojure.com <http://4clojure.com> *-or- 
>>>> *4clojure.org <http://4clojure.org> *over to us so that we can host 
>>>> 4ever-clojure there (instead of on a separate domain)
>>>>
>>>> Thanks!
>>>> - Mitesh
>>>>
>>>> On Tuesday, July 6, 2021 at 5:56:10 PM UTC+5:30 Srihari Sriraman wrote:
>>>>
>>>>> Hey Alan, we really like 4clojure. We've suggested using it for 
>>>>> training most people at nilenso and we're very thankful to you and all 
>>>>> the 
>>>>> contributors for that!
>>>>> We (nilenso) would be up for picking up the hosting costs, and also 
>>>>> some other operations or development work if needed.
>>>>>
>>>>> It would be even better if we could work together and turn this into a 
>>>>> community owned project (ex: clojurists together 
>>>>> <http://clojuriststogether.org>). That might also assuage your 
>>>>> concerns about data ownership.
>>>>>
>>>>> The questions, and solutions that the community has put together on 
>>>>> 4clojure over the last decade are very valuable as a learning tool. 
>>>>> Perhaps 
>>>>> we can find a way to keep them around without attributing them to a user? 
>>>>> One idea might be to deactivate all existing accounts, and remove the 
>>>>> user 
>>>>> data (email, passwords, other PII) etc while keeping the questions and 
>>>>> solutions from those users.
>>>>>
>>>>> We would be sad to see 4clojure go away, hope we can find a wa

Re: Any updates on spec after “Maybe Not” presentation?

2022-05-25 Thread Dmitry Kakurin
Thank you  EuAndreh and Alex!
Alex, is it still the plan that spec2 will become *the released spec* 
eventually? Or has thinking changed since then?
I'm curious if any serious obstacles to the spec2 approach were discovered 
since Rich gave the talk.

Thank you, Dmitry.

On Tuesday, May 24, 2022 at 8:15:46 AM UTC-7 Alex Miller wrote:

> The schema and select support has been added to spec in spec2 (
> https://github.com/clojure/spec-alpha2) but is still a work in progress. 
> You can find more info at 
> https://github.com/clojure/spec-alpha2/wiki/Schema-and-select .
>
> Alex
>
> On Thursday, May 19, 2022 at 4:12:33 PM UTC-5 Dmitry Kakurin wrote:
>
>> Hello,
>> The “Maybe Not” talk from 2018 has hinted at significant upcoming changes 
>> for spec, such as removal of “:req” keys for map specs and potential 
>> introduction of “spec/select”.
>> But I could not find any additional information in the past 3-4 years on 
>> the evolution of that line of development.
>> Are there any updates or additional information on this?
>>
>> Thank you, Dmitry.
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/b83c9d7d-b9f9-416f-9de5-8348591a9645n%40googlegroups.com.


Re: Any updates on spec after “Maybe Not” presentation?

2022-05-24 Thread Alex Miller
The schema and select support has been added to spec in spec2 
(https://github.com/clojure/spec-alpha2) but is still a work in progress. 
You can find more info at 
https://github.com/clojure/spec-alpha2/wiki/Schema-and-select .

Alex

On Thursday, May 19, 2022 at 4:12:33 PM UTC-5 Dmitry Kakurin wrote:

> Hello,
> The “Maybe Not” talk from 2018 has hinted at significant upcoming changes 
> for spec, such as removal of “:req” keys for map specs and potential 
> introduction of “spec/select”.
> But I could not find any additional information in the past 3-4 years on 
> the evolution of that line of development.
> Are there any updates or additional information on this?
>
> Thank you, Dmitry.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/3109a816-69ca-4a5c-b5c4-287cc8529e9an%40googlegroups.com.


Re: Book project : compilation of Rich Hickey conferences transcripts translated in french

2022-05-24 Thread Alex Miller
Hi Paul, contact me at alex.mil...@cognitect.com.

I will say that if anyone wants to do translations / transcriptions in 
other languages for anything on ClojureTV, I am more than happy to add 
those to the video.

Alex

On Tuesday, May 24, 2022 at 6:21:02 AM UTC-5 paul@gmail.com wrote:

> Hi,
>
> I am a French web developer, soon a teacher, IT books and standards 
> enthusiast.
>
> I've listened many times to many of Rich Hickey conferences. It took me 
> time and mental efforts to understand those ideas and concepts, but now I 
> can say that I consider Rich Hickey to be on of the most precious (public 
> at least) thinker and artisan in the IT. So for that, I want first to thank 
> him to have shape my mind to fascinating new horizons.
>
> I want to make the ideas and concepts discussed in those conferences 
> accessible for a French-speaking audience. I think many people (besides 
> programmers) interested from near or far to information systems would 
> benefit from this content. I'm rather surprised to realize that even if 
> understanding/reading English language is a "must have" for any developer 
> around the world, still many French-speaking developers and IT people are 
> not able to "read" (in the general sense) with ease many English textbooks 
> or conferences. I would like to contribute to feel that gap by translating 
> and publishing some content found in those conferences for this audience, 
> because this work is highly valuable, and I think need to be better known 
> by many IT people.
>
> I've already made a French subtitle version of the conference "The Value 
> of Values" (Jax Conference, 2012) available on YouTube (link: 
> https://www.youtube.com/watch?v=VJi1vOwu2SM). I've been doing caption for 
> many years now. Mainly I have caption 5 of 7 of the Feynman Lectures on 
> Physics conference (1964) (I'm an ex physicist and big fan of Richard 
> Feynman...) (link: 
> https://www.youtube.com/watch?v=GSeSqqUV7_4=PLS3XEhTy6-AkS1j8JrHoJnkSrY31Bfddl).
>  
> And I saw that many people were hungry for this wonderful and rich content 
> (as your work) they cannot access otherwise.
>
> I would like, in the near future, to work on a compilation of transcripts 
> of some of Rich Hickey conferences (based on some themes), translated in 
> French. The idea I have in mind is to try to publish a small book in French 
> in the same idea as the book "La nature de la physique", a French 
> transcript compilation of the Feynman Lectures on Physics.
>
> I wanted to know if Rich Hickey (or any other people involved) would be 
> interested to see this project happening or not, and if there are any legal 
> questions, constrains etc...
>
> Thank you for reading this way too long message,
>
> I wish you a very pleasant day,
>
> Best regards,
>
> Paul Schuhmacher

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/c8642d7d-720a-443b-8628-a043b8c2cb6bn%40googlegroups.com.


Re: Any updates on spec after “Maybe Not” presentation?

2022-05-22 Thread 'EuAndreh' via Clojure
AFAICT, the spec-alpha2 repository [0] is the latest thing there is.

[0]: https://github.com/clojure/spec-alpha2

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/165324054467.3399.2499847542854819811%40localhost.


Re: Unnecessary boxing of return from set!

2022-05-16 Thread pete windle
Hi Alex,

   - the ^void is necessary to get the method signature right for it to 
   compile at all
   - *the nil workaround "works" in that decompilation shows the method 
   body with the addition only, no cast - thank you*
   - ...but makes a smaller difference to my overall execution time:-)
   - lesson learned (remembered): use asynchronous profiling to avoid 
   safepoint bias
   - when I do that without the workaround it's clear that the addition is 
   50% of the observable work in that method, the Numbers.num Long.valueOf() 
   calls the other 50% - so eliminating the cast doesn't make everything free

Thanks,

Pete Windle
On Monday, May 16, 2022 at 12:40:07 AM UTC+1 Alex Miller wrote:

> I don't think that void type hint is going to do anything there.  The 
> deftype impl of apply here will (has to by Java requirements) return void 
> here. There is a gap here I think where the return gets needlessly boxed. 
> You might try just putting a nil expr after the set! as a workaround.
> In any case, we should definitely get a ticket filed and track this down.
>
>
> On Sunday, May 15, 2022 at 7:11:31 AM UTC-5 pete windle wrote:
>
>> Hey, I'm trying to work on some performance sensitive code using Clojure 
>> together with the Carrotsearch HPPC library. I've come up against a weird 
>> behaviour of set! in conjunction with primitive maths.
>>
>> This example is a toy problem not a production problem, but there are 
>> things I might not be harder to do at work w/Clojure.
>>
>> I have a com.carrotsearch.hppc.LongLongHashMap and I wish to sum the 
>> contents of the map. They provide a com.carrotsearch.hppc.LongLongProcedure 
>> where an apply method is called for each k, v.
>>
>> Thence:
>> (defprotocol ValueRetriever
>>   (get-value [this ^LongLongHashMap memory]))
>>
>> (deftype ValueAdder [^{:unsynchronized-mutable true} ^long total]
>>   LongLongProcedure
>>   (^void apply [this ^long k ^long v]
>>(set! total (unchecked-add total v)))
>>   ValueRetriever
>>   (get-value [this memory] (set! total 0) (.forEach memory this) total))
>>
>> To a first approximation all of the time spent summing the map is in the 
>> apply method as expected, however when I profile it with YourKit every 
>> sample taken is actually in clojure.lang.Numbers.num. Using the extremely 
>> handy *clj-java-decompiler *library I can try to see what's happening, 
>> and it looks like we're attempting to box the return value from set!
>>
>> public void apply(final long k, final long n) {
>> Numbers.num(this.total += n);
>> }
>>
>>
>> Is there some technique I can use to stop the return value from set! 
>> being boxed (before the box is discarded to the void)?
>>
>> I do have real use cases where a rather tight aggregation loop will be 
>> called for many millions of values and I'd prefer not to incur this cost.
>>
>> Workaround is obviously to write the aggregators in Java but that's 
>> strongly not preferred, at the point I'm mixing modes I might as well write 
>> the whole core in Java.
>>
>> Cheers,
>>
>> Pete Windle
>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/937375d6-1ff5-496d-8a41-8f86e7a7fb10n%40googlegroups.com.


Re: Unnecessary boxing of return from set!

2022-05-15 Thread 'Alex Miller' via Clojure
I don't think that void type hint is going to do anything there.  The 
deftype impl of apply here will (has to by Java requirements) return void 
here. There is a gap here I think where the return gets needlessly boxed. 
You might try just putting a nil expr after the set! as a workaround.
In any case, we should definitely get a ticket filed and track this down.

On Sunday, May 15, 2022 at 7:11:31 AM UTC-5 pete windle wrote:

> Hey, I'm trying to work on some performance sensitive code using Clojure 
> together with the Carrotsearch HPPC library. I've come up against a weird 
> behaviour of set! in conjunction with primitive maths.
>
> This example is a toy problem not a production problem, but there are 
> things I might not be harder to do at work w/Clojure.
>
> I have a com.carrotsearch.hppc.LongLongHashMap and I wish to sum the 
> contents of the map. They provide a com.carrotsearch.hppc.LongLongProcedure 
> where an apply method is called for each k, v.
>
> Thence:
> (defprotocol ValueRetriever
>   (get-value [this ^LongLongHashMap memory]))
>
> (deftype ValueAdder [^{:unsynchronized-mutable true} ^long total]
>   LongLongProcedure
>   (^void apply [this ^long k ^long v]
>(set! total (unchecked-add total v)))
>   ValueRetriever
>   (get-value [this memory] (set! total 0) (.forEach memory this) total))
>
> To a first approximation all of the time spent summing the map is in the 
> apply method as expected, however when I profile it with YourKit every 
> sample taken is actually in clojure.lang.Numbers.num. Using the extremely 
> handy *clj-java-decompiler *library I can try to see what's happening, 
> and it looks like we're attempting to box the return value from set!
>
> public void apply(final long k, final long n) {
> Numbers.num(this.total += n);
> }
>
>
> Is there some technique I can use to stop the return value from set! being 
> boxed (before the box is discarded to the void)?
>
> I do have real use cases where a rather tight aggregation loop will be 
> called for many millions of values and I'd prefer not to incur this cost.
>
> Workaround is obviously to write the aggregators in Java but that's 
> strongly not preferred, at the point I'm mixing modes I might as well write 
> the whole core in Java.
>
> Cheers,
>
> Pete Windle
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/854262ad-34ec-4cb1-9760-0329fdbf714cn%40googlegroups.com.


Re: Unnecessary boxing of return from set!

2022-05-15 Thread pete windle
I wondered if this would work if I handed the result off to a helper class

public class VoidHelper {
public static void voidLong(long x) {}
}

If this somehow improved the code path, with inlining etc it would be 
basically free.

...but the generated code gets worse.

public void apply(final long k, final long n) {
this.total += n;
final long longCast = RT.longCast(Numbers.num(this.total));
this = null;
VoidHelper.voidLong(longCast);
}

total is long, but we box it with Numbers.num and then RT.longCast it 
before calling voidLong. Hmmm. Feels like the knowledge that it's returning 
a primitive type is missing.

Thanks,

Pete Windle
On Sunday, May 15, 2022 at 1:39:08 PM UTC+1 pete windle wrote:

> Definitely in the same wheelhouse, but upgrading to 1.11.1 shows the same 
> behaviour - as expected, because this is not an InstanceMethodExpr.
>
>
> https://github.com/clojure/clojure/blame/master/src/jvm/clojure/lang/Compiler.java#L1831-L1842
>  
> is the logic for StaticMethodExpr.
>
> AssignExpr hands off to the AssignableExpr target which in my case is 
> the InstanceFieldExpr(?)
>
> Takes us to here I guess: 
> https://github.com/clojure/clojure/blame/master/src/jvm/clojure/lang/Compiler.java#L1237-L1259
>
> Unless I roll my sleeves up and debug into this to check exactly where the 
> boxing is being emitted not sure I will get further, feels like I'm deeper 
> in the innards of Compiler.java than I'm qualified for without more thought 
> and reading.
>
> Thanks though, helpful pointer!
>
> Pete Windle
>
> On Sunday, May 15, 2022 at 1:17:10 PM UTC+1 er...@assum.net wrote:
>
>> This reminds me of a bug that I believe Ghadi fixed for 1.11, 
>>
>> https://clojure.atlassian.net/browse/CLJ-2621
>>
>> Don’t know if that helps much, though. 
>>
>> Erik. 
>> -- 
>> i farta
>>
>> 15. mai 2022 kl. 14:11 skrev pete windle :
>>
>> Hey, I'm trying to work on some performance sensitive code using Clojure 
>> together with the Carrotsearch HPPC library. I've come up against a weird 
>> behaviour of set! in conjunction with primitive maths.
>>
>>
>> This example is a toy problem not a production problem, but there are 
>> things I might not be harder to do at work w/Clojure.
>>
>> I have a com.carrotsearch.hppc.LongLongHashMap and I wish to sum the 
>> contents of the map. They provide a com.carrotsearch.hppc.LongLongProcedure 
>> where an apply method is called for each k, v.
>>
>> Thence:
>> (defprotocol ValueRetriever
>>   (get-value [this ^LongLongHashMap memory]))
>>
>> (deftype ValueAdder [^{:unsynchronized-mutable true} ^long total]
>>   LongLongProcedure
>>   (^void apply [this ^long k ^long v]
>>(set! total (unchecked-add total v)))
>>   ValueRetriever
>>   (get-value [this memory] (set! total 0) (.forEach memory this) total))
>>
>> To a first approximation all of the time spent summing the map is in the 
>> apply method as expected, however when I profile it with YourKit every 
>> sample taken is actually in clojure.lang.Numbers.num. Using the extremely 
>> handy *clj-java-decompiler *library I can try to see what's happening, 
>> and it looks like we're attempting to box the return value from set!
>>
>> public void apply(final long k, final long n) {
>> Numbers.num(this.total += n);
>> }
>>
>>
>> Is there some technique I can use to stop the return value from set! 
>> being boxed (before the box is discarded to the void)?
>>
>> I do have real use cases where a rather tight aggregation loop will be 
>> called for many millions of values and I'd prefer not to incur this cost.
>>
>> Workaround is obviously to write the aggregators in Java but that's 
>> strongly not preferred, at the point I'm mixing modes I might as well write 
>> the whole core in Java.
>>
>> Cheers,
>>
>> Pete Windle
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/clojure/d9eccd28-3db3-4e6f-88f9-7a4106fc05aan%40googlegroups.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 

Re: Unnecessary boxing of return from set!

2022-05-15 Thread pete windle
Definitely in the same wheelhouse, but upgrading to 1.11.1 shows the same 
behaviour - as expected, because this is not an InstanceMethodExpr.

https://github.com/clojure/clojure/blame/master/src/jvm/clojure/lang/Compiler.java#L1831-L1842
 
is the logic for StaticMethodExpr.

AssignExpr hands off to the AssignableExpr target which in my case is 
the InstanceFieldExpr(?)

Takes us to here I guess: 
https://github.com/clojure/clojure/blame/master/src/jvm/clojure/lang/Compiler.java#L1237-L1259

Unless I roll my sleeves up and debug into this to check exactly where the 
boxing is being emitted not sure I will get further, feels like I'm deeper 
in the innards of Compiler.java than I'm qualified for without more thought 
and reading.

Thanks though, helpful pointer!

Pete Windle

On Sunday, May 15, 2022 at 1:17:10 PM UTC+1 er...@assum.net wrote:

> This reminds me of a bug that I believe Ghadi fixed for 1.11, 
>
> https://clojure.atlassian.net/browse/CLJ-2621
>
> Don’t know if that helps much, though. 
>
> Erik. 
> -- 
> i farta
>
> 15. mai 2022 kl. 14:11 skrev pete windle :
>
> Hey, I'm trying to work on some performance sensitive code using Clojure 
> together with the Carrotsearch HPPC library. I've come up against a weird 
> behaviour of set! in conjunction with primitive maths.
>
>
> This example is a toy problem not a production problem, but there are 
> things I might not be harder to do at work w/Clojure.
>
> I have a com.carrotsearch.hppc.LongLongHashMap and I wish to sum the 
> contents of the map. They provide a com.carrotsearch.hppc.LongLongProcedure 
> where an apply method is called for each k, v.
>
> Thence:
> (defprotocol ValueRetriever
>   (get-value [this ^LongLongHashMap memory]))
>
> (deftype ValueAdder [^{:unsynchronized-mutable true} ^long total]
>   LongLongProcedure
>   (^void apply [this ^long k ^long v]
>(set! total (unchecked-add total v)))
>   ValueRetriever
>   (get-value [this memory] (set! total 0) (.forEach memory this) total))
>
> To a first approximation all of the time spent summing the map is in the 
> apply method as expected, however when I profile it with YourKit every 
> sample taken is actually in clojure.lang.Numbers.num. Using the extremely 
> handy *clj-java-decompiler *library I can try to see what's happening, 
> and it looks like we're attempting to box the return value from set!
>
> public void apply(final long k, final long n) {
> Numbers.num(this.total += n);
> }
>
>
> Is there some technique I can use to stop the return value from set! being 
> boxed (before the box is discarded to the void)?
>
> I do have real use cases where a rather tight aggregation loop will be 
> called for many millions of values and I'd prefer not to incur this cost.
>
> Workaround is obviously to write the aggregators in Java but that's 
> strongly not preferred, at the point I'm mixing modes I might as well write 
> the whole core in Java.
>
> Cheers,
>
> Pete Windle
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/clojure/d9eccd28-3db3-4e6f-88f9-7a4106fc05aan%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/3f59f65e-3d1a-4dc1-9d59-93e124682a81n%40googlegroups.com.


Re: Unnecessary boxing of return from set!

2022-05-15 Thread Erik Assum
This reminds me of a bug that I believe Ghadi fixed for 1.11, 

https://clojure.atlassian.net/browse/CLJ-2621

Don’t know if that helps much, though. 

Erik. 
-- 
i farta

> 15. mai 2022 kl. 14:11 skrev pete windle :
> 
> Hey, I'm trying to work on some performance sensitive code using Clojure 
> together with the Carrotsearch HPPC library. I've come up against a weird 
> behaviour of set! in conjunction with primitive maths.
> 
> This example is a toy problem not a production problem, but there are things 
> I might not be harder to do at work w/Clojure.
> 
> I have a com.carrotsearch.hppc.LongLongHashMap and I wish to sum the contents 
> of the map. They provide a com.carrotsearch.hppc.LongLongProcedure where an 
> apply method is called for each k, v.
> 
> Thence:
> (defprotocol ValueRetriever
>   (get-value [this ^LongLongHashMap memory]))
> 
> (deftype ValueAdder [^{:unsynchronized-mutable true} ^long total]
>   LongLongProcedure
>   (^void apply [this ^long k ^long v]
>(set! total (unchecked-add total v)))
>   ValueRetriever
>   (get-value [this memory] (set! total 0) (.forEach memory this) total))
> 
> To a first approximation all of the time spent summing the map is in the 
> apply method as expected, however when I profile it with YourKit every sample 
> taken is actually in clojure.lang.Numbers.num. Using the extremely handy 
> clj-java-decompiler library I can try to see what's happening, and it looks 
> like we're attempting to box the return value from set!
> 
> public void apply(final long k, final long n) {
> Numbers.num(this.total += n);
> }
> 
> 
> Is there some technique I can use to stop the return value from set! being 
> boxed (before the box is discarded to the void)?
> 
> I do have real use cases where a rather tight aggregation loop will be called 
> for many millions of values and I'd prefer not to incur this cost.
> 
> Workaround is obviously to write the aggregators in Java but that's strongly 
> not preferred, at the point I'm mixing modes I might as well write the whole 
> core in Java.
> 
> Cheers,
> 
> Pete Windle
> 
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/clojure/d9eccd28-3db3-4e6f-88f9-7a4106fc05aan%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/13C1C76F-D17A-4940-959D-F555B4714CC2%40assum.net.


Re: Clojure-Asia April 2022 Online Meetup

2022-04-16 Thread Zack Teo
Here's the link to Daniel's talk - "Clay -- a tiny ball of mud with your 
favourite tools inside"

https://youtu.be/gFNPtgAw36k

On Saturday, April 16, 2022 at 4:51:54 PM UTC+8 clojur...@gmail.com wrote:

> Hello!! :)
>
> We just ended today's meetup!
>
> [image: 20220416_ClojureAsia_3.png]
>
> Daniel Slutsky gave an enjoyable talk on clay - a new visual tool meant 
> to integrate with existing tools like Portal, Clerk and Scittle (And had 
> an insightful discussion thereafter :)) (I will be uploading the talk on 
> the Clojure Asia YouTube channel 
>  in time)
>
> For our sessions, we have a monthly flash talk (10 to 15 min). This not 
> only give us ample time for introductions/quick catch-ups before the talk 
> and discussions after the talk, but is also more approachable for members 
> who would like to volunteer their time to give a talk :D
>
> For those who were interested in joining but were unable to, we will be 
> having these meetups once a month so hope to see you for upcoming sessions!
>
> Do join us on the #clojure-asia channel 
>  on the Clojurian 
> Slack, follow https://twitter.com/ClojureAsia and refer to the Clojure-Asia 
> Online Meetup Schedule for 2022 - Google Calendar 
>  for the dates we have 
> planned for future sessions (every 3rd Saturday of the month)
>
> Zachary (zackteo)
> On Saturday, April 9, 2022 at 9:49:24 AM UTC+8 Clojure Asia wrote:
>
>> Hello! :) We will be having our Clojure-Asia April Meetup in a week's 
>> time!
>>
>> We will be having a talk given by Daniel Slutsky titled "Clay -- a tiny 
>> ball of mud with your favourite tools inside”
>>
>> Here's an abstract:
>> The Clojure visual tooling scene is growing beautifully, with amazing 
>> tools such as Portal and Clerk.
>> Clay is a thin layer wrapping a few of those tools in harmony, offering a 
>> playful & dynamic workflow for data exploration and documentation.
>> At the meeting we will share an initial working version of Clay, discuss 
>> its goals, and demonstrate its use through a data analysis problem.
>>
>> The talk will be followed by QnA/discussion. Hope to see you there! :D
>>
>> Meeting Details:
>> Date: 16th April 2022 (Saturday)
>> Time: 1330-1500 SGT (0530-0700 UTC)
>> Location: Jitsi (Easy to setup open source video conferencing) (will 
>> email the link in time)
>> Contact Info:
>> Email: clojur...@gmail.com
>> Slack/Telegram: @zackteo
>>
>> Please fill up the form here:
>> https://forms.gle/13Uzwffpkc2hUTmp7
>>
>> Also:
>> Do join us on the #clojure-asia channel in the Clojurian Slack: 
>> https://clojurians.slack.com/archives/C02N2TTDVT5
>>
>> Here's the google calendar link for planned Clojure-Asia Meetups in 2022 
>> (every 3rd Saturday of the month): 
>> https://calendar.google.com/calendar/u/0?cid=OWRtcjQ5Z29ybmNydjNna3FoZWoxdWRhczRAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/2aec1b13-18b3-441c-80e6-c1164b9c8973n%40googlegroups.com.


Re: Digest for clojure@googlegroups.com - 1 update in 1 topic

2022-03-24 Thread 'Harvie Griffith Jr.' via Clojure
The tests mentioned in the Changes have better examples. This link specifically:

https://clojure.atlassian.net/browse/CLJ-2685

Sam Griffith
stayp...@mac.com
512-771-8153

Sent from my iPhone



> On Mar 23, 2022, at 6:23 PM, clojure@googlegroups.com wrote:
> 
> 
> clojure@googlegroups.com  Google Groups   
> Topic digest 
> View all topics
> Clojure 1.11 is now available! - 1 Update
> Clojure 1.11 is now available!
> Mark Engelberg : Mar 22 10:30PM -0700 
> 
> Exciting! Thanks for the new release.
>  
> Where can I find more information about the new iteration function? The
> docstring alone isn't sufficient for me to understand how to use it
> effectively.
>  
> On Tue, Mar 22, 2022 at 9:22 AM Alex Miller 
> wrote:
>  
> Back to top
> You received this digest because you're subscribed to updates for this group. 
> You can change your settings on the group membership page.
> To unsubscribe from this group and stop receiving emails from it send an 
> email to clojure+unsubscr...@googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/2CC6611F-0C28-472C-873D-0B54E53A8034%40mac.com.


Re: Clojure 1.11 is now available!

2022-03-22 Thread Mark Engelberg
Exciting! Thanks for the new release.

Where can I find more information about the new iteration function? The
docstring alone isn't sufficient for me to understand how to use it
effectively.

On Tue, Mar 22, 2022 at 9:22 AM Alex Miller 
wrote:

> You can find an overview here:
> https://clojure.org/news/2022/03/22/clojure-1-11-0
>
> And full changelog here:
>
> https://github.com/clojure/clojure/blob/master/changes.md#changes-to-clojure-in-version-1110
>
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/3814ba94-48bc-4cd2-9b54-00782c53862en%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CAORbMOMi-wXqTb7umk15Sx5SBD7xN74bY2DB1W5oE%2Bgn6vnbqw%40mail.gmail.com.


Re: Clojure-Asia February 2022 Online meetup

2022-03-04 Thread Zack Teo
A bit delayed but if anyone is interested, here's the link to Paul S Chun 
talk - *Navigating Maps: Different Map Functions in Clojure* :)


https://www.youtube.com/watch?v=HYv-gxDfRGo=1s


On Thursday, February 24, 2022 at 9:39:17 PM UTC+8 Zack Teo wrote:

> Hello!! :D
>
> We had an enjoyable time at our recent Clojure-Asia meetup!
>
> [image: 202219_ClojureAsia_2.png]
>
> Paul S. Chun gave us a nice flash talk on "Navigating Maps: Different Map 
> Functions in Clojure" (which I will be uploading unto our Clojure Asia 
> YouTube Channel  
> in a couple of days). And following which, we had a short QnA followed by a 
> joyful and laughter-packed discussion of Clojure related topics under the 
> sun :D.
>
> Based on this session, we will be aiming to have a monthly flash talk (10 
> to 15 min) for our sessions. This not only give us ample time for 
> introductions/quick catch-ups before the talk and discussions after the 
> talk, but is also more approachable for members who would like to volunteer 
> their time to give a talk :) 
>
> For those who were interested in joining but were unable to, we will be 
> having these meetups once a month so hope to see you for upcoming sessions!
>
> Do join us on the #clojure-asia channel 
>  on the Clojurian 
> Slack, follow https://twitter.com/ClojureAsia and refer to the Clojure-Asia 
> Online Meetup Schedule for 2022 - Google Calendar 
> 
>  
> for the dates we have planned for future sessions (every 3rd Saturday of 
> the month)
>
> Zachary (zackteo)
>
> On Saturday, February 12, 2022 at 11:18:38 AM UTC+8 Zack Teo wrote:
>
>> Happy Chinese New Year my fellow Clojurians! :) We will be having another 
>> Clojure-Asia Online Meetup for the month of February!
>>
>> If all goes as planned, we will be having a talk by Paul S. Chun on his 
>> use of Reitit followed by QnA/discussion. Hope to see you there! :D
>>
>> Meeting Details:
>> Date: 19th February 2022 (Saturday)
>> Time: 1300-1400 SGT (0500-0600 UTC)
>> Location: Jitsi (Easy to setup open source video conferencing) (will 
>> email the link in time)
>>
>> Contact Info:
>> Email: zac...@gmail.com
>> Slack/Telegram: @zackteo
>>
>> Please fill up the form here:
>> https://forms.gle/HbMf3yeixsh9mn3V8 
>> 
>>
>> Also:
>> Do join us on the #clojure-asia channel in the Clojurian Slack: 
>> https://clojurians.slack.com/archives/C02N2TTDVT5 
>> 
>>
>> Here's the google calendar link for planned Clojure-Asia Meetups in 2022 
>> (every 3rd Saturday of the month): 
>> https://calendar.google.com/calendar/u/0?cid=OWRtcjQ5Z29ybmNydjNna3FoZWoxdWRhczRAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ
>>  
>> 
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/edc5a72d-aff9-45a1-bb6f-fa3f3df9dc5dn%40googlegroups.com.


Re: Why is next.jdbc using my IP address?

2022-03-04 Thread Sean Corfield
> Okay, this seems to have to do with characters acting as wildcards in the
password itself. This is in the .env file:

I don't know what library you are using for managing your configuration but
perhaps it interprets $n as an environment variable called n and
substitutes the value (which will be empty, in general).

On Fri, Mar 4, 2022 at 5:58 AM Lawrence Krubner 
wrote:

> Okay, this seems to have to do with characters acting as wildcards in the
> password itself. This is in the .env file:
>
> vvv*8Ezr30R%$n?L5!
>
> but printlin in the Clojure code outputs:
>
> vvv*8Ezr30R%?L5!
>
> The "$n" simply vanishes.
>
> Why is that? This is not a regular expression. I didn't think plain
> strings in Clojure would be interpreted like this.
>
> Or is this how bash interprets it?
>
>
>
>
> On Friday, March 4, 2022 at 8:06:56 AM UTC-5 Lawrence Krubner wrote:
>
>> So, as a new way to test this, I've ssh'ed to an EC2 instance that is in
>> the same VCP as the RDS database. I upload my jar file so I can run it on
>> this EC2 instance.
>>
>> println the hash map at startup:
>>
>> {:dbtype mysql, :dbname pulsedata, :user pulseuser, :password , :host
>> pulse-data.cclr8stksfch.us-west-2.rds.amazonaws.com}
>> This gets me the above error. But if I copy and paste the values and use
>> them with the mysql client:
>>
>> mysql -u pulseuser -h pulse-data.cclr8stksfch.us-west-2.rds.amazonaws.com
>> -p pulsedata
>>
>> I am able to log in. This is in the same terminal window: the MySQL
>> client, at the command line in my terminal, logs me into MySQL, but "java
>> -jar user.jar" in the same terminal window gives me this error, about me
>> being rejected. I am copying and pasting the same values for user and host
>> and password.
>>
>> It has to be something about the Clojure code.
>>
>>
>> On Friday, March 4, 2022 at 6:35:59 AM UTC-5 ore...@orestis.gr wrote:
>>
>>> The error message indicates that you connect with user `pulseuser` - is
>>> that the expected user?
>>>
>>> I would print out the configuration that you’re passing in to jdbc.next
>>> to be absolutely certain it contains the values you expect it does.
>>>
>>> When you say “cli”, do you mean a mysql client? Double check the
>>> credentials (dbname, user, password) that *it* uses.
>>>
>>> Best,
>>> Orestis
>>>
>>> On 4 Mar 2022, at 13.27, Lawrence Krubner  wrote:
>>>
>>> But, again, I can connect from the cli using my terminal. I'm using my
>>> Spectrum connection to the Internet in both cases. If I run the app on my
>>> laptop, or I connect from the terminal, using the CLI, then in all cases
>>> I'm connecting over my Spectrum connection to the Internet. If MySQL was
>>> going to block one, then it would block the other, yes? I think the issue
>>> must have something to do with the Clojure code, since that is the only
>>> difference. I mean, if I do "java -jar user.jar" in the same terminal
>>> window, it fails, but then in that same terminal window I can connect to
>>> RDS without a problem using the CLI.
>>>
>>>
>>> On Thursday, March 3, 2022 at 3:26:31 PM UTC-5 red...@gmail.com wrote:
>>>
 That is a message from MySQL, not next.jdbc.

 MySQL allows you to grant permissions to a user base on the host they
 are connecting from so permission denied kinds of errors include the
 username and the host the users connection came from.

 On Thu, Mar 3, 2022, 11:18 Lawrence Krubner 
 wrote:

> I just wrote a small app that needs to connect to a MySQL app. I was
> running it on my laptop, connecting to MySQL on the laptop, and everything
> was working fine. Then I wanted to connect to one of our test databases in
> RDS in AWS. I've a simple function that finds the environment variables 
> and
> returns them as a map:
>
> (defn get-config
>   []
>   (check-config)
>   {
>:dbtype "mysql"
>:dbname (System/getenv "DATABASE_NAME")
>:user (System/getenv "DATABASE_USER")
>:password (System/getenv "DATABASE_PASSWORD")
>:host (System/getenv "DATABASE_HOST")
>})
>
> This is used simply:
>   ds (jdbc/get-datasource  (get-config))
>
> I've checked the environment values several times and they are
> correct. But when the code tries to write to the RDS database, I get:
>
> *java.sql.SQLException*: *Access denied for user
> 'pulseuser'@'cpe-74-71-234-49.nyc.res.rr.com
> ' (using password: YES)*
>
> I am connecting to the Internet through Spectrum, and apparently "
> rr.com" is Spectrum. I'm confused, why would next.jdbc use this info?
> Did I forget some important value in the hash map?
>
> From my laptop, I can reach the RDS database using the MySQL CLI, so
> there are no problems with connectivity. I whitelisted the IP address of 
> my
> house. This is something specific about what next.jdbc needs in that hash
> map, I think.
>
>
>

Re: Why is next.jdbc using my IP address?

2022-03-04 Thread Cora Sutton
And also change your password now.

On Fri, Mar 4, 2022 at 8:09 AM Orestis Markou  wrote:

> You might need to quote the string with single quotes, otherwise bash will
> probably try and interpolate a var `$n`...
>
>
> On 4 Mar 2022, at 15.58, Lawrence Krubner  wrote:
>
> Okay, this seems to have to do with characters acting as wildcards in the
> password itself. This is in the .env file:
>
> vvv*8Ezr30R%$n?L5!
>
> but printlin in the Clojure code outputs:
>
> vvv*8Ezr30R%?L5!
>
> The "$n" simply vanishes.
>
> Why is that? This is not a regular expression. I didn't think plain
> strings in Clojure would be interpreted like this.
>
> Or is this how bash interprets it?
>
>
>
>
> On Friday, March 4, 2022 at 8:06:56 AM UTC-5 Lawrence Krubner wrote:
>
>> So, as a new way to test this, I've ssh'ed to an EC2 instance that is in
>> the same VCP as the RDS database. I upload my jar file so I can run it on
>> this EC2 instance.
>>
>> println the hash map at startup:
>>
>> {:dbtype mysql, :dbname pulsedata, :user pulseuser, :password , :host
>>  pulse-data.cclr8stksfch.us-west-2.rds.amazonaws.com}
>> This gets me the above error. But if I copy and paste the values and use
>> them with the mysql client:
>>
>> mysql -u pulseuser -h pulse-data.cclr8stksfch.us-west-2.rds.amazonaws.com
>>  -p pulsedata
>>
>> I am able to log in. This is in the same terminal window: the MySQL
>> client, at the command line in my terminal, logs me into MySQL, but "java
>> -jar user.jar" in the same terminal window gives me this error, about me
>> being rejected. I am copying and pasting the same values for user and host
>> and password.
>>
>> It has to be something about the Clojure code.
>>
>>
>> On Friday, March 4, 2022 at 6:35:59 AM UTC-5 ore...@orestis.gr wrote:
>>
>>> The error message indicates that you connect with user `pulseuser` - is
>>> that the expected user?
>>>
>>> I would print out the configuration that you’re passing in to jdbc.next
>>> to be absolutely certain it contains the values you expect it does.
>>>
>>> When you say “cli”, do you mean a mysql client? Double check the
>>> credentials (dbname, user, password) that *it* uses.
>>>
>>> Best,
>>> Orestis
>>>
>>> On 4 Mar 2022, at 13.27, Lawrence Krubner  wrote:
>>>
>>> But, again, I can connect from the cli using my terminal. I'm using my
>>> Spectrum connection to the Internet in both cases. If I run the app on my
>>> laptop, or I connect from the terminal, using the CLI, then in all cases
>>> I'm connecting over my Spectrum connection to the Internet. If MySQL was
>>> going to block one, then it would block the other, yes? I think the issue
>>> must have something to do with the Clojure code, since that is the only
>>> difference. I mean, if I do "java -jar user.jar" in the same terminal
>>> window, it fails, but then in that same terminal window I can connect to
>>> RDS without a problem using the CLI.
>>>
>>>
>>> On Thursday, March 3, 2022 at 3:26:31 PM UTC-5 red...@gmail.com wrote:
>>>
 That is a message from MySQL, not next.jdbc.

 MySQL allows you to grant permissions to a user base on the host they
 are connecting from so permission denied kinds of errors include the
 username and the host the users connection came from.

 On Thu, Mar 3, 2022, 11:18 Lawrence Krubner 
 wrote:

> I just wrote a small app that needs to connect to a MySQL app. I was
> running it on my laptop, connecting to MySQL on the laptop, and everything
> was working fine. Then I wanted to connect to one of our test databases in
> RDS in AWS. I've a simple function that finds the environment variables 
> and
> returns them as a map:
>
> (defn get-config
>   []
>   (check-config)
>   {
>:dbtype "mysql"
>:dbname (System/getenv "DATABASE_NAME")
>:user (System/getenv "DATABASE_USER")
>:password (System/getenv "DATABASE_PASSWORD")
>:host (System/getenv "DATABASE_HOST")
>})
>
> This is used simply:
>   ds (jdbc/get-datasource  (get-config))
>
> I've checked the environment values several times and they are
> correct. But when the code tries to write to the RDS database, I get:
>
> *java.sql.SQLException*: *Access denied for user
> 'pulseuser'@'cpe-74-71-234-49.nyc.res.rr.com
> ' (using password: YES)*
>
> I am connecting to the Internet through Spectrum, and apparently "
> rr.com" is Spectrum. I'm confused, why would next.jdbc use this info?
> Did I forget some important value in the hash map?
>
> From my laptop, I can reach the RDS database using the MySQL CLI, so
> there are no problems with connectivity. I whitelisted the IP address of 
> my
> house. This is something specific about what next.jdbc needs in that hash
> map, I think.
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups 

Re: Why is next.jdbc using my IP address?

2022-03-04 Thread Orestis Markou
You might need to quote the string with single quotes, otherwise bash will 
probably try and interpolate a var `$n`...

> On 4 Mar 2022, at 15.58, Lawrence Krubner  wrote:
> 
> Okay, this seems to have to do with characters acting as wildcards in the 
> password itself. This is in the .env file:
> 
> vvv*8Ezr30R%$n?L5!
> 
> but printlin in the Clojure code outputs:
> 
> vvv*8Ezr30R%?L5!
> 
> The "$n" simply vanishes. 
> 
> Why is that? This is not a regular expression. I didn't think plain strings 
> in Clojure would be interpreted like this. 
> 
> Or is this how bash interprets it? 
> 
> 
> 
> 
> On Friday, March 4, 2022 at 8:06:56 AM UTC-5 Lawrence Krubner wrote:
> So, as a new way to test this, I've ssh'ed to an EC2 instance that is in the 
> same VCP as the RDS database. I upload my jar file so I can run it on this 
> EC2 instance.
> 
> println the hash map at startup:
> 
> {:dbtype mysql, :dbname pulsedata, :user pulseuser, :password , :host 
> pulse-data.cclr8stksfch.us-west-2.rds.amazonaws.com 
> }
> 
> This gets me the above error. But if I copy and paste the values and use them 
> with the mysql client:
> 
> mysql -u pulseuser -h pulse-data.cclr8stksfch.us-west-2.rds.amazonaws.com 
>  -p pulsedata
> 
> I am able to log in. This is in the same terminal window: the MySQL client, 
> at the command line in my terminal, logs me into MySQL, but "java -jar 
> user.jar" in the same terminal window gives me this error, about me being 
> rejected. I am copying and pasting the same values for user and host and 
> password. 
> 
> It has to be something about the Clojure code. 
> 
> 
> On Friday, March 4, 2022 at 6:35:59 AM UTC-5 ore...@orestis.gr 
>  wrote:
> The error message indicates that you connect with user `pulseuser` - is that 
> the expected user? 
> 
> I would print out the configuration that you’re passing in to jdbc.next to be 
> absolutely certain it contains the values you expect it does.
> 
> When you say “cli”, do you mean a mysql client? Double check the credentials 
> (dbname, user, password) that *it* uses. 
> 
> Best,
> Orestis
> 
> 
>> On 4 Mar 2022, at 13.27, Lawrence Krubner > wrote:
>> 
> 
>> But, again, I can connect from the cli using my terminal. I'm using my 
>> Spectrum connection to the Internet in both cases. If I run the app on my 
>> laptop, or I connect from the terminal, using the CLI, then in all cases I'm 
>> connecting over my Spectrum connection to the Internet. If MySQL was going 
>> to block one, then it would block the other, yes? I think the issue must 
>> have something to do with the Clojure code, since that is the only 
>> difference. I mean, if I do "java -jar user.jar" in the same terminal 
>> window, it fails, but then in that same terminal window I can connect to RDS 
>> without a problem using the CLI. 
>> 
>> 
>> On Thursday, March 3, 2022 at 3:26:31 PM UTC-5 red...@gmail.com <> wrote:
>> That is a message from MySQL, not next.jdbc.
>> 
>> MySQL allows you to grant permissions to a user base on the host they are 
>> connecting from so permission denied kinds of errors include the username 
>> and the host the users connection came from.
>> 
>> On Thu, Mar 3, 2022, 11:18 Lawrence Krubner > wrote:
>> I just wrote a small app that needs to connect to a MySQL app. I was running 
>> it on my laptop, connecting to MySQL on the laptop, and everything was 
>> working fine. Then I wanted to connect to one of our test databases in RDS 
>> in AWS. I've a simple function that finds the environment variables and 
>> returns them as a map:
>> 
>> (defn get-config
>>   []
>>   (check-config)
>>   {
>>:dbtype "mysql"
>>:dbname (System/getenv "DATABASE_NAME")
>>:user (System/getenv "DATABASE_USER")
>>:password (System/getenv "DATABASE_PASSWORD")
>>:host (System/getenv "DATABASE_HOST")
>>})
>> 
>> This is used simply:
>>   ds (jdbc/get-datasource  (get-config))
>> 
>> I've checked the environment values several times and they are correct. But 
>> when the code tries to write to the RDS database, I get: 
>> java.sql.SQLException: Access denied for user 
>> 'pulseuser'@'cpe-74-71-234-49.nyc.res.rr.com 
>> ' (using password: YES)
>> 
>> I am connecting to the Internet through Spectrum, and apparently "rr.com 
>> " is Spectrum. I'm confused, why would next.jdbc use this 
>> info? Did I forget some important value in the hash map? 
>> 
>> From my laptop, I can reach the RDS database using the MySQL CLI, so there 
>> are no problems with connectivity. I whitelisted the IP address of my house. 
>> This is something specific about what next.jdbc needs in that hash map, I 
>> think.
>> 
>> 
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com <>
>> Note that 

Re: Why is next.jdbc using my IP address?

2022-03-04 Thread Lawrence Krubner
Okay, this seems to have to do with characters acting as wildcards in the 
password itself. This is in the .env file:

vvv*8Ezr30R%$n?L5!

but printlin in the Clojure code outputs:

vvv*8Ezr30R%?L5!

The "$n" simply vanishes. 

Why is that? This is not a regular expression. I didn't think plain strings 
in Clojure would be interpreted like this. 

Or is this how bash interprets it? 




On Friday, March 4, 2022 at 8:06:56 AM UTC-5 Lawrence Krubner wrote:

> So, as a new way to test this, I've ssh'ed to an EC2 instance that is in 
> the same VCP as the RDS database. I upload my jar file so I can run it on 
> this EC2 instance.
>
> println the hash map at startup:
>
> {:dbtype mysql, :dbname pulsedata, :user pulseuser, :password , :host 
> pulse-data.cclr8stksfch.us-west-2.rds.amazonaws.com}
> This gets me the above error. But if I copy and paste the values and use 
> them with the mysql client:
>
> mysql -u pulseuser -h pulse-data.cclr8stksfch.us-west-2.rds.amazonaws.com 
> -p pulsedata
>
> I am able to log in. This is in the same terminal window: the MySQL 
> client, at the command line in my terminal, logs me into MySQL, but "java 
> -jar user.jar" in the same terminal window gives me this error, about me 
> being rejected. I am copying and pasting the same values for user and host 
> and password. 
>
> It has to be something about the Clojure code. 
>
>
> On Friday, March 4, 2022 at 6:35:59 AM UTC-5 ore...@orestis.gr wrote:
>
>> The error message indicates that you connect with user `pulseuser` - is 
>> that the expected user? 
>>
>> I would print out the configuration that you’re passing in to jdbc.next 
>> to be absolutely certain it contains the values you expect it does.
>>
>> When you say “cli”, do you mean a mysql client? Double check the 
>> credentials (dbname, user, password) that *it* uses. 
>>
>> Best,
>> Orestis
>>
>> On 4 Mar 2022, at 13.27, Lawrence Krubner  wrote:
>>
>> But, again, I can connect from the cli using my terminal. I'm using my 
>> Spectrum connection to the Internet in both cases. If I run the app on my 
>> laptop, or I connect from the terminal, using the CLI, then in all cases 
>> I'm connecting over my Spectrum connection to the Internet. If MySQL was 
>> going to block one, then it would block the other, yes? I think the issue 
>> must have something to do with the Clojure code, since that is the only 
>> difference. I mean, if I do "java -jar user.jar" in the same terminal 
>> window, it fails, but then in that same terminal window I can connect to 
>> RDS without a problem using the CLI. 
>>
>>
>> On Thursday, March 3, 2022 at 3:26:31 PM UTC-5 red...@gmail.com wrote:
>>
>>> That is a message from MySQL, not next.jdbc.
>>>
>>> MySQL allows you to grant permissions to a user base on the host they 
>>> are connecting from so permission denied kinds of errors include the 
>>> username and the host the users connection came from.
>>>
>>> On Thu, Mar 3, 2022, 11:18 Lawrence Krubner  
>>> wrote:
>>>
 I just wrote a small app that needs to connect to a MySQL app. I was 
 running it on my laptop, connecting to MySQL on the laptop, and everything 
 was working fine. Then I wanted to connect to one of our test databases in 
 RDS in AWS. I've a simple function that finds the environment variables 
 and 
 returns them as a map:

 (defn get-config
   []
   (check-config)
   {
:dbtype "mysql"
:dbname (System/getenv "DATABASE_NAME")
:user (System/getenv "DATABASE_USER")
:password (System/getenv "DATABASE_PASSWORD")
:host (System/getenv "DATABASE_HOST")
})

 This is used simply:
   ds (jdbc/get-datasource  (get-config))

 I've checked the environment values several times and they are correct. 
 But when the code tries to write to the RDS database, I get: 

 *java.sql.SQLException*: *Access denied for user 
 'pulseuser'@'cpe-74-71-234-49.nyc.res.rr.com 
 ' (using password: YES)*

 I am connecting to the Internet through Spectrum, and apparently "
 rr.com" is Spectrum. I'm confused, why would next.jdbc use this info? 
 Did I forget some important value in the hash map? 

 From my laptop, I can reach the RDS database using the MySQL CLI, so 
 there are no problems with connectivity. I whitelisted the IP address of 
 my 
 house. This is something specific about what next.jdbc needs in that hash 
 map, I think.



 -- 
 You received this message because you are subscribed to the Google
 Groups "Clojure" group.
 To post to this group, send email to clo...@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+u...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 

Re: Why is next.jdbc using my IP address?

2022-03-04 Thread Lawrence Krubner


So, as a new way to test this, I've ssh'ed to an EC2 instance that is in 
the same VCP as the RDS database. I upload my jar file so I can run it on 
this EC2 instance.

println the hash map at startup:

{:dbtype mysql, :dbname pulsedata, :user pulseuser, :password , :host 
pulse-data.cclr8stksfch.us-west-2.rds.amazonaws.com}
This gets me the above error. But if I copy and paste the values and use 
them with the mysql client:

mysql -u pulseuser -h pulse-data.cclr8stksfch.us-west-2.rds.amazonaws.com 
-p pulsedata

I am able to log in. This is in the same terminal window: the MySQL client, 
at the command line in my terminal, logs me into MySQL, but "java -jar 
user.jar" in the same terminal window gives me this error, about me being 
rejected. I am copying and pasting the same values for user and host and 
password. 

It has to be something about the Clojure code. 


On Friday, March 4, 2022 at 6:35:59 AM UTC-5 ore...@orestis.gr wrote:

> The error message indicates that you connect with user `pulseuser` - is 
> that the expected user? 
>
> I would print out the configuration that you’re passing in to jdbc.next to 
> be absolutely certain it contains the values you expect it does.
>
> When you say “cli”, do you mean a mysql client? Double check the 
> credentials (dbname, user, password) that *it* uses. 
>
> Best,
> Orestis
>
> On 4 Mar 2022, at 13.27, Lawrence Krubner  wrote:
>
> But, again, I can connect from the cli using my terminal. I'm using my 
> Spectrum connection to the Internet in both cases. If I run the app on my 
> laptop, or I connect from the terminal, using the CLI, then in all cases 
> I'm connecting over my Spectrum connection to the Internet. If MySQL was 
> going to block one, then it would block the other, yes? I think the issue 
> must have something to do with the Clojure code, since that is the only 
> difference. I mean, if I do "java -jar user.jar" in the same terminal 
> window, it fails, but then in that same terminal window I can connect to 
> RDS without a problem using the CLI. 
>
>
> On Thursday, March 3, 2022 at 3:26:31 PM UTC-5 red...@gmail.com wrote:
>
>> That is a message from MySQL, not next.jdbc.
>>
>> MySQL allows you to grant permissions to a user base on the host they are 
>> connecting from so permission denied kinds of errors include the username 
>> and the host the users connection came from.
>>
>> On Thu, Mar 3, 2022, 11:18 Lawrence Krubner  
>> wrote:
>>
>>> I just wrote a small app that needs to connect to a MySQL app. I was 
>>> running it on my laptop, connecting to MySQL on the laptop, and everything 
>>> was working fine. Then I wanted to connect to one of our test databases in 
>>> RDS in AWS. I've a simple function that finds the environment variables and 
>>> returns them as a map:
>>>
>>> (defn get-config
>>>   []
>>>   (check-config)
>>>   {
>>>:dbtype "mysql"
>>>:dbname (System/getenv "DATABASE_NAME")
>>>:user (System/getenv "DATABASE_USER")
>>>:password (System/getenv "DATABASE_PASSWORD")
>>>:host (System/getenv "DATABASE_HOST")
>>>})
>>>
>>> This is used simply:
>>>   ds (jdbc/get-datasource  (get-config))
>>>
>>> I've checked the environment values several times and they are correct. 
>>> But when the code tries to write to the RDS database, I get: 
>>>
>>> *java.sql.SQLException*: *Access denied for user 
>>> 'pulseuser'@'cpe-74-71-234-49.nyc.res.rr.com 
>>> ' (using password: YES)*
>>>
>>> I am connecting to the Internet through Spectrum, and apparently "rr.com" 
>>> is Spectrum. I'm confused, why would next.jdbc use this info? Did I forget 
>>> some important value in the hash map? 
>>>
>>> From my laptop, I can reach the RDS database using the MySQL CLI, so 
>>> there are no problems with connectivity. I whitelisted the IP address of my 
>>> house. This is something specific about what next.jdbc needs in that hash 
>>> map, I think.
>>>
>>>
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/clojure/eadd7b66-d19d-41e8-b02d-76185de0778dn%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>
> -- 
> You received this message because you are subscribed to 

Re: Why is next.jdbc using my IP address?

2022-03-04 Thread Orestis Markou
The error message indicates that you connect with user `pulseuser` - is that 
the expected user? 

I would print out the configuration that you’re passing in to jdbc.next to be 
absolutely certain it contains the values you expect it does.

When you say “cli”, do you mean a mysql client? Double check the credentials 
(dbname, user, password) that *it* uses. 

Best,
Orestis

> On 4 Mar 2022, at 13.27, Lawrence Krubner  wrote:
> 
> But, again, I can connect from the cli using my terminal. I'm using my 
> Spectrum connection to the Internet in both cases. If I run the app on my 
> laptop, or I connect from the terminal, using the CLI, then in all cases I'm 
> connecting over my Spectrum connection to the Internet. If MySQL was going to 
> block one, then it would block the other, yes? I think the issue must have 
> something to do with the Clojure code, since that is the only difference. I 
> mean, if I do "java -jar user.jar" in the same terminal window, it fails, but 
> then in that same terminal window I can connect to RDS without a problem 
> using the CLI. 
> 
> 
> On Thursday, March 3, 2022 at 3:26:31 PM UTC-5 redc...@gmail.com wrote:
> That is a message from MySQL, not next.jdbc.
> 
> MySQL allows you to grant permissions to a user base on the host they are 
> connecting from so permission denied kinds of errors include the username and 
> the host the users connection came from.
> 
> On Thu, Mar 3, 2022, 11:18 Lawrence Krubner  > wrote:
> I just wrote a small app that needs to connect to a MySQL app. I was running 
> it on my laptop, connecting to MySQL on the laptop, and everything was 
> working fine. Then I wanted to connect to one of our test databases in RDS in 
> AWS. I've a simple function that finds the environment variables and returns 
> them as a map:
> 
> (defn get-config
>   []
>   (check-config)
>   {
>:dbtype "mysql"
>:dbname (System/getenv "DATABASE_NAME")
>:user (System/getenv "DATABASE_USER")
>:password (System/getenv "DATABASE_PASSWORD")
>:host (System/getenv "DATABASE_HOST")
>})
> 
> This is used simply:
>   ds (jdbc/get-datasource  (get-config))
> 
> I've checked the environment values several times and they are correct. But 
> when the code tries to write to the RDS database, I get: 
> java.sql.SQLException: Access denied for user 
> 'pulseuser'@'cpe-74-71-234-49.nyc.res.rr.com 
> ' (using password: YES)
> 
> I am connecting to the Internet through Spectrum, and apparently "rr.com 
> " is Spectrum. I'm confused, why would next.jdbc use this 
> info? Did I forget some important value in the hash map? 
> 
> From my laptop, I can reach the RDS database using the MySQL CLI, so there 
> are no problems with connectivity. I whitelisted the IP address of my house. 
> This is something specific about what next.jdbc needs in that hash map, I 
> think.
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/clojure/eadd7b66-d19d-41e8-b02d-76185de0778dn%40googlegroups.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 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/clojure/9e58a686-29fb-43d4-af41-2cf0345425c6n%40googlegroups.com
>  
> .

-- 
You received this message because you 

Re: Why is next.jdbc using my IP address?

2022-03-04 Thread Lawrence Krubner
But, again, I can connect from the cli using my terminal. I'm using my 
Spectrum connection to the Internet in both cases. If I run the app on my 
laptop, or I connect from the terminal, using the CLI, then in all cases 
I'm connecting over my Spectrum connection to the Internet. If MySQL was 
going to block one, then it would block the other, yes? I think the issue 
must have something to do with the Clojure code, since that is the only 
difference. I mean, if I do "java -jar user.jar" in the same terminal 
window, it fails, but then in that same terminal window I can connect to 
RDS without a problem using the CLI. 


On Thursday, March 3, 2022 at 3:26:31 PM UTC-5 redc...@gmail.com wrote:

> That is a message from MySQL, not next.jdbc.
>
> MySQL allows you to grant permissions to a user base on the host they are 
> connecting from so permission denied kinds of errors include the username 
> and the host the users connection came from.
>
> On Thu, Mar 3, 2022, 11:18 Lawrence Krubner  wrote:
>
>> I just wrote a small app that needs to connect to a MySQL app. I was 
>> running it on my laptop, connecting to MySQL on the laptop, and everything 
>> was working fine. Then I wanted to connect to one of our test databases in 
>> RDS in AWS. I've a simple function that finds the environment variables and 
>> returns them as a map:
>>
>> (defn get-config
>>   []
>>   (check-config)
>>   {
>>:dbtype "mysql"
>>:dbname (System/getenv "DATABASE_NAME")
>>:user (System/getenv "DATABASE_USER")
>>:password (System/getenv "DATABASE_PASSWORD")
>>:host (System/getenv "DATABASE_HOST")
>>})
>>
>> This is used simply:
>>   ds (jdbc/get-datasource  (get-config))
>>
>> I've checked the environment values several times and they are correct. 
>> But when the code tries to write to the RDS database, I get: 
>>
>> *java.sql.SQLException*: *Access denied for user 
>> 'pulseuser'@'cpe-74-71-234-49.nyc.res.rr.com 
>> ' (using password: YES)*
>>
>> I am connecting to the Internet through Spectrum, and apparently "rr.com" 
>> is Spectrum. I'm confused, why would next.jdbc use this info? Did I forget 
>> some important value in the hash map? 
>>
>> From my laptop, I can reach the RDS database using the MySQL CLI, so 
>> there are no problems with connectivity. I whitelisted the IP address of my 
>> house. This is something specific about what next.jdbc needs in that hash 
>> map, I think.
>>
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/clojure/eadd7b66-d19d-41e8-b02d-76185de0778dn%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/9e58a686-29fb-43d4-af41-2cf0345425c6n%40googlegroups.com.


Re: Why is next.jdbc using my IP address?

2022-03-03 Thread Kevin Downey
That is a message from MySQL, not next.jdbc.

MySQL allows you to grant permissions to a user base on the host they are
connecting from so permission denied kinds of errors include the username
and the host the users connection came from.

On Thu, Mar 3, 2022, 11:18 Lawrence Krubner  wrote:

> I just wrote a small app that needs to connect to a MySQL app. I was
> running it on my laptop, connecting to MySQL on the laptop, and everything
> was working fine. Then I wanted to connect to one of our test databases in
> RDS in AWS. I've a simple function that finds the environment variables and
> returns them as a map:
>
> (defn get-config
>   []
>   (check-config)
>   {
>:dbtype "mysql"
>:dbname (System/getenv "DATABASE_NAME")
>:user (System/getenv "DATABASE_USER")
>:password (System/getenv "DATABASE_PASSWORD")
>:host (System/getenv "DATABASE_HOST")
>})
>
> This is used simply:
>   ds (jdbc/get-datasource  (get-config))
>
> I've checked the environment values several times and they are correct.
> But when the code tries to write to the RDS database, I get:
>
> *java.sql.SQLException*: *Access denied for user
> 'pulseuser'@'cpe-74-71-234-49.nyc.res.rr.com
> ' (using password: YES)*
>
> I am connecting to the Internet through Spectrum, and apparently "rr.com"
> is Spectrum. I'm confused, why would next.jdbc use this info? Did I forget
> some important value in the hash map?
>
> From my laptop, I can reach the RDS database using the MySQL CLI, so there
> are no problems with connectivity. I whitelisted the IP address of my
> house. This is something specific about what next.jdbc needs in that hash
> map, I think.
>
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/eadd7b66-d19d-41e8-b02d-76185de0778dn%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CAE8CPr6D_g1iNX0H%2BtM8MUAaFV6trFKE9f7e4VxOMu5tb0Damg%40mail.gmail.com.


Re: Developing Ionic application using Clojurescript

2022-02-23 Thread Marko Kocić
Posted an update to the same blog post how to configure webpack to play 
together with shadow-cljs, since Ionic framework requires webpack packaging.

https://marko.euptera.com/posts/ionic-clojure-todo-example.html


Marko Kocić schrieb am Montag, 21. Februar 2022 um 16:00:37 UTC+1:

> I wrote an updated tutorial about developing Ionic application using 
> Clojurescript and shadow-cljs, this time completely ignoring Ionic tooling 
> and using trusted Clojurescript tools.
>
> https://marko.euptera.com/posts/ionic-clojure-todo-example.html
>
> Feedback wellcome.
>
> Cheers,
> Marko
>
> Marko Kocić schrieb am Montag, 14. Februar 2022 um 17:31:11 UTC+1:
>
>> I made a blog post with instructions how to use Clojure instead of 
>> Typescript or Javascript to develop an application using the latest version 
>> of the cross-platform Ionic Framework.
>>
>> https://marko.euptera.com/posts/ionic-clojure.html
>>
>> This should bring another option to develop mobile applications using 
>> Clojurescript, besides React Native, of course.
>>
>> Did anyone else also used Ionic with Clojure? What are your impressions.
>>
>> Best regards,
>> Marko
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/69c9911c-6f16-4f07-9c81-8e73c71ac728n%40googlegroups.com.


Re: Developing Ionic application using Clojurescript

2022-02-21 Thread Marko Kocić
 I wrote an updated tutorial about developing Ionic application using 
Clojurescript and shadow-cljs, this time completely ignoring Ionic tooling 
and using trusted Clojurescript tools.

https://marko.euptera.com/posts/ionic-clojure-todo-example.html

Feedback wellcome.

Cheers,
Marko

Marko Kocić schrieb am Montag, 14. Februar 2022 um 17:31:11 UTC+1:

> I made a blog post with instructions how to use Clojure instead of 
> Typescript or Javascript to develop an application using the latest version 
> of the cross-platform Ionic Framework.
>
> https://marko.euptera.com/posts/ionic-clojure.html
>
> This should bring another option to develop mobile applications using 
> Clojurescript, besides React Native, of course.
>
> Did anyone else also used Ionic with Clojure? What are your impressions.
>
> Best regards,
> Marko
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/8a10adc5-88ac-4622-94c2-6e50aad7a183n%40googlegroups.com.


Re: pre and post assertions, always in the meta data?

2022-02-15 Thread Sean Corfield
Whilst you solved your problem, you didn't get an answer about metadata.

There are multiple places metadata can appear in a function definition:

dev=> (defn ^{:one true} func (^{:two true} [x] {:three true} x) {:four 
true})
#'dev/func
dev=> (meta #'func)
{:one true, :arglists ([x]), :four true, :line 1, :column 1, :file 
"/home/seanc/.clojure/dev.clj", :name func, :ns 
#object[clojure.lang.Namespace 0x17b6ad97 "dev"]}
dev=> (->> #'func (meta) :arglists (mapv meta))
[{:two true, :three true}]
dev=>

I've delineated the arity of the function with ( ) for clarity so you can 
which metadata belongs to the function Var and which belongs to a specific 
arity, and you can see they are combined.

I've never seen anything except :pre/:post in position three and I've never 
seen :pre/:post in position two (until I saw your example from ostash.dev) 
-- but as you can see they are equivalent (and they combine).

I don't think I've ever seen function Var metadata in position four.
On Thursday, February 3, 2022 at 10:56:59 AM UTC-8 Laws wrote:

>
> I see this old post by Fogus:
>
> http://blog.fogus.me/2009/12/21/clojures-pre-and-post/
>
> With this example:
>
> (defn constrained–fn [f x]
>   {:pre  [(pos? x)]
>:post [(= % (* 2 x))]}
>   (f x))
>
> But I see this modern example:
>
> https://ostash.dev/posts/2021-07-01-pre-post-conditions/
>
> (defn func ^{:pre [(pos? x)] :post [(< % 100) (> % 1)]} [x] (+ 1 x))
>
> Where it is in the metadata. 
>
> But here I still the old style:
>
> https://clojure.org/reference/special_forms
>
> (defn constrained-sqr [x] {:pre [(pos? x)] :post [(> % 16), (< % 225)]} (* 
> x x))
>
> I was away from Clojure for a few years, so I think it I missed some of 
> its evolution. Is one of these styles favored? 
>
> I'm struggling with an issue where I cannot get the error to show up, even 
> when I deliberately send in data that would cause the assertion to return 
> false. 
>
> My function started: 
>
> (defn get-cisa-advisories
>   [cisa-advisory-urls]
>   {
>:pre [(set? cisa-advisory-urls)]
>:post [(vector? %)]
>}
>   (println "get-cisa-advisories")
>   (try
>
> When I called this with a vector, I got no error, but the app silently 
> died. I'm confused about this. The call to this function is wrapped in a 
> try/catch block, and that assertion must have thrown an error because that 
> is where the app dies, yet I couldn't see the exception in my catch block. 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/3cc16f33-3f7b-49dd-96e8-b20fdb37e9cdn%40googlegroups.com.


Re: how do I debug a cryptic XML error?

2022-02-15 Thread Laws
Okay, this seemed to fix the problem:


cpe-dictionary (-> "official-cpe-dictionary_v2.3.xml"
   (java.io.FileInputStream.)
   (xml/parse))


xmlzipper (clojure.zip/xml-zip cpe-dictionary)

xmlnode (-> xmlzipper
zip/down
zip/right
zip/node)




On Tuesday, February 15, 2022 at 10:44:13 PM UTC-5 Laws wrote:

>
> I changed the code a bit:
>
> cpe-dictionary (-> "official-cpe-dictionary_v2.3.xml"
>(java.io.StringReader.)
>(xml/parse))
>
> xmlzipper (clojure.zip/xml-zip cpe-dictionary)
>
> Now I get this:
>
>   clojure.data.xml/*parse*   
> xml.clj:  84
>
>   clojure.data.xml/*parse*   
> xml.clj: 109
>
> clojure.data.xml.tree/*event-tree*
>   tree.clj:  70
>
>  clojure.core/*ffirst*
>   core.clj: 105
>
>   clojure.core/*first*
>   core.clj:  55
>
>  ...  
>  
>
>clojure.data.xml.tree/seq-tree/*fn*
>   tree.clj:  39
>
> clojure.core/*seq*
>   core.clj: 139
>
>  ...  
>  
>
>   clojure.data.xml.jvm.parse/pull-seq/*fn*   
>   parse.clj:  78
>
> com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next  
> XMLStreamReaderImpl.java: 652
>
> *javax.xml.stream.XMLStreamException*: *ParseError at [row,col]:[1,1]*
>
> * Message: Content is not allowed in 
> prolog.*
>
> *location*: 
> #object[com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl$1 
> 0x296bfddb "Line number = 1\nColumn number = 1\nSystem Id = null\nPublic Id 
> = null\nLocation Uri= null\nCharacterOffset = 0\n"]
>
>
>
>
> On Tuesday, February 15, 2022 at 7:50:12 PM UTC-5 Laws wrote:
>
>> So, I went to the government NVD website:
>>
>> https://nvd.nist.gov/products/cpe
>>
>> I downloaded the CPE Dictionary and unpacked it. It looks like standard 
>> XML. 
>>
>> I copy and paste the standard XML example given on the Clojure XML 
>> documentation page:
>>
>>  cpe-dictionary (-> "official-cpe-dictionary_v2.3.xml" io/resource 
>> io/file clj-xml/parse zip/xml-zip)
>>
>> I get:
>>
>> clojure.xml/*startparse-sax*xml.clj:  76
>> ...   
>>
>>jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke  
>> DelegatingMethodAccessorImpl.java:  43
>>
>>jdk.internal.reflect.NativeMethodAccessorImpl.invoke  
>> NativeMethodAccessorImpl.java:  77
>>
>>   jdk.internal.reflect.NativeMethodAccessorImpl.invoke0   
>> NativeMethodAccessorImpl.java
>>
>> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse   
>>   SAXParserImpl.java: 317
>>
>> *java.lang.IllegalArgumentException*: 
>>
>>
>> I'm wondering, how do I figure out what is wrong here? I'm going to 
>> assume the government is offering reasonably standard XML, so where would 
>> the problem arise? How do I figure out a way around this? 
>>
>> The CPE dictionary is 386 megabytes so I can't share the hold file here, 
>> but when I run "head" on it, the beginning looks like this:
>>
>>
>> 
>>
>> http://scap.nist.gov/schema/configuration/0.1; 
>> xmlns="http://cpe.mitre.org/dictionary/2.0; xmlns:xsi="
>> http://www.w3.org/2001/XMLSchema-instance; xmlns:scap-core="
>> http://scap.nist.gov/schema/scap-core/0.3; xmlns:cpe-23="
>> http://scap.nist.gov/schema/cpe-extension/2.3; xmlns:ns6="
>> http://scap.nist.gov/schema/scap-core/0.1; xmlns:meta="
>> http://scap.nist.gov/schema/cpe-dictionary-metadata/0.2; 
>> xsi:schemaLocation="http://scap.nist.gov/schema/cpe-extension/2.3 
>> https://scap.nist.gov/schema/cpe/2.3/cpe-dictionary-extension_2.3.xsd 
>> http://cpe.mitre.org/dictionary/2.0 
>> https://scap.nist.gov/schema/cpe/2.3/cpe-dictionary_2.3.xsd 
>> http://scap.nist.gov/schema/cpe-dictionary-metadata/0.2 
>> https://scap.nist.gov/schema/cpe/2.1/cpe-dictionary-metadata_0.2.xsd 
>> http://scap.nist.gov/schema/scap-core/0.3 
>> https://scap.nist.gov/schema/nvd/scap-core_0.3.xsd 
>> http://scap.nist.gov/schema/configuration/0.1 
>> https://scap.nist.gov/schema/nvd/configuration_0.1.xsd 
>> http://scap.nist.gov/schema/scap-core/0.1 
>> https://scap.nist.gov/schema/nvd/scap-core_0.1.xsd;>
>>
>>   
>>
>> National Vulnerability Database (NVD)
>>
>> 4.9
>>
>> 2.3
>>
>> 2022-01-25T04:50:56.780Z
>>
>>   
>>
>>   > 

Re: how do I debug a cryptic XML error?

2022-02-15 Thread Laws

I changed the code a bit:

cpe-dictionary (-> "official-cpe-dictionary_v2.3.xml"
   (java.io.StringReader.)
   (xml/parse))

xmlzipper (clojure.zip/xml-zip cpe-dictionary)

Now I get this:

  clojure.data.xml/*parse* 
  xml.clj:  84

  clojure.data.xml/*parse* 
  xml.clj: 109

clojure.data.xml.tree/*event-tree*  
tree.clj:  70

 clojure.core/*ffirst*  
core.clj: 105

  clojure.core/*first*  
core.clj:  55

 ...
   

   clojure.data.xml.tree/seq-tree/*fn*  
tree.clj:  39

clojure.core/*seq*  
core.clj: 139

 ...
   

  clojure.data.xml.jvm.parse/pull-seq/*fn* 
parse.clj:  78

com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next  
XMLStreamReaderImpl.java: 652

*javax.xml.stream.XMLStreamException*: *ParseError at [row,col]:[1,1]*

* Message: Content is not allowed in 
prolog.*

*location*: 
#object[com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl$1 
0x296bfddb "Line number = 1\nColumn number = 1\nSystem Id = null\nPublic Id 
= null\nLocation Uri= null\nCharacterOffset = 0\n"]




On Tuesday, February 15, 2022 at 7:50:12 PM UTC-5 Laws wrote:

> So, I went to the government NVD website:
>
> https://nvd.nist.gov/products/cpe
>
> I downloaded the CPE Dictionary and unpacked it. It looks like standard 
> XML. 
>
> I copy and paste the standard XML example given on the Clojure XML 
> documentation page:
>
>  cpe-dictionary (-> "official-cpe-dictionary_v2.3.xml" io/resource io/file 
> clj-xml/parse zip/xml-zip)
>
> I get:
>
> clojure.xml/*startparse-sax*xml.clj:  76  
>   ...   
>
>jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke  
> DelegatingMethodAccessorImpl.java:  43
>
>jdk.internal.reflect.NativeMethodAccessorImpl.invoke  
> NativeMethodAccessorImpl.java:  77
>
>   jdk.internal.reflect.NativeMethodAccessorImpl.invoke0   
> NativeMethodAccessorImpl.java
>
> com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse   
>   SAXParserImpl.java: 317
>
> *java.lang.IllegalArgumentException*: 
>
>
> I'm wondering, how do I figure out what is wrong here? I'm going to assume 
> the government is offering reasonably standard XML, so where would the 
> problem arise? How do I figure out a way around this? 
>
> The CPE dictionary is 386 megabytes so I can't share the hold file here, 
> but when I run "head" on it, the beginning looks like this:
>
>
> 
>
> http://scap.nist.gov/schema/configuration/0.1; 
> xmlns="http://cpe.mitre.org/dictionary/2.0; xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance; xmlns:scap-core="
> http://scap.nist.gov/schema/scap-core/0.3; xmlns:cpe-23="
> http://scap.nist.gov/schema/cpe-extension/2.3; xmlns:ns6="
> http://scap.nist.gov/schema/scap-core/0.1; xmlns:meta="
> http://scap.nist.gov/schema/cpe-dictionary-metadata/0.2; 
> xsi:schemaLocation="http://scap.nist.gov/schema/cpe-extension/2.3 
> https://scap.nist.gov/schema/cpe/2.3/cpe-dictionary-extension_2.3.xsd 
> http://cpe.mitre.org/dictionary/2.0 
> https://scap.nist.gov/schema/cpe/2.3/cpe-dictionary_2.3.xsd 
> http://scap.nist.gov/schema/cpe-dictionary-metadata/0.2 
> https://scap.nist.gov/schema/cpe/2.1/cpe-dictionary-metadata_0.2.xsd 
> http://scap.nist.gov/schema/scap-core/0.3 
> https://scap.nist.gov/schema/nvd/scap-core_0.3.xsd 
> http://scap.nist.gov/schema/configuration/0.1 
> https://scap.nist.gov/schema/nvd/configuration_0.1.xsd 
> http://scap.nist.gov/schema/scap-core/0.1 
> https://scap.nist.gov/schema/nvd/scap-core_0.1.xsd;>
>
>   
>
> National Vulnerability Database (NVD)
>
> 4.9
>
> 2.3
>
> 2022-01-25T04:50:56.780Z
>
>   
>
>name="cpe:/a:%240.99_kindle_books_project:%240.99_kindle_books:6::~~~android~~">
>
> $0.99 Kindle Books project $0.99 Kindle Books 
> (aka com.kindle.books.for99) for android 6.0
>

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

Re: real-world-data meetings

2022-02-09 Thread Daniel Slutsky
Following the warm responses we got to the real-world-data meetups 
suggestion, João Santiago and I are organizing the first event on the 
series.
https://clojureverse.org/t/real-world-data-meetup-1/

On Wednesday, 26 January 2022 at 12:42:53 UTC+2 Daniel Slutsky wrote:

> Following recent conversations, we are organizing a meetup – hopefully a 
> first on a series – where individuals and groups will share their 
> experiences, problems, hopes, and doubts, regarding the use of Clojure for 
> data problems.
>
> https://clojureverse.org/t/real-world-data-meetings/
>
> Your response to the survey will help a lot.
> Also, please share this with relevant friends.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/87fc82e0-6371-466e-822d-b257f70bfee9n%40googlegroups.com.


Re: pre and post assertions, always in the meta data?

2022-02-03 Thread Laws
Hmmm, okay, I was using slingshot/try+ everywhere and then, just once, I 
used a plain 'try' and forgot to use the correct catch. My fault. 

On Thursday, February 3, 2022 at 1:56:59 PM UTC-5 Laws wrote:

>
> I see this old post by Fogus:
>
> http://blog.fogus.me/2009/12/21/clojures-pre-and-post/
>
> With this example:
>
> (defn constrained–fn [f x]
>   {:pre  [(pos? x)]
>:post [(= % (* 2 x))]}
>   (f x))
>
> But I see this modern example:
>
> https://ostash.dev/posts/2021-07-01-pre-post-conditions/
>
> (defn func ^{:pre [(pos? x)] :post [(< % 100) (> % 1)]} [x] (+ 1 x))
>
> Where it is in the metadata. 
>
> But here I still the old style:
>
> https://clojure.org/reference/special_forms
>
> (defn constrained-sqr [x] {:pre [(pos? x)] :post [(> % 16), (< % 225)]} (* 
> x x))
>
> I was away from Clojure for a few years, so I think it I missed some of 
> its evolution. Is one of these styles favored? 
>
> I'm struggling with an issue where I cannot get the error to show up, even 
> when I deliberately send in data that would cause the assertion to return 
> false. 
>
> My function started: 
>
> (defn get-cisa-advisories
>   [cisa-advisory-urls]
>   {
>:pre [(set? cisa-advisory-urls)]
>:post [(vector? %)]
>}
>   (println "get-cisa-advisories")
>   (try
>
> When I called this with a vector, I got no error, but the app silently 
> died. I'm confused about this. The call to this function is wrapped in a 
> try/catch block, and that assertion must have thrown an error because that 
> is where the app dies, yet I couldn't see the exception in my catch block. 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/57315054-1970-4e4b-95f7-b61ebd0381d8n%40googlegroups.com.


Re: common ways to run regex against either Hickory HTML or zippers?

2022-02-03 Thread Laws
Thank you, everyone.

On Wednesday, February 2, 2022 at 3:22:53 PM UTC-5 lawrence...@gmail.com 
wrote:

> Assume I've been cursed to scrape HTML. If I convert the pages to Hickory 
> I end up with a big mass of data which, sadly, lacks many "class" or "id"s 
> that would let me easily pick out the data I need. However, for the most 
> part, the only thing I really need off this page is the CVEs, which look 
> like this:
>
> CVE-2021-40539
>
> I'm thinking I might write regex against the plain text of the page, but 
> I'm also curious, is it common to take something like Hiccup or Hickory or 
> a zipper and run regex through it? If yes, how is that done? 
>
> A small part of the data looks like this:
>
> :content
> [{:type :element,
>   :attrs
>   {:class "tip-intro", :style "font-size: 15px;"},
>   :tag :p,
>   :content
>   [{:type :element,
> :attrs nil,
> :tag :em,
> :content
> ["This Joint Cybersecurity Advisory uses the MITRE 
> Adversarial Tactics, Techniques, and Common Knowledge (ATT®) framework, 
> Version 8. See the "
>  {:type :element,
>   :attrs
>   {:href
>"
> https://attack.mitre.org/versions/v9/techniques/enterprise/"},
>   :tag :a,
>   :content ["ATT for Enterprise"]}
>  " for  referenced threat actor tactics and for 
> techniques."]}]}
>  "\n\n"
>  {:type :element,
>   :attrs nil,
>   :tag :p,
>   :content
>   ["This joint advisory is the result of analytic efforts 
> between the Federal Bureau of Investigation (FBI), United States Coast 
> Guard Cyber Command (CGCYBER), and the Cybersecurity and Infrastructure 
> Security Agency (CISA) to highlight the cyber threat associated with active 
> exploitation of a newly identified vulnerability (CVE-2021-40539) in 
> ManageEngine ADSelfService Plus—a self-service password management and 
> single sign-on solution."]}
>  "\n\n"
>  {:type :element,
>   :attrs nil,
>   :tag :p,
>   :content
>   ["CVE-2021-40539, rated critical by the Common 
> Vulnerability Scoring System (CVSS), is an authentication bypass 
> vulnerability affecting representational state transfer (REST) application 
> programming interface (API) URLs that could enable remote code execution. 
> The FBI, CISA, and CGCYBER assess that advanced persistent threat (APT) 
> cyber actors are likely among those exploiting the vulnerability. The 
> exploitation of ManageEngine ADSelfService Plus poses a serious risk to 
> critical infrastructure companies, U.S.-cleared defense contractors, 
> academic institutions, and other entities that use the software. Successful 
> exploitation of the vulnerability allows an attacker to place webshells, 
> which enable the adversary to conduct post-exploitation activities, such as 
> compromising administrator credentials, conducting lateral movement, and 
> exfiltrating registry hives and Active Directory files."]}
>  "\n\n"
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/388183d2-7cf6-4b58-900f-aa0d0074cd91n%40googlegroups.com.


Re: common ways to run regex against either Hickory HTML or zippers?

2022-02-02 Thread Harold
I would use enlive for this.
 - https://github.com/cgrand/enlive

`re-pred` seems 
relevant: 
https://cljdoc.org/d/enlive/enlive/1.1.6/api/net.cgrand.enlive-html#re-pred

Here's someone doing something similar a while 
ago: 
https://stackoverflow.com/questions/18604049/clojure-enlive-a-selector-that-uses-regex
 - The were also having problems with text encoding, hopefully you wont.

hth,
-Harold

On Wednesday, February 2, 2022 at 1:22:53 PM UTC-7 lawrence...@gmail.com 
wrote:

> Assume I've been cursed to scrape HTML. If I convert the pages to Hickory 
> I end up with a big mass of data which, sadly, lacks many "class" or "id"s 
> that would let me easily pick out the data I need. However, for the most 
> part, the only thing I really need off this page is the CVEs, which look 
> like this:
>
> CVE-2021-40539
>
> I'm thinking I might write regex against the plain text of the page, but 
> I'm also curious, is it common to take something like Hiccup or Hickory or 
> a zipper and run regex through it? If yes, how is that done? 
>
> A small part of the data looks like this:
>
> :content
> [{:type :element,
>   :attrs
>   {:class "tip-intro", :style "font-size: 15px;"},
>   :tag :p,
>   :content
>   [{:type :element,
> :attrs nil,
> :tag :em,
> :content
> ["This Joint Cybersecurity Advisory uses the MITRE 
> Adversarial Tactics, Techniques, and Common Knowledge (ATT®) framework, 
> Version 8. See the "
>  {:type :element,
>   :attrs
>   {:href
>"
> https://attack.mitre.org/versions/v9/techniques/enterprise/"},
>   :tag :a,
>   :content ["ATT for Enterprise"]}
>  " for  referenced threat actor tactics and for 
> techniques."]}]}
>  "\n\n"
>  {:type :element,
>   :attrs nil,
>   :tag :p,
>   :content
>   ["This joint advisory is the result of analytic efforts 
> between the Federal Bureau of Investigation (FBI), United States Coast 
> Guard Cyber Command (CGCYBER), and the Cybersecurity and Infrastructure 
> Security Agency (CISA) to highlight the cyber threat associated with active 
> exploitation of a newly identified vulnerability (CVE-2021-40539) in 
> ManageEngine ADSelfService Plus—a self-service password management and 
> single sign-on solution."]}
>  "\n\n"
>  {:type :element,
>   :attrs nil,
>   :tag :p,
>   :content
>   ["CVE-2021-40539, rated critical by the Common 
> Vulnerability Scoring System (CVSS), is an authentication bypass 
> vulnerability affecting representational state transfer (REST) application 
> programming interface (API) URLs that could enable remote code execution. 
> The FBI, CISA, and CGCYBER assess that advanced persistent threat (APT) 
> cyber actors are likely among those exploiting the vulnerability. The 
> exploitation of ManageEngine ADSelfService Plus poses a serious risk to 
> critical infrastructure companies, U.S.-cleared defense contractors, 
> academic institutions, and other entities that use the software. Successful 
> exploitation of the vulnerability allows an attacker to place webshells, 
> which enable the adversary to conduct post-exploitation activities, such as 
> compromising administrator credentials, conducting lateral movement, and 
> exfiltrating registry hives and Active Directory files."]}
>  "\n\n"
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/078db869-2405-48da-a383-8c5ca187c5adn%40googlegroups.com.


Re: common ways to run regex against either Hickory HTML or zippers?

2022-02-02 Thread Cora Sutton
If all you're looking for is the format CVE--N then by all means
just use regex against the plain text of the page. If you need to do dom
traversal then jsoup is a good choice. Otherwise, like Mark said, tree-seq
is a great choice if you don't want to play with clojure.walk.

On Wed, Feb 2, 2022 at 2:58 PM Mark Nutter  wrote:

> I don't know how common it is, but have you looked at the `tree-seq`
> function in Clojure? This seems like a good use case for it.
>
> Mark
>
> On Wed, Feb 2, 2022 at 3:22 PM lawrence...@gmail.com <
> lawrence.krub...@gmail.com> wrote:
>
>> Assume I've been cursed to scrape HTML. If I convert the pages to Hickory
>> I end up with a big mass of data which, sadly, lacks many "class" or "id"s
>> that would let me easily pick out the data I need. However, for the most
>> part, the only thing I really need off this page is the CVEs, which look
>> like this:
>>
>> CVE-2021-40539
>>
>> I'm thinking I might write regex against the plain text of the page, but
>> I'm also curious, is it common to take something like Hiccup or Hickory or
>> a zipper and run regex through it? If yes, how is that done?
>>
>> A small part of the data looks like this:
>>
>> :content
>> [{:type :element,
>>   :attrs
>>   {:class "tip-intro", :style "font-size: 15px;"},
>>   :tag :p,
>>   :content
>>   [{:type :element,
>> :attrs nil,
>> :tag :em,
>> :content
>> ["This Joint Cybersecurity Advisory uses the MITRE
>> Adversarial Tactics, Techniques, and Common Knowledge (ATT®) framework,
>> Version 8. See the "
>>  {:type :element,
>>   :attrs
>>   {:href
>>"
>> https://attack.mitre.org/versions/v9/techniques/enterprise/"},
>>   :tag :a,
>>   :content ["ATT for Enterprise"]}
>>  " for  referenced threat actor tactics and for
>> techniques."]}]}
>>  "\n\n"
>>  {:type :element,
>>   :attrs nil,
>>   :tag :p,
>>   :content
>>   ["This joint advisory is the result of analytic efforts
>> between the Federal Bureau of Investigation (FBI), United States Coast
>> Guard Cyber Command (CGCYBER), and the Cybersecurity and Infrastructure
>> Security Agency (CISA) to highlight the cyber threat associated with active
>> exploitation of a newly identified vulnerability (CVE-2021-40539) in
>> ManageEngine ADSelfService Plus—a self-service password management and
>> single sign-on solution."]}
>>  "\n\n"
>>  {:type :element,
>>   :attrs nil,
>>   :tag :p,
>>   :content
>>   ["CVE-2021-40539, rated critical by the Common
>> Vulnerability Scoring System (CVSS), is an authentication bypass
>> vulnerability affecting representational state transfer (REST) application
>> programming interface (API) URLs that could enable remote code execution.
>> The FBI, CISA, and CGCYBER assess that advanced persistent threat (APT)
>> cyber actors are likely among those exploiting the vulnerability. The
>> exploitation of ManageEngine ADSelfService Plus poses a serious risk to
>> critical infrastructure companies, U.S.-cleared defense contractors,
>> academic institutions, and other entities that use the software. Successful
>> exploitation of the vulnerability allows an attacker to place webshells,
>> which enable the adversary to conduct post-exploitation activities, such as
>> compromising administrator credentials, conducting lateral movement, and
>> exfiltrating registry hives and Active Directory files."]}
>>  "\n\n"
>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/clojure/5f2bd2a4-5c35-463b-9cb4-eecb9148fc89n%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to 

Re: common ways to run regex against either Hickory HTML or zippers?

2022-02-02 Thread Mark Nutter
I don't know how common it is, but have you looked at the `tree-seq`
function in Clojure? This seems like a good use case for it.

Mark

On Wed, Feb 2, 2022 at 3:22 PM lawrence...@gmail.com <
lawrence.krub...@gmail.com> wrote:

> Assume I've been cursed to scrape HTML. If I convert the pages to Hickory
> I end up with a big mass of data which, sadly, lacks many "class" or "id"s
> that would let me easily pick out the data I need. However, for the most
> part, the only thing I really need off this page is the CVEs, which look
> like this:
>
> CVE-2021-40539
>
> I'm thinking I might write regex against the plain text of the page, but
> I'm also curious, is it common to take something like Hiccup or Hickory or
> a zipper and run regex through it? If yes, how is that done?
>
> A small part of the data looks like this:
>
> :content
> [{:type :element,
>   :attrs
>   {:class "tip-intro", :style "font-size: 15px;"},
>   :tag :p,
>   :content
>   [{:type :element,
> :attrs nil,
> :tag :em,
> :content
> ["This Joint Cybersecurity Advisory uses the MITRE
> Adversarial Tactics, Techniques, and Common Knowledge (ATT®) framework,
> Version 8. See the "
>  {:type :element,
>   :attrs
>   {:href
>"
> https://attack.mitre.org/versions/v9/techniques/enterprise/"},
>   :tag :a,
>   :content ["ATT for Enterprise"]}
>  " for  referenced threat actor tactics and for
> techniques."]}]}
>  "\n\n"
>  {:type :element,
>   :attrs nil,
>   :tag :p,
>   :content
>   ["This joint advisory is the result of analytic efforts
> between the Federal Bureau of Investigation (FBI), United States Coast
> Guard Cyber Command (CGCYBER), and the Cybersecurity and Infrastructure
> Security Agency (CISA) to highlight the cyber threat associated with active
> exploitation of a newly identified vulnerability (CVE-2021-40539) in
> ManageEngine ADSelfService Plus—a self-service password management and
> single sign-on solution."]}
>  "\n\n"
>  {:type :element,
>   :attrs nil,
>   :tag :p,
>   :content
>   ["CVE-2021-40539, rated critical by the Common
> Vulnerability Scoring System (CVSS), is an authentication bypass
> vulnerability affecting representational state transfer (REST) application
> programming interface (API) URLs that could enable remote code execution.
> The FBI, CISA, and CGCYBER assess that advanced persistent threat (APT)
> cyber actors are likely among those exploiting the vulnerability. The
> exploitation of ManageEngine ADSelfService Plus poses a serious risk to
> critical infrastructure companies, U.S.-cleared defense contractors,
> academic institutions, and other entities that use the software. Successful
> exploitation of the vulnerability allows an attacker to place webshells,
> which enable the adversary to conduct post-exploitation activities, such as
> compromising administrator credentials, conducting lateral movement, and
> exfiltrating registry hives and Active Directory files."]}
>  "\n\n"
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/5f2bd2a4-5c35-463b-9cb4-eecb9148fc89n%40googlegroups.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 

Re: How to suppress warnings about namespace replacements?

2022-02-02 Thread Laws
Thank you.

On Tuesday, February 1, 2022 at 6:44:50 PM UTC-5 Alex Miller wrote:

> Most likely a newer version of this library exists that addresses these 
> warnings. In this particular case, the issue was fixed in June 2016 as of 
> tools.analyzer version 0.6.9.
>
> In a namespace with this issue, you can address like this:
>
> (ns whatever
>   (:refer-clojure :exclude [boolean?]))
>
> But you can't really do that from outside the namespace or suppress this 
> warning otherwise.
>
> Alex
>
>
> On Tuesday, February 1, 2022 at 11:22:28 AM UTC-6 Laws wrote:
>
>> I get a lot of warnings like this:
>>
>> WARNING: boolean? already refers to: #'clojure.core/boolean? in 
>> namespace: clojure.tools.analyzer.utils, being replaced by: 
>> #'clojure.tools.analyzer.utils/boolean?
>>
>>
>> Is there an official way to acknowledge that I'm aware of this namespace 
>> issue, such that the warnings disappear? 
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/fc115dbb-8153-4547-9061-aed3ec81bf02n%40googlegroups.com.


Re: How to suppress warnings about namespace replacements?

2022-02-01 Thread 'Alex Miller' via Clojure
Most likely a newer version of this library exists that addresses these 
warnings. In this particular case, the issue was fixed in June 2016 as of 
tools.analyzer version 0.6.9.

In a namespace with this issue, you can address like this:

(ns whatever
  (:refer-clojure :exclude [boolean?]))

But you can't really do that from outside the namespace or suppress this 
warning otherwise.

Alex


On Tuesday, February 1, 2022 at 11:22:28 AM UTC-6 Laws wrote:

> I get a lot of warnings like this:
>
> WARNING: boolean? already refers to: #'clojure.core/boolean? in namespace: 
> clojure.tools.analyzer.utils, being replaced by: 
> #'clojure.tools.analyzer.utils/boolean?
>
>
> Is there an official way to acknowledge that I'm aware of this namespace 
> issue, such that the warnings disappear? 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/8ae0ad15-006f-4875-a9d3-425b367e6681n%40googlegroups.com.


Re: visual-tools group -- meeting 1

2022-01-26 Thread Daniel Slutsky
Please note the time change for the meeting.

On Tuesday, 25 January 2022 at 11:59:01 UTC+2 Daniel Slutsky wrote:

> Recently we discussed 
>  the 
> idea to organize a group that would collaborate on tooling for literate 
> programming and data visualization /exploration.
>
> Following that discussion and the responses to the survey 
> ,
>  
> we are organizing the first meeting of that group.
>
> It will be a casual first meeting to feel out a direction and desired 
> timings.
>
> https://clojureverse.org/t/visual-tools-group-meeting-1/
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/5c6e42bb-e79d-426e-99cf-f76438acb4bdn%40googlegroups.com.


Re: Python dataclass equivalent

2022-01-21 Thread Kovas Palunas
Thanks for the detailed response!  I like the idea of using destructuring
to be more specific about what data a function expects.  I also think the
pre/post conditions with spec would mostly solve my problem. I think I'm
still getting used to spec's syntax, which feels fairly verbose to me when
defining nested structures.  But maybe it will make more sense with time.

BTW, I posted this question at
https://www.reddit.com/r/Clojure/comments/s90udy/python_dataclass_equivalent/
as well, where it has sparked a good deal of discussion.

On Thu, Jan 20, 2022 at 9:39 PM James Reeves 
wrote:

> Type hints in Clojure have a different purpose to those in Python. In
> Clojure, type hints are only a mechanism to avoid reflection; their use is
> solely to improve performance.
>
> So the question "Can I use spec as a type hint?" is actually asking "Will
> the compiler use specs to avoid reflection?", to which the answer is no.
> However Spec, and other equivalent libraries, can be used for runtime type
> checking in Clojure.
>
> Where you'd use a dataclass in Python, you'd generally use a map in
> Clojure. This requires a little explanation because of the different ways
> Clojure and Python support data modelling.
>
> Suppose Python you have a dataclass:
>
> @dataclassclass InventoryItem:
> name: str
> unit_price: float
> quantity_on_hand: int = 0
>
> def total_cost(self) -> float:
> return self.unit_price * self.quantity_on_hand
>
>
> Then the *minimal* equivalent Clojure code is simply:
>
> (defn total-cost [{:keys [unit-price quantity-on-hand]}]
>   (* unit-price quantity-on-hand))
>
> The Clojure example lacks explicit type checking, but that may not be
> necessary. In Clojure, we can incrementally add more specific checks as
> necessary. For example, we could add a precondition to check the inputs:
>
> (defn total-cost [{:keys [unit-price quantity-on-hand]}]
>   {:pre [(float? unit-price) (int? quantity-on-hand)]}
>   (* unit-price quantity-on-hand))
>
> Clojure spec allows checks to be taken further, with the caveat that
> keywords must be namespaced. Spec is more granular than classes, as it's
> interested in single key/value pairs, rather than grouped properties as in
> a class or struct. With spec, we might declare:
>
> (s/def :inventory.item/name string?)
> (s/def :inventory.item/unit-price float?)
> (s/def :inventory.item/quantity-on-hand int?)
>
> (defn total-cost [{:inventory.item/keys [unit-price quantity-on-hand]}]
>   (* unit-price quantity-on-hand))
>
> This doesn't automatically perform type checks, as they may not be
> necessary. We can add type checks to a function with
> *clojure.spec.test.alpha/instrument*, or add them as a precondition using
> *clojure.spec.alpha/valid?*.
>
> The validation required depends on the origin of the data. Suppose the
> inventory item comes from a database with its own schema. In which case, we
> may be reasonably certain that the types are correct and there's no need
> for additional confirmation.
>
> Or suppose instead that we read the inventory item from an external source
> we may not trust. In that case, we'd want to validate it as input, and
> reject it if the data is invalid. But after we've validated it, we can pass
> it around internally without further checks.
>
> Perhaps we're worried instead about human error. In this case, we might
> turn on checking during development and testing, but remove it during
> production when we're more interested in performance. This is the broad
> use-case for Spec's *instrument* function.
>
> Clojure's takes a more nuanced, and possibly unique approach to data,
> compared to other languages. Understanding how Clojure views data is
> understanding Clojure as a language.
>
> On Fri, 21 Jan 2022, at 3:22 AM, Kovas Palunas wrote:
>
> Hi all,
>
> Coming from python, I use dataclasses
>  a lot to tie complex
> collections of data together. I like using them in combination with type
> hints so that it's clearer to me at a glance what kind of data a function
> is processing.  When my data starts to look like a dict of dicts of lists,
> I turn to dataclasses to help my simplify.
>
> So far in my Clojure journey, I've stumbled across two features that could
> help me do something similar.  First are datatypes
>  (deftype, defrecord), and
> second is using maps with spec .  Based
> on my reading, using spec to define types seems like a really flexible
> system that does built in testing for me.  I was surprised to read that
> specs can't quite be treated like types though:
> https://ask.clojure.org/index.php/10464/can-i-use-spec-as-type-hint.
> Maybe the intention is to use the :pre and :post keys in a function's
> options as type hints?
>
> I'm curious if I'm thinking along the right lines here, or if there are
> other language features I could be looking at.  Also curious if anyone has
> 

Re: Python dataclass equivalent

2022-01-20 Thread James Reeves
Type hints in Clojure have a different purpose to those in Python. In Clojure, 
type hints are only a mechanism to avoid reflection; their use is solely to 
improve performance.

So the question "Can I use spec as a type hint?" is actually asking "Will the 
compiler use specs to avoid reflection?", to which the answer is no. However 
Spec, and other equivalent libraries, can be used for runtime type checking in 
Clojure.

Where you'd use a dataclass in Python, you'd generally use a map in Clojure. 
This requires a little explanation because of the different ways Clojure and 
Python support data modelling.

Suppose Python you have a dataclass:

@dataclass
class InventoryItem:
name: str
unit_price: float
quantity_on_hand: int = 0

def total_cost(self) -> float:
return self.unit_price * self.quantity_on_hand

Then the *minimal* equivalent Clojure code is simply:

(defn total-cost [{:keys [unit-price quantity-on-hand]}]
  (* unit-price quantity-on-hand))

The Clojure example lacks explicit type checking, but that may not be 
necessary. In Clojure, we can incrementally add more specific checks as 
necessary. For example, we could add a precondition to check the inputs:

(defn total-cost [{:keys [unit-price quantity-on-hand]}]
  {:pre [(float? unit-price) (int? quantity-on-hand)]}
  (* unit-price quantity-on-hand))

Clojure spec allows checks to be taken further, with the caveat that keywords 
must be namespaced. Spec is more granular than classes, as it's interested in 
single key/value pairs, rather than grouped properties as in a class or struct. 
With spec, we might declare:

(s/def :inventory.item/name string?)
(s/def :inventory.item/unit-price float?)
(s/def :inventory.item/quantity-on-hand int?)

(defn total-cost [{:inventory.item/keys [unit-price quantity-on-hand]}]
  (* unit-price quantity-on-hand))

This doesn't automatically perform type checks, as they may not be necessary. 
We can add type checks to a function with *clojure.spec.test.alpha/instrument*, 
or add them as a precondition using *clojure.spec.alpha/valid?*.

The validation required depends on the origin of the data. Suppose the 
inventory item comes from a database with its own schema. In which case, we may 
be reasonably certain that the types are correct and there's no need for 
additional confirmation.

Or suppose instead that we read the inventory item from an external source we 
may not trust. In that case, we'd want to validate it as input, and reject it 
if the data is invalid. But after we've validated it, we can pass it around 
internally without further checks.

Perhaps we're worried instead about human error. In this case, we might turn on 
checking during development and testing, but remove it during production when 
we're more interested in performance. This is the broad use-case for Spec's 
*instrument* function.

Clojure's takes a more nuanced, and possibly unique approach to data, compared 
to other languages. Understanding how Clojure views data is understanding 
Clojure as a language.

On Fri, 21 Jan 2022, at 3:22 AM, Kovas Palunas wrote:
> Hi all,
> 
> Coming from python, I use dataclasses 
>  a lot to tie complex 
> collections of data together. I like using them in combination with type 
> hints so that it's clearer to me at a glance what kind of data a function is 
> processing.  When my data starts to look like a dict of dicts of lists, I 
> turn to dataclasses to help my simplify.
> 
> So far in my Clojure journey, I've stumbled across two features that could 
> help me do something similar.  First are datatypes 
>  (deftype, defrecord), and second is 
> using maps with spec .  Based on my reading, 
> using spec to define types seems like a really flexible system that does 
> built in testing for me.  I was surprised to read that specs can't quite be 
> treated like types though: 
> https://ask.clojure.org/index.php/10464/can-i-use-spec-as-type-hint.  Maybe 
> the intention is to use the :pre and :post keys in a function's options as 
> type hints?
> 
> I'm curious if I'm thinking along the right lines here, or if there are other 
> language features I could be looking at.  Also curious if anyone has 
> suggestions for books or articles that explore data typing options in Clojure.
> 
> Thanks,
> 
>  - Kovas
> 
> 
> -- 
> 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 

Re: Clojure Devs Required!

2022-01-18 Thread muthui shere
Yes Interested!

On Monday, January 17, 2022 at 10:21:32 PM UTC+5:30 nancy...@gmail.com 
wrote:

> Hi Devs!
>
> I am looking for a developer to work remotely in Mexico, with nominal 
> scheme, fulltime and benefits above the law. Anyone interested?
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/a6589f35-afff-4e96-aab1-b8fddf3e3200n%40googlegroups.com.


Re: Ruby on Rails similar functionality for auto-generating an API?

2022-01-08 Thread Orestis Markou
Hi,

I’m not sure it’s a 100% match of what you want but https://coast.swlkr.com/ is 
a recent attempt at a full stack framework. Perhaps it will be useful. 

Best,
Orestis

> On 8 Jan 2022, at 6:27 AM, Laws  wrote:
> 
> In Ruby on Rails, given an existing database, it is very easy to 
> autogenerate much of the code needed to serve a simple RESTful API. Does the 
> Clojure ecosystem have anything like that? 
> -- 
> 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.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/clojure/383a6a55-7f11-439d-b8a0-cd09a61dee9fn%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/F482A944-46A7-4330-A211-5344E226CF0B%40orestis.gr.


Re: infinite loop print out of cyclic structure at repl

2022-01-01 Thread dieter.v...@gmail.com
I also notice that 
user> (((methods print-method) clojure.lang.Atom) (atom 5) *out*)
#atom[5 0x403721b8]nil
user> (atom 5)
#

and I could not reproduce the printing of '#' with any of 
(keys (methods print-method))...

On Saturday, January 1, 2022 at 10:25:28 AM UTC+1 dieter.v...@gmail.com 
wrote:

> Hello,
>
> I'm trying the proposed solution ('want unlimited depth, but want to avoid 
> printing the
> value of any reference object more than once'). But running into issues:
> - clojure.core/print-sequential appears to be private. Solved with (let 
> [printing-fn #'clojure.core/print-sequential]...
> - pr-on does not seem to exist anymore. I assume it functions just as 'pr' 
> but using a Writer of your own choosing
> - *iderefs* got to be ^:dynamic
>
> After that, the print-method for IDerefs can be compiled, but when testing 
> it on the provided example, I get an
> Execution error (StackOverflowError) at java.lang.ThreadLocal/get 
> (ThreadLocal.java:163).
> [#atom[
>
> It appears '[#atom[' printed out is a start of the print-method 
> implemented by cider.nrepl and I'm still searching in this direction.
> Is there an updated solution to this problem (print cyclic refs with 
> unlimited depth, but avoid printing the
> value of any reference object more than once)?
>
> kind regards,
> Dieter
>
> On Tuesday, October 1, 2013 at 8:57:56 PM UTC+2 Chouser wrote:
>
>> Bah, mutable state! To be cursed in all its forms! 
>>
>> Here is the same content as was at that paste.lisp.org link. I haven't 
>> tested it with recent versions of Clojure or anything: 
>>
>> https://gist.github.com/Chouser/6783292 
>>
>> --Chouser 
>>
>> On Tue, Oct 1, 2013 at 12:44 PM, Patrik Sundberg 
>>  wrote: 
>> > This paste seems gone - anyone has it available? 
>> > 
>> > I seem to get bitten by this kind of thing in emacs using nrepl and it 
>> > pretty printing something and it gets into an infinite loop locking up 
>> my 
>> > emacs session completely. Running the same from command line i can see 
>> same 
>> > behavior (seems related to protocols in my case, but haven't spent much 
>> time 
>> > on it(). Either way I'd love to work out a way to avoid the cycles and 
>> this 
>> > paste sounds good. 
>> > 
>> > 
>> > On Monday, January 18, 2010 10:21:52 PM UTC, Chouser wrote: 
>> >> 
>> >> > On Jan 18, 4:22 pm, Raoul Duke  wrote: 
>> >> >> hi, 
>> >> >> 
>> >> >> hmmm, i wish there were a way (or that it was the default) to tell 
>> the 
>> >> >> repl to not continue to loop for ever over things it has already 
>> >> >> "printed" out when i eval something that is a cyclic thing. anybody 
>> >> >> have a patch, or thought on this? 
>> >> 
>> >> On Mon, Jan 18, 2010 at 4:38 PM, Mark Hamstra  
>> wrote: 
>> >> > See *print-length* and *print-level* in the core API. 
>> >> 
>> >> Or if you want unlimited depth, but want to avoid printing the 
>> >> value of any reference object more than once, you can try this 
>> >> little thing I hacked together a while ago: 
>> >> 
>> >> http://paste.lisp.org/display/83647 
>> >> 
>> >> Note that it has to keep a reference to every IDeref object it 
>> >> sees while it's printing, in order to detect duplicates. 
>> >> 
>> >> --Chouser 
>> >> http://joyofclojure.com/ 
>> > 
>> > -- 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> > Groups "Clojure" group. 
>> > To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com. 
>> > For more options, visit https://groups.google.com/groups/opt_out. 
>>
>>
>>
>> -- 
>> --Chouser 
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/e5d844b1-9b09-4911-a448-3c403e0aae18n%40googlegroups.com.


Re: infinite loop print out of cyclic structure at repl

2022-01-01 Thread dieter.v...@gmail.com
Hello,

I'm trying the proposed solution ('want unlimited depth, but want to avoid 
printing the
value of any reference object more than once'). But running into issues:
- clojure.core/print-sequential appears to be private. Solved with (let 
[printing-fn #'clojure.core/print-sequential]...
- pr-on does not seem to exist anymore. I assume it functions just as 'pr' 
but using a Writer of your own choosing
- *iderefs* got to be ^:dynamic

After that, the print-method for IDerefs can be compiled, but when testing 
it on the provided example, I get an
Execution error (StackOverflowError) at java.lang.ThreadLocal/get 
(ThreadLocal.java:163).
[#atom[

It appears '[#atom[' printed out is a start of the print-method implemented 
by cider.nrepl and I'm still searching in this direction.
Is there an updated solution to this problem (print cyclic refs with 
unlimited depth, but avoid printing the
value of any reference object more than once)?

kind regards,
Dieter

On Tuesday, October 1, 2013 at 8:57:56 PM UTC+2 Chouser wrote:

> Bah, mutable state! To be cursed in all its forms!
>
> Here is the same content as was at that paste.lisp.org link. I haven't
> tested it with recent versions of Clojure or anything:
>
> https://gist.github.com/Chouser/6783292
>
> --Chouser
>
> On Tue, Oct 1, 2013 at 12:44 PM, Patrik Sundberg
>  wrote:
> > This paste seems gone - anyone has it available?
> >
> > I seem to get bitten by this kind of thing in emacs using nrepl and it
> > pretty printing something and it gets into an infinite loop locking up my
> > emacs session completely. Running the same from command line i can see 
> same
> > behavior (seems related to protocols in my case, but haven't spent much 
> time
> > on it(). Either way I'd love to work out a way to avoid the cycles and 
> this
> > paste sounds good.
> >
> >
> > On Monday, January 18, 2010 10:21:52 PM UTC, Chouser wrote:
> >>
> >> > On Jan 18, 4:22 pm, Raoul Duke  wrote:
> >> >> hi,
> >> >>
> >> >> hmmm, i wish there were a way (or that it was the default) to tell 
> the
> >> >> repl to not continue to loop for ever over things it has already
> >> >> "printed" out when i eval something that is a cyclic thing. anybody
> >> >> have a patch, or thought on this?
> >>
> >> On Mon, Jan 18, 2010 at 4:38 PM, Mark Hamstra  
> wrote:
> >> > See *print-length* and *print-level* in the core API.
> >>
> >> Or if you want unlimited depth, but want to avoid printing the
> >> value of any reference object more than once, you can try this
> >> little thing I hacked together a while ago:
> >>
> >> http://paste.lisp.org/display/83647
> >>
> >> Note that it has to keep a reference to every IDeref object it
> >> sees while it's printing, in order to detect duplicates.
> >>
> >> --Chouser
> >> http://joyofclojure.com/
> >
> > --
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
> -- 
> --Chouser
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/dbabb537-4557-47a3-9360-9aec93d4aef2n%40googlegroups.com.


Re: Pesky java interop bug with 0xFFFFFFF error in BuferredReader

2021-12-27 Thread Hank Lenzi
This is embarassing. ;-) 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/3a4fb35a-a282-4762-bf08-4f891447b7b9n%40googlegroups.com.


Re: Pesky java interop bug with 0xFFFFFFF error in BuferredReader

2021-12-27 Thread LaurentJ
Hank,

Your last version does not work because your `if` condition is wrong, your 
code stops on the first read ;)

Laurent

Le lundi 27 décembre 2021 à 21:34:05 UTC+1, hank@gmail.com a écrit :

> Ooops my bad, there's a typo in '(.toString sb1)' which sould be 'sb'.
> It doesn't change anything, it still won't work, only Laurent's version 
> works. 
>
> user> (defn pt%% [file]
>
> (let [afr (FileReader. file)
>  bfr (BufferedReader. afr)]
>(loop [x (.read bfr)
>   sb (StringBuilder.)]
>  (if (not (= x -1))
>  (.toString sb)
>  (recur  (.append sb (char x)) (.read bfr))
>
> #'user/pt%%
> user> (pt%% ribs)
> ""
>
> Which makes no sense to me...
> -- Hank
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/9252a765-a5ff-46d9-8c49-b9affb9d2651n%40googlegroups.com.


Re: Pesky java interop bug with 0xFFFFFFF error in BuferredReader

2021-12-27 Thread Hank Lenzi
Ooops my bad, there's a typo in '(.toString sb1)' which sould be 'sb'.
It doesn't change anything, it still won't work, only Laurent's version 
works. 

user> (defn pt%% [file]
(let [afr (FileReader. file)
 bfr (BufferedReader. afr)]
   (loop [x (.read bfr)
  sb (StringBuilder.)]
 (if (not (= x -1))
 (.toString sb)
 (recur  (.append sb (char x)) (.read bfr))

#'user/pt%%
user> (pt%% ribs)
""

Which makes no sense to me...
-- Hank

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/310d27b9-1f6e-4017-9465-14ee8c7a4e15n%40googlegroups.com.


Re: Pesky java interop bug with 0xFFFFFFF error in BuferredReader

2021-12-27 Thread Hank Lenzi
Hi --
Thanks so much, Laurent!
I was actually kind of close (you told me not to peep, so I didn't hehe).

(defn pt30 [file]
(def ^:dynamic *asb* (StringBuilder.))
(let [afr (FileReader. file) 
 bfr (BufferedReader. afr)]
   (loop [x (.read bfr)
  *asb* (StringBuilder.)]
 (when (not (= x -1))
 (recur (.read bfr) (.append *asb* (java.lang.Character/toChars 
x)))

with  (def ribs "/path/to/ribs.txt")

which looks similar. But, for some reason, the *asb* variable didn't 
populate with rib advertisements:

user> (pt30 ribs)
nil
user> *asb*
#object[java.lang.StringBuilder 0x29f4eb0c ""]

When I convert this practically to the same you did,
user> (defn pt34 [file]
(let [afr (FileReader. file) 
 bfr (BufferedReader. afr)]
   (loop [x (.read bfr)
  sb (StringBuilder.)]
 (if (not (= x -1))
 (.toString sb1)
   (recur (.read bfr) (.append sb (char x)))
#'user/pt34
user> (pt34 ribs)
""
I still get no beef (err, ribs). Doesn't print anything either. 

Weird. Just weird.

-- Hank

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/3c1312f9-619b-4056-a54d-d880fcf80cf4n%40googlegroups.com.


Re: What is this notation? "-a"

2021-12-27 Thread Hank Lenzi
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/d46da6c5-9409-4994-83eb-6cb13aefe7f7n%40googlegroups.com.


Re: What is this notation? "-a"

2021-12-26 Thread William la Forge
https://stackoverflow.com/questions/10846423/is-there-a-clojure-convention-for-naming-private-functions/10853372

On Saturday, December 25, 2021 at 6:53:56 PM UTC-5 hank@gmail.com wrote:

> Hello --
>
> Sometimes I see a notation that uses a prefix "-", as in:
>
> user> (def -a (atom []))
> #'user/-a
>
> Is there a special meaning/convention regarding this use of a hyphen 
> prefix?
> TIA
> -- Hank
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/dd81c045-f6a3-4c31-94ea-1f252e0fa86an%40googlegroups.com.


Re: Pesky java interop bug with 0xFFFFFFF error in BuferredReader

2021-12-26 Thread LaurentJ
Hank,

Just a message to give you the solution [spoiler alert]
Don't read it, if you still want to search :)






SPOILER












SPOILER





  ;; ugly version using the fact that java objects are mutable in place
  (defn ugly-read-chars-one-by-one
[reader]
(let [sb (StringBuilder.)]
  (loop []
(let [v (.read reader)]
  (if (neg? v)
(.toString sb)
(do (.append sb (char v))
  (recur)))


  ;; "better" version using loop bindings
  (defn read-chars-one-by-one
[reader]
(loop [sb (StringBuilder.)
  v (.read reader)]
  (if (neg? v)
(.toString sb)
(recur (.append sb (char v))
  (.read reader)


  ;; usage
  (require '[clojure.java.io :as io])
  (with-open [rdr (io/reader "some-file.txt")]
(read-chars-one-by-one rdr))



Regards,
Laurent
Le dimanche 26 décembre 2021 à 18:12:56 UTC+1, hank@gmail.com a écrit :

> Hi --
> Thanks for taking the time to help me.
> As far as I understand the examples, loop has this template:
>
> loop [binding]
>   (condition
>  (statement)
>  (recur (binding)))
> And in 'recur' the loop is re-executed with new bindings.
>
> There was indeed an issue with the 'recur' outside 'when'. Thanks for 
> pointing that out.
> I corrected that in the version below.
>
> I also changed to a smaller file (UTF-8 encoded in Linux), called 
> 'ribs.txt', with the following content:
>
> source/txt on  master [!?] 
> ❯ cat ribs.txt
> Try my delicious pork-chop ribs!
>
> source/txt on  master [!?] 
> ❯ cat ribs.hexdump 
> : 54 72 79 20 6d 79 20 64 65 6c 69 63 69 6f 75 73  Try my delicious
> 0010: 20 70 6f 72 6b 2d 63 68 6f 70 20 72 69 62 73 21   pork-chop ribs!
> 0020: 0a   .
>
>
> (defn pt8 [file]
>(let [afr (FileReader. file); instances of FileReader, BufferedReader, 
> StringBuffer
>  bfr (BufferedReader. afr)
>  ct (StringBuilder.)
>  this-list (list afr bfr ct)]
>  ; (apply println this-list)
>  ; put recur INSIDE THE WHEN
>  (loop [val (.read bfr)]
>(when (not (= val -1))
>  (.append ct (Character/toChars (.read bfr)))
>(recur [val (.read bfr)])))
> ; when finished...
> (.toString ct)))
>
> I think this fixed the 'recur', because it does rebinding to a new call to 
> "read()".
> However, the errors remains.
> 
> user> (pt8 ribs)
> Execution error (IllegalArgumentException) at java.lang.Character/toChars 
> (Character.java:8572).
> Not a valid Unicode code point: 0x
>
> The file used is sufficiently small so that we can walk the bytes using 
> jshell:
>
> jshell> FileReader afr = new FileReader("/home/hank/source/txt/ribs.txt/")
> afr ==> java.io.FileReader@1698c449
>
> jshell> BufferedReader bfr = new BufferedReader(afr)
> bfr ==> java.io.BufferedReader@5ef04b5
>
> jshell> StringBuilder ct = new StringBuilder()
> ct ==> 
>
> FileReader reads 2 bytes per character so, to get to the end, of the first 
> hexdump line, let's walk 32 bytes:
>
> jshell> for (int i=0; i < 31; i++) {
>...> if ((value = bfr.read()) != -1) { ct.append((char) value); }
>...> i++;
>...> }
>
> jshell> ct
> ct ==> Try my delicious
>
> : 54 72 79 20 6d 79 20 64 65 6c 69 63 69 6f 75 73  Try my delicious
>   T  r  y  SP m  y  SP d  e  l  i  c  i  o  u  s  (< YOU ARE 
> HERE)
>
> : 54 72 79 20 6d 79 20 64 65 6c 69 63 69 6f 75 73  Try my delicious
> 0010: 20 70 6f 72 6b 2d 63 68 6f 70 20 72 69 62 73 21   pork-chop ribs!
> 0020: 0a   .
>
> Now we iterate 31 more bytes, stopping short of the last character:
> jshell> for (int i=0; i < 30; i++) {
>...> if ((value = bfr.read()) != -1) { ct.append((char) value); }
>...> i++;
>...> }
>
> jshell> ct
> ct ==> Try my delicious pork-chop ribs
>
> : 54 72 79 20 6d 79 20 64 65 6c 69 63 69 6f 75 73  Try my delicious
> 0010: 20 70 6f 72 6b 2d 63 68 6f 70 20 72 69 62 73 21   pork-chop ribs!
> ^ we stopped here  
>
> We just advance one more:
>
> jshell> if ((value = bfr.read()) != -1) { ct.append((char) value); }
>...> 
>
> jshell> ct
> ct ==> Try my delicious pork-chop ribs!
>
> And one more time, to see if it borks:
> jshell> if ((value = bfr.read()) != -1) { ct.append((char) value); }
>
> jshell> ct
> ct ==&

Re: Pesky java interop bug with 0xFFFFFFF error in BuferredReader

2021-12-26 Thread LaurentJ
Hi Hank,

That loop/recur is still wrong because `loop` set bindings to define names 
and gives initial values but `recur` does *not set bindings*, it just 
provides new values.
So `recur` does not need a vector of bindings like `loop`

The pattern is as follow:
  (loop [a-local-var "initial-value"]
(if (should-stop-looping? a-local-var)
  (execute-last-expression a-local-var)
  (recur a-new-local-var)))

In your pt8 function, you are reading your stream to many times in a loop, 
if I write your pt8 function in procedural pseudo-code, this is what I get: 

bfr = input-stream()
ct = string-buffer()

set loop-start   // set loop point
with val,   // set loop args
val = read(bfr) // set args initial value, first read

if !(val == -1) {
ct.append(char(read(bfr)))  // read again! and lose previous byte!!
goto loop-start
 with val = vector(val, read(bfr))  // read again! this byte will 
be lost soon :(
}
ct.toString()


Regards,
Laurent


Le dimanche 26 décembre 2021 à 18:12:56 UTC+1, hank@gmail.com a écrit :

> Hi --
> Thanks for taking the time to help me.
> As far as I understand the examples, loop has this template:
>
> loop [binding]
>   (condition
>  (statement)
>  (recur (binding)))
> And in 'recur' the loop is re-executed with new bindings.
>
> There was indeed an issue with the 'recur' outside 'when'. Thanks for 
> pointing that out.
> I corrected that in the version below.
>
> I also changed to a smaller file (UTF-8 encoded in Linux), called 
> 'ribs.txt', with the following content:
>
> source/txt on  master [!?] 
> ❯ cat ribs.txt
> Try my delicious pork-chop ribs!
>
> source/txt on  master [!?] 
> ❯ cat ribs.hexdump 
> : 54 72 79 20 6d 79 20 64 65 6c 69 63 69 6f 75 73  Try my delicious
> 0010: 20 70 6f 72 6b 2d 63 68 6f 70 20 72 69 62 73 21   pork-chop ribs!
> 0020: 0a   .
>
>
> (defn pt8 [file]
>(let [afr (FileReader. file); instances of FileReader, BufferedReader, 
> StringBuffer
>  bfr (BufferedReader. afr)
>  ct (StringBuilder.)
>  this-list (list afr bfr ct)]
>  ; (apply println this-list)
>  ; put recur INSIDE THE WHEN
>  (loop [val (.read bfr)]
>(when (not (= val -1))
>  (.append ct (Character/toChars (.read bfr)))
>(recur [val (.read bfr)])))
> ; when finished...
> (.toString ct)))
>
> I think this fixed the 'recur', because it does rebinding to a new call to 
> "read()".
> However, the errors remains.
> 
> user> (pt8 ribs)
> Execution error (IllegalArgumentException) at java.lang.Character/toChars 
> (Character.java:8572).
> Not a valid Unicode code point: 0x
>
> The file used is sufficiently small so that we can walk the bytes using 
> jshell:
>
> jshell> FileReader afr = new FileReader("/home/hank/source/txt/ribs.txt/")
> afr ==> java.io.FileReader@1698c449
>
> jshell> BufferedReader bfr = new BufferedReader(afr)
> bfr ==> java.io.BufferedReader@5ef04b5
>
> jshell> StringBuilder ct = new StringBuilder()
> ct ==> 
>
> FileReader reads 2 bytes per character so, to get to the end, of the first 
> hexdump line, let's walk 32 bytes:
>
> jshell> for (int i=0; i < 31; i++) {
>...> if ((value = bfr.read()) != -1) { ct.append((char) value); }
>...> i++;
>...> }
>
> jshell> ct
> ct ==> Try my delicious
>
> : 54 72 79 20 6d 79 20 64 65 6c 69 63 69 6f 75 73  Try my delicious
>   T  r  y  SP m  y  SP d  e  l  i  c  i  o  u  s  (< YOU ARE 
> HERE)
>
> : 54 72 79 20 6d 79 20 64 65 6c 69 63 69 6f 75 73  Try my delicious
> 0010: 20 70 6f 72 6b 2d 63 68 6f 70 20 72 69 62 73 21   pork-chop ribs!
> 0020: 0a   .
>
> Now we iterate 31 more bytes, stopping short of the last character:
> jshell> for (int i=0; i < 30; i++) {
>...> if ((value = bfr.read()) != -1) { ct.append((char) value); }
>...> i++;
>...> }
>
> jshell> ct
> ct ==> Try my delicious pork-chop ribs
>
> : 54 72 79 20 6d 79 20 64 65 6c 69 63 69 6f 75 73  Try my delicious
> 0010: 20 70 6f 72 6b 2d 63 68 6f 70 20 72 69 62 73 21   pork-chop ribs!
> ^ we stopped here  
>
> We just advance one more:
>
> jshell> if ((value = bfr.read()) != -1) { ct.append((char) value); }
>...> 
>
> jshell> ct
> ct ==> Try my delicious pork-chop ribs!
>
> And one more time, to see if it borks:
> jshell> 

Re: Pesky java interop bug with 0xFFFFFFF error in BuferredReader

2021-12-26 Thread Hank Lenzi
Hi --
Thanks for taking the time to help me.
As far as I understand the examples, loop has this template:

loop [binding]
  (condition
 (statement)
 (recur (binding)))
And in 'recur' the loop is re-executed with new bindings.

There was indeed an issue with the 'recur' outside 'when'. Thanks for 
pointing that out.
I corrected that in the version below.

I also changed to a smaller file (UTF-8 encoded in Linux), called 
'ribs.txt', with the following content:

source/txt on  master [!?] 
❯ cat ribs.txt
Try my delicious pork-chop ribs!

source/txt on  master [!?] 
❯ cat ribs.hexdump 
: 54 72 79 20 6d 79 20 64 65 6c 69 63 69 6f 75 73  Try my delicious
0010: 20 70 6f 72 6b 2d 63 68 6f 70 20 72 69 62 73 21   pork-chop ribs!
0020: 0a   .


(defn pt8 [file]
   (let [afr (FileReader. file); instances of FileReader, BufferedReader, 
StringBuffer
 bfr (BufferedReader. afr)
 ct (StringBuilder.)
 this-list (list afr bfr ct)]
 ; (apply println this-list)
 ; put recur INSIDE THE WHEN
 (loop [val (.read bfr)]
   (when (not (= val -1))
 (.append ct (Character/toChars (.read bfr)))
   (recur [val (.read bfr)])))
; when finished...
(.toString ct)))

I think this fixed the 'recur', because it does rebinding to a new call to 
"read()".
However, the errors remains.

user> (pt8 ribs)
Execution error (IllegalArgumentException) at java.lang.Character/toChars 
(Character.java:8572).
Not a valid Unicode code point: 0x

The file used is sufficiently small so that we can walk the bytes using 
jshell:

jshell> FileReader afr = new FileReader("/home/hank/source/txt/ribs.txt/")
afr ==> java.io.FileReader@1698c449

jshell> BufferedReader bfr = new BufferedReader(afr)
bfr ==> java.io.BufferedReader@5ef04b5

jshell> StringBuilder ct = new StringBuilder()
ct ==> 

FileReader reads 2 bytes per character so, to get to the end, of the first 
hexdump line, let's walk 32 bytes:

jshell> for (int i=0; i < 31; i++) {
   ...> if ((value = bfr.read()) != -1) { ct.append((char) value); }
   ...> i++;
   ...> }

jshell> ct
ct ==> Try my delicious

: 54 72 79 20 6d 79 20 64 65 6c 69 63 69 6f 75 73  Try my delicious
  T  r  y  SP m  y  SP d  e  l  i  c  i  o  u  s  (< YOU ARE 
HERE)

: 54 72 79 20 6d 79 20 64 65 6c 69 63 69 6f 75 73  Try my delicious
0010: 20 70 6f 72 6b 2d 63 68 6f 70 20 72 69 62 73 21   pork-chop ribs!
0020: 0a   .

Now we iterate 31 more bytes, stopping short of the last character:
jshell> for (int i=0; i < 30; i++) {
   ...> if ((value = bfr.read()) != -1) { ct.append((char) value); }
   ...> i++;
   ...> }

jshell> ct
ct ==> Try my delicious pork-chop ribs

: 54 72 79 20 6d 79 20 64 65 6c 69 63 69 6f 75 73  Try my delicious
0010: 20 70 6f 72 6b 2d 63 68 6f 70 20 72 69 62 73 21   pork-chop ribs!
^ we stopped here  

We just advance one more:

jshell> if ((value = bfr.read()) != -1) { ct.append((char) value); }
   ...> 

jshell> ct
ct ==> Try my delicious pork-chop ribs!

And one more time, to see if it borks:
jshell> if ((value = bfr.read()) != -1) { ct.append((char) value); }

jshell> ct
ct ==> Try my delicious pork-chop ribs!

Nope, everything looks fine. Now where does that '0xFFF" come from?!
-- Hank

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/d3510982-bcaa-43c2-9461-aaae7be11f49n%40googlegroups.com.


Re: Pesky java interop bug with 0xFFFFFFF error in BuferredReader

2021-12-26 Thread LaurentJ
Hank

Your loop/recur in your pt5 function is still not good. Take the time to 
read the loop/recur documentation and to understand examples.

A Clojure loop/recur is not really a loop like in other procedural 
languages.
It is more akin to a new function call at the `loop` point with new args 
provided by the `recur` call.

If you continue with the function call metaphor
The `loop` call defines 3 things:
  - the starting point of the function
  - the argument name of the function
  - the **initial values** of those arguments

When you need to call again that function with new arguments, you use 
`recur` with **new values**.
When you don't need to recur, well... dont call `recur` :) and just 
evaluate a last expression which is the result of the `loop` expression.

regards
Laurent


Le dimanche 26 décembre 2021 à 02:35:47 UTC+1, hank@gmail.com a écrit :

> Thank for the answers.
> Trying to recur with '(recur (.read bfr))' resulted in a:
> Syntax error (UnsupportedOperationException) compiling recur at 
> (*cider-repl ~:localhost:41097(clj)*:237:9).
> Can only recur from tail position
> So I changed the code (see below). 
>
> And now it complains that a previous form that was working '(.append 
> etc..') doesn't and the same error remains. 
>
> user> (pt5 myfile)
>
> Execution error (IllegalArgumentException) at java.lang.Character/toChars 
> (Character.java:8572).
> Not a valid Unicode code point: 0x
>
> (defn pt5 [file]
>
>(let [afr (FileReader. file); instances of FileReader, BufferedReader, 
> StringBuffer
>  bfr (BufferedReader. afr)
>  ct (StringBuilder.)
>  this-list (list afr bfr ct)]
>  ; (apply println this-list)
>  (loop [val (.read bfr)]
>(when (not (= val -1))
>  (.append ct (Character/toChars (.read bfr
>(recur val))
> ; when finished...
> (.toString ct)))
>
> Harder then it seemed at first sight...
> -- Hank
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/66318891-e779-4a3c-818c-a235f7b32550n%40googlegroups.com.


Re: Pesky java interop bug with 0xFFFFFFF error in BuferredReader

2021-12-26 Thread LaurentJ
Hi,

In the quoted example the `recur` call is *inside* the `when` which is a 
huge difference because there is in this case an halting condition to get 
out of the loop ;)

regards
Laurent
Le dimanche 26 décembre 2021 à 14:41:15 UTC+1, hank@gmail.com a écrit :

> 2021-12-25, 21:11:46 UTC-3, LaurentJ wrote:
> "Hi,
>
> Your loop/recur usage is wrong, your error may be because your loop has no 
> halting condition."
>
> Hi Laurent --
> I actually took inspiration from one of the sources you posted:
> (import '(javax.sound.sampled AudioSystem AudioFormat$Encoding))
>
> (let [mp3-file (java.io.File. "tryout.mp3")
>   audio-in (AudioSystem/getAudioInputStream mp3-file)
>   audio-decoded-in (AudioSystem/getAudioInputStream 
> AudioFormat$Encoding/PCM_SIGNED audio-in)
>   buffer (make-array Byte/TYPE 1024)]
>   (loop []
> (let [size (.read audio-decoded-in buffer)]
>   (when (> size 0)
> ;do something with PCM data
> (recur)
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/93ed9e36-bd43-4592-b5c3-89187304d75cn%40googlegroups.com.


Re: Pesky java interop bug with 0xFFFFFFF error in BuferredReader

2021-12-26 Thread Hank Lenzi
2021-12-25, 21:11:46 UTC-3, LaurentJ wrote:
"Hi,

Your loop/recur usage is wrong, your error may be because your loop has no 
halting condition."

Hi Laurent --
I actually took inspiration from one of the sources you posted:
(import '(javax.sound.sampled AudioSystem AudioFormat$Encoding))

(let [mp3-file (java.io.File. "tryout.mp3")
  audio-in (AudioSystem/getAudioInputStream mp3-file)
  audio-decoded-in (AudioSystem/getAudioInputStream 
AudioFormat$Encoding/PCM_SIGNED audio-in)
  buffer (make-array Byte/TYPE 1024)]
  (loop []
(let [size (.read audio-decoded-in buffer)]
  (when (> size 0)
;do something with PCM data
(recur)


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/c293ceb0-d187-41f9-b0a4-68860cb55bd2n%40googlegroups.com.


Re: Pesky java interop bug with 0xFFFFFFF error in BuferredReader

2021-12-26 Thread Hank Lenzi
Thanks, Harold.
You see, that was an exercise in Java interop - I know about slurp, but I 
was trying to understand what was going on there.
-- Hank

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/dc222f28-0f21-4f02-b79c-1d0f4db4f95bn%40googlegroups.com.


Re: Pesky java interop bug with 0xFFFFFFF error in BuferredReader

2021-12-25 Thread Harold
Hank,

Welcome. Great efforts- it certainly seems like you're learning a lot, and 
quickly.

`clojure.core/slurp` is related, in case you haven't seen it 
yet: https://clojuredocs.org/clojure.core/slurp

The implementation may also be 
enlightening: 
https://github.com/clojure/clojure/blob/clojure-1.10.3/src/clj/clojure/core.clj#L6944-L6954

It's natural when coming from non-functional languages to write `loop`-y 
code like you did, and while it's neat that Clojure enables writing code in 
that style (essential, actually, to the stated goal of pragmatism), it's 
not always helpful. In this case, the implementation of `slurp` also 
interops with Java to produce strings, but does so at a more helpful level 
of abstraction.

I'll also note here that the https://ask.clojure.org/ site may be more fun 
for these types of discussions than the mailing list- though getting help 
anywhere (there are quite a few places actually) is of course fine.

Best of luck, and warm wishes,
-Harold

On Saturday, December 25, 2021 at 6:35:47 PM UTC-7 hank@gmail.com wrote:

> Thank for the answers.
> Trying to recur with '(recur (.read bfr))' resulted in a:
> Syntax error (UnsupportedOperationException) compiling recur at 
> (*cider-repl ~:localhost:41097(clj)*:237:9).
> Can only recur from tail position
> So I changed the code (see below). 
>
> And now it complains that a previous form that was working '(.append 
> etc..') doesn't and the same error remains. 
>
> user> (pt5 myfile)
>
> Execution error (IllegalArgumentException) at java.lang.Character/toChars 
> (Character.java:8572).
> Not a valid Unicode code point: 0x
>
> (defn pt5 [file]
>
>(let [afr (FileReader. file); instances of FileReader, BufferedReader, 
> StringBuffer
>  bfr (BufferedReader. afr)
>  ct (StringBuilder.)
>  this-list (list afr bfr ct)]
>  ; (apply println this-list)
>  (loop [val (.read bfr)]
>(when (not (= val -1))
>  (.append ct (Character/toChars (.read bfr
>(recur val))
> ; when finished...
> (.toString ct)))
>
> Harder then it seemed at first sight...
> -- Hank
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/87069aee-1320-4774-b214-bae29e0062f3n%40googlegroups.com.


Re: Pesky java interop bug with 0xFFFFFFF error in BuferredReader

2021-12-25 Thread Hank Lenzi
Thank for the answers.
Trying to recur with '(recur (.read bfr))' resulted in a:
Syntax error (UnsupportedOperationException) compiling recur at 
(*cider-repl ~:localhost:41097(clj)*:237:9).
Can only recur from tail position
So I changed the code (see below). 

And now it complains that a previous form that was working '(.append 
etc..') doesn't and the same error remains. 

user> (pt5 myfile)
Execution error (IllegalArgumentException) at java.lang.Character/toChars 
(Character.java:8572).
Not a valid Unicode code point: 0x

(defn pt5 [file]
   (let [afr (FileReader. file); instances of FileReader, BufferedReader, 
StringBuffer
 bfr (BufferedReader. afr)
 ct (StringBuilder.)
 this-list (list afr bfr ct)]
 ; (apply println this-list)
 (loop [val (.read bfr)]
   (when (not (= val -1))
 (.append ct (Character/toChars (.read bfr
   (recur val))
; when finished...
(.toString ct)))

Harder then it seemed at first sight...
-- Hank


-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/17bab821-c47d-4791-b3ad-c56df51757a1n%40googlegroups.com.


Re: Pesky java interop bug with 0xFFFFFFF error in BuferredReader

2021-12-25 Thread Mark Nutter
I think at least part of the problem is your use of val in the let
statement. Inside the loop, you're testing (not (= val -1)),  but val is an
immutable value defined above the loop as being the first character read
from the buffer, so it will always loop until it reads in the 0xFFF
that makes it crash. You probably want to modify your loop like this:

(loop [val (.read bfr)]
  (when (not (= val -1))
(.append ct (Character/toChars val)))
(recur (.read bfr))

Now this re-assigns the next character from the buffer to val each time you
go through the loop.

I'm not a guru when it comes to Java interop, but I think the above is the
main problem you're having right now, so hopefully that will get you back
on track.


On Sat, Dec 25, 2021 at 2:23 PM Hank Lenzi  wrote:

>
> Hello --
>
> I'm learning Clojure and its Java interop stuff. I am trying to emulate
> this function:
>
>  public String readAllCharsOneByOne(BufferedReader bufferedReader) throws
> IOException {
> StringBuilder content = new StringBuilder();
>
> int value;
> while ((value = bufferedReader.read()) != -1) {
> content.append((char) value);
> }
>
> return content.toString();
> }
>
>
> So far, I've been able to reason that the parts I need are:
>
>
> (def myfile "/path/to/svenska_sample.txt")
> (import java.io.BufferedReader)
> (import java.io.FileReader)
> (import java.lang.StringBuilder)
> (import java.lang.Character)
>
> (def a-FileReader (FileReader. myfile))
> (def bufferedReader (BufferedReader. a-FileReader))
> (def content (StringBuilder.))
>
> which works
>
> user> (.append content (Character/toChars (.read bufferedReader)))
> #object[java.lang.StringBuilder 0x490447d0 "\nDe"]
> user> (.append content (Character/toChars (.read bufferedReader)))
> #object[java.lang.StringBuilder 0x490447d0 "\nDen"]
> user> (.append content (Character/toChars (.read bufferedReader)))
> #object[java.lang.StringBuilder 0x490447d0 "\nDen "]
> user> (.append content (Character/toChars (.read bufferedReader)))
> #object[java.lang.StringBuilder 0x490447d0 "\nDen t"]
> user> (.append content (Character/toChars (.read bufferedReader)))
> #object[java.lang.StringBuilder 0x490447d0 "\nDen ty"]
> user> (.append content (Character/toChars (.read bufferedReader)))
> #object[java.lang.StringBuilder 0x490447d0 "\nDen typ"]
> user> (.append content (Character/toChars (.read bufferedReader)))
> #object[java.lang.StringBuilder 0x490447d0 "\nDen typi"]
>
> The file is a small text file UTF-8 encoded in Linux with the following
> content:
>
> ❯ cat svenska_sample.txt
>
> Den typiska impulsiva olycksfågeln är en ung man som kraschar flera bilar,
> och ofta skryter lite med det, i varje fall när han är tillsammans med sina
> vänner._. För dem har otur i det närmaste blivit en livsstil, och de råkar
> konstant ut för olyckor, stora som små. Olycksfåglar kallar vi dem. Hur
> många det finns kan ingen med säkerhet säga, för det finns inga konkreta
> definitioner på denna grupp, och heller ingen given avgränsning av den. Att
> de finns, råder det emellertid ingen tvekan om, varken på sjukhusens
> akutmottagningar eller i försäkringsbranschen
>
> I wrote a function, with my brand new Clojure Java interop chops, that
> looks like this:
>
> ;; COMPILES  - BUT CAN'T GET AROUND THE 0XFFF BUG
> (defn pt%% [file]
>(let [afr (FileReader. file); instances of FileReader, BufferedReader,
> StringBuffer
>  bfr (BufferedReader. afr)
>  ct (StringBuilder.)
>  val (.read bfr)
>  this-list (list afr bfr ct)]
>  ; (apply println this-list)
>  (loop []
>(when (not (= val -1))
>  (.append ct (Character/toChars (.read bfr
>(recur))
> ; when finished...
>  (.toString ct)))
>
> but it borks with the following error:
>
> user> (pt%% myfile)
> Execution error (IllegalArgumentException) at java.lang.Character/toChars
> (Character.java:8572).
> Not a valid Unicode code point: 0x
>
> What in the world could be causing this (NOTE: I am not a Java
> programmer)?
> Here is the hex dump of the file text file:
>
> ❯ cat svenska_sample.hexdump
> : 0a44 656e 2074 7970 6973 6b61 2069 6d70  .Den typiska imp
> 0010: 756c 7369 7661 206f 6c79 636b 7366 c3a5  ulsiva olycksf..
> 0020: 6765 6c6e 20c3 a472 2065 6e20 756e 6720  geln ..r en ung
> 0030: 6d61 6e20 736f 6d20 6b72 6173 6368 6172  man som kraschar
> 0040: 2066 6c65 7261 2062 696c 6172 2c20 6f63   flera bilar, oc
> 0050: 6820 6f66 7461 2073 6b72 7974 6572 206c  h o

Re: Pesky java interop bug with 0xFFFFFFF error in BuferredReader

2021-12-25 Thread LaurentJ
Hi,

Your loop/recur usage is wrong, your error may be because your loop has no 
halting condition.

https://clojure.org/reference/special_forms#loop
https://clojuredocs.org/clojure.core/loop

Regards
Laurent

Le samedi 25 décembre 2021 à 20:23:37 UTC+1, hank@gmail.com a écrit :

>
> Hello --
>
> I'm learning Clojure and its Java interop stuff. I am trying to emulate 
> this function:
>
>  public String readAllCharsOneByOne(BufferedReader bufferedReader) throws 
> IOException {
> StringBuilder content = new StringBuilder();
> 
> int value;
> while ((value = bufferedReader.read()) != -1) {
> content.append((char) value);
> }
> 
> return content.toString();
> }
>
>
> So far, I've been able to reason that the parts I need are:
>
>
> (def myfile "/path/to/svenska_sample.txt")
> (import java.io.BufferedReader)
> (import java.io.FileReader) 
> (import java.lang.StringBuilder)
> (import java.lang.Character)
>  
> (def a-FileReader (FileReader. myfile))
> (def bufferedReader (BufferedReader. a-FileReader))
> (def content (StringBuilder.))
>
> which works
>
> user> (.append content (Character/toChars (.read bufferedReader)))
> #object[java.lang.StringBuilder 0x490447d0 "\nDe"]
> user> (.append content (Character/toChars (.read bufferedReader)))
> #object[java.lang.StringBuilder 0x490447d0 "\nDen"]
> user> (.append content (Character/toChars (.read bufferedReader)))
> #object[java.lang.StringBuilder 0x490447d0 "\nDen "]
> user> (.append content (Character/toChars (.read bufferedReader)))
> #object[java.lang.StringBuilder 0x490447d0 "\nDen t"]
> user> (.append content (Character/toChars (.read bufferedReader)))
> #object[java.lang.StringBuilder 0x490447d0 "\nDen ty"]
> user> (.append content (Character/toChars (.read bufferedReader)))
> #object[java.lang.StringBuilder 0x490447d0 "\nDen typ"]
> user> (.append content (Character/toChars (.read bufferedReader)))
> #object[java.lang.StringBuilder 0x490447d0 "\nDen typi"]
>
> The file is a small text file UTF-8 encoded in Linux with the following 
> content:
>
> ❯ cat svenska_sample.txt 
>
> Den typiska impulsiva olycksfågeln är en ung man som kraschar flera bilar, 
> och ofta skryter lite med det, i varje fall när han är tillsammans med sina 
> vänner._. För dem har otur i det närmaste blivit en livsstil, och de råkar 
> konstant ut för olyckor, stora som små. Olycksfåglar kallar vi dem. Hur 
> många det finns kan ingen med säkerhet säga, för det finns inga konkreta 
> definitioner på denna grupp, och heller ingen given avgränsning av den. Att 
> de finns, råder det emellertid ingen tvekan om, varken på sjukhusens 
> akutmottagningar eller i försäkringsbranschen
>
> I wrote a function, with my brand new Clojure Java interop chops, that 
> looks like this:
>
> ;; COMPILES  - BUT CAN'T GET AROUND THE 0XFFF BUG
> (defn pt%% [file]
>(let [afr (FileReader. file); instances of FileReader, BufferedReader, 
> StringBuffer
>  bfr (BufferedReader. afr)
>  ct (StringBuilder.)
>  val (.read bfr)
>  this-list (list afr bfr ct)]
>  ; (apply println this-list)
>  (loop []
>(when (not (= val -1))
>  (.append ct (Character/toChars (.read bfr
>(recur))
> ; when finished...
>  (.toString ct)))
>  
> but it borks with the following error:
>
> user> (pt%% myfile)
> Execution error (IllegalArgumentException) at java.lang.Character/toChars 
> (Character.java:8572).
> Not a valid Unicode code point: 0x
>
> What in the world could be causing this (NOTE: I am not a Java 
> programmer)? 
> Here is the hex dump of the file text file:
>
> ❯ cat svenska_sample.hexdump 
> : 0a44 656e 2074 7970 6973 6b61 2069 6d70  .Den typiska imp
> 0010: 756c 7369 7661 206f 6c79 636b 7366 c3a5  ulsiva olycksf..
> 0020: 6765 6c6e 20c3 a472 2065 6e20 756e 6720  geln ..r en ung 
> 0030: 6d61 6e20 736f 6d20 6b72 6173 6368 6172  man som kraschar
> 0040: 2066 6c65 7261 2062 696c 6172 2c20 6f63   flera bilar, oc
> 0050: 6820 6f66 7461 2073 6b72 7974 6572 206c  h ofta skryter l
> 0060: 6974 6520 6d65 6420 6465 742c 2069 2076  ite med det, i v
> 0070: 6172 6a65 2066 616c 6c20 6ec3 a472 2068  arje fall n..r h
> 0080: 616e 20c3 a472 2074 696c 6c73 616d 6d61  an ..r tillsamma
> 0090: 6e73 206d 6564 2073 696e 6120 76c3 a46e  ns med sina v..n
> 00a0: 6e65 722e 5f2e 2046 c3b6 7220 6465 6d20  ner._. F..r dem 
> 00b0: 6861 7220 6f74 7572 2069 2064 6574 206e  har otur i det n
> 00c0: c3a4 726d 6173 7465 2062 6c69 7669 7420  ..rmaste blivit 
> 00d0: 656e 206c 6976 7373 7469 6c2c 206f 6368  en livsstil, och
> 00e0: 2064 6520 72c3 a56b 6172 206b 6f6e 7374   de r..kar konst
> 00f0: 616e 7420 7574 2066 c3b6 7220 6f6c 7963  ant ut f..r olyc
> 0100: 6b6f 722c 2073 746f 7261 2073 6f6d 2073  kor, stora som s
> 0110: 6dc3 a52e 204f 6c79 636b 7366 c3a5 676c  m... Olycksf..gl
> 

Re: Clojure Data Science Special -- Dec. 5th 2021

2021-12-15 Thread Daniel Slutsky
Here are all the public recordings from the re:Clojure 2021 Data Science 
Special.

There is more to say about our lessons from that day, but first, let us 
share the videos: 
https://www.youtube.com/watch?v=t32bIbzQdCU=PLtw0bWXdq7pNyb2NojSGBnCARRuvLxsAc

Many thanks to the presenters, organizers, and everybody who has 
participated.
On Friday, 19 November 2021 at 00:19:45 UTC+2 Daniel Slutsky wrote:

> An initial announcement and a survey: a re:Clojure Data Science Special 
> day on Dec. 5th.
>
> https://clojureverse.org/t/re-clojure-data-science-special-dec-5th-2021/
>
> Responses to the survey will help so much in planning the event.
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/142bfdc3-f5c3-4c58-b780-c9aa25f649b6n%40googlegroups.com.


Re: Rationale of behavior when invoking composite data type as 0-arity function

2021-12-05 Thread dieter.v...@gmail.com
Hello Brent, thank you for the response. You're right, better keep a clear 
distinction between invoking and evaluating.

On Thursday, November 25, 2021 at 3:35:09 PM UTC+1 brent@gmail.com 
wrote:

> Ok so I think taking a step back, I think their is some complecting going 
> on here. I don't see how you see "that invoking a map without arguments 
> evaluates it" as a generalization. I believe Rich's intention behind map's, 
> set's, and vector's being callable is that they naturally behave as 
> primitive (mathematically) functions, which map a key space to an output 
> space. So first, there aren't any natural meanings for calling a map with 
> zero arguments. (If anything, I think it should return nil. Because 
> sometimes we would call functions using apply like (apply f [a b c]), and 
> sometimes that list is empty, like (apply {} []). This is just like how (+) 
> evaluates to 0. But I digress...).
>
> What you are generally talking about is controlling code evaluation. You 
> are specifically storing code within the values (and potentially keys) of 
> the map. Really, this code is just lists, aka data. It is really important 
> to keep the phases of evaluation separate, otherwise this makes macro 
> writing very confusing (and coding in general). What you are suggesting 
> complects calling a map (keys to values), with evaling a map (recursively 
> eval any non quoted lists). These are separate actions/ideas. When we do 
> want to operate in different phases, then we really do want to call eval 
> explicitly as this is a "dramatic" action. Eval takes literal data and 
> pipes them through unless they are lists, where it treats the first arg as 
> a function/special-form, and the output can be very different from the 
> input. In contrast, often transformations on maps result in other maps. My 
> take here is, again, this should be explicit. In your intended behavior 
> example (({}) :b), it is calling eval behind the scenes. This is very 
> hidden and leads to very different performance implications. My take is you 
> are suggesting reducing code size but not actually addressing duplication, 
> and in the process making special behaviors less intuitive. (One other 
> thing is what you suggest doesn't blend nicely with -> as you'd still have 
> to call .invoke at the end instead of just calling eval.)
>
> -
>
> To support your cause, however, I think there are many tools to help you 
> with code manipulation and code analysis during runtime.
>
> If you want your code to work as is but have code analysis phases, you can 
> use macros to insert code analyzing phases without impacting the evaluation 
> and runtime implications of the code itself.
>
> For example:
> (def code-size (atom 0))
> (defmacro count-code [some-code]
>   (reset! code-size (count (str some-code)))
>   some-code)
>
> (count-code {:a :b}) ;; => {:a :b}
> @code-size ;; => 7
>
> From there, you can write code analysis walkers as functions (not macros) 
> and use them at runtime with explicit quoted forms at the repl, or insert 
> them into your macros for analyzing "production" code.
> On Wednesday, November 24, 2021 at 2:52:43 PM UTC-5 dieter.v...@gmail.com 
> wrote:
>
>> Hello Brent,
>>
>> The use case I had in mind was to keep a map readable during development. 
>> Take a simple map: {:type QTDIR :path (hash "a string")}. It's easier to 
>> play with this data if evaluation of certain symbols and functions is 
>> delayed.
>>
>> Thanks you both for your answer,
>> kind regards,
>> Dieter
>>
>>
>>
>>
>> On Mon, Nov 22, 2021 at 3:39 AM Brent Millare  
>> wrote:
>>
>>> I'm curious why you are saving hashmaps that have clojure code within it 
>>> with the intention of evaluating this code as embedded in the hashmap? What 
>>> is the use case? Are you trying to delay evaluation? Regardless, eval 
>>> always incurs a cost and should generally be avoided if you can use 
>>> "runtime" techniques instead. Is the embedded code trusted?
>>>
>>> Best,
>>> Brent
>>>
>>> On Sunday, November 21, 2021 at 9:22:47 AM UTC-5 dieter.v...@gmail.com 
>>> wrote:
>>>
 Hello,

 It seems to be a design decision that 0-arity invoke of a composite 
 data type gives an ArityException: the composite data type does not 
 implement the IFn when no arguments are given.
 Is there a certain design decision behind this behavior? (or a certain 
 use-case)


 repl> ;composite data type evaluates to itself
 repl> {:a 1 :b (hash "word")} 
 {:a 1 :b -304538205}
 repl> '{:a 1 :b (hash "word")}
 {:a 1 :b (hash "word")}
 repl> (def mydata '{:a 1 :b (hash "word")})
 repl> mydata
 {:a 1 :b (hash "word")}
 repl> ;composite data type implements IFn for its keys
 repl> (mydata :b)
 (hash "word")
 repl> ; there is no '0-arity' implementation of IFn for composite data 
 type
 repl> ({})
 ... (ArityException)...
 repl> (mydata)
 ... (ArityException)...
 repl> ; instead i 

Re: Changes to official Clojure Docker images

2021-12-03 Thread Wes Morgan
One more important clarification:

In my original message I mentioned that the clojure / clojure:latest image 
got clj as its new default ENTRYPOINT instead of lein. But it actually goes 
further than that. Previously any image that didn't mention a build tool in 
its Docker tag (e.g. clojure:openjdk-11) would have lein installed (so 
clojure:openjdk-11 was the same as clojure:openjdk-11-lein).

Now, however, those images have also been switched to clj. So now 
clojure:openjdk-11 has clj as its only build tool (remember that *only *the 
clojure / clojure:latest image has all three build tools installed). 
clojure:openjdk-11 is now the same as clojure:openjdk-11-tools-deps.

This is (yet another) good moment to remind everyone to use fully specified 
Docker tags as much as possible (e.g. 
clojure:openjdk-17-tools-deps-1.10.3.1040-slim-buster) rather than relying 
on the defaults (as they can and do change from time to time). A good 
heuristic might be: Typing a Docker tag into a shell command? Fine to rely 
on defaults or just run clojure / clojure:latest. Typing a Docker tag into 
a code editor? Use a fully-specified tag.

On Wednesday, December 1, 2021 at 7:07:29 PM UTC-7 Wes Morgan wrote:

> Clarification: The clojure / clojure:latest image still includes all three 
> build tools (lein, boot, tools-deps). Only the default one you get if you 
> don't specify a different one has changed from lein to clj. But this image 
> has also inherited the ENTRYPOINT / CMD changes I outlined above, so be 
> aware of that. It should figure out what you want if you do something like 
> `docker run clojure lein` though, so let us know on GitHub (
> https://github.com/Quantisan/docker-clojure) if it doesn't do what you 
> expect in this regard.
>
> On Wednesday, December 1, 2021 at 7:01:59 PM UTC-7 Wes Morgan wrote:
>
>> Some important and potentially breaking changes to be aware of in the 
>> official Clojure Docker images are landing soon (likely already present in 
>> the images on Docker Hub by the time you read this):
>>
>> - JDK 17 is the new LTS release, and as a result, is now the JDK version 
>> you get if you don't specify a different one in your Docker tag (which we 
>> recommend doing in production).
>>
>> - The clojure:latest image (which is what you get if you only specify 
>> 'clojure' for your image name) now defaults to clj (i.e. tools.deps) 
>> instead of lein. When these images were first created, Leiningen was the de 
>> facto Clojure build tool. Nowadays we have an official first party tool, so 
>> we've moved to that. As always, we only recommend using this image in 
>> one-off commands and specifying build tool, clojure version, Linux distro, 
>> and openjdk base version where those matter.
>>
>> - All images using openjdk-17 or higher now use an ENTRYPOINT of their 
>> respective build tool (i.e. lein, clj, or boot) and a CMD that launches a 
>> REPL instead of the previous practice of the CMD being build-tool repl 
>> (roughly). This means a bare docker run should behave approximately the 
>> same way as before, except you can now do things like: `docker run clojure 
>> -e '(+ 1 2)'` and it will print '3'. We left the older openjdk images alone 
>> in case folks were relying on the old behavior in some cases, and we don't 
>> want to break things where people were using full-specification tags.
>> - If you're not familiar with this ENTRYPOINT vs. CMD concept in 
>> Docker, it basically boils down to this: The CMD gets replaced with 
>> whatever you put after the image name in a docker run command. So now you 
>> can specify arguments to the build tool of whatever image you're running 
>> instead of redundantly specifying it first. You can override the default 
>> ENTRYPOINT with the `--entrypoint foo` arg to docker run (must come before 
>> the image name) but see the "important caveat" below as many use cases will 
>> hopefully be covered already without using that.
>> - An important caveat: The entrypoint script we're using tries to 
>> detect if you specify a CMD that isn't an argument nor subcommand of that 
>> image's build tool and runs it as a standalone executable. In other words, 
>> `docker run -ti clojure bash` still gets you a bash prompt. Please report 
>> issues on https://github.com/Quantisan/docker-clojure if you find errors 
>> in that logic. It is a requirement that official Docker images behave this 
>> way, but we also want to make sure it is robust in the vast majority of use 
>> cases.
>>
>> - Some time ago we announced that debian slim-bullseye would be the 
>> default distro you'd get if you didn't specify one, but not all of our 
>> images were migrated to that default. Now they all are hopefully.
>>
>> - The alpine-based images (only available for openjdk-18 currently) are 
>> now using Alpine Linux 3.15 which was recently released. The biggest change 
>> you'd probably notice there is that an rlwrap package is finally available 
>> in Alpine and installed in the 

Re: Changes to official Clojure Docker images

2021-12-01 Thread Wes Morgan
Clarification: The clojure / clojure:latest image still includes all three 
build tools (lein, boot, tools-deps). Only the default one you get if you 
don't specify a different one has changed from lein to clj. But this image 
has also inherited the ENTRYPOINT / CMD changes I outlined above, so be 
aware of that. It should figure out what you want if you do something like 
`docker run clojure lein` though, so let us know on GitHub 
(https://github.com/Quantisan/docker-clojure) if it doesn't do what you 
expect in this regard.

On Wednesday, December 1, 2021 at 7:01:59 PM UTC-7 Wes Morgan wrote:

> Some important and potentially breaking changes to be aware of in the 
> official Clojure Docker images are landing soon (likely already present in 
> the images on Docker Hub by the time you read this):
>
> - JDK 17 is the new LTS release, and as a result, is now the JDK version 
> you get if you don't specify a different one in your Docker tag (which we 
> recommend doing in production).
>
> - The clojure:latest image (which is what you get if you only specify 
> 'clojure' for your image name) now defaults to clj (i.e. tools.deps) 
> instead of lein. When these images were first created, Leiningen was the de 
> facto Clojure build tool. Nowadays we have an official first party tool, so 
> we've moved to that. As always, we only recommend using this image in 
> one-off commands and specifying build tool, clojure version, Linux distro, 
> and openjdk base version where those matter.
>
> - All images using openjdk-17 or higher now use an ENTRYPOINT of their 
> respective build tool (i.e. lein, clj, or boot) and a CMD that launches a 
> REPL instead of the previous practice of the CMD being build-tool repl 
> (roughly). This means a bare docker run should behave approximately the 
> same way as before, except you can now do things like: `docker run clojure 
> -e '(+ 1 2)'` and it will print '3'. We left the older openjdk images alone 
> in case folks were relying on the old behavior in some cases, and we don't 
> want to break things where people were using full-specification tags.
> - If you're not familiar with this ENTRYPOINT vs. CMD concept in 
> Docker, it basically boils down to this: The CMD gets replaced with 
> whatever you put after the image name in a docker run command. So now you 
> can specify arguments to the build tool of whatever image you're running 
> instead of redundantly specifying it first. You can override the default 
> ENTRYPOINT with the `--entrypoint foo` arg to docker run (must come before 
> the image name) but see the "important caveat" below as many use cases will 
> hopefully be covered already without using that.
> - An important caveat: The entrypoint script we're using tries to 
> detect if you specify a CMD that isn't an argument nor subcommand of that 
> image's build tool and runs it as a standalone executable. In other words, 
> `docker run -ti clojure bash` still gets you a bash prompt. Please report 
> issues on https://github.com/Quantisan/docker-clojure if you find errors 
> in that logic. It is a requirement that official Docker images behave this 
> way, but we also want to make sure it is robust in the vast majority of use 
> cases.
>
> - Some time ago we announced that debian slim-bullseye would be the 
> default distro you'd get if you didn't specify one, but not all of our 
> images were migrated to that default. Now they all are hopefully.
>
> - The alpine-based images (only available for openjdk-18 currently) are 
> now using Alpine Linux 3.15 which was recently released. The biggest change 
> you'd probably notice there is that an rlwrap package is finally available 
> in Alpine and installed in the tools-deps images so the clj repl will 
> behave as it should.
>
> - There is a long-standing bug in Docker that makes rlwrap crash if it is 
> started too soon after a container starts. We used to work around this with 
> a naive 1 second wait in the tools-deps images. We are now shipping with a 
> much better solution that waits a much shorter amount of time when it can, 
> but still waits for as long as it needs to on slower systems. This means 
> you should generally notice faster container starts for tools-deps images 
> than before.
>
> OK I think that's it! Please report issues at 
> https://github.com/Quantisan/docker-clojure if you run into anything that 
> unexpectedly doesn't work.
>
> New tools-deps images for releases after 1.10.3.1020 were waiting on this 
> being merged, so those should appear soon too.
>
> Feel free to reply here if you have any questions, and may the REPL be 
> with you.
>

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

Re: Ok, so code is data...

2021-11-30 Thread Brent Millare
Do you want to create an html visualization in html? The main thing to 
check is other code walkers for reference 
like https://github.com/ztellman/riddley but I strongly recommend trying 
this out yourself without using other libraries as you will learn a lot in 
the process.

You don't need to "convert" clojure to nested lists. It already is a nested 
list. Wrapping a clojure exp in a macro provides the macro with the 
unevaluated nested data. Alternatively, when viewing files, then you simply 
want to call read/read-string on raw clj file data.

On Monday, November 29, 2021 at 3:16:23 PM UTC-5 kovas@gmail.com wrote:

> Just stumbled across this thread 10 years later!  I'm actually interested 
> in doing the same thing: taking some clojure logic that I write and 
> converting it to a call-graph in html. Is there any prior art here I should 
> know about?  Or can this be done with basic clojure to e.g. convert the 
> code of a function into nested lists for me to then convert to html?
>
>  - Kovas
>
> On Tuesday, May 10, 2011 at 8:18:03 PM UTC-7 Bill Robertson wrote:
>
>> Thanks for the feedback and pointers. 
>>
>>
>>
>> On May 10, 11:37 am, Timothy Baldridge  wrote: 
>> > On Tue, May 10, 2011 at 10:26 AM, Jonathan Fischer Friberg < 
>> > 
>> > odysso...@gmail.com> wrote: 
>> > > "How do I actually just load code w/o evaluating it?" 
>> > > mostly when you want something like this, you want a macro. 
>> Manipulating 
>> > > code is also done within macros. 
>> > 
>> > Yeah, I would consider the whole code-is-data thing to refer more to 
>> using 
>> > macros than eval. For something fun to read up on this check out this 
>> > tutorial: 
>> > 
>> > http://www.learningclojure.com/2010/09/clojure-faster-than-machine-co... 
>>
>> > 
>> > Here the author goes and takes a tree data structure, and on-the-fly 
>> > generates function that represents that structure. The result is some 
>> > insanely fast code. 
>> > 
>> > Timothy
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/826a9a4d-5b83-4f40-9eaf-2d6f77c3fa93n%40googlegroups.com.


Re: Ok, so code is data...

2021-11-29 Thread Kovas Palunas
Just stumbled across this thread 10 years later!  I'm actually interested 
in doing the same thing: taking some clojure logic that I write and 
converting it to a call-graph in html. Is there any prior art here I should 
know about?  Or can this be done with basic clojure to e.g. convert the 
code of a function into nested lists for me to then convert to html?

 - Kovas

On Tuesday, May 10, 2011 at 8:18:03 PM UTC-7 Bill Robertson wrote:

> Thanks for the feedback and pointers.
>
>
>
> On May 10, 11:37 am, Timothy Baldridge  wrote:
> > On Tue, May 10, 2011 at 10:26 AM, Jonathan Fischer Friberg <
> >
> > odysso...@gmail.com> wrote:
> > > "How do I actually just load code w/o evaluating it?"
> > > mostly when you want something like this, you want a macro. 
> Manipulating
> > > code is also done within macros.
> >
> > Yeah, I would consider the whole code-is-data thing to refer more to 
> using
> > macros than eval. For something fun to read up on this check out this
> > tutorial:
> >
> > http://www.learningclojure.com/2010/09/clojure-faster-than-machine-co...
> >
> > Here the author goes and takes a tree data structure, and on-the-fly
> > generates function that represents that structure. The result is some
> > insanely fast code.
> >
> > Timothy

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/c5c6965d-0098-484d-bec7-48e57e149ccfn%40googlegroups.com.


Re: Clojure-SG (Singapore) Online Meetup

2021-11-28 Thread Zack Teo
Hello!

Just some updates about the meetup :) we had a humble but admirable turn 
out of 5 people. And it was quite a diverse turn out with Clojurians from 
India, Singapore, Philippines and Malaysia. 

Because of this and there being a pre-exising Singapore Clojure Meetup group 
, I have decided to pitch 
future meet ups as Clojure Asia :)  I have also created a #clojure-asia 
channel  on the 
Clojurian Slack. Do feel free to join :)

For those who were interested in joining but were unable to for the recent 
session, we are planning to organise these meetups once a month :) so hope 
to see you for upcoming sessions!

Zachary (zackteo)


On Saturday, November 6, 2021 at 2:58:14 PM UTC+8 Zack Teo wrote:

> Hi Everyone! It has a long while since those of us in Singapore had a 
> Clojure-SG meetup, so I thought it would be great to have an online one 
> amidst this period!
>
> Am planning to not have any talk, just have a chill session to get to know 
> and check in with one another :)
>
> (Other Clojurians are free and welcome to join too :D Though of course we 
> haven't had a meetup in over a year so it would be ideal to have more 
> people that are based in (/are frequently in) Singapore!)
>
> Meeting Details:
> Date: 20th November 2021 (Saturday)
> Time: 1500-1600 SGT (0700-0800 UTC)
> Location: Zoom/Google Meets (will email the link in time)
>
> Please fill up the form:
> https://forms.gle/6331jq2EVyzRej2z7 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/07f1e6fc-990a-42a3-a97f-4542a960ec9fn%40googlegroups.com.


Re: Rationale of behavior when invoking composite data type as 0-arity function

2021-11-25 Thread Brent Millare
Ok so I think taking a step back, I think their is some complecting going 
on here. I don't see how you see "that invoking a map without arguments 
evaluates it" as a generalization. I believe Rich's intention behind map's, 
set's, and vector's being callable is that they naturally behave as 
primitive (mathematically) functions, which map a key space to an output 
space. So first, there aren't any natural meanings for calling a map with 
zero arguments. (If anything, I think it should return nil. Because 
sometimes we would call functions using apply like (apply f [a b c]), and 
sometimes that list is empty, like (apply {} []). This is just like how (+) 
evaluates to 0. But I digress...).

What you are generally talking about is controlling code evaluation. You 
are specifically storing code within the values (and potentially keys) of 
the map. Really, this code is just lists, aka data. It is really important 
to keep the phases of evaluation separate, otherwise this makes macro 
writing very confusing (and coding in general). What you are suggesting 
complects calling a map (keys to values), with evaling a map (recursively 
eval any non quoted lists). These are separate actions/ideas. When we do 
want to operate in different phases, then we really do want to call eval 
explicitly as this is a "dramatic" action. Eval takes literal data and 
pipes them through unless they are lists, where it treats the first arg as 
a function/special-form, and the output can be very different from the 
input. In contrast, often transformations on maps result in other maps. My 
take here is, again, this should be explicit. In your intended behavior 
example (({}) :b), it is calling eval behind the scenes. This is very 
hidden and leads to very different performance implications. My take is you 
are suggesting reducing code size but not actually addressing duplication, 
and in the process making special behaviors less intuitive. (One other 
thing is what you suggest doesn't blend nicely with -> as you'd still have 
to call .invoke at the end instead of just calling eval.)

-

To support your cause, however, I think there are many tools to help you 
with code manipulation and code analysis during runtime.

If you want your code to work as is but have code analysis phases, you can 
use macros to insert code analyzing phases without impacting the evaluation 
and runtime implications of the code itself.

For example:
(def code-size (atom 0))
(defmacro count-code [some-code]
  (reset! code-size (count (str some-code)))
  some-code)

(count-code {:a :b}) ;; => {:a :b}
@code-size ;; => 7

>From there, you can write code analysis walkers as functions (not macros) 
and use them at runtime with explicit quoted forms at the repl, or insert 
them into your macros for analyzing "production" code.
On Wednesday, November 24, 2021 at 2:52:43 PM UTC-5 dieter.v...@gmail.com 
wrote:

> Hello Brent,
>
> The use case I had in mind was to keep a map readable during development. 
> Take a simple map: {:type QTDIR :path (hash "a string")}. It's easier to 
> play with this data if evaluation of certain symbols and functions is 
> delayed.
>
> Thanks you both for your answer,
> kind regards,
> Dieter
>
>
>
>
> On Mon, Nov 22, 2021 at 3:39 AM Brent Millare  wrote:
>
>> I'm curious why you are saving hashmaps that have clojure code within it 
>> with the intention of evaluating this code as embedded in the hashmap? What 
>> is the use case? Are you trying to delay evaluation? Regardless, eval 
>> always incurs a cost and should generally be avoided if you can use 
>> "runtime" techniques instead. Is the embedded code trusted?
>>
>> Best,
>> Brent
>>
>> On Sunday, November 21, 2021 at 9:22:47 AM UTC-5 dieter.v...@gmail.com 
>> wrote:
>>
>>> Hello,
>>>
>>> It seems to be a design decision that 0-arity invoke of a composite data 
>>> type gives an ArityException: the composite data type does not implement 
>>> the IFn when no arguments are given.
>>> Is there a certain design decision behind this behavior? (or a certain 
>>> use-case)
>>>
>>>
>>> repl> ;composite data type evaluates to itself
>>> repl> {:a 1 :b (hash "word")} 
>>> {:a 1 :b -304538205}
>>> repl> '{:a 1 :b (hash "word")}
>>> {:a 1 :b (hash "word")}
>>> repl> (def mydata '{:a 1 :b (hash "word")})
>>> repl> mydata
>>> {:a 1 :b (hash "word")}
>>> repl> ;composite data type implements IFn for its keys
>>> repl> (mydata :b)
>>> (hash "word")
>>> repl> ; there is no '0-arity' implementation of IFn for composite data 
>>> type
>>> repl> ({})
>>> ... (ArityException)...
>>> repl> (mydata)
>>> ... (ArityException)...
>>> repl> ; instead i have to type eval
>>> repl> ((eval mymap) :b)
>>>  -304538205
>>>
>>> I know its only 4 letters and a space extra, but software composition is 
>>> supposed to avoid code duplication and perhaps the idea makes sense that 
>>> invoking a map without arguments evaluates it... Hence the question about 
>>> the choice made for the current behavior.
>>>
>>> A 

Re: Rationale of behavior when invoking composite data type as 0-arity function

2021-11-24 Thread Dieter Van Eessen
Hello Brent,

The use case I had in mind was to keep a map readable during development.
Take a simple map: {:type QTDIR :path (hash "a string")}. It's easier to
play with this data if evaluation of certain symbols and functions is
delayed.

Thanks you both for your answer,
kind regards,
Dieter




On Mon, Nov 22, 2021 at 3:39 AM Brent Millare 
wrote:

> I'm curious why you are saving hashmaps that have clojure code within it
> with the intention of evaluating this code as embedded in the hashmap? What
> is the use case? Are you trying to delay evaluation? Regardless, eval
> always incurs a cost and should generally be avoided if you can use
> "runtime" techniques instead. Is the embedded code trusted?
>
> Best,
> Brent
>
> On Sunday, November 21, 2021 at 9:22:47 AM UTC-5 dieter.v...@gmail.com
> wrote:
>
>> Hello,
>>
>> It seems to be a design decision that 0-arity invoke of a composite data
>> type gives an ArityException: the composite data type does not implement
>> the IFn when no arguments are given.
>> Is there a certain design decision behind this behavior? (or a certain
>> use-case)
>>
>>
>> repl> ;composite data type evaluates to itself
>> repl> {:a 1 :b (hash "word")}
>> {:a 1 :b -304538205}
>> repl> '{:a 1 :b (hash "word")}
>> {:a 1 :b (hash "word")}
>> repl> (def mydata '{:a 1 :b (hash "word")})
>> repl> mydata
>> {:a 1 :b (hash "word")}
>> repl> ;composite data type implements IFn for its keys
>> repl> (mydata :b)
>> (hash "word")
>> repl> ; there is no '0-arity' implementation of IFn for composite data
>> type
>> repl> ({})
>> ... (ArityException)...
>> repl> (mydata)
>> ... (ArityException)...
>> repl> ; instead i have to type eval
>> repl> ((eval mymap) :b)
>>  -304538205
>>
>> I know its only 4 letters and a space extra, but software composition is
>> supposed to avoid code duplication and perhaps the idea makes sense that
>> invoking a map without arguments evaluates it... Hence the question about
>> the choice made for the current behavior.
>>
>> A possible small workaround
>> (defrecord qid [qid]
>>  clojure.lang.IFn
>>  (invoke [this] (eval qid))
>> But expect this to throw alot of bugs: this record is not the same simple
>> map.
>> (issues with other protocols, reducers, transducers and much more I don't
>> know of.)
>>
>> I hope this is the right google group to ask this question.
>> kind regards,
>> Dieter
>>
>> --
> 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 a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/d16Ow0MvhPU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/ff296de8-ce0f-4798-a1cc-cd3e4b38c631n%40googlegroups.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CAC2TPPhuLSWQ%2BoB0m1EqLOKrSouP-9oUTbhrs88ZyghChcj%3D9w%40mail.gmail.com.


Re: Rationale of behavior when invoking composite data type as 0-arity function

2021-11-21 Thread Brent Millare
I'm curious why you are saving hashmaps that have clojure code within it 
with the intention of evaluating this code as embedded in the hashmap? What 
is the use case? Are you trying to delay evaluation? Regardless, eval 
always incurs a cost and should generally be avoided if you can use 
"runtime" techniques instead. Is the embedded code trusted?

Best,
Brent

On Sunday, November 21, 2021 at 9:22:47 AM UTC-5 dieter.v...@gmail.com 
wrote:

> Hello,
>
> It seems to be a design decision that 0-arity invoke of a composite data 
> type gives an ArityException: the composite data type does not implement 
> the IFn when no arguments are given.
> Is there a certain design decision behind this behavior? (or a certain 
> use-case)
>
>
> repl> ;composite data type evaluates to itself
> repl> {:a 1 :b (hash "word")} 
> {:a 1 :b -304538205}
> repl> '{:a 1 :b (hash "word")}
> {:a 1 :b (hash "word")}
> repl> (def mydata '{:a 1 :b (hash "word")})
> repl> mydata
> {:a 1 :b (hash "word")}
> repl> ;composite data type implements IFn for its keys
> repl> (mydata :b)
> (hash "word")
> repl> ; there is no '0-arity' implementation of IFn for composite data type
> repl> ({})
> ... (ArityException)...
> repl> (mydata)
> ... (ArityException)...
> repl> ; instead i have to type eval
> repl> ((eval mymap) :b)
>  -304538205
>
> I know its only 4 letters and a space extra, but software composition is 
> supposed to avoid code duplication and perhaps the idea makes sense that 
> invoking a map without arguments evaluates it... Hence the question about 
> the choice made for the current behavior.
>
> A possible small workaround  
> (defrecord qid [qid]
>  clojure.lang.IFn  
>  (invoke [this] (eval qid))
> But expect this to throw alot of bugs: this record is not the same simple 
> map.
> (issues with other protocols, reducers, transducers and much more I don't 
> know of.)
>
> I hope this is the right google group to ask this question.
> kind regards,
> Dieter
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/ff296de8-ce0f-4798-a1cc-cd3e4b38c631n%40googlegroups.com.


  1   2   3   4   5   6   7   8   9   10   >