[ANN] Monroe 0.1.0 - nrepl client for Emacs

2014-09-24 Thread Sanel Zukan
Hi everyone,

Here  is initial release for Monroe, a new 
Clojure nREPL client for Emacs. The main idea behind Monroe is to be 
simple, easy to install (just put it in your *load-path*) and to work like 
inferior modes (inferior-lisp or inferior-scheme), providing common 
keybindings in REPL, including color and history support. You will also 
need clojure-mode.el for code syntax highlighting, but this is optional.

This initial release is ready for consumption (I'm using it on a bit larger 
project) and feel free to drop me a line if you find some issues.

Again, the url is https://github.com/sanel/monroe

Best,
Sanel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] Monroe 0.1.0 - nrepl client for Emacs

2014-09-24 Thread Sanel Zukan
Correct, there is no support for code completion. This way you can use 
whatever facility you prefer, like autocomplete or company-mode as this is 
strictly client-side operation.

Best,
Sanel

On Wednesday, September 24, 2014 7:04:54 PM UTC+2, dennis wrote:
>
> Looks great.But it doesn't support code completion?
>
> 2014-09-25 0:50 GMT+08:00 Sanel Zukan >:
>
>> Hi everyone,
>>
>> Here <https://github.com/sanel/monroe> is initial release for Monroe, a 
>> new Clojure nREPL client for Emacs. The main idea behind Monroe is to be 
>> simple, easy to install (just put it in your *load-path*) and to work 
>> like inferior modes (inferior-lisp or inferior-scheme), providing common 
>> keybindings in REPL, including color and history support. You will also 
>> need clojure-mode.el for code syntax highlighting, but this is optional.
>>
>> This initial release is ready for consumption (I'm using it on a bit 
>> larger project) and feel free to drop me a line if you find some issues.
>>
>> Again, the url is https://github.com/sanel/monroe
>>
>> Best,
>> Sanel
>>
>> -- 
>> 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.
>>
>
>
>
> -- 
> 庄晓丹 
> Email:killm...@gmail.com  xzh...@avos.com 
> 
> Site:   http://fnil.net
> Twitter:  @killme2008
>
>
> 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] Monroe 0.1.0 - nrepl client for Emacs

2014-09-25 Thread Sanel Zukan
Thanks for reply with the details, Bastien :)

> As someone new to CIDER (probably only use 10% of its features), what's 
the difference between this and CIDER?

I think you already answered it :) I find Cider amazing project, but is a 
bit biggish for my taste, especially if you would like to get the extension 
and start working on Clojure code, instead of setting up the details. Also, 
I prefer keeping REPL and all REPL related stuff (erorrs and exceptions) 
_inside_ REPL buffer and window, just like many Emacs modes works.

Now, a little bit internals: Monroe REPL is using comint-mode, which means 
that many comint keys and variables should work out of the box. In Emacs, 
comint-mode is used by default for interaction with external programs like 
shell, ielm, inferior-[lisp, scheme, python] and many of them are sharing 
similar shortcuts.

> i.e. why would I want to use this over CIDER? (could be good to put in 
the README as well)

I think README summarize the goals behind the project. If you find it 
confusing, I'll try to clarify the things a little bit.

Best,
Sanel

On Thursday, September 25, 2014 6:41:52 AM UTC+2, Bastien Guerry wrote:
>
> John Louis Del Rosario > writes: 
>
> > Looks neat. As someone new to CIDER (probably only use 10% of its 
> > features), what's the difference between this and CIDER? i.e. why 
> > would I want to use this over CIDER? (could be good to put in the 
> > README as well) 
>
> Copying what's on the reddit page: 
>
>
> http://www.reddit.com/r/Clojure/comments/2hde6w/monroe_new_nrepl_client_for_emacs/
>  
>
> "Some features: 
>
> - lightweight 
> 
> - focused only on nrepl protocol so you can easily combine it with 
>   favorite libraries (e.g. company-mode) 
> 
> - single buffer for interaction, which behaves like inferior 
>   modes. Errors and results will be shown in that buffer, instead 
>   poping out new buffers. 
> 
> - works on older Emacs versions 
> 
> - history in repl that actually works" 
>
> -- 
>  Bastien 
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] Monroe 0.1.0 - nrepl client for Emacs

2014-09-26 Thread Sanel Zukan
True; Monroe for now is focused only on providing stable nrepl connection 
with usable REPL, but you should be able to use any *clojure-mode.el* that 
floats around the net. AFAIK, Cider comes with *clojure-mode.el* and you 
could try it. If you find issues please let me know.

Also, there is clojure-mode.el on EmacsWiki 
<http://www.emacswiki.org/emacs-en/clojure-mode.el> or you can use the one 
from my repository 
<https://github.com/sanel/dotfiles/blob/master/emacs.d/modes/clojure-mode.el> 
(warning, it is a bit outdated and I'm using it mainly for syntax 
highlighting).

Best,
Sanel

On Friday, September 26, 2014 5:28:58 PM UTC+2, John Louis Del Rosario 
wrote:
>
> Thanks!
>
> Just installed it and disabled CIDER. Hmm first things I miss are no 
> syntax highlighting and no paredit.
> I think I can just add a hook for paredit, but not sure about syntax 
> highlighting. Any ideas?
>
> On Thursday, September 25, 2014 8:32:05 PM UTC+8, Sanel Zukan wrote:
>>
>> Thanks for reply with the details, Bastien :)
>>
>> > As someone new to CIDER (probably only use 10% of its features), what's 
>> the difference between this and CIDER?
>>
>> I think you already answered it :) I find Cider amazing project, but is a 
>> bit biggish for my taste, especially if you would like to get the extension 
>> and start working on Clojure code, instead of setting up the details. Also, 
>> I prefer keeping REPL and all REPL related stuff (erorrs and exceptions) 
>> _inside_ REPL buffer and window, just like many Emacs modes works.
>>
>> Now, a little bit internals: Monroe REPL is using comint-mode, which 
>> means that many comint keys and variables should work out of the box. In 
>> Emacs, comint-mode is used by default for interaction with external 
>> programs like shell, ielm, inferior-[lisp, scheme, python] and many of them 
>> are sharing similar shortcuts.
>>
>> > i.e. why would I want to use this over CIDER? (could be good to put in 
>> the README as well)
>>
>> I think README summarize the goals behind the project. If you find it 
>> confusing, I'll try to clarify the things a little bit.
>>
>> Best,
>> Sanel
>>
>> On Thursday, September 25, 2014 6:41:52 AM UTC+2, Bastien Guerry wrote:
>>>
>>> John Louis Del Rosario  writes: 
>>>
>>> > Looks neat. As someone new to CIDER (probably only use 10% of its 
>>> > features), what's the difference between this and CIDER? i.e. why 
>>> > would I want to use this over CIDER? (could be good to put in the 
>>> > README as well) 
>>>
>>> Copying what's on the reddit page: 
>>>
>>>
>>> http://www.reddit.com/r/Clojure/comments/2hde6w/monroe_new_nrepl_client_for_emacs/
>>>  
>>>
>>> "Some features: 
>>>
>>> - lightweight 
>>> 
>>> - focused only on nrepl protocol so you can easily combine it with 
>>>   favorite libraries (e.g. company-mode) 
>>> 
>>> - single buffer for interaction, which behaves like inferior 
>>>   modes. Errors and results will be shown in that buffer, instead 
>>>   poping out new buffers. 
>>> 
>>> - works on older Emacs versions 
>>> 
>>> - history in repl that actually works" 
>>>
>>> -- 
>>>  Bastien 
>>>
>>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] Monroe 0.1.0 - nrepl client for Emacs

2014-09-26 Thread Sanel Zukan
Thanks for the tip!

Actually, I was using the one from *nrepl.el*, but I will check your fixed 
version and see how to adapt it :) Do you a sample that will break the 
current parser (so I can use it for validation and testing)?

Best,
Sanel

