Your use of % is syntactically correct. However, think of what is happening in the second example.
Every time take-while invokes your function #(= (first %) %), % is bound to an element of the list s. So, something like this would happen when take-while is checking the first element: (= (first 1) 1). The exception just means that the function "first" can only work on sequences. Numbers are not sequences. On Monday, 23 May 2016 18:10:47 UTC-7, Phil Virgo wrote: > > I just starting to try and teach myself Clojure. Kindly let me know if > there is a more appropriate place I should post simple questions. > > > (def s '(1 1 1 4 99) > > (take-while #(= (first s) %) s) ; works fine: (1 1 1) > > (take-while #(= (first %) %) s) ; IllegalArgumentException Don't know > how to create ISeq from: java.lang.Long clojure.lang.RT.seqFrom > (RT.java:505) > > It appears as though "%" cannot be used within a nested function - but > this works > > (#(prn (+ 3 %) % ) 5) ; works fine: 8 5 > > Does anyone know what is the rule of statement construction being violated? > > ~thanks > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.