This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Warning: we are not using the native binary ocamlc.opt because it is older than the bytecode binary boot/ocamlc; you should silence this warning by either removing ocamlc.opt or rebuilding it (or `touch`-ing it) if you want it used. | |
../../ocamlc.opt -nostdlib -I ../../stdlib ../../compilerlibs/ocamlcommon.cma \ | |
-I ../../parsing -I ../../driver \ | |
cross_reference_checker.ml -o cross-reference-checker | |
/Library/Developer/CommandLineTools/usr/bin/make -C src all | |
/Library/Developer/CommandLineTools/usr/bin/make html | |
../../runtime/ocamlrun ../tools/texquote2 < allfiles.etex > allfiles.texquote_error.tex | |
mv allfiles.texquote_error.tex allfiles.tex | |
../../runtime/ocamlrun ../tools/texquote2 < foreword.etex > foreword.texquote_error.tex | |
mv foreword.texquote_error.tex foreword.tex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ocaml_binary(name = 'ackermann_3_2_is_' + | |
str( | |
(lambda x, m, n: x(x, m, n)) | |
((lambda x, m, n: n + 1 if m == 0 else (x(x, m - 1, 1) if n == 0 else x(x, m - 1, x(x, m, n - 1)))), 3, 2) | |
), srcs = [], deps = []) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* from https://okmij.org/ftp/ML/first-class-modules/ *) | |
module Eq = struct | |
type ('a,'b) eq = Refl of 'a option ref * 'b option ref | |
let refl () = let r = ref None in Refl (r,r) | |
let symm : ('a,'b) eq -> ('b,'a) eq = function | |
Refl (x,y) -> Refl (y,x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ocaml | |
module type HdArg = sig | |
type t | |
val x: t list | |
val continuation : t -> unit | |
end | |
let hd (module M : HdArg): unit = | |
let fn : M.t list -> M.t = function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hole_is_a_variable(): | |
_ = 'hello' | |
print(_) # 'hello' | |
def hole_is_not_a_variable(): | |
match 'hello': | |
case _: | |
print(_) # NameError | |
hole_is_a_variable() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Max Heiber | |
I'm implementing IDE support for a language using Language Server Protocol. | |
I want to trigger a rename after extracting a variable into the current scope. That is, I've implemented steps 1 to 2 of the current flow and want to know how to implement 3 and 4 | |
1. When the user selects an expression a yellow lightbulb shows up. Example: `z = 3 + /*selection-start*/5000/*selection-end*/` | |
2. When the user selects "extract into variable" then a new variable called "placeholder" is created in the current scope and the original expression is assigned to it. Example: `placeholder = 5000; z = 3 + placeholder` | |
3. The first instance of `placeholder` is highlighted and the text box for renaming pops up. When the user types "the_new_name" and presses `Return` then the text is: `the_new_name = 5000; z = 3 + the_new_name` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
function fetch(uri) { | |
throw new Error("synchronous"); | |
} | |
function sync() { | |
return fetch('http://stuff'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module type Univ = sig | |
type t | |
val embed: unit -> ('a -> t) * (t -> 'a option) | |
end | |
module U1 = struct | |
type t = exn | |
let embed (type a) () = | |
let open struct | |
exception E of a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type (_, _) eq = Eq: ('a, 'a) eq | |
module M: sig | |
type t | |
type u | |
val tx: t | |
val ux: u | |
val eq_t_int: (t, int) eq | |
val eq_int_u: (int, u) eq | |
end = struct |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type zero = unit * unit | |
type 'a minus1 = 'snd constraint 'a = unit * 'snd | |
type 'a plus1 = unit * 'a | |
type _ lst = | |
| [] : zero lst | |
| ( :: ) : int * 'b lst -> ('b lst) plus1 lst | |
let cons n lst = n :: lst |
NewerOlder