On Sat, Jan 31, 2009 at 8:26 PM, Onorio Catenacci <catena...@gmail.com> wrote: > > Hi all, > > I feel like a bloody noob for having to ask this (I've been coding C++ > for years but Clojure, Lisp and Java are all new territory for me) but > I'm missing something obvious and basic here and I'm still struggling > with the syntax a bit. > > I'm trying to learn clojure by simply translating an example app from > the Apache POI project. I'm attempting to create a dummy Excel > spreadsheet. The code below is cut down a bit from the code I'm > trying to run; I'm just trying to demonstrate the issue that I'm > having. > > This code compiles just fine but when I run it, I see all of the > println message except "In init-sheet". So it looks like init-sheet > is never getting called. Would someone please give me a little > guidance as to why the function is not getting invoked? Is this > something to do with lazy evaluation? > > **** > ;; calendardemo > ;; 29 January 2009 > ;; Onorio Catenacci > > ;Clojure version of CalendarDemo app originally done by Yegor Kozlov > ;Define namespace for app and include needed libraries > (ns name.catenacci.calendardemo > (:import (org.apache.poi.xssf.usermodel)) > (:import (org.apache.poi.ss.util CellRangeAddress)) > (:import (org.apache.poi.ss.usermodel)) > (:import (org.apache.poi.ss.usermodel Font)) > (:import (org.apache.poi.hssf.usermodel HSSFWorkbook)) > (:import (java.util Calendar)) > (:import (java.io FileOutputStream)) > ) > > (def debugging true) > ;Constant for days of the week > (def days > ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]) > (if debugging (println days)) > > ;Constant for months > (def months > ["January","February","March","April","May","June","July","August","September","October","November","December"]) > (if debugging (println months)) > > > ;hold the main calendar instance > (def cal (. Calendar getInstance)) > (if debugging (println cal)) > > ;now create a workbook instance > (def wb (HSSFWorkbook.)) > (if debugging (println wb)) > > > ;initialize the various worksheets > (defn init-sheet > #^{:doc "Initialize a worksheet with a particular month"} > ([current-month]
What are you trying to achieve with the previous line? > (if debugging (println "In init-sheet")) > ) > ) > > ;For my own reference--this is an example of a Clojure sequence > comprehension > (for [current-month [months]] I think you want the previous line to be: (for [current-month months] > (let [current-sheet (init-sheet current-month)]) > ) -- R. Mark Volkmann Object Computing, Inc. --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---