On Friday, September 26, 2014 9:34:11 PM UTC+2, Bozhidar Batsov wrote:
>
> Btw, you’re using CIDER’s old bencode parser, which was flawed (big 
> requests break it due to deep recursive calls). We recently reworked it and 
> the new version is much more robust.
>
> —
> Cheers, 
> Bozhidar
>
> On September 25, 2014 at 4:32:12 PM, Sanel Zukan (san...@gmail.com 
> ) wrote:
>
> Thanks for reply with the details, Bastien :)
>
> > As someone new to CIDER (probably only use 10% of its features), what's 
> the difference between this and CIDER? 
>
> I think you already answered it :) I find Cider amazing project, but is a 
> bit biggish for my taste, especially if you would like to get the extension 
> and start working on Clojure code, instead of setting up the details. Also, 
> I prefer keeping REPL and all REPL related stuff (erorrs and exceptions) 
> _inside_ REPL buffer and window, just like many Emacs modes works.
>
> Now, a little bit internals: Monroe REPL is using comint-mode, which means 
> that many comint keys and variables should work out of the box. In Emacs, 
> comint-mode is used by default for interaction with external programs like 
> shell, ielm, inferior-[lisp, scheme, python] and many of them are sharing 
> similar shortcuts.
>
> > i.e. why would I want to use this over CIDER? (could be good to put in 
> the README as well)
>
> I think README summarize the goals behind the project. If you find it 
> confusing, I'll try to clarify the things a little bit.
>
> Best,
> Sanel
>
> On Thursday, September 25, 2014 6:41:52 AM UTC+2, Bastien Guerry wrote: 
>>
>> John Louis Del Rosario  writes:
>>
>> > Looks neat. As someone new to CIDER (probably only use 10% of its
>> > features), what's the difference between this and CIDER? i.e. why
>> > would I want to use this over CIDER? (could be good to put in the
>> > README as well)
>>
>> Copying what's on the reddit page:
>>
>>  
>> http://www.reddit.com/r/Clojure/comments/2hde6w/monroe_new_nrepl_client_for_emacs/
>>
>> "Some features:
>>
>> - lightweight
>>
>> - focused only on nrepl protocol so you can easily combine it with
>>   favorite libraries (e.g. company-mode)
>>
>> - single buffer for interaction, which behaves like inferior
>>   modes. Errors and results will be shown in that buffer, instead
>>   poping out new buffers.
>>
>> - works on older Emacs versions
>>
>> - history in repl that actually works"
>>
>> --
>>  Bastien
>>
>  --
> 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.
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] Monroe 0.2.0 - nrepl client for Emacs

2014-10-27 Thread Sanel Zukan
 Hi,

I'm happy to announce the release of Monroe 0.2.0, a new nREPL client
for Emacs.

This release comes with a bunch of fixes and some new features, like
support for interrupting remote evaluations, reading from stdin,
getting exception details and more.

Release changes and download link are on
https://github.com/sanel/monroe/releases/tag/0.2.0. You can also get
Monroe from *MELPA* or *Marmalade*.

Thanks everyone who helped by reporting bugs and suggesting new
features.

Cheers!
Sanel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Lisp Devroom at FOSDEM 2015: Call for Participation

2014-11-17 Thread Sanel Zukan
Dear Lispers,

I'm pleased to announce, for the first time, Lisp Devroom @ FOSDEM,
the biggest FLOSS event in Europe, that will be held in Brussels on
January 31st to February 2nd, 2015.

This is a call to propose your talks for FOSDEM.

The topic of the devroom includes all Lisp-inspired dialects,
like Common Lisp, Scheme, Clojure, Emacs Lisp, newLISP, Racket,
GCC-Melt, LFE, Shen & more. Every talk is welcome: from real-world
examples, research projects, unusual ideas to small pet hacks.

FOSDEM is a hacker conference and we would be happy to see more
practical proposals, crazy ideas and open source projects
demonstrations than dry scientific papers (we will leave them for ILC
and ELS :-P).


Important dates
---

* Submission deadlines: 2014-12-14
* Acceptance notifications: 2014-12-28
* Lisp Devroom conference:  2015-01-31 (Saturday)


Submitting proposals


Please use https://penta.fosdem.org/submission/FOSDEM15 to submit your
proposals; you will have to create Pentabarf account unless you
already have one.

When submitting your talk in Pentabarf, make sure to select the
'Lisp devroom' as the 'Track'.


Submission details
--

Your submission should include the following information:

* The title and subtitle of your talk, descriptive as possible
* A short abstract of one paragraph
* A longer description of the talk, if you would like so
* Links to related online material, like pages, blogs, repositories
  and etc.


Devroom mailing list


Please join Lisp devroom mailing list; this will be official
communication channel for the devroom and all further announcements
will be sent there.

* desktops-devr...@lists.fosdem.org

* https://lists.fosdem.org/listinfo/desktops-devroom - mailing list
  and subscription form

  
Planned schedule


Two types of sessions are considered:

* lighting talk - 30 minues
* full presentation - 60 minues

with 5 minutes for the setup between each talk. More details will be
announced on devroom mailing list.


Questions & volunteers
--

Don't hesitate to mail me at 'sanelz [at] gmail [dot] com' in case you
have questions or would like to help with organization (put
'[Lisp-fosdem]' in subject). Also, feel free to use official devroom
mailing list for discussion.

Did I said that there will be video recordings? Yes, video volunteers
are welcome too :)

Please forward this announcement to the relevant lists.

'(Best Regards, Sanel)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Lisp Devroom at FOSDEM 2015: Call for Participation [UPDATED]

2014-11-18 Thread Sanel Zukan
Sorry guys for spamming, I put the wrong mailing list. Now is updated.

->8-

Dear Lispers,

I'm pleased to announce, for the first time, Lisp Devroom @ FOSDEM,
the biggest FLOSS event in Europe, that will be held in Brussels on
January 31st to February 2nd, 2015.

This is a call to propose your talks for FOSDEM.

The topic of the devroom includes all Lisp-inspired dialects,
like Common Lisp, Scheme, Clojure, Emacs Lisp, newLISP, Racket,
GCC-Melt, LFE, Shen & more. Every talk is welcome: from real-world
examples, research projects, unusual ideas to small pet hacks.

FOSDEM is a hacker conference and we would be happy to see more
practical proposals, crazy ideas and open source projects
demonstrations than dry scientific papers (we will leave them for ILC
and ELS :-P).


Important dates
---

* Submission deadlines: 2014-12-14
* Acceptance notifications: 2014-12-28
* Lisp Devroom conference:  2015-01-31 (Saturday)


Submitting proposals


Please use https://penta.fosdem.org/submission/FOSDEM15 to submit your
proposals; you will have to create Pentabarf account unless you
already have one.

When submitting your talk in Pentabarf, make sure to select the
'Lisp devroom' as the 'Track'.


Submission details
--

Your submission should include the following information:

* The title and subtitle of your talk, descriptive as possible
* A short abstract
* A longer description of the talk, if you would like so
* Links to related online material like pages, blogs, repositories
  and etc.


Devroom mailing list


Please join Lisp devroom mailing list; this will be official
communication channel for the devroom and all further announcements
will be sent there.

* lisp-devr...@lists.fosdem.org - mailing list address

* https://lists.fosdem.org/listinfo/lisp-devroom - mailing list
  and subscription form

  
Planned schedule


Two types of sessions are considered:

* lighting talk - 30 minues including discussion
* full presentation - 60 minues including discussion

with 5 minutes for the setup between each talk. More details will be
announced on devroom mailing list.


Questions & volunteers
--

Don't hesitate to mail me at 'sanelz [at] gmail [dot] com' in case you
have questions or would like to help with organization (put
'[Lisp-fosdem]' in subject). Also, feel free to use official devroom
mailing list for discussion.

Did I said that there will be video recordings? Yes, video volunteers
are welcome too :)

Please forward this announcement to the relevant lists.

'(Best Regards, Sanel)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Setting the font size

2016-10-05 Thread Sanel Zukan
Hi Cecil,

Setting fonts under Seesaw isn't the most intuitive option, so you'd
have to dig into Swing core for this and investigate
java.swing.UIManager documentation.

Here is a function that I often use in my applications:

