Skip to main content

Javier Neira's Library tagged tutorial   View Popular

01 Dec 09

The Continuation Monad in Clojure

  • (defn func-a [x]
    (inc x))

    (defn func-b [x]
    (* 2 x))

    (defn func-c [x]
    (dec x))

    (defn fn1 [x]
    (let [a (func-a x)
    b (func-b a)
    c (func-c b)]
    c))
  • Also note that fn1 could have been defined like:

    (def fn1 (comp func-c func-b func-a))
  • 6 more annotations...

Working in Java time - JavaWorld

1. Java reckons time in milliseconds before or after the start of January 1, 1970.
2. The Date class's constructor Date() returns an object that represents the moment the object was created. Date's getTime() method returns a long value whose number equals the number of milliseconds before or after January 1, 1970.
3. The DateFormat class is used to convert Dates to Strings, and vice versa. The static getDateInstance() method returns a DateFormat object in the default format; the getDateInstance(DateFormat.FIELD) returns a DateFormat object with a specified format. The format(Date d) method returns a String that represents the date, such as "January 1, 2002." Conversely, the parse(String s) method returns a Date object based on the date the String argument represents.
4. The appearance of Strings returned by the format() method can vary according to the regional settings on the computer where the program is being run.
5. The GregorianCalendar class has two important constructors: GregorianCalendar(), which returns an object that represents the moment it was created, and the GregorianCalendar(int year, int month, int date) constructor used to create an object that represents an arbitrary date. The GregorianCalendar class's getTime() method returns a Date object. The add(int field, int amount) method calculates dates by adding or subtracting units of time like days, months, or years.

www.javaworld.com/...jw-0330-time.html - Preview

java date format time tutorial handling

    • This article builds on the information presented in my Calculating Java Dates article (JavaWorld, December 29, 2000). Here I've listed some key points from that article that should be familiar to you. If these points are
      not clear to you, I recommend that you read "Calculating Java Dates" for further explanation.



      1. Java reckons time in milliseconds before or after the start of January 1, 1970.
      2. The Date class's constructor Date() returns an object that represents the moment the object was created. Date's getTime() method returns a long value whose number equals the number of milliseconds before or after January 1, 1970.
      3. The DateFormat class is used to convert Dates to Strings, and vice versa. The static getDateInstance() method returns a DateFormat object in the default format; the getDateInstance(DateFormat.FIELD) returns a DateFormat object with a specified format. The format(Date d) method returns a String that represents the date, such as "January 1, 2002." Conversely, the parse(String s) method returns a Date object based on the date the String argument represents.
      4. The appearance of Strings returned by the format() method can vary according to the regional settings on the computer where the program is being run.
      5. The GregorianCalendar class has two important constructors: GregorianCalendar(), which returns an object that represents the moment it was created, and the GregorianCalendar(int year, int month, int date) constructor used to create an object that represents an arbitrary date. The GregorianCalendar class's getTime() method returns a Date object. The add(int field, int amount) method calculates dates by adding or subtracting units of time like days, months, or years.
13 Nov 09

Clojure tutorial: fetching web comics (part 1) « Occasionally sane

  • for each comic:
    get the html
    extract the image URL with a regex
    display the complete image URL
1 - 20 of 232 Next › Last »
Showing 20 items per page

Highlighter, Sticky notes, Tagging, Groups and Network: integrated suite dramatically boosting research productivity. Learn more »

Join Diigo