Z3 OCaml module linking error in "dune utop"
OCaml » Stack Overflow
by JoMinGyu
3d ago
I have to execute z3 module in OCaml. But when I try to execute dune utop then I meet under error mingyu809@DESKTOP-NTK8E0T:~/ocaml/COSE419-2024-main/hw2$ dune utop File "_none_", line 1: Error: Error on dynamically loaded library: /home/mingyu809/.opam/default/lib/lwt/../stublibs/dllz3ml.so: /home/mingyu809/.opam/default/lib/lwt/../stublibs/dllz3ml.so: undefined symbol: Z3_mk_u32string But I execute dune build and dune exec -- ./main.exe, it works well. I use WSL2 on Windows 11 I tried to remove opam and other package and reinstall but same error occurs ..read more
Visit website
How to convert non-built-in types to string in Ocaml?
OCaml » Stack Overflow
by otchkcom
3d ago
I'm trying to write a module that convert something like x:int = if true then 3 else 5 to a string Here's the code I have so far module Ast = struct type typ = Bool | Int type var = A | B | C | D | E | F type exp = Const of int * typ | App of string * exp list | If of exp * exp * exp | And of exp * exp | Or of exp * exp | Id of var * typ * exp let rec toString (t) = let formatDec1(va,ty,e) = ??? match t with Const(n, _) -> print_int n | App(id, [e1; e2]) -> formatter(" " ^ id ^ " ", e1, e2) | App(id, [e1]) -&g ..read more
Visit website
How to write sublist of a char list as [’1’; ’2’; ’3’; ’ ’; ’ ’; ’4’; ’5’; ’ ’; ’6’], to = [[’1’; ’2’; ’3’] ; [’4’; ’5’] ; [’6’]]
OCaml » Stack Overflow
by Batuhan Arıca
5d ago
I am currently learning OCaml and i couldn't make sublist even thought I can make a list without spaces as ['1'; '2'; '3'; '4'; '5'; '6']. I couldn't find any sources to my question so thanks for explaining it too please. type chiffre = int (*0-9*);; type chiffreCar = char (* '0' - '9'*) type nombre = chiffre list;; type txtnb = chiffreCar list ;; let rec les_nb (a:txtnb) : txtnb = match a with | [] -> [] | ' ' :: tl -> les_nb(tl) | hd::tl ->hd :: les_nb(tl ..read more
Visit website
Fast intersection of two N^4 sets
OCaml » Stack Overflow
by SerialCookie
5d ago
I'm looking for an algorithm that returns (the length of) the intersection of two given N^4 lists / sets (more precisely in [|0;7|]^4). I'm not expecting an answer in a specific programming language (I'm doing it in OCaml but as this language isn't very popular I don't expect answers to be written in Caml...). Note that solutions involving big pre-computations (for example to completly change the structure of sets) aren't a problem in my case. I tried to consider N^4 sets as classical integer sets to then intersect them using buit-in set intersections (but this was way too slow for my purpose ..read more
Visit website
Infix operators with 3 parameters ocaml
OCaml » Stack Overflow
by Pierre NEILLO
1w ago
Is it possible in ocaml to define an operator like the array set function which can be written a.(n)<-v? The OCaml manual explains how to define 2-parameters infix operators but not 3-parameters operators. I would like to know if there is a way to define a function , a bit like the Array.set method which can be called using the a.(n)<-v syntax. I would like to create a new operator that could be called using this syntax: a[b<-c] I tried some things like this: let ([<-]) a b c = ... let (#1[#2<-#3]) a b c =... but these didn't work. Thanks in advance for your help ..read more
Visit website
Making a list of rows to a set in ocaml [closed]
OCaml » Stack Overflow
by Torps
1w ago
I am supposed to make this table: ( ["Id"; "Name"; "Gender"; "Course"], [ ["2"; "Jim"; "Male"; "Geography"]; ["4"; "Linnea"; "Female"; "Economics"]; ["7"; "Steve"; "Male"; "Informatics"]; ["9"; "Hannah"; "Female"; "Geography"] ] ) into a set instead of a list containing lists and thereby it should not include any duplicates. I should then be able to make the functions project, rename, and restrict on the set. How do I go about doing this?' I used list.flatten within a function setToList and ListToSet which worked and the list did not include any duplicates but the at ..read more
Visit website
Why can't dune recognize ppx_jane?
OCaml » Stack Overflow
by stormckey
2w ago
I am now writing a project in OCaml v4.06, and I have installed ppx_jane v0.11.0. Actually the environment is based on a docker image. Now here is the dune file (menhir (modules parser)) (ocamllex lexer) (executable (name compiler) (libraries core) (preprocess (pps ppx_jane))) Which I think is pretty simple, but running dune build compiler.exe will output File "dune", line 9, characters 18-26: 9 | (preprocess (pps ppx_jane))) ^^^^^^^^ Error: Ppx dependency on a non-ppx library "ppx_jane". If "ppx_jane" is in fact a ppx rewriter library, it should have (kind ppx ..read more
Visit website
Is there a function that returns a list of values with specific type in OCaml?
OCaml » Stack Overflow
by toku-sa-n
2w ago
In Haskell, using listify with Data can extract values of a specific type from a deeply nested structure without lots of getters. For example, with the following code: {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE OverloadedStrings #-} module Lib ( john , listStrings ) where import Data.Data import Data.Generics.Schemes import Data.Text data Person = Person { name :: Name , address :: Address } deriving (Data, Show) data Name = Name { firstName :: Text , lastName :: Text } deriving (Data, Show) data Address = Address { addressLine ..read more
Visit website
How to use menhir to parse into a GADT expression?
OCaml » Stack Overflow
by stormckey
2w ago
I have just learned something about GADT in OCaml through Real World OCaml, and want to try to transfer the first little language there into a interpreter, thus using menhir. The ast definition is totally the same as the example.Here is it: type _ value = | Int : int -> int value | Bool : bool -> bool value type _ expr = | Value: 'a value -> 'a expr | Eq : int expr * int expr -> bool expr | Plus : int expr * int expr -> int expr | If : bool expr * 'a expr * 'a expr -> 'a expr let eval_value : type a. a value -> a = function | Int x -> x | Bool x ..read more
Visit website
How to search for OCaml functions by name and type [closed]
OCaml » Stack Overflow
by illabout
2w ago
In Haskell, there are two main ways to look up information on functions. Sites like Hoogle and Stackage. These sites provide two main types of searching: Searching for the name of a function. For example, here is a search on Hoogle for a function called catMaybes. This search returns the type of the catMaybes function, as well as the package and module it is defined in. The major use-case for this type of search is when you see a function used somewhere and you want to know its type and what package it is defined in. Searching for the type of a function. For example, here is a search on ..read more
Visit website

Follow OCaml » Stack Overflow on FeedSpot

Continue with Google
Continue with Apple
OR