From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 422457EE25 for ; Mon, 28 Oct 2013 22:58:48 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of ollie.frolovs.2012@my.bristol.ac.uk) identity=pra; client-ip=209.85.128.42; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="of12343@my.bristol.ac.uk"; x-sender="ollie.frolovs.2012@my.bristol.ac.uk"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of of12343@my.bristol.ac.uk) identity=mailfrom; client-ip=209.85.128.42; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="of12343@my.bristol.ac.uk"; x-sender="of12343@my.bristol.ac.uk"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-qe0-f42.google.com) identity=helo; client-ip=209.85.128.42; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="of12343@my.bristol.ac.uk"; x-sender="postmaster@mail-qe0-f42.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqACAAzdblLRVYAqlGdsb2JhbABZgz9UwAwIFg4BAQEBBwsLCRIqgxkuBF0SAQUBiDwNlmuDBJVDiRSMf4EbgViEFgOYCpAbGCmEUTw X-IPAS-Result: AqACAAzdblLRVYAqlGdsb2JhbABZgz9UwAwIFg4BAQEBBwsLCRIqgxkuBF0SAQUBiDwNlmuDBJVDiRSMf4EbgViEFgOYCpAbGCmEUTw X-IronPort-AV: E=Sophos;i="4.93,588,1378850400"; d="scan'208";a="32295114" Received: from mail-qe0-f42.google.com ([209.85.128.42]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 28 Oct 2013 22:58:47 +0100 Received: by mail-qe0-f42.google.com with SMTP id gc15so4500025qeb.1 for ; Mon, 28 Oct 2013 14:58:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=u1wmn39fn/fsXMDi4N/H5oRTvFrhQttvar9X4VQfRX4=; b=bD3OBB3n7hZGudfMW0jmE0PylR/+jB6XeEj1PABz50FTXZ/CbqGCnVIY6eeywSIzmi MRt5bOLz6J/2voaBAivuL7j/jMMP51gxvExVVCif1p50nzi9z1ax4BCdoUCCvLOpZI0R F/z7nO+R3l/T6EwpQcmgWOXTuCFoHASXv5XQjJal8k5hLcTzemcumSMl16cJP5ZepPmg anqWXaXAk8/W/KESVXHuvIq8VKSg0ofNzMpjCi/GwOovefxrjb4YI3UHofha2IgbE+wK 1nVqlX2hANNaXR8A+8soH6pT4A3L+NYAkRI8id3kw4W54y+n+QbhltOdCJ+fDtha10OD OB9Q== X-Gm-Message-State: ALoCoQnzD/ACYkCA2sAEwZQsVEoLJe7y8PNZVK7mEOfBm0Cxa0M4fAKMW+WCmxnfcuQzfoW/mNuG MIME-Version: 1.0 X-Received: by 10.49.30.227 with SMTP id v3mr5226365qeh.92.1382997526076; Mon, 28 Oct 2013 14:58:46 -0700 (PDT) Reply-To: ollie.frolovs.2012@my.bristol.ac.uk Received: by 10.229.37.129 with HTTP; Mon, 28 Oct 2013 14:58:46 -0700 (PDT) Date: Mon, 28 Oct 2013 21:58:46 +0000 Message-ID: From: O Frolovs To: caml-list@inria.fr Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Validation-by: ollie.frolovs.2012@my.bristol.ac.uk Subject: [Caml-list] Using Uri with Google Distance Matrix API Hello I'm learning OCaml and currently trying to use it for my project at uni. Specifically, i=92m trying to use Uri [1] to create a Google Distance Matrix request and i find it a bit awkward since the API uses pipe character "|" for separating parameter values but Uri uses commas "," and i could not find a way to override it: utop # open Core.Std;; utop # #require "uri";; utop # let x =3D Uri.of_string "http://www.github.com/";; val x : Uri.t =3D utop # let y =3D Uri.add_query_param x ("origins", ["Bristol"; "Cambridge"; "Plymouth"; "London"]);; val y : Uri.t =3D utop # Uri.to_string y;; - : string =3D "http://www.github.com/?origins=3DBristol,Cambridge,Plymouth= ,London" This is not what the API expects. I also tried concatenating the origins values before passing it to Uri but as you can see below, Uri performed character escape on pipe characters. So besides not looking elegant, it did not work: utop # String.concat ~sep:"|" ["Bristol"; "Cambridge"; "Plymouth"; "London"= ];; - : string =3D "Bristol|Cambridge|Plymouth|London" utop # let y =3D Uri.add_query_param x ("origins", [c]);; val y : Uri.t =3D utop # Uri.to_string y;; - : string =3D "http://www.github.com/?origins=3DBristol%7CCambridge%7CPlym= outh%7CLondon" I am wondering (a) if there is a way to make Uri do what i want, that is to use pipe character to separate the origins values. (b) why Uri does not have an optional ~sep parameter, like Jane Street's Core.String.concat does? Help?! -- Ollie [1] http://www.cl.cam.ac.uk/projects/ocamllabs/pkg/uri/1.3.8/index.html [2] https://developers.google.com/maps/documentation/distancematrix/