(defn set-font
  "Set default font for the whole Swing application. Make sure
to call it before UI was shown."
  [name size]
  (let [res  (FontUIResource. name Font/PLAIN size)
what ["Button.font" "ToggleButton.font"
  "RadioButton.font" "CheckBox.font"
  "ColorChooser.font" "ComboBox.font"
  "Label.font" "List.font"
  "MenuBar.font" "MenuItem.font"
  "RadioButtonMenuItem.font"
  "CheckBoxMenuItem.font" "Menu.font"
  "PopupMenu.font" "OptionPane.font"
  "Panel.font" "ProgressBar.font"
  "ScrollPane.font" "Viewport.font"
  "TabbedPane.font" "Table.font"
  "TableHeader.font" "TextField.font"
  "PasswordField.font" "TextArea.font"
  "TextPane.font" "EditorPane.font"
  "TitledBorder.font" "ToolBar.font"
  "ToolTip.font" "Tree.font"]]
(doseq [key what]
  (UIManager/put key res

I use it like:

(defn runner []
  (seesaw/native!)
  (seesaw/invoke-later
   (set-font "Sans Serif" 11)
   (seesaw/show! )))

Best,
Sanel

On Wednesday, October 5, 2016 at 10:47:14 AM UTC+2, Cecil Westerhof wrote:
>
> I already asked it on Clojure-seesaw, but the last three months there 
> has been no activity there. So I ask it here also. 
>
> Some time ago I wrote a Clojure program that uses SeeSaw. I just 
> bought a high resolution monitor and now I cannot read the text in my 
> JFrames anymore. How can I increase the default font size? 
>
> I create the frames like: 
>   (let [ 
> ^JFrame 
> other-frm (frame :title "Other"  :on-close 
> :hide:resizable? false) 
>
> I now generate buttons like: 
> ^JButton 
> all-authors   (button :text "All Authors" 
>   :font {:size 25} 
>   :listen [:action (fn [e] (show-all-authors))]) 
>
> But I have to set the font for every label in this way. 
>
> At another part I have: 
>   (grid-bag-layout 
>search-panel 
>:fill  :HORIZONTAL 
>:ipadx 8 
>:ipady 4 
>:gridy i 
>:gridx 0 ^JLabel (label description) 
>:gridx 1 ^JTextField 
>(text  :columns 40 
>   :listen 
>   [:action (fn [e] 
>(let [ 
>  search-str (text e) 
>  ] 
>  (when (not (empty? search-str)) 
>(function search-str 
>   ] 
>
> At the moment I do not know how to set the font there. 
>
> Is there also a way to increase/decrease the fontsize in the whole 
> application. I now have amiddle and high resolution screen. It would 
> be nice if when I put things on the other monitor, the fonts would 
> scale. 
>
> -- 
> Cecil Westerhof 
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Setting the font size

2016-10-06 Thread Sanel Zukan
Cecil Westerhof  writes:
> Two points:
> When using:
> (seesaw/invoke-later
> I get:
> Exception in thread "main" java.lang.RuntimeException: No such
> namespace: seesaw
>
> What do I need to do to get rid of this?

 (require '[seesaw.core :as seesaw])

> Is it possible to increase the font in the title from the window?
> Probably not, because I think that is done by the Operating System.
> But maybe I am wrong.

No; this is OS specific and the only safe option is to manually draw
frame titlebar and borders, handling all mouse/keyboard/DnD events by
yourself.

Other option is to go with frameworks that has this feature, like WebLaF
(http://weblookandfeel.com/).

Best,
Sanel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Setting the font size

2016-10-06 Thread Sanel Zukan
Cecil Westerhof  writes:
> I saw that I already had:
> (use 'seesaw.core)
> and called:
> (invoke-later
>
> So I changed your call also into (invoke-later. Is this OK, or is
> there a reason to do it your way?

That is fine. It is more idiomatic to use 'require' to avoid namespace
conflicts, as explained on 
http://stackoverflow.com/questions/871997/difference-between-use-and-require.

Best,
Sanel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] lein-codeindex 0.1.0 - Easy code indexing and referencing for Emacs, Vim and other editors

2016-12-28 Thread Sanel Zukan
Hi everyone,

I'm happy to announce first version of lein-codeindex, source code indexer
that will scan and reference your project files and all dependencies
used by the project.

This is Leiningen plugin that can generate references for Emacs (with
etags) or Vim and other editors (with ctags).

You can details on github page
(https://github.com/sanel/lein-codeindex) and some common usage in
this post: 
http://acidwords.com/posts/2016-12-29-code-indexing-with-lein-codeindex.html.

Best,
Sanel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] lein-codeindex 0.1.0 - Easy code indexing and referencing for Emacs, Vim and other editors

2016-12-30 Thread Sanel Zukan
Daniel  writes:
> What is the benefit of tags over cider's go to definition functionality or 
> docs functionality?

Plenty of functions comes without docs strings, especially private
ones.

Also, go-to-definition will jump to implementation of current
function/ns only; you are not able to use auto-completion with tags,
symbol regex search (e.g. 'into-*') nor listing all references to
e.g. 'assoc-in' used through the code.

If you are funky enough, you can even integrate tags index with your
zsh/bash shell:

 * https://asciinema.org/a/88088
 * http://vim.wikia.com/wiki/Using_ZSH_completion_with_ctags_and_Vim
 * 
https://robots.thoughtbot.com/silver-searcher-tab-completion-with-exuberant-ctags

Best,
Sanel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] lein-codeindex 0.1.0 - Easy code indexing and referencing for Emacs, Vim and other editors

2016-12-30 Thread Sanel Zukan
Pedro Santos  writes:
> Played around with it and it was pretty cool. Did have to change your code
> to specify a full path for ctags on my machine.

Thanks! I'll add this as TODO for the next version.

> The thing is, when I tried something like namespace/function it didn't
> follow... that would be my main usage I'd say. Any plans to accomplish that?

I'm aware of this problem. This issue is mainly related to ctags/etags
limitations and has been brought up before [1]. For now, maybe you can
try with newer ctags version [2] or adjust $HOME/.ctags with custom
Clojure regular expressions and cut off namespace part (pretty crude
solution).

But the answer is yes, this is in my TODO for one of the next releases.

[1] https://sourceforge.net/p/ctags/bugs/362/
[2] https://ctags.io/

Best,
Sanel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Monitoring Clojure applications in production

2017-07-10 Thread Sanel Zukan
You can try with Riemann (http://riemann.io) as it has few JMX collectors. 
Also, there is riemann-clojure-client 
(https://github.com/riemann/riemann-clojure-client)
that can be integrated with your application to pull custom metrics.

It requires some knowledge (scripting is done in Clojure) to configure, but 
you can use it further as router (or collector) for graphite or even 
forwarder for
tons of services it support.

Best,
Sanel

On Monday, July 10, 2017 at 10:35:33 AM UTC+2, Łukasz Korecki wrote:
>
> Hi all!
>
> I'm wondering how people are getting application performance metrics out 
> of their clojure applications?
> My team is using a combination of collectd for machine/os metrics and 
> statsd instrumentation for application level code (RabbitMQ consumers, http 
> handlers etc).
> All of that data is sent to graphite where we also have alerts etc
>
> My question is more related to instrumenting actual code and JVM metrics - 
> I've seen a JMX plugin for collectd but it's a bit awkward to setup and 
> requires collectd 
> to pull metrics from the application (please let's skip the pull vs push 
> metrics issue for now).
>
> So - my question is how folks do this in the wild? NewRelic? Thousands of 
> nested macros wrapping statsd? Wrapper's around Coda Hale's metrics library?
>
> Thanks!
>
> Łukasz
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Monroe 0.3.0 released

2016-08-05 Thread Sanel Zukan
Monroe, an easy to use Emacs client for Clojure, got a new release. Notable 
changes are:

* Support for ClojureScript stacktraces.
* Allow urls with 'nrepl://' prefix
* Added support for decoding negative numbers in protocol (thanks to 
@technomancy)
* Added support for custom nREPL operators (thanks to @technomancy)

Details about this release you can find on blog post 
(http://acidwords.com/posts/2016-08-05-monroe-0-3-released.html) and 
releases page (https://github.com/sanel/monroe/releases/tag/0.3.0).

Cheers,
Sanel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Could not apply function with keyword

2010-07-19 Thread Sanel Zukan
Hi,

> (apply hash-map :a 1 [:b 2]) or (apply hash-map :a 1 :b 2 nil)

...or we could be more explicit and put:

user=> (apply hash-map :a 1 :b 2 {})
{:a 1, :b 2}

Best.


On Jul 19, 9:00 am, Meikel Brandmeyer  wrote:
> Hi,
>
> On Jul 19, 8:56 am, boyan  wrote:
>
> > I have a question about  apply function.
> > For examle,create a hash map:
>
> > user=> (hash-map :a 1 :b 2)
> > {:a 1, :b 2}
>
> > It works fine,but if i want to use apply:
>
> > user=> (apply hash-map :a 1 :b 2)
> > java.lang.IllegalArgumentException: Don't know how to create ISeq from:
> > java.lang.Integer (NO_SOURCE_FILE:0)
>
> > Why it throw this exception?Is apply could not work with keyword? Any
> > solution?
>
> The last argument to apply has to be a sequence (or a thing you can
> call seq on).
>
> (apply hash-map :a 1 [:b 2]) or (apply hash-map :a 1 :b 2 nil)
>
> Sincerely
> Meikel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: generating a list of random numbers

2010-07-28 Thread Sanel Zukan
> (repeatedly 100 #(rand-int 10))

Hm... on 1.1.:

 user=> (repeatedly 100 #(rand-int 10))
 java.lang.IllegalArgumentException: Wrong number of args passed to:
core$repeatedly (NO_SOURCE_FILE:0)
 user=>

but, could be solved with:

 user=> (take 100 (repeatedly #(rand-int 10)))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Google Summer of Code 2012 Application

2012-04-05 Thread Sanel Zukan
Hi,

Thank you for showing interest, specially for NativeClojure (you already 
got extremely good advices about your second application, related to 
pluggable backend). The one of ideas behind NativeClojure, beside compiling 
Clojure code, were to explore possibility of reusing Java (or whatever 
language) libraries and translating them into binary form; that is why I 
mention VMKit or gcj. This would also make project easier to implement than 
writing own compiler from scratch and when you take into account your 
familiarity with VMKit and LLVM, completing it would be even easier.

However, you can explore another compiling solutions, like already 
mentioned clojure-scheme or compiling it straight to C/C++ code (like 
Ferret does). There is already one proposal about this second approach I 
discussed with interested student via mail.

Regarding to given content of proposal, Aaron already gave you idea about 
formal part. Regarding to VMKit usage, giving two equal options gives 
'focus-less' impression; for example, I would chose one (like compiling 
with J3) and elaborate in details pros and cons and how those cons can be 
minimized, if possible. I will give serious tone to proposal and clear 
understanding what can and will be delivered during summer work.

Sanel

On Wednesday, April 4, 2012 12:51:36 PM UTC+2, Notfonk wrote:
>
> Hi there,
>
> I've been a hobbyist Clojure developer for some time now, and a lurker in 
> the community.
>
> I'm very interrested in participating to the Google Summer of Code on the 
> Clojure team. Clojure is a language that i love, and i would love 
> contributing to it.
>
> My main field of knowledge is in compilation, and two projects exposed on 
> the are of particular interrest to me:
>
>
>- The first is the Pluggable backend 
> Project
> - My application  which 
>i would like to pair with the development of a new backend for 
>ClojureScript.
>- The second is the Native Clojure 
> Project
> - My application 
>
> I've put every detail I've thought of about the way i intend to work 
> through those projects, the understanding i have of the task, and my 
> experience with the problem in each project application.
>
> They are still in draft stage, most notably, the code for some of my 
> projects is not yet online, and so is my personal page.
>
> I'm posting those here now to have a chance to get some feedback before i 
> actually submit the applications.
>
> I know i'm quite late in the application process, i hope it's not too 
> late, because i would really like to work with the clojure/dev team !
>
> Thanks in advance,
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure code optimizer

2012-04-06 Thread Sanel Zukan
This looks really nice; good work!

To force evaluation of lazy constructs, you can use 'doall' and 'dorun'. 
Can you show the snippet with this problem?

Sanel

On Thursday, April 5, 2012 1:19:32 AM UTC+2, Andru Gheorghiu wrote:
>
> Sorry for dropping off the radar, I was caught up in some homework for 
> college. 
> I've written a very simple program for a limited form of constant 
> folding: 
>
> ; Forces evaluation of an expression or returns the expression if 
> ; it can be evaluated 
> (defn force-eval [exprs] 
>   (try (eval exprs) 
> (catch Exception e exprs))) 
>
> ; Recursively evaluates expressions and subexpressions achieving 
> ; constant folding 
> (defn eval-deep [exprs] 
>   (if (not (list? exprs)) 
>   exprs 
>   (let [evaled (force-eval exprs)] 
> (if (list? evaled) 
> (map eval-deep evaled) 
> evaled 
>
> ; Checks if the given argument is a boolean type 
> (defn boolean? [x] 
>   (or (true? x) (false? x))) 
>
> ; Replaces an if for which the test condition is known with the 
> ; corresponding branch (then for true, else for false) 
> (defn replace-if [exprs] 
>   (cond (or (not (list? exprs)) (empty? exprs)) exprs 
> (= (first exprs) 'if) 
>   (if (boolean? (nth exprs 1)) 
> (if (nth exprs 1) 
>   (first (replace-if (drop 2 exprs))) 
>   (first (replace-if (drop 3 exprs 
>   (map replace-if exprs)) 
> :else (map replace-if exprs))) 
>
> ; Combines eval-deep and replace-if 
> (defn optimize [exprs] 
>   (let [reduced (reverse (into nil (eval-deep exprs)))] 
> (replace-if reduced))) 
>
> The basic idea was to use exception handlers to try to evaluate and 
> expression if it can be evaluated and if so, replace it with it's 
> evaluated form. Then recursively apply this function to an expression 
> and, if necessary, all subexpressions. 
> I've also added a function to reduce if statements. Similar functions 
> can be written for cond, condp, case. 
>
> I did have a problem: for some reason my eval-deep function returns a 
> lazy sequence for the expressions that can't be evaluated. This was an 
> inconvenient when I was trying to apply another function (namely 
> replace-if) on the result of eval-deep. To get around this I converted 
> the lazy sequence into a persistent list, but this lead to that ugly 
> application of functions in the let in optimize. How could I have 
> avoided this? 
>
> Andru Gheorghiu 
>
> On Mar 22, 1:41 pm, Andru Gheorghiu  wrote: 
> > Thank you for the responses. I'm looking into the resources you gave 
> > me. 
> > 
> > Andru Gheorghiu 
> > 
> > On Mar 21, 1:16 pm, Sanel Zukan  wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > >  I'm happy to see you are familiar with the subject :) 
> > 
> > > I was thinking that a 
> > 
> > > > similar program forClojurecould detect stack recursive functions and 
> > > > replace them with their iterative counterparts, though this can be 
> > > > somewhat difficult as various loop-holes can arise that would "fool" 
> > > > the program. 
> > 
> > > This isn't a big issue, as recursive functions aren't much advised in 
> > >Clojure. However, ideal solution would be to detect tail calls and 
> rewrite 
> > > block in loop/recur combo. This would allowClojureto fully reuse TCO 
> > > without waiting for JVM to implement it (which will probably never 
> happen). 
> > 
> > > I suppose an approach can be found which makes the best out of both 
> > 
> > > > worlds: a tree shaker and constant folding implementation + an 
> > > > automated program which detects recursions and replaces them with 
> more 
> > > > efficient versions and a rule-based system to cover some cases which 
> > > > the first approach misses. 
> > 
> > > Using all this tasks would impose a bit of work to complete them all. 
> I 
> > > would advise taking smaller steps in form of real tasks, followed with 
> > > rigorous tests. It can look like this: 
> > 
> > >  * constant folding 
> > >  * empty let removal 
> > >  * lambda reduction 
> > >  * TCO 
> > >  * simplification (using Kibit or directly core.logic) 
> > >  * ... 
> > 
> > > If you decide to work on this, for the starting point you can look at 
> > > "optimizer.scm" (from CHICKEN source) which is nicely summarized at 
> [1] and 
&

Re: Google Summer of Code 2012 Application

2012-04-06 Thread Sanel Zukan
No problem :) I'm glad you found something you feel comfortable to complete 
in given timeframe. And good luck with the project.

Sanel

On Friday, April 6, 2012 6:21:09 PM UTC+2, Notfonk wrote:
>
> Sanel, i'm sorry but due to lack of time i prioritized finishing the 
> ClojureScript application. However, in the next few monthes, i'll keep 
> working with VMKit and J3 for my Z3 project, so i will try and AOT compile 
> Clojure (My professor tells me that potentially any Java program should be 
> AOT compilable with J3, but i remain skeptical :) ) and forward the results 
> to you.
>
> On Thursday, April 5, 2012 1:35:05 PM UTC+2, Sanel Zukan wrote:
>>
>> Hi,
>>
>> Thank you for showing interest, specially for NativeClojure (you already 
>> got extremely good advices about your second application, related to 
>> pluggable backend). The one of ideas behind NativeClojure, beside compiling 
>> Clojure code, were to explore possibility of reusing Java (or whatever 
>> language) libraries and translating them into binary form; that is why I 
>> mention VMKit or gcj. This would also make project easier to implement than 
>> writing own compiler from scratch and when you take into account your 
>> familiarity with VMKit and LLVM, completing it would be even easier.
>>
>> However, you can explore another compiling solutions, like already 
>> mentioned clojure-scheme or compiling it straight to C/C++ code (like 
>> Ferret does). There is already one proposal about this second approach I 
>> discussed with interested student via mail.
>>
>> Regarding to given content of proposal, Aaron already gave you idea about 
>> formal part. Regarding to VMKit usage, giving two equal options gives 
>> 'focus-less' impression; for example, I would chose one (like compiling 
>> with J3) and elaborate in details pros and cons and how those cons can be 
>> minimized, if possible. I will give serious tone to proposal and clear 
>> understanding what can and will be delivered during summer work.
>>
>> Sanel
>>
>> On Wednesday, April 4, 2012 12:51:36 PM UTC+2, Notfonk wrote:
>>>
>>> Hi there,
>>>
>>> I've been a hobbyist Clojure developer for some time now, and a lurker 
>>> in the community.
>>>
>>> I'm very interrested in participating to the Google Summer of Code on 
>>> the Clojure team. Clojure is a language that i love, and i would love 
>>> contributing to it.
>>>
>>> My main field of knowledge is in compilation, and two projects exposed 
>>> on the are of particular interrest to me:
>>>
>>>
>>>- The first is the Pluggable backend 
>>> Project<http://dev.clojure.org/display/community/Google+Summer+of+Code+2012#GoogleSummerofCode2012-Pluggablebackend>
>>> - My application <http://raph-amiard.github.com/ClojureScript.html> 
>>> which 
>>>i would like to pair with the development of a new backend for 
>>>ClojureScript.
>>>- The second is the Native Clojure 
>>> Project<http://dev.clojure.org/display/community/Google+Summer+of+Code+2012#GoogleSummerofCode2012-NativeClojure>
>>> - My application <http://raph-amiard.github.com/NativeClojure.html>
>>>
>>> I've put every detail I've thought of about the way i intend to work 
>>> through those projects, the understanding i have of the task, and my 
>>> experience with the problem in each project application.
>>>
>>> They are still in draft stage, most notably, the code for some of my 
>>> projects is not yet online, and so is my personal page.
>>>
>>> I'm posting those here now to have a chance to get some feedback before 
>>> i actually submit the applications.
>>>
>>> I know i'm quite late in the application process, i hope it's not too 
>>> late, because i would really like to work with the clojure/dev team !
>>>
>>> Thanks in advance,
>>>
>>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure code optimizer

2012-04-06 Thread Sanel Zukan
Very good solution :)

To continue this discussion, feel free to mail me; we will also reduce some 
noise here on the list.

Sanel

On Friday, April 6, 2012 6:47:37 PM UTC+2, Andru Gheorghiu wrote:
>
> It's ok now. The problem was in the let of the optimize function... 
> initially I had: 
>   (let [reduced (reverse (into nil (eval-deep exprs)))] 
> because exprs was a lazy sequence and I wanted to turn it into a list. 
> I replaced the "(reverse (into nil ..." part with "(apply list ..." 
> and it works just fine :) 
>
> The problem is that this implementation doesn't account for variable 
> scoping, I need to fix that. 
> For example if I have 
>
> (def n 10) 
> (let [ n 5 ] (+ (+ n 6) something)) 
>
> If i try to optimize the let it will return 
>
> (let [ n 5 ] (+ 16 something)) 
>
> Because it uses the global n defined outside the let. 
>
> Andru Gheorghiu 
>
> On Apr 6, 10:56 am, Sanel Zukan  wrote: 
> > This looks really nice; good work! 
> > 
> > To force evaluation of lazy constructs, you can use 'doall' and 'dorun'. 
> > Can you show the snippet with this problem? 
> > 
> > Sanel 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Thursday, April 5, 2012 1:19:32 AM UTC+2, Andru Gheorghiu wrote: 
> > 
> > > Sorry for dropping off the radar, I was caught up in some homework for 
> > > college. 
> > > I've written a very simple program for a limited form of constant 
> > > folding: 
> > 
> > > ; Forces evaluation of an expression or returns the expression if 
> > > ; it can be evaluated 
> > > (defn force-eval [exprs] 
> > >   (try (eval exprs) 
> > > (catch Exception e exprs))) 
> > 
> > > ; Recursively evaluates expressions and subexpressions achieving 
> > > ; constant folding 
> > > (defn eval-deep [exprs] 
> > >   (if (not (list? exprs)) 
> > >   exprs 
> > >   (let [evaled (force-eval exprs)] 
> > > (if (list? evaled) 
> > > (map eval-deep evaled) 
> > > evaled 
> > 
> > > ; Checks if the given argument is a boolean type 
> > > (defn boolean? [x] 
> > >   (or (true? x) (false? x))) 
> > 
> > > ; Replaces an if for which the test condition is known with the 
> > > ; corresponding branch (then for true, else for false) 
> > > (defn replace-if [exprs] 
> > >   (cond (or (not (list? exprs)) (empty? exprs)) exprs 
> > > (= (first exprs) 'if) 
> > >   (if (boolean? (nth exprs 1)) 
> > > (if (nth exprs 1) 
> > >   (first (replace-if (drop 2 exprs))) 
> > >   (first (replace-if (drop 3 exprs 
> > >   (map replace-if exprs)) 
> > > :else (map replace-if exprs))) 
> > 
> > > ; Combines eval-deep and replace-if 
> > > (defn optimize [exprs] 
> > >   (let [reduced (reverse (into nil (eval-deep exprs)))] 
> > > (replace-if reduced))) 
> > 
> > > The basic idea was to use exception handlers to try to evaluate and 
> > > expression if it can be evaluated and if so, replace it with it's 
> > > evaluated form. Then recursively apply this function to an expression 
> > > and, if necessary, all subexpressions. 
> > > I've also added a function to reduce if statements. Similar functions 
> > > can be written for cond, condp, case. 
> > 
> > > I did have a problem: for some reason my eval-deep function returns a 
> > > lazy sequence for the expressions that can't be evaluated. This was an 
> > > inconvenient when I was trying to apply another function (namely 
> > > replace-if) on the result of eval-deep. To get around this I converted 
> > > the lazy sequence into a persistent list, but this lead to that ugly 
> > > application of functions in the let in optimize. How could I have 
> > > avoided this? 
> > 
> > > Andru Gheorghiu 
> > 
> > > On Mar 22, 1:41 pm, Andru Gheorghiu  wrote: 
> > > > Thank you for the responses. I'm looking into the resources you gave 
> > > > me. 
> > 
> > > > Andru Gheorghiu 
> > 
> > > > On Mar 21, 1:16 pm, Sanel Zukan  wrote: 
> > 
> > > > >  I'm happy to see you are familiar with the subject :) 
> > 
> > > > > I was thinking that a 
> > 
> > > > > > similar program forClojurecould detect stack rec

Re: [ANN] analyze 0.1.3

2012-04-10 Thread Sanel Zukan
Congrats!

I'm just curious: reading your example on gist, (ast [1 2]) will yield 
'{:op :constant, :env {:locals {}, :ns {:name analyze.core}}, :val (1 2)}'. 
After downloading 0.1.4 version and running (ast '(1 2)), I'm getting the 
same; is it possible to get object type as part of output, e.g. in first 
case vector and in second list or better say PersistentVector and 
PersistentList?

Sanel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] analyze 0.1.3

2012-04-10 Thread Sanel Zukan
Hi,

Hm, look at the following output:

user=> (= (->> '(1 2) ast :val class)
   (->>  [1 2] ast :val class))
true
user=>

This is intended (both will return LazySeq as type)?

Greetings,
Sanel

On Tuesday, April 10, 2012 3:16:33 PM UTC+2, Ambrose Bonnaire-Sergeant 
wrote:
>
> Hi Sanel,
>
> Testing the class of the :val entry will provide that information.
>
> Thanks,
> Ambrose
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: ANN: Clojure/dev Google Summer of Code 2012 Proposals Selected!

2012-04-24 Thread Sanel Zukan
> These proposals were selected as they not only had the best overall
> score as determined by the mentoring group

I'm just curious: "Improved Clojars System" was rejected but is the second 
one with highest scores in the list?

Sanel

On Tuesday, April 24, 2012 5:03:02 AM UTC+2, David Nolen wrote:
>
> Congratulations to the following students, their proposals have been
> accepted for Clojure/dev's Google Summer of Code 2012!
>
> Jon Rose
>   - Lightweight Clojure editor
> Raphael Amiard
>   - Pluggable backend infrastructure for ClojureScript
> Alexander Yakushev
>   - Toolchain for dynamic Clojure development on Android
> Ambrose Bonnaire-Sargeant
>   - Typed Clojure
> 
> These proposals were selected as they not only had the best overall
> score as determined by the mentoring group but we believe that they
> will have a significant impact and are likely to be embraced and
> extended by the Clojure community. We received many proposals we
> wished to pursue but as a first year organization we feel pretty lucky
> to have been given four slots and we're confident that these
> four will keep everyone quite busy.
>
> We look forward to collaborating as a whole community with these
> students this summer. Collectively let's try our best to
> make sure these projects succeed! Doing so will improve our
> chances to be accepted as a mentoring organization next year and to
> accommodate an even larger number of proposals.
>
> A big cheers to the Clojure community, this is going to be a fun summer!
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Help getting Clojure/Leiningen 2.0 building with LWJGL

2012-07-11 Thread Sanel Zukan
Try to add in project.clj:
  
   :jvm-opts ["-Djava.library.path=native/linux"])

where it will point to folder with OS specific libraries.

Regards,
Sanel

On Monday, July 9, 2012 4:26:05 AM UTC+2, Karl Smeltzer wrote:
>
> Is anybody willing and able to walk me through getting a simple project 
> compiling which correctly manages all the dependencies required by LWJGL 
> [1]? It seems that Leiningen's handling of native dependencies has changed 
> over time and so much of the already scant information on the web is no 
> longer correct or functioning. I'm using the latest prerelease of Leiningen 
> 2.0 as recommended on the download page.
>
> Things I've already done:
> 1. Sticking [org.lwjgl.lwjgl/lwjgl "2.8.4"] in my project.clj which causes 
> this files to be downloaded as expected.
> 2. Created a directory named "native" in the project root and copied the 
> native library files (*.so, *.dll, etc.) into it.
> 3. Added :native-path "native" to my project.clj, although I'm not sure 
> this is correct or working the way I expect
>
> This allows me to import the parts of the library that don't link against 
> the native libraries, but not those that do. Help please!
>
> [1] http://www.lwjgl.org/
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: implement a shell in repl

2011-09-20 Thread Sanel Zukan
I had quite similar task, integrating custom shell with clojure repl,
where all expressions between parenthesis
were interpreted as clojure code and rest as custom shell programs.

The best way to do this is to explore (clojure.main/repl) function.
One of the parameters will be :eval function; there clojure repl will
send
all expressions for evaluation. It could look like this:

(defn evaluate [expr]
  (if (re-find #"^(.*)$" expr)
(eval expr)
;; here you call some java code for executing system commands
;; like (.exec (Runtime/getRuntime) expr) or something like that
) )

(clojure.main/repl
:eval evaluate)

With clojure.main/repl you can do even more: write custom input,
output and such. Feel free to explore it ;)

Sanel

On Sep 20, 9:38 am, jaime  wrote:
> Hi guys,
>
> I want to implement a shell on top of REPL but without any ideas on
> how to do it. Could you please suggest?
>
> What I want is something that can let user do things like:
>     1. in REPL, user enter "(myshell)" (or some other command name)
>     2. then a prompt string will show up so that user can interact
> with Clojure
>     3. built-in commands support is possible
>     4. prompt for user input is possible (I think this is the most
> import part that I want, but I don't know how I can make REPL prompts
> a user input...)
>     5. real Clojure form can be dispatch to REPL and the shell can
> show the result returned by REPL
>
> is there any project already on this, or is it possible to implement
> it in some kind of ways??
>
> Thanks,
> Jaime

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


ANN: Hubris 0.1.0 released

2012-01-17 Thread Sanel Zukan
Hi all,

I'm pleased to announce initial release of Hubris, HBase alternative
shell[1].

The main aim of hubris is to address hbase shell weakness, providing
solid ground for writing extensions using simple DSL and extending
shell features in directions other than HBase authors intended.

Clojure users can find it interest as hubris reuses clojure facilities
(REPL and documentation system) for mimicking hbase shell, providing
two modes:

 * plain - run commands as you did in hbase shell
 * clojure mode - gives you access to clojure REPL

As this is initial release, not all hbase shell commands are
implemented which is planned to be done in the next release. Feel free
to play with it and please let me know (or fill a bug report [2]) in
case you find some oddities.

Sanel

[1] https://github.com/sanel/hubris
[2] https://github.com/sanel/hubris/issues

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ANN: Hubris 0.1.0 released

2012-01-18 Thread Sanel Zukan
Thank you for the supporting comment. Glad I'm not the only one seeing
needs for alternative in this field :)

Regards.

On Jan 17, 5:05 pm, Marc Limotte  wrote:
> Nice contribution, Sanel.  The hbase ruby shell was in need of a
> alternative, and Clojure's DSL capabilities will be of great use.
>
>
>
>
>
>
>
> On Tue, Jan 17, 2012 at 10:44 AM, Sanel Zukan  wrote:
> > Hi all,
>
> > I'm pleased to announce initial release of Hubris, HBase alternative
> > shell[1].
>
> > The main aim of hubris is to address hbase shell weakness, providing
> > solid ground for writing extensions using simple DSL and extending
> > shell features in directions other than HBase authors intended.
>
> > Clojure users can find it interest as hubris reuses clojure facilities
> > (REPL and documentation system) for mimicking hbase shell, providing
> > two modes:
>
> >  * plain - run commands as you did in hbase shell
> >  * clojure mode - gives you access to clojure REPL
>
> > As this is initial release, not all hbase shell commands are
> > implemented which is planned to be done in the next release. Feel free
> > to play with it and please let me know (or fill a bug report [2]) in
> > case you find some oddities.
>
> > Sanel
>
> > [1]https://github.com/sanel/hubris
> > [2]https://github.com/sanel/hubris/issues
>
> > --
> > 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 post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure for Cocoa

2012-01-26 Thread Sanel Zukan
LOL, clojure-py is the project I was planning for some time. I'm very
glad someone started it first :)

Will be any wiki pages or mailing list any time soon so interest
parties could get into current internals and planned roadmap?

Thanks,
Sanel

On Jan 24, 3:37 pm, Timothy Baldridge  wrote:
> > Clojure in Clojure would be a nice start to have e.g. a LLVM frontend.
> > But it's really quiet as far as CiC goes, right?
>
> It should be mentioned that writing a Clojure compiler is not a very
> long task it basically comes down to the following tasks:
>
> 1) Implement the persistent classes (PersistentList, PersistentHashMap, etc.)
> 2) Implement the LispReader
> 3) Implement the Compiler
> 4) Start fixing bugs in core.clj
>
> About a month ago I started implementing Clojure on the Python VM.
> It's still in pre-alpha, but the current system can compile and run
> over 500 lines of clojure's core.clj.
> (https://github.com/halgari/clojure-py)
>
> Now, the fun part is adapting the "clojure-jvm way" of doing things to
> a system that your tool-chain prefers. So, for instance, in Java we
> have Namespace.java to handle namespace creation, and tracking. But in
> Python the module system works perfectly fine for us. So
> clojure.lang.Namespace doesn't even exist in clojure-py. Other clojure
> functions such as "cast" have absolutely no use at all in clojure-py
> and are therefore removed. However, other functions like "vec" are
> implemented in pure clojure code in clojure-py, while they are
> implemented in java code in clojure-jvm
>
> So next we have to ask a different question, do you want your
> clojure-objc compiler to depend on java to run? This is what
> clojurescript does. It does not have a compiler written in javascript.
> Instead the compiler is written Java, and this compiler outputs
> javascript. This means that all clojurescript macros must be
> compile-able by clojure-jvm, while the rest of the code has to be
> clojurescript compatible. In clojure-py the compiler is written in
> python, and is completely independent from clojure-jvm
>
> Finally you'll need to research how hard it is to get llvm to
> interface with the objc runtime. So if I say this in clojure:
>
> (instance? clojure.lang.IPersistentList x)
>
> What llvm functions will you call to a) find
> clojure.lang.IPersistentList and b) how will you determine the class
> of x.
>
> Some things to think about,
>
> 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


Re: Google Summer of Code 2012 - any mentors?

2012-02-29 Thread Sanel Zukan
Another two ideas were added :) (Native Clojure and Code optimizer).

Hoping readers will not mind for putting myself as mentor on one of
them, but if there are better candidates, feel free to take it :) I
did a little bit gcj + Clojure playing and I'm eager to see native
Clojure without jvm.

Although I did some exploring on possible optimization techniques, I'm
leaving mentor section on Optimizer empty as there are probably more
experienced colleagues in this field.

Regards,
Sanel



On Feb 26, 6:19 pm, David Nolen  wrote:
> http://dev.clojure.org/display/community/Google+Summer+of+Code+2012
>
> Please submit more project ideas :)
>
> David
>
> On Sun, Feb 26, 2012 at 6:15 AM, Alexander Yakushev 
>
>
>
>
>
>
> > wrote:
> > So the application submiting procedure for organizations starts
> > tomorrow but sadly there isn't any word about it at least on
> > Confluence. There are willing mentors on the clojure-dev list and
> > ideas to submit but as far as I understood from the GSOC site an
> > organization must apply to host all these project ideas and
> > subsequently assign mentors.
>
> > Here's how a mentoring organization should apply (may save some time):
>
> >http://www.google-melange.com/gsoc/document/show/gsoc_program/google/...
> > .
> > Here's an example of the idea list for GSOC:
> >http://community.kde.org/GSoC/2011/Ideas
>
> > Hopefully we will see Clojure as a mentoring organization for the
> > Clojure itself and third-party projects too. As you can see, there are
> > students who would like to jump in the development and Clojure
> > community could make use of them.
>
> > --
> > 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 post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: classpath issues

2012-03-06 Thread Sanel Zukan
If you are going to play with feedparser-clj from repl, maybe the best way 
would be to run 'lein repl' inside feedparser-clj folder you just 
downloaded. In this case, lein would automatically setup classpath for you.

However, if you are planning to use it inside your project, create it with 
'lein new ' and add [org.clojars.scsibug.feedparser-clj 
"0.3"] inside project.clj file.

Sanel

On Tuesday, March 6, 2012 4:36:41 PM UTC+1, Bob wrote:
>
> I am new to clojure.  I am just trying to install and use feedparser-

 

>
> clj.  I ran "lein install" and it said it completed ok. 
>
> >git clone git://github.com/scsibug/feedparser-clj.git 
> >cd feedparser-clj/ 
> >lein install 
> ... 
> Compiling feedparser-clj.core 
> Compilation succeeded. 
> Created /Users/bstewart/feedparser-clj/feedparser-clj-0.3.jar 
> Wrote pom.xml 
> [INFO] Installing /Users/bstewart/feedparser-clj/feedparser- 
> clj-0.3.jar to /Users/bstewart/.m2/repository/org/clojars/scsibug/ 
> feedparser-clj/0.3/feedparser-clj-0.3.jar 
>
> But when I try to use the library in clojure repl, it fails with 
> following error: 
>
> Clojure 1.2.0 
> user=> (ns user (:use feedparser-clj.core) (:require 
> [clojure.contrib.string :as string])) 
> java.io.FileNotFoundException: Could not locate feedparser_clj/ 
> core__init.class or feedparser_clj/core.clj on classpath: 
> (NO_SOURCE_FILE:1) 
>
> So seems it is a classpath error but I am also new to java so how can 
> I check that class path is ok?  I dont have any $CLASSPATH variable 
> set AFAIK.  I tried: 
>
> >export CLASSPATH=$CLASSPATH:/
> But that had no effect, still got same error in REPL. 
>
> Thanks 
> Bob


On Tuesday, March 6, 2012 4:36:41 PM UTC+1, Bob wrote:
>
> I am new to clojure.  I am just trying to install and use feedparser- 
> clj.  I ran "lein install" and it said it completed ok. 
>
> >git clone git://github.com/scsibug/feedparser-clj.git 
> >cd feedparser-clj/ 
> >lein install 
> ... 
> Compiling feedparser-clj.core 
> Compilation succeeded. 
> Created /Users/bstewart/feedparser-clj/feedparser-clj-0.3.jar 
> Wrote pom.xml 
> [INFO] Installing /Users/bstewart/feedparser-clj/feedparser- 
> clj-0.3.jar to /Users/bstewart/.m2/repository/org/clojars/scsibug/ 
> feedparser-clj/0.3/feedparser-clj-0.3.jar 
>
> But when I try to use the library in clojure repl, it fails with 
> following error: 
>
> Clojure 1.2.0 
> user=> (ns user (:use feedparser-clj.core) (:require 
> [clojure.contrib.string :as string])) 
> java.io.FileNotFoundException: Could not locate feedparser_clj/ 
> core__init.class or feedparser_clj/core.clj on classpath: 
> (NO_SOURCE_FILE:1) 
>
> So seems it is a classpath error but I am also new to java so how can 
> I check that class path is ok?  I dont have any $CLASSPATH variable 
> set AFAIK.  I tried: 
>
> >export CLASSPATH=$CLASSPATH:/
> But that had no effect, still got same error in REPL. 
>
> Thanks 
> Bob


On Tuesday, March 6, 2012 4:36:41 PM UTC+1, Bob wrote:
>
> I am new to clojure.  I am just trying to install and use feedparser- 
> clj.  I ran "lein install" and it said it completed ok. 
>
> >git clone git://github.com/scsibug/feedparser-clj.git 
> >cd feedparser-clj/ 
> >lein install 
> ... 
> Compiling feedparser-clj.core 
> Compilation succeeded. 
> Created /Users/bstewart/feedparser-clj/feedparser-clj-0.3.jar 
> Wrote pom.xml 
> [INFO] Installing /Users/bstewart/feedparser-clj/feedparser- 
> clj-0.3.jar to /Users/bstewart/.m2/repository/org/clojars/scsibug/ 
> feedparser-clj/0.3/feedparser-clj-0.3.jar 
>
> But when I try to use the library in clojure repl, it fails with 
> following error: 
>
> Clojure 1.2.0 
> user=> (ns user (:use feedparser-clj.core) (:require 
> [clojure.contrib.string :as string])) 
> java.io.FileNotFoundException: Could not locate feedparser_clj/ 
> core__init.class or feedparser_clj/core.clj on classpath: 
> (NO_SOURCE_FILE:1) 
>
> So seems it is a classpath error but I am also new to java so how can 
> I check that class path is ok?  I dont have any $CLASSPATH variable 
> set AFAIK.  I tried: 
>
> >export CLASSPATH=$CLASSPATH:/
> But that had no effect, still got same error in REPL. 
>
> Thanks 
> Bob

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: idiomatic list-ify

2012-03-09 Thread Sanel Zukan
Not sure what kind of input you can get, but apply-ing list only on strings 
would decompose them, so your function can be written as:

(defn ls [x]
   (cond
 (string? x)
   (apply list (list x))
 :else
   (apply list x

as '(apply list nil)' will yield '().

Or, you can write it more lispy:

(defn ls [x]
  (apply list (if (string? x)
 (list x)
  x)))

On Thursday, March 8, 2012 7:28:12 PM UTC+1, Brandon Harvey wrote:
>
> Hi,
>
> I'm seeking a small & idiomatic function that will take input and ensure 
> it's wrapped in a list.  If nil, I'd like the list to be empty.  If the 
> input is already a list, I don't want to wrap it in another list layer.  So:
>
>   "hi"   => ("hi")
>   nil=> ()
>   ("hi") => ("hi")
>
>  (list '("hi")) => (("hi"))  ; bad
>  (apply list "hi")  => (\h \i)   ; bad
>
> So I've ended up writing the function with a conditional, like so.  Is 
> there a tidier way?
>
> (defn ls [x] (cond (list? x) (apply list x) 
>(nil? x)  '() 
>:else (list x)))
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Which emacs packages?

2012-03-13 Thread Sanel Zukan
Or Evil (http://gitorious.org/evil) >:)

On Monday, March 12, 2012 8:03:52 PM UTC+1, Sean Devlin wrote:
>
> vim :-p
>
> On Thursday, March 8, 2012 12:10:15 PM UTC-5, AndyK wrote:
>>
>> Curious about which emacs packages folks use for increased Clojure 
>> productivity (beyond the obvious, like slime/swank-clojure)...
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure code optimizer

2012-03-19 Thread Sanel Zukan
Hi Andru and thank you for expressing interest in this proposal.
 

> Could you please give more details (or examples) on the types of 
> optimizations the optimizer should be able to do? Also, what is a tree 
> shaker implementation?
>

As David wrote, this is dead code elimination and in LISP world is also 
known as tree shaking. Contrary to pattern matching (for which you 
expressed desire), dead code elimination is usually more advanced approach, 
sometimes requiring passing through the code multiple times, inspecting 
compiler facilities or simply doing a bunch of tricks to remove obvious and 
not so obvious unused code.

Take this example:

  (defonce *always-true* true)
  (if *always-true*
 (println "Always executed")
 (println "Never executed"))

Matching this case could be hard for pattern matching tools; they often do 
not understand the content outside given pattern. True optimizer would pick 
up *always-true* and notice it will never be changed for this block. 
However, if I do some weird magic inside some function and globally change 
the value of *always-true* at some point, optimizer should recognize this 
case or would remove valid code.

Also, often case for optimizers is to precompute simple expressions in 
compilation phase yielding static values, like:

  (let [a 0
 b (+ a 1)]
(if something
  b))

here it could rewrite whole block as:

 (if something
   1)

or even can recognize Clojure patterns like:

 (apply + (range 1 10))

where the pattern matching approach could rewrite expression to (+ 1 2 3 4 
5 6 ... 9) and optimizer would simply produce 45. Using this case you can 
see how pattern matching can be a part of optimizer.

I'm hoping I manage to fully describe you an idea behind this proposal. Of 
course, taking some expert system approach and doing Kibit-style matching 
can be a good starting point too :)

Also, if you are interested to take tree shaking way, a good starting point 
can be SBCL alpha shaker at http://jsnell.iki.fi/tmp/shake.lisp. 
Unfortunately without documentation, but the code is quite easy to follow.

Sanel

On Saturday, March 17, 2012 10:59:44 PM UTC+1, Andru Gheorghiu wrote:
>
> Hello, 
>
> I am a third year student majoring in computer science and I am 
> interested in the Clojure code optimizer project proposed for GSoC 
> 2012. Could you please give more details (or examples) on the types of 
> optimizations the optimizer should be able to do? Also, what is a tree 
> shaker implementation? 
> I was thinking that an optimizer could be implemented as a rule engine 
> similar to Jess or CLIPS in which rules contains patterns which need 
> to be replaced and the code to replace them with. For example one 
> could write patterns for generic linear recursive functions that 
> should be replaced with linear iterative functions. Similarly patterns 
> can be written for functions which replicate the behavior of an 
> already existing function (such as reverse, map, apply etc) and a rule 
> to replace those functions with the predefined ones. 
>
> Thank you, 
> Andru Gheorghiu 
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure code optimizer

2012-03-21 Thread Sanel Zukan
 I'm happy to see you are familiar with the subject :)

I was thinking that a 
> similar program for Clojure could detect stack recursive functions and 
> replace them with their iterative counterparts, though this can be 
> somewhat difficult as various loop-holes can arise that would "fool" 
> the program. 
>

This isn't a big issue, as recursive functions aren't much advised in 
Clojure. However, ideal solution would be to detect tail calls and rewrite 
block in loop/recur combo. This would allow Clojure to fully reuse TCO 
without waiting for JVM to implement it (which will probably never happen).

I suppose an approach can be found which makes the best out of both 
> worlds: a tree shaker and constant folding implementation + an 
> automated program which detects recursions and replaces them with more 
> efficient versions and a rule-based system to cover some cases which 
> the first approach misses.
>

Using all this tasks would impose a bit of work to complete them all. I 
would advise taking smaller steps in form of real tasks, followed with 
rigorous tests. It can look like this:

 * constant folding
 * empty let removal
 * lambda reduction
 * TCO
 * simplification (using Kibit or directly core.logic)
 * ...

If you decide to work on this, for the starting point you can look at 
"optimizer.scm" (from CHICKEN source) which is nicely summarized at [1] and 
Egi's code [2]. Both of them applies common techniques in quite readable 
manner. Of course, if someone else have additional resource, please share 
it :)

Sanel

[1] 
http://wiki.call-cc.org/chicken-internal-structure#the-optimizer-optimizerscm
[2] https://bitbucket.org/egi/compiler/src

On Tuesday, March 20, 2012 7:30:41 PM UTC+1, Andru Gheorghiu wrote:
>
> Thank you for the clarifications and the resources, I understand now 
> what tree shaking is. In fact, I had a project last year at our 
> college to implement (in Scheme) a constant folding optimizer for 
> Scheme programs, I now see the resemblance with what you described. 
> The program would optimize functions like: 
>
> (define some-function 
> (lambda (x) 
>  (if (> x (+ 2 4)) 
> (- 7 (car ‘(1 2 3))) 
> (cons x 4))) 
>
> Turning it into 
>
> (define some-function 
> (lambda (x) 
>(if (> x 6) 
>6 
>(cons x 4 
>
> Also, when finding conditional statements in which the test condition 
> is known (can be evaluated) to replace it with the code which runs on 
> the appropriate branch. For example, replacing: 
>
> (if (or #f #t) 
> then-code 
> else-code) 
>
> With 
>
> then-code 
>
> Same thing for cond. 
>
> Another part of the project was to classify recursive functions into 
> stack recursive, tree recursive or iterations. I was thinking that a 
> similar program for Clojure could detect stack recursive functions and 
> replace them with their iterative counterparts, though this can be 
> somewhat difficult as various loop-holes can arise that would "fool" 
> the program. 
> I suppose an approach can be found which makes the best out of both 
> worlds: a tree shaker and constant folding implementation + an 
> automated program which detects recursions and replaces them with more 
> efficient versions and a rule-based system to cover some cases which 
> the first approach misses. 
>
> Andru Gheorghiu 
>
> On Mar 20, 1:31 am, Sanel Zukan  wrote: 
> > Hi Andru and thank you for expressing interest in this proposal. 
> > 
> > > Could you please give more details (or examples) on the types of 
> > > optimizations the optimizer should be able to do? Also, what is a tree 
> > > shaker implementation? 
> > 
> > As David wrote, this is dead code elimination and in LISP world is also 
> > known as tree shaking. Contrary to pattern matching (for which you 
> > expressed desire), dead code elimination is usually more advanced 
> approach, 
> > sometimes requiring passing through the code multiple times, inspecting 
> > compiler facilities or simply doing a bunch of tricks to remove obvious 
> and 
> > not so obvious unused code. 
> > 
> > Take this example: 
> > 
> >   (defonce *always-true* true) 
> >   (if *always-true* 
> >  (println "Always executed") 
> >  (println "Never executed")) 
> > 
> > Matching this case could be hard for pattern matching tools; they often 
> do 
> > not understand the content outside given pattern. True optimizer would 
> pick 
> > up *always-true* and notice it will never be changed for this block. 
> > However, if I do some weird magic inside some function and