Hiccup with Sequence

2010-09-27 Thread Paul
Hi all,

I'm trying to output the items from a sequence into a HTML list using
the Hiccup HTML builder, but am having problems.

Here is the code I think 'should' work, but nothing after the ':ul' is
passed back to the response:

(html
[:html
[:body
[:ul
(doseq [item myseq] [:li item])
]
]
]
)

Can anyone see why this is not working?

Thanks,

Paul.

-- 
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: Hiccup with Sequence

2010-09-27 Thread Nicolas Oury
doseq do not return anything. (It is for side-effect only).

You might be looking for 'for'.

(doc for)
-
clojure.core/for
([seq-exprs body-expr])
Macro
  List comprehension. Takes a vector of one or more
   binding-form/collection-expr pairs, each followed by zero or more
   modifiers, and yields a lazy sequence of evaluations of expr.
   Collections are iterated in a nested fashion, rightmost fastest,
   and nested coll-exprs can refer to bindings created in prior
   binding-forms.  Supported modifiers are: :let [binding-form expr ...],
   :while test, :when test.

  (take 100 (for [x (range 1) y (range 100) :while ( y x)] [x y]))


On Mon, Sep 27, 2010 at 11:25 AM, Paul paul_bow...@yahoo.com wrote:
 Hi all,

 I'm trying to output the items from a sequence into a HTML list using
 the Hiccup HTML builder, but am having problems.

 Here is the code I think 'should' work, but nothing after the ':ul' is
 passed back to the response:

 (html
        [:html
                [:body
                        [:ul
                                (doseq [item myseq] [:li item])
                        ]
                ]
        ]
 )

 Can anyone see why this is not working?

 Thanks,

 Paul.

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



-- 
Sent from an IBM Model M, 15 August 1989.

-- 
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: Hiccup with Sequence

2010-09-27 Thread Paul
Nicolas,

Yes, that's solved the problem. Many thanks for you swift help.

Paul.

On Sep 27, 12:12 pm, Nicolas Oury nicolas.o...@gmail.com wrote:
 doseq do not return anything. (It is for side-effect only).

 You might be looking for 'for'.

 (doc for)
 -
 clojure.core/for
 ([seq-exprs body-expr])
 Macro
   List comprehension. Takes a vector of one or more
    binding-form/collection-expr pairs, each followed by zero or more
    modifiers, and yields a lazy sequence of evaluations of expr.
    Collections are iterated in a nested fashion, rightmost fastest,
    and nested coll-exprs can refer to bindings created in prior
    binding-forms.  Supported modifiers are: :let [binding-form expr ...],
    :while test, :when test.

   (take 100 (for [x (range 1) y (range 100) :while ( y x)] [x 
 y]))





 On Mon, Sep 27, 2010 at 11:25 AM, Paul paul_bow...@yahoo.com wrote:
  Hi all,

  I'm trying to output the items from a sequence into a HTML list using
  the Hiccup HTML builder, but am having problems.

  Here is the code I think 'should' work, but nothing after the ':ul' is
  passed back to the response:

  (html
         [:html
                 [:body
                         [:ul
                                 (doseq [item myseq] [:li item])
                         ]
                 ]
         ]
  )

  Can anyone see why this is not working?

  Thanks,

  Paul.

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

 --
 Sent from an IBM Model M, 15 August 1989.

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