mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-30 23:23:07 +00:00 
			
		
		
		
	Add min-of and max-of.
This commit is contained in:
		| @@ -698,6 +698,14 @@ | ||||
|   "Returns the numeric minimum of the arguments." | ||||
|   [& args] (extreme < args)) | ||||
|  | ||||
| (defn max-of | ||||
|   "Returns the numeric maximum of the argument sequence." | ||||
|   [args] (extreme > args)) | ||||
|  | ||||
| (defn min-of | ||||
|   "Returns the numeric minimum of the argument sequence." | ||||
|   [args] (extreme < args)) | ||||
|  | ||||
| (defn first | ||||
|   "Get the first element from an indexed data structure." | ||||
|   [xs] | ||||
|   | ||||
| @@ -234,6 +234,9 @@ static void add_timeout(JanetTimeout to) { | ||||
|  | ||||
| /* Create a new event listener */ | ||||
| static JanetListenerState *janet_listen_impl(JanetStream *stream, JanetListener behavior, int mask, size_t size, void *user) { | ||||
|     if (stream->flags & JANET_STREAM_CLOSED) { | ||||
|         janet_panic("cannot listen on closed stream"); | ||||
|     } | ||||
|     if (stream->_mask & mask) { | ||||
|         janet_panic("cannot listen for duplicate event on stream"); | ||||
|     } | ||||
| @@ -344,8 +347,10 @@ static void janet_stream_close_impl(JanetStream *stream, int is_gc) { | ||||
|     { | ||||
|         CloseHandle(stream->handle); | ||||
|     } | ||||
|     stream->handle = INVALID_HANDLE_VALUE; | ||||
| #else | ||||
|     close(stream->handle); | ||||
|     stream->handle = -1; | ||||
| #endif | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose