Commits

camlspotter  committed f39469c

added list_filter

  • Participants
  • Parent commits 815c98f

Comments (0)

Files changed (2)

      INSTALL=ocamlfind remove $(PACK); $(INSTALL)
      REQUIRED_PACKS+=$(Installed findlib)
      GET_OBJS(dummy)=
-         println(find find $(OCAMLFIND_DESTDIR)/$(PACK))
+         println(find $(OCAMLFIND_DESTDIR)/$(PACK))
          return $(addprefix \$\(OCAMLFIND_DESTDIR\)/\$\(PACK\)/, $(Files $(OCAMLFIND_DESTDIR)/$(PACK)))
      OCamlExternal($(PACK))
+
     mkdir $(dir) 
   return
 
+# OCaml -where
+# ========================================================================
+
+#|Path to the OCaml library directory
+OCAML_WHERE = $(shell ocamlc -where)
+
 # OCamlFind
 # ========================================================================
 
 USE_OCAMLFIND = true
 OCAMLFIND_DESTDIR= $(shell ocamlfind printconf destdir)
 
-# OCaml -where
-# ========================================================================
-
-#|Path to the OCaml library directory
-OCAML_WHERE = $(shell ocamlc -where)
-
 #|Preinstalled libraries which are always available for normal ocaml.
 #
 # You may want to add the required packages which are built and installed out of OMy framework:
 	    $(OCAMLFIND) ocamldoc -I +threads $(OCAMLPACKAGEFLAGS) $(LAZY_OCAMLFINDFLAGS) $(PREFIXED_OCAMLPACKS) $(OCAMLPPFLAGS) $(PREFIXED_OCAMLINCLUDES) -dot -dot-include-all -dot-reduce $+ -o $@
 
 
+#| filter list
+#  example::
+#     is_url(file) =
+#       match $(file)
+#       case $'://'
+#         return true
+#       default
+#         return false
+# 
+#     DOWNLOAD_URLS[]=$(list_filter $(fun x, $(is_url $(x))), $(URLS))
+list_filter(pred, list) =
+  result=
+  foreach(x, $(list))
+    if $(apply $(pred), $(x))
+      result+=$(x)
+      export
+    export
+  return $(result)