Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' into gstreamer_encoder

  • Loading branch information...
commit 748fb5b2aedab428a134e5f333163e32951afd19 2 parents baa5e16 + 9a924f3
@toots toots authored
Showing with 18 additions and 1 deletion.
  1. +18 −1 src/lang/lang_builtins.ml
View
19 src/lang/lang_builtins.ml
@@ -1031,6 +1031,23 @@ let () =
(List.sort sort (Lang.to_list l)))
let () =
+ add_builtin "list.filter" ~cat:List
+ ~descr:"Filter a list according to a filtering function."
+ ["",
+ Lang.fun_t [false,"",Lang.univ_t 1] Lang.bool_t,
+ None, None ;
+ "",Lang.list_t (Lang.univ_t 1),None,None] (Lang.list_t (Lang.univ_t 1))
+ (fun p ->
+ let f = Lang.assoc "" 1 p in
+ let filter x =
+ Lang.to_bool (Lang.apply ~t:Lang.bool_t f ["",x])
+ in
+ let l = Lang.assoc "" 2 p in
+ Lang.list
+ (Lang.of_list_t l.Lang.t)
+ (List.filter filter (Lang.to_list l)))
+
+let () =
add_builtin "list.tl" ~cat:List
~descr:"Return the list without its first element."
["",Lang.list_t (Lang.univ_t 1),None,None]
@@ -1447,7 +1464,7 @@ let () =
Lang.string default)
let () =
- add_builtin "server.register" ~cat:Sys
+ add_builtin "server.register" ~cat:Interaction
~descr:"Register a command. You can then execute this function \
through the server, either telnet or socket."
[ "namespace",Lang.string_t,Some (Lang.string ""),None ;
Please sign in to comment.
Something went wrong with that request. Please try